blob: 5e27a8327b472e5cdbf92c0b1f6c099df14899a9 [file] [log] [blame]
Chris Lattnerdad40622010-04-14 03:54:58 +00001/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __ALTIVEC_H
24#define __ALTIVEC_H
25
26#ifndef __ALTIVEC__
27#error "AltiVec support not enabled"
28#endif
29
30/* constants for mapping CR6 bits to predicate result. */
31
32#define __CR6_EQ 0
33#define __CR6_EQ_REV 1
34#define __CR6_LT 2
35#define __CR6_LT_REV 3
36
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000037#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000040vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000041
42static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000043vec_perm(vector unsigned char __a,
44 vector unsigned char __b,
45 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000046
Anton Yartsev9e968982010-08-19 03:00:09 +000047static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000048vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000050static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000051vec_perm(vector short __a, vector short __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000052
53static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000054vec_perm(vector unsigned short __a,
55 vector unsigned short __b,
56 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000057
Anton Yartsev9e968982010-08-19 03:00:09 +000058static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000059vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000060
61static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000062vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000063
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000064static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000065vec_perm(vector int __a, vector int __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000066
67static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000068vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000069
Anton Yartsev9e968982010-08-19 03:00:09 +000070static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000071vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000072
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000073static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000074vec_perm(vector float __a, vector float __b, vector unsigned char __c);
Chris Lattnerdad40622010-04-14 03:54:58 +000075
Bill Schmidtf7e289c2014-06-05 19:07:40 +000076static vector unsigned char __ATTRS_o_ai
77vec_xor(vector unsigned char __a, vector unsigned char __b);
78
Chris Lattnerdad40622010-04-14 03:54:58 +000079/* vec_abs */
80
Chris Lattnerdad40622010-04-14 03:54:58 +000081#define __builtin_altivec_abs_v16qi vec_abs
82#define __builtin_altivec_abs_v8hi vec_abs
83#define __builtin_altivec_abs_v4si vec_abs
84
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000085static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000086vec_abs(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000087{
David Blaikie3302f2b2013-01-16 23:08:36 +000088 return __builtin_altivec_vmaxsb(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +000089}
90
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000091static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000092vec_abs(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000093{
David Blaikie3302f2b2013-01-16 23:08:36 +000094 return __builtin_altivec_vmaxsh(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +000095}
96
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000097static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000098vec_abs(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000099{
David Blaikie3302f2b2013-01-16 23:08:36 +0000100 return __builtin_altivec_vmaxsw(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000101}
102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000103static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000104vec_abs(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000105{
David Blaikie3302f2b2013-01-16 23:08:36 +0000106 vector unsigned int __res = (vector unsigned int)__a
Anton Yartsev79d6af32010-09-18 00:39:16 +0000107 & (vector unsigned int)(0x7FFFFFFF);
David Blaikie3302f2b2013-01-16 23:08:36 +0000108 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +0000109}
110
111/* vec_abss */
112
Chris Lattnerdad40622010-04-14 03:54:58 +0000113#define __builtin_altivec_abss_v16qi vec_abss
114#define __builtin_altivec_abss_v8hi vec_abss
115#define __builtin_altivec_abss_v4si vec_abss
116
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000117static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000118vec_abss(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000119{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000120 return __builtin_altivec_vmaxsb
David Blaikie3302f2b2013-01-16 23:08:36 +0000121 (__a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000122}
123
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000124static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000125vec_abss(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000126{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000127 return __builtin_altivec_vmaxsh
David Blaikie3302f2b2013-01-16 23:08:36 +0000128 (__a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000129}
130
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000131static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000132vec_abss(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000133{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000134 return __builtin_altivec_vmaxsw
David Blaikie3302f2b2013-01-16 23:08:36 +0000135 (__a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000136}
137
138/* vec_add */
139
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000140static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000141vec_add(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000142{
David Blaikie3302f2b2013-01-16 23:08:36 +0000143 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000144}
145
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000146static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000147vec_add(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000148{
David Blaikie3302f2b2013-01-16 23:08:36 +0000149 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000150}
151
152static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000153vec_add(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000154{
David Blaikie3302f2b2013-01-16 23:08:36 +0000155 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000156}
157
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000158static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000159vec_add(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000160{
David Blaikie3302f2b2013-01-16 23:08:36 +0000161 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000162}
163
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000164static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000165vec_add(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000166{
David Blaikie3302f2b2013-01-16 23:08:36 +0000167 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000168}
169
170static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000171vec_add(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000172{
David Blaikie3302f2b2013-01-16 23:08:36 +0000173 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000174}
175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000176static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000177vec_add(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000178{
David Blaikie3302f2b2013-01-16 23:08:36 +0000179 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000180}
181
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000182static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000183vec_add(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000184{
David Blaikie3302f2b2013-01-16 23:08:36 +0000185 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000186}
187
188static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000189vec_add(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000190{
David Blaikie3302f2b2013-01-16 23:08:36 +0000191 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000192}
193
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000194static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000195vec_add(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000196{
David Blaikie3302f2b2013-01-16 23:08:36 +0000197 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000198}
199
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000200static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000201vec_add(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000202{
David Blaikie3302f2b2013-01-16 23:08:36 +0000203 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000204}
205
206static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000207vec_add(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000208{
David Blaikie3302f2b2013-01-16 23:08:36 +0000209 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000210}
211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000212static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000213vec_add(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000214{
David Blaikie3302f2b2013-01-16 23:08:36 +0000215 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000216}
217
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000218static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000219vec_add(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000220{
David Blaikie3302f2b2013-01-16 23:08:36 +0000221 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000222}
223
224static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000225vec_add(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000226{
David Blaikie3302f2b2013-01-16 23:08:36 +0000227 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000228}
229
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000230static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000231vec_add(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000232{
David Blaikie3302f2b2013-01-16 23:08:36 +0000233 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000234}
235
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000236static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000237vec_add(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000238{
David Blaikie3302f2b2013-01-16 23:08:36 +0000239 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000240}
241
242static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000243vec_add(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000244{
David Blaikie3302f2b2013-01-16 23:08:36 +0000245 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000246}
247
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000248static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000249vec_add(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000250{
David Blaikie3302f2b2013-01-16 23:08:36 +0000251 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000252}
253
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000254/* vec_vaddubm */
255
256#define __builtin_altivec_vaddubm vec_vaddubm
257
258static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000259vec_vaddubm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000260{
David Blaikie3302f2b2013-01-16 23:08:36 +0000261 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000262}
263
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000264static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000265vec_vaddubm(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000266{
David Blaikie3302f2b2013-01-16 23:08:36 +0000267 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000268}
269
270static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000271vec_vaddubm(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000272{
David Blaikie3302f2b2013-01-16 23:08:36 +0000273 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000274}
275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000276static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000277vec_vaddubm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000278{
David Blaikie3302f2b2013-01-16 23:08:36 +0000279 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000280}
281
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000282static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000283vec_vaddubm(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000284{
David Blaikie3302f2b2013-01-16 23:08:36 +0000285 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000286}
287
288static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000289vec_vaddubm(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000290{
David Blaikie3302f2b2013-01-16 23:08:36 +0000291 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000292}
293
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000294/* vec_vadduhm */
295
296#define __builtin_altivec_vadduhm vec_vadduhm
297
298static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000299vec_vadduhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000300{
David Blaikie3302f2b2013-01-16 23:08:36 +0000301 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000302}
303
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000304static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000305vec_vadduhm(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000306{
David Blaikie3302f2b2013-01-16 23:08:36 +0000307 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000308}
309
310static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000311vec_vadduhm(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000312{
David Blaikie3302f2b2013-01-16 23:08:36 +0000313 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000314}
315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000316static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000317vec_vadduhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000318{
David Blaikie3302f2b2013-01-16 23:08:36 +0000319 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000320}
321
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000322static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000323vec_vadduhm(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000324{
David Blaikie3302f2b2013-01-16 23:08:36 +0000325 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000326}
327
328static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000329vec_vadduhm(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000330{
David Blaikie3302f2b2013-01-16 23:08:36 +0000331 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000332}
333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000334/* vec_vadduwm */
335
336#define __builtin_altivec_vadduwm vec_vadduwm
337
338static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000339vec_vadduwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000340{
David Blaikie3302f2b2013-01-16 23:08:36 +0000341 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000342}
343
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000344static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000345vec_vadduwm(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000346{
David Blaikie3302f2b2013-01-16 23:08:36 +0000347 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000348}
349
350static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000351vec_vadduwm(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000352{
David Blaikie3302f2b2013-01-16 23:08:36 +0000353 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000354}
355
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000356static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000357vec_vadduwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000358{
David Blaikie3302f2b2013-01-16 23:08:36 +0000359 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000360}
361
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000362static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000363vec_vadduwm(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000364{
David Blaikie3302f2b2013-01-16 23:08:36 +0000365 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000366}
367
368static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000369vec_vadduwm(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000370{
David Blaikie3302f2b2013-01-16 23:08:36 +0000371 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000372}
373
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000374/* vec_vaddfp */
375
376#define __builtin_altivec_vaddfp vec_vaddfp
377
378static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000379vec_vaddfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000380{
David Blaikie3302f2b2013-01-16 23:08:36 +0000381 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000382}
383
Chris Lattnerdad40622010-04-14 03:54:58 +0000384/* vec_addc */
385
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000386static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000387vec_addc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000388{
David Blaikie3302f2b2013-01-16 23:08:36 +0000389 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000390}
391
392/* vec_vaddcuw */
393
394static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000395vec_vaddcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000396{
David Blaikie3302f2b2013-01-16 23:08:36 +0000397 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000398}
Chris Lattnerdad40622010-04-14 03:54:58 +0000399
400/* vec_adds */
401
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000402static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000403vec_adds(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000404{
David Blaikie3302f2b2013-01-16 23:08:36 +0000405 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000406}
407
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000408static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000409vec_adds(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000410{
David Blaikie3302f2b2013-01-16 23:08:36 +0000411 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000412}
413
414static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000415vec_adds(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000416{
David Blaikie3302f2b2013-01-16 23:08:36 +0000417 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000418}
419
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000420static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000421vec_adds(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000422{
David Blaikie3302f2b2013-01-16 23:08:36 +0000423 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000424}
425
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000426static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000427vec_adds(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000428{
David Blaikie3302f2b2013-01-16 23:08:36 +0000429 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000430}
431
432static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000433vec_adds(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000434{
David Blaikie3302f2b2013-01-16 23:08:36 +0000435 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000436}
437
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000438static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000439vec_adds(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000440{
David Blaikie3302f2b2013-01-16 23:08:36 +0000441 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000442}
443
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000444static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000445vec_adds(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000446{
David Blaikie3302f2b2013-01-16 23:08:36 +0000447 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000448}
449
450static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000451vec_adds(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000452{
David Blaikie3302f2b2013-01-16 23:08:36 +0000453 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000454}
455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000456static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000457vec_adds(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000458{
David Blaikie3302f2b2013-01-16 23:08:36 +0000459 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000460}
461
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000462static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000463vec_adds(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000464{
David Blaikie3302f2b2013-01-16 23:08:36 +0000465 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000466}
467
468static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000469vec_adds(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000470{
David Blaikie3302f2b2013-01-16 23:08:36 +0000471 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000472}
473
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000474static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000475vec_adds(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000476{
David Blaikie3302f2b2013-01-16 23:08:36 +0000477 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000478}
479
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000480static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000481vec_adds(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000482{
David Blaikie3302f2b2013-01-16 23:08:36 +0000483 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000484}
485
486static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000487vec_adds(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000488{
David Blaikie3302f2b2013-01-16 23:08:36 +0000489 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000490}
491
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000492static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000493vec_adds(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000494{
David Blaikie3302f2b2013-01-16 23:08:36 +0000495 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000496}
497
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000498static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000499vec_adds(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000500{
David Blaikie3302f2b2013-01-16 23:08:36 +0000501 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000502}
503
504static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000505vec_adds(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000506{
David Blaikie3302f2b2013-01-16 23:08:36 +0000507 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000508}
509
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000510/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000511
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000512static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000513vec_vaddsbs(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000514{
David Blaikie3302f2b2013-01-16 23:08:36 +0000515 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000516}
517
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000518static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000519vec_vaddsbs(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000520{
David Blaikie3302f2b2013-01-16 23:08:36 +0000521 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000522}
523
524static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000525vec_vaddsbs(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000526{
David Blaikie3302f2b2013-01-16 23:08:36 +0000527 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000528}
529
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000530/* vec_vaddubs */
531
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000532static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000533vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000534{
David Blaikie3302f2b2013-01-16 23:08:36 +0000535 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000536}
537
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000538static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000539vec_vaddubs(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000540{
David Blaikie3302f2b2013-01-16 23:08:36 +0000541 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000542}
543
544static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000545vec_vaddubs(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000546{
David Blaikie3302f2b2013-01-16 23:08:36 +0000547 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000548}
549
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000550/* vec_vaddshs */
551
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000552static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000553vec_vaddshs(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000554{
David Blaikie3302f2b2013-01-16 23:08:36 +0000555 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000556}
557
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000558static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000559vec_vaddshs(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000560{
David Blaikie3302f2b2013-01-16 23:08:36 +0000561 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000562}
563
564static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000565vec_vaddshs(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000566{
David Blaikie3302f2b2013-01-16 23:08:36 +0000567 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000568}
569
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000570/* vec_vadduhs */
571
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000572static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000573vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000574{
David Blaikie3302f2b2013-01-16 23:08:36 +0000575 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000576}
577
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000578static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000579vec_vadduhs(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000580{
David Blaikie3302f2b2013-01-16 23:08:36 +0000581 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000582}
583
584static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000585vec_vadduhs(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000586{
David Blaikie3302f2b2013-01-16 23:08:36 +0000587 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000588}
589
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000590/* vec_vaddsws */
591
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000592static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000593vec_vaddsws(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000594{
David Blaikie3302f2b2013-01-16 23:08:36 +0000595 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000596}
597
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000598static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000599vec_vaddsws(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000600{
David Blaikie3302f2b2013-01-16 23:08:36 +0000601 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000602}
603
604static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000605vec_vaddsws(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000606{
David Blaikie3302f2b2013-01-16 23:08:36 +0000607 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000608}
609
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000610/* vec_vadduws */
611
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000612static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000613vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000614{
David Blaikie3302f2b2013-01-16 23:08:36 +0000615 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000616}
617
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000618static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000619vec_vadduws(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000620{
David Blaikie3302f2b2013-01-16 23:08:36 +0000621 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000622}
623
624static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000625vec_vadduws(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000626{
David Blaikie3302f2b2013-01-16 23:08:36 +0000627 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000628}
629
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000630/* vec_and */
631
632#define __builtin_altivec_vand vec_and
633
634static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000635vec_and(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000636{
David Blaikie3302f2b2013-01-16 23:08:36 +0000637 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000638}
639
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000640static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000641vec_and(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000642{
David Blaikie3302f2b2013-01-16 23:08:36 +0000643 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000644}
645
646static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000647vec_and(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000648{
David Blaikie3302f2b2013-01-16 23:08:36 +0000649 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000650}
651
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000652static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000653vec_and(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000654{
David Blaikie3302f2b2013-01-16 23:08:36 +0000655 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000656}
657
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000658static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000659vec_and(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000660{
David Blaikie3302f2b2013-01-16 23:08:36 +0000661 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000662}
663
664static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000665vec_and(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000666{
David Blaikie3302f2b2013-01-16 23:08:36 +0000667 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000668}
669
670static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000671vec_and(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000672{
David Blaikie3302f2b2013-01-16 23:08:36 +0000673 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000674}
675
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000676static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000677vec_and(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000678{
David Blaikie3302f2b2013-01-16 23:08:36 +0000679 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000680}
681
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000682static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000683vec_and(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000684{
David Blaikie3302f2b2013-01-16 23:08:36 +0000685 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000686}
687
688static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000689vec_and(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000690{
David Blaikie3302f2b2013-01-16 23:08:36 +0000691 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000692}
693
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000694static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000695vec_and(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000696{
David Blaikie3302f2b2013-01-16 23:08:36 +0000697 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000698}
699
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000700static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000701vec_and(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000702{
David Blaikie3302f2b2013-01-16 23:08:36 +0000703 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000704}
705
706static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000707vec_and(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000708{
David Blaikie3302f2b2013-01-16 23:08:36 +0000709 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000710}
711
712static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000713vec_and(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000714{
David Blaikie3302f2b2013-01-16 23:08:36 +0000715 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000716}
717
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000718static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000719vec_and(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000720{
David Blaikie3302f2b2013-01-16 23:08:36 +0000721 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000722}
723
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000724static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000725vec_and(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000726{
David Blaikie3302f2b2013-01-16 23:08:36 +0000727 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000728}
729
730static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000731vec_and(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000732{
David Blaikie3302f2b2013-01-16 23:08:36 +0000733 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000734}
735
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000736static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000737vec_and(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000738{
David Blaikie3302f2b2013-01-16 23:08:36 +0000739 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000740}
741
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000742static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000743vec_and(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000744{
David Blaikie3302f2b2013-01-16 23:08:36 +0000745 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000746}
747
748static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000749vec_and(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000750{
David Blaikie3302f2b2013-01-16 23:08:36 +0000751 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000752}
753
754static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000755vec_and(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000756{
David Blaikie3302f2b2013-01-16 23:08:36 +0000757 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000758}
759
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000760static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000761vec_and(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000762{
David Blaikie3302f2b2013-01-16 23:08:36 +0000763 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
764 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000765}
766
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000767static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000768vec_and(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000769{
David Blaikie3302f2b2013-01-16 23:08:36 +0000770 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
771 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000772}
773
774static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000775vec_and(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000776{
David Blaikie3302f2b2013-01-16 23:08:36 +0000777 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
778 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000779}
780
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000781/* vec_vand */
782
783static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000784vec_vand(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000785{
David Blaikie3302f2b2013-01-16 23:08:36 +0000786 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000787}
788
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000789static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000790vec_vand(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000791{
David Blaikie3302f2b2013-01-16 23:08:36 +0000792 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000793}
794
795static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000796vec_vand(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000797{
David Blaikie3302f2b2013-01-16 23:08:36 +0000798 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000799}
800
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000801static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000802vec_vand(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000803{
David Blaikie3302f2b2013-01-16 23:08:36 +0000804 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000805}
806
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000807static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000808vec_vand(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000809{
David Blaikie3302f2b2013-01-16 23:08:36 +0000810 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000811}
812
813static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000814vec_vand(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000815{
David Blaikie3302f2b2013-01-16 23:08:36 +0000816 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000817}
818
819static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000820vec_vand(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000821{
David Blaikie3302f2b2013-01-16 23:08:36 +0000822 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000823}
824
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000825static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000826vec_vand(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000827{
David Blaikie3302f2b2013-01-16 23:08:36 +0000828 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000829}
830
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000831static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000832vec_vand(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000833{
David Blaikie3302f2b2013-01-16 23:08:36 +0000834 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000835}
836
837static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000838vec_vand(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000839{
David Blaikie3302f2b2013-01-16 23:08:36 +0000840 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000841}
842
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000843static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000844vec_vand(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000845{
David Blaikie3302f2b2013-01-16 23:08:36 +0000846 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000847}
848
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000849static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000850vec_vand(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000851{
David Blaikie3302f2b2013-01-16 23:08:36 +0000852 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000853}
854
855static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000856vec_vand(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000857{
David Blaikie3302f2b2013-01-16 23:08:36 +0000858 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000859}
860
861static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000862vec_vand(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000863{
David Blaikie3302f2b2013-01-16 23:08:36 +0000864 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000865}
866
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000868vec_vand(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000869{
David Blaikie3302f2b2013-01-16 23:08:36 +0000870 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000871}
872
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000873static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000874vec_vand(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000875{
David Blaikie3302f2b2013-01-16 23:08:36 +0000876 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000877}
878
879static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000880vec_vand(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000881{
David Blaikie3302f2b2013-01-16 23:08:36 +0000882 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000883}
884
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000885static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000886vec_vand(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000887{
David Blaikie3302f2b2013-01-16 23:08:36 +0000888 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000889}
890
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000891static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000892vec_vand(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000893{
David Blaikie3302f2b2013-01-16 23:08:36 +0000894 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000895}
896
897static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000898vec_vand(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000899{
David Blaikie3302f2b2013-01-16 23:08:36 +0000900 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000901}
902
903static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000904vec_vand(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000905{
David Blaikie3302f2b2013-01-16 23:08:36 +0000906 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000907}
908
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000909static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000910vec_vand(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000911{
David Blaikie3302f2b2013-01-16 23:08:36 +0000912 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
913 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000914}
915
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000916static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000917vec_vand(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000918{
David Blaikie3302f2b2013-01-16 23:08:36 +0000919 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
920 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000921}
922
923static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000924vec_vand(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000925{
David Blaikie3302f2b2013-01-16 23:08:36 +0000926 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
927 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000928}
929
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000930/* vec_andc */
931
932#define __builtin_altivec_vandc vec_andc
933
934static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000935vec_andc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000936{
David Blaikie3302f2b2013-01-16 23:08:36 +0000937 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000938}
939
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000940static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000941vec_andc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000942{
David Blaikie3302f2b2013-01-16 23:08:36 +0000943 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000944}
945
946static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000947vec_andc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000948{
David Blaikie3302f2b2013-01-16 23:08:36 +0000949 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000950}
951
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000952static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000953vec_andc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000954{
David Blaikie3302f2b2013-01-16 23:08:36 +0000955 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000956}
957
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000958static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000959vec_andc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000960{
David Blaikie3302f2b2013-01-16 23:08:36 +0000961 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000962}
963
964static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000965vec_andc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000966{
David Blaikie3302f2b2013-01-16 23:08:36 +0000967 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000968}
969
970static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000971vec_andc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000972{
David Blaikie3302f2b2013-01-16 23:08:36 +0000973 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000974}
975
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000976static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000977vec_andc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000978{
David Blaikie3302f2b2013-01-16 23:08:36 +0000979 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000980}
981
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000982static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000983vec_andc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000984{
David Blaikie3302f2b2013-01-16 23:08:36 +0000985 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000986}
987
988static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000989vec_andc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000990{
David Blaikie3302f2b2013-01-16 23:08:36 +0000991 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000992}
993
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000994static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000995vec_andc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000996{
David Blaikie3302f2b2013-01-16 23:08:36 +0000997 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000998}
999
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001000static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001001vec_andc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001002{
David Blaikie3302f2b2013-01-16 23:08:36 +00001003 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001004}
1005
1006static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001007vec_andc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001008{
David Blaikie3302f2b2013-01-16 23:08:36 +00001009 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001010}
1011
1012static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001013vec_andc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001014{
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001016}
1017
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001018static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001019vec_andc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001020{
David Blaikie3302f2b2013-01-16 23:08:36 +00001021 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001022}
1023
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001024static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001025vec_andc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001026{
David Blaikie3302f2b2013-01-16 23:08:36 +00001027 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001028}
1029
1030static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001031vec_andc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001032{
David Blaikie3302f2b2013-01-16 23:08:36 +00001033 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001034}
1035
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001036static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001037vec_andc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001038{
David Blaikie3302f2b2013-01-16 23:08:36 +00001039 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001040}
1041
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001042static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001043vec_andc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001044{
David Blaikie3302f2b2013-01-16 23:08:36 +00001045 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001046}
1047
1048static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001049vec_andc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001050{
David Blaikie3302f2b2013-01-16 23:08:36 +00001051 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001052}
1053
1054static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001055vec_andc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001056{
David Blaikie3302f2b2013-01-16 23:08:36 +00001057 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001058}
1059
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001060static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001061vec_andc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001062{
David Blaikie3302f2b2013-01-16 23:08:36 +00001063 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1064 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001065}
1066
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001067static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001068vec_andc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001069{
David Blaikie3302f2b2013-01-16 23:08:36 +00001070 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1071 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001072}
1073
1074static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001075vec_andc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001076{
David Blaikie3302f2b2013-01-16 23:08:36 +00001077 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1078 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001079}
1080
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001081/* vec_vandc */
1082
1083static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001084vec_vandc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001085{
David Blaikie3302f2b2013-01-16 23:08:36 +00001086 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001087}
1088
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001089static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001090vec_vandc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001091{
David Blaikie3302f2b2013-01-16 23:08:36 +00001092 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001093}
1094
1095static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001096vec_vandc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001097{
David Blaikie3302f2b2013-01-16 23:08:36 +00001098 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001099}
1100
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001101static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001102vec_vandc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001103{
David Blaikie3302f2b2013-01-16 23:08:36 +00001104 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001105}
1106
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001107static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001108vec_vandc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001109{
David Blaikie3302f2b2013-01-16 23:08:36 +00001110 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001111}
1112
1113static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001114vec_vandc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001115{
David Blaikie3302f2b2013-01-16 23:08:36 +00001116 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001117}
1118
1119static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001120vec_vandc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001121{
David Blaikie3302f2b2013-01-16 23:08:36 +00001122 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001123}
1124
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001125static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001126vec_vandc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001127{
David Blaikie3302f2b2013-01-16 23:08:36 +00001128 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001129}
1130
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001131static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001132vec_vandc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001133{
David Blaikie3302f2b2013-01-16 23:08:36 +00001134 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001135}
1136
1137static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001138vec_vandc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001139{
David Blaikie3302f2b2013-01-16 23:08:36 +00001140 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001141}
1142
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001143static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001144vec_vandc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001145{
David Blaikie3302f2b2013-01-16 23:08:36 +00001146 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001147}
1148
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001149static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001150vec_vandc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001151{
David Blaikie3302f2b2013-01-16 23:08:36 +00001152 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001153}
1154
1155static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001156vec_vandc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001157{
David Blaikie3302f2b2013-01-16 23:08:36 +00001158 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001159}
1160
1161static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001162vec_vandc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001163{
David Blaikie3302f2b2013-01-16 23:08:36 +00001164 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001165}
1166
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001167static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001168vec_vandc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001169{
David Blaikie3302f2b2013-01-16 23:08:36 +00001170 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001171}
1172
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001173static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001174vec_vandc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001175{
David Blaikie3302f2b2013-01-16 23:08:36 +00001176 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001177}
1178
1179static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001180vec_vandc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001181{
David Blaikie3302f2b2013-01-16 23:08:36 +00001182 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001183}
1184
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001185static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001186vec_vandc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001187{
David Blaikie3302f2b2013-01-16 23:08:36 +00001188 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001189}
1190
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001191static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001192vec_vandc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001193{
David Blaikie3302f2b2013-01-16 23:08:36 +00001194 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001195}
1196
1197static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001198vec_vandc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001199{
David Blaikie3302f2b2013-01-16 23:08:36 +00001200 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001201}
1202
1203static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001204vec_vandc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001205{
David Blaikie3302f2b2013-01-16 23:08:36 +00001206 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001207}
1208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001209static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001210vec_vandc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001211{
David Blaikie3302f2b2013-01-16 23:08:36 +00001212 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1213 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001214}
1215
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001216static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001217vec_vandc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001218{
David Blaikie3302f2b2013-01-16 23:08:36 +00001219 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1220 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001221}
1222
1223static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001224vec_vandc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001225{
David Blaikie3302f2b2013-01-16 23:08:36 +00001226 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1227 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001228}
1229
Chris Lattnerdad40622010-04-14 03:54:58 +00001230/* vec_avg */
1231
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001232static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001233vec_avg(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001234{
David Blaikie3302f2b2013-01-16 23:08:36 +00001235 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001236}
1237
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001238static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001239vec_avg(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001240{
David Blaikie3302f2b2013-01-16 23:08:36 +00001241 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001242}
1243
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001244static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001245vec_avg(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001246{
David Blaikie3302f2b2013-01-16 23:08:36 +00001247 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001248}
1249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001250static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001251vec_avg(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001252{
David Blaikie3302f2b2013-01-16 23:08:36 +00001253 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001254}
1255
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001256static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001257vec_avg(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001258{
David Blaikie3302f2b2013-01-16 23:08:36 +00001259 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001260}
1261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001262static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001263vec_avg(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001264{
David Blaikie3302f2b2013-01-16 23:08:36 +00001265 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001266}
1267
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001268/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001269
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001270static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001271vec_vavgsb(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001272{
David Blaikie3302f2b2013-01-16 23:08:36 +00001273 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001274}
1275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001276/* vec_vavgub */
1277
1278static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001279vec_vavgub(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001280{
David Blaikie3302f2b2013-01-16 23:08:36 +00001281 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001282}
1283
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001284/* vec_vavgsh */
1285
1286static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001287vec_vavgsh(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001288{
David Blaikie3302f2b2013-01-16 23:08:36 +00001289 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001290}
1291
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001292/* vec_vavguh */
1293
1294static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001295vec_vavguh(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001296{
David Blaikie3302f2b2013-01-16 23:08:36 +00001297 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001298}
1299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001300/* vec_vavgsw */
1301
1302static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001303vec_vavgsw(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001304{
David Blaikie3302f2b2013-01-16 23:08:36 +00001305 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001306}
1307
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001308/* vec_vavguw */
1309
1310static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001311vec_vavguw(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001312{
David Blaikie3302f2b2013-01-16 23:08:36 +00001313 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001314}
1315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001316/* vec_ceil */
1317
1318static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001319vec_ceil(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001320{
David Blaikie3302f2b2013-01-16 23:08:36 +00001321 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001322}
1323
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001324/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001325
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001326static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001327vec_vrfip(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001328{
David Blaikie3302f2b2013-01-16 23:08:36 +00001329 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001330}
1331
1332/* vec_cmpb */
1333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001334static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001335vec_cmpb(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001336{
David Blaikie3302f2b2013-01-16 23:08:36 +00001337 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001338}
1339
1340/* vec_vcmpbfp */
1341
1342static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001343vec_vcmpbfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001344{
David Blaikie3302f2b2013-01-16 23:08:36 +00001345 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001346}
Chris Lattnerdad40622010-04-14 03:54:58 +00001347
1348/* vec_cmpeq */
1349
Anton Yartsevfc83c602010-08-19 03:21:36 +00001350static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001351vec_cmpeq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001352{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001353 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001354 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001355}
1356
Anton Yartsevfc83c602010-08-19 03:21:36 +00001357static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001358vec_cmpeq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001359{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001360 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001361 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001362}
1363
Anton Yartsevfc83c602010-08-19 03:21:36 +00001364static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001365vec_cmpeq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001366{
David Blaikie3302f2b2013-01-16 23:08:36 +00001367 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001368}
1369
Anton Yartsevfc83c602010-08-19 03:21:36 +00001370static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001371vec_cmpeq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001372{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001373 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00001374 __builtin_altivec_vcmpequh((vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001375}
1376
Anton Yartsevfc83c602010-08-19 03:21:36 +00001377static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001378vec_cmpeq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001379{
David Blaikie3302f2b2013-01-16 23:08:36 +00001380 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001381}
1382
Anton Yartsevfc83c602010-08-19 03:21:36 +00001383static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001384vec_cmpeq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001385{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001386 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00001387 __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001388}
1389
Anton Yartsevfc83c602010-08-19 03:21:36 +00001390static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001391vec_cmpeq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001392{
David Blaikie3302f2b2013-01-16 23:08:36 +00001393 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001394}
1395
1396/* vec_cmpge */
1397
Anton Yartsevfc83c602010-08-19 03:21:36 +00001398static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001399vec_cmpge(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001400{
David Blaikie3302f2b2013-01-16 23:08:36 +00001401 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001402}
1403
1404/* vec_vcmpgefp */
1405
Anton Yartsevfc83c602010-08-19 03:21:36 +00001406static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001407vec_vcmpgefp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001408{
David Blaikie3302f2b2013-01-16 23:08:36 +00001409 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001410}
Chris Lattnerdad40622010-04-14 03:54:58 +00001411
1412/* vec_cmpgt */
1413
Anton Yartsevfc83c602010-08-19 03:21:36 +00001414static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001415vec_cmpgt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001416{
David Blaikie3302f2b2013-01-16 23:08:36 +00001417 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001418}
1419
Anton Yartsevfc83c602010-08-19 03:21:36 +00001420static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001421vec_cmpgt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001422{
David Blaikie3302f2b2013-01-16 23:08:36 +00001423 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001424}
1425
Anton Yartsevfc83c602010-08-19 03:21:36 +00001426static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001427vec_cmpgt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001428{
David Blaikie3302f2b2013-01-16 23:08:36 +00001429 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001430}
1431
Anton Yartsevfc83c602010-08-19 03:21:36 +00001432static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001433vec_cmpgt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001434{
David Blaikie3302f2b2013-01-16 23:08:36 +00001435 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001436}
1437
Anton Yartsevfc83c602010-08-19 03:21:36 +00001438static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001439vec_cmpgt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001440{
David Blaikie3302f2b2013-01-16 23:08:36 +00001441 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001442}
1443
Anton Yartsevfc83c602010-08-19 03:21:36 +00001444static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001445vec_cmpgt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001446{
David Blaikie3302f2b2013-01-16 23:08:36 +00001447 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001448}
1449
Anton Yartsevfc83c602010-08-19 03:21:36 +00001450static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001451vec_cmpgt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001452{
David Blaikie3302f2b2013-01-16 23:08:36 +00001453 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001454}
1455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001456/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001457
Anton Yartsevfc83c602010-08-19 03:21:36 +00001458static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001459vec_vcmpgtsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001460{
David Blaikie3302f2b2013-01-16 23:08:36 +00001461 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001462}
1463
1464/* vec_vcmpgtub */
1465
Anton Yartsevfc83c602010-08-19 03:21:36 +00001466static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001467vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001468{
David Blaikie3302f2b2013-01-16 23:08:36 +00001469 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001470}
1471
1472/* vec_vcmpgtsh */
1473
Anton Yartsevfc83c602010-08-19 03:21:36 +00001474static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001475vec_vcmpgtsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001476{
David Blaikie3302f2b2013-01-16 23:08:36 +00001477 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001478}
1479
1480/* vec_vcmpgtuh */
1481
Anton Yartsevfc83c602010-08-19 03:21:36 +00001482static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001483vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001484{
David Blaikie3302f2b2013-01-16 23:08:36 +00001485 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001486}
1487
1488/* vec_vcmpgtsw */
1489
Anton Yartsevfc83c602010-08-19 03:21:36 +00001490static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001491vec_vcmpgtsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001492{
David Blaikie3302f2b2013-01-16 23:08:36 +00001493 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001494}
1495
1496/* vec_vcmpgtuw */
1497
Anton Yartsevfc83c602010-08-19 03:21:36 +00001498static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001499vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001500{
David Blaikie3302f2b2013-01-16 23:08:36 +00001501 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001502}
1503
1504/* vec_vcmpgtfp */
1505
Anton Yartsevfc83c602010-08-19 03:21:36 +00001506static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001507vec_vcmpgtfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001508{
David Blaikie3302f2b2013-01-16 23:08:36 +00001509 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001510}
1511
1512/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001513
Anton Yartsevfc83c602010-08-19 03:21:36 +00001514static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001515vec_cmple(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001516{
David Blaikie3302f2b2013-01-16 23:08:36 +00001517 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001518}
1519
1520/* vec_cmplt */
1521
Anton Yartsevfc83c602010-08-19 03:21:36 +00001522static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001523vec_cmplt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001524{
David Blaikie3302f2b2013-01-16 23:08:36 +00001525 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001526}
1527
Anton Yartsevfc83c602010-08-19 03:21:36 +00001528static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001529vec_cmplt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001530{
David Blaikie3302f2b2013-01-16 23:08:36 +00001531 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001532}
1533
Anton Yartsevfc83c602010-08-19 03:21:36 +00001534static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001535vec_cmplt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001536{
David Blaikie3302f2b2013-01-16 23:08:36 +00001537 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001538}
1539
Anton Yartsevfc83c602010-08-19 03:21:36 +00001540static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001541vec_cmplt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001542{
David Blaikie3302f2b2013-01-16 23:08:36 +00001543 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001544}
1545
Anton Yartsevfc83c602010-08-19 03:21:36 +00001546static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001547vec_cmplt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001548{
David Blaikie3302f2b2013-01-16 23:08:36 +00001549 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001550}
1551
Anton Yartsevfc83c602010-08-19 03:21:36 +00001552static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001553vec_cmplt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001554{
David Blaikie3302f2b2013-01-16 23:08:36 +00001555 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001556}
1557
Anton Yartsevfc83c602010-08-19 03:21:36 +00001558static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001559vec_cmplt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001560{
David Blaikie3302f2b2013-01-16 23:08:36 +00001561 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001562}
1563
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001564/* vec_ctf */
1565
1566static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001567vec_ctf(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001568{
David Blaikie3302f2b2013-01-16 23:08:36 +00001569 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001570}
1571
1572static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001573vec_ctf(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001574{
David Blaikie3302f2b2013-01-16 23:08:36 +00001575 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001576}
1577
1578/* vec_vcfsx */
1579
1580static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001581vec_vcfsx(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001582{
David Blaikie3302f2b2013-01-16 23:08:36 +00001583 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001584}
1585
1586/* vec_vcfux */
1587
1588static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001589vec_vcfux(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001590{
David Blaikie3302f2b2013-01-16 23:08:36 +00001591 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001592}
1593
1594/* vec_cts */
1595
1596static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001597vec_cts(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001598{
David Blaikie3302f2b2013-01-16 23:08:36 +00001599 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001600}
1601
1602/* vec_vctsxs */
1603
1604static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001605vec_vctsxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001606{
David Blaikie3302f2b2013-01-16 23:08:36 +00001607 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001608}
1609
1610/* vec_ctu */
1611
1612static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001613vec_ctu(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001614{
David Blaikie3302f2b2013-01-16 23:08:36 +00001615 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001616}
1617
1618/* vec_vctuxs */
1619
1620static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001621vec_vctuxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001622{
David Blaikie3302f2b2013-01-16 23:08:36 +00001623 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001624}
1625
Bill Schmidtcee13a22014-11-14 12:10:51 +00001626/* vec_div */
1627#ifdef __VSX__
1628static vector float __ATTRS_o_ai
1629vec_div(vector float __a, vector float __b)
1630{
1631 return __builtin_vsx_xvdivsp(__a, __b);
1632}
1633
1634static vector double __ATTRS_o_ai
1635vec_div(vector double __a, vector double __b)
1636{
1637 return __builtin_vsx_xvdivdp(__a, __b);
1638}
1639#endif
1640
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001641/* vec_dss */
1642
1643static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001644vec_dss(int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001645{
David Blaikie3302f2b2013-01-16 23:08:36 +00001646 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001647}
1648
1649/* vec_dssall */
1650
1651static void __attribute__((__always_inline__))
1652vec_dssall(void)
1653{
1654 __builtin_altivec_dssall();
1655}
1656
1657/* vec_dst */
1658
1659static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001660vec_dst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001661{
David Blaikie3302f2b2013-01-16 23:08:36 +00001662 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001663}
1664
1665/* vec_dstst */
1666
1667static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001668vec_dstst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001669{
David Blaikie3302f2b2013-01-16 23:08:36 +00001670 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001671}
1672
1673/* vec_dststt */
1674
1675static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001676vec_dststt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001677{
David Blaikie3302f2b2013-01-16 23:08:36 +00001678 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001679}
1680
1681/* vec_dstt */
1682
1683static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001684vec_dstt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001685{
David Blaikie3302f2b2013-01-16 23:08:36 +00001686 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001687}
1688
1689/* vec_expte */
1690
1691static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001692vec_expte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001693{
David Blaikie3302f2b2013-01-16 23:08:36 +00001694 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001695}
1696
1697/* vec_vexptefp */
1698
1699static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001700vec_vexptefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001701{
David Blaikie3302f2b2013-01-16 23:08:36 +00001702 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001703}
1704
1705/* vec_floor */
1706
1707static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001708vec_floor(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001709{
David Blaikie3302f2b2013-01-16 23:08:36 +00001710 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001711}
1712
1713/* vec_vrfim */
1714
1715static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001716vec_vrfim(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001717{
David Blaikie3302f2b2013-01-16 23:08:36 +00001718 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001719}
1720
1721/* vec_ld */
1722
1723static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001724vec_ld(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001725{
David Blaikie3302f2b2013-01-16 23:08:36 +00001726 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001727}
1728
1729static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001730vec_ld(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001731{
David Blaikie3302f2b2013-01-16 23:08:36 +00001732 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001733}
1734
1735static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001736vec_ld(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001737{
David Blaikie3302f2b2013-01-16 23:08:36 +00001738 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001739}
1740
1741static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001742vec_ld(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001743{
David Blaikie3302f2b2013-01-16 23:08:36 +00001744 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001745}
1746
Anton Yartsevfc83c602010-08-19 03:21:36 +00001747static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001748vec_ld(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001749{
David Blaikie3302f2b2013-01-16 23:08:36 +00001750 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001751}
1752
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001753static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001754vec_ld(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001755{
David Blaikie3302f2b2013-01-16 23:08:36 +00001756 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001757}
1758
1759static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001760vec_ld(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001761{
David Blaikie3302f2b2013-01-16 23:08:36 +00001762 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001763}
1764
1765static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001766vec_ld(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001767{
David Blaikie3302f2b2013-01-16 23:08:36 +00001768 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001769}
1770
1771static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001772vec_ld(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001773{
David Blaikie3302f2b2013-01-16 23:08:36 +00001774 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001775}
1776
Anton Yartsevfc83c602010-08-19 03:21:36 +00001777static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001778vec_ld(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001779{
David Blaikie3302f2b2013-01-16 23:08:36 +00001780 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001781}
1782
1783static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001784vec_ld(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001785{
David Blaikie3302f2b2013-01-16 23:08:36 +00001786 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001787}
1788
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001789static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001790vec_ld(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001791{
David Blaikie3302f2b2013-01-16 23:08:36 +00001792 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001793}
1794
1795static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001796vec_ld(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001797{
David Blaikie3302f2b2013-01-16 23:08:36 +00001798 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001799}
1800
1801static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001802vec_ld(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001803{
David Blaikie3302f2b2013-01-16 23:08:36 +00001804 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001805}
1806
1807static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001808vec_ld(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001809{
David Blaikie3302f2b2013-01-16 23:08:36 +00001810 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001811}
1812
Anton Yartsevfc83c602010-08-19 03:21:36 +00001813static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001814vec_ld(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001815{
David Blaikie3302f2b2013-01-16 23:08:36 +00001816 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001817}
1818
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001819static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001820vec_ld(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001821{
David Blaikie3302f2b2013-01-16 23:08:36 +00001822 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001823}
1824
1825static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001826vec_ld(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001827{
David Blaikie3302f2b2013-01-16 23:08:36 +00001828 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001829}
1830
1831/* vec_lvx */
1832
1833static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001834vec_lvx(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001835{
David Blaikie3302f2b2013-01-16 23:08:36 +00001836 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001837}
1838
1839static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001840vec_lvx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001841{
David Blaikie3302f2b2013-01-16 23:08:36 +00001842 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001843}
1844
1845static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001846vec_lvx(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001847{
David Blaikie3302f2b2013-01-16 23:08:36 +00001848 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001849}
1850
1851static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001852vec_lvx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001853{
David Blaikie3302f2b2013-01-16 23:08:36 +00001854 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001855}
1856
Anton Yartsevfc83c602010-08-19 03:21:36 +00001857static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001858vec_lvx(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001859{
David Blaikie3302f2b2013-01-16 23:08:36 +00001860 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001861}
1862
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001863static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001864vec_lvx(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001865{
David Blaikie3302f2b2013-01-16 23:08:36 +00001866 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001867}
1868
1869static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001870vec_lvx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001871{
David Blaikie3302f2b2013-01-16 23:08:36 +00001872 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001873}
1874
1875static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001876vec_lvx(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001877{
David Blaikie3302f2b2013-01-16 23:08:36 +00001878 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001879}
1880
1881static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001882vec_lvx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001883{
David Blaikie3302f2b2013-01-16 23:08:36 +00001884 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001885}
1886
Anton Yartsevfc83c602010-08-19 03:21:36 +00001887static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001888vec_lvx(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001889{
David Blaikie3302f2b2013-01-16 23:08:36 +00001890 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001891}
1892
1893static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001894vec_lvx(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001895{
David Blaikie3302f2b2013-01-16 23:08:36 +00001896 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001897}
1898
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001899static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001900vec_lvx(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001901{
David Blaikie3302f2b2013-01-16 23:08:36 +00001902 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001903}
1904
1905static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001906vec_lvx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001907{
David Blaikie3302f2b2013-01-16 23:08:36 +00001908 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001909}
1910
1911static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001912vec_lvx(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001913{
David Blaikie3302f2b2013-01-16 23:08:36 +00001914 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001915}
1916
1917static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001918vec_lvx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001919{
David Blaikie3302f2b2013-01-16 23:08:36 +00001920 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001921}
1922
Anton Yartsevfc83c602010-08-19 03:21:36 +00001923static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001924vec_lvx(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001925{
David Blaikie3302f2b2013-01-16 23:08:36 +00001926 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001927}
1928
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001929static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001930vec_lvx(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001931{
David Blaikie3302f2b2013-01-16 23:08:36 +00001932 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001933}
1934
1935static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001936vec_lvx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001937{
David Blaikie3302f2b2013-01-16 23:08:36 +00001938 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001939}
1940
1941/* vec_lde */
1942
1943static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001944vec_lde(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001945{
David Blaikie3302f2b2013-01-16 23:08:36 +00001946 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001947}
1948
1949static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001950vec_lde(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001951{
David Blaikie3302f2b2013-01-16 23:08:36 +00001952 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001953}
1954
1955static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001956vec_lde(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001957{
David Blaikie3302f2b2013-01-16 23:08:36 +00001958 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001959}
1960
1961static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001962vec_lde(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001963{
David Blaikie3302f2b2013-01-16 23:08:36 +00001964 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001965}
1966
1967static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001968vec_lde(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001969{
David Blaikie3302f2b2013-01-16 23:08:36 +00001970 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001971}
1972
1973static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001974vec_lde(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001975{
David Blaikie3302f2b2013-01-16 23:08:36 +00001976 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001977}
1978
1979static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001980vec_lde(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001981{
David Blaikie3302f2b2013-01-16 23:08:36 +00001982 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001983}
1984
1985/* vec_lvebx */
1986
1987static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001988vec_lvebx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001989{
David Blaikie3302f2b2013-01-16 23:08:36 +00001990 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001991}
1992
1993static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001994vec_lvebx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001995{
David Blaikie3302f2b2013-01-16 23:08:36 +00001996 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001997}
1998
1999/* vec_lvehx */
2000
2001static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002002vec_lvehx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002003{
David Blaikie3302f2b2013-01-16 23:08:36 +00002004 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002005}
2006
2007static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002008vec_lvehx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002009{
David Blaikie3302f2b2013-01-16 23:08:36 +00002010 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002011}
2012
2013/* vec_lvewx */
2014
2015static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002016vec_lvewx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002017{
David Blaikie3302f2b2013-01-16 23:08:36 +00002018 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002019}
2020
2021static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002022vec_lvewx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002023{
David Blaikie3302f2b2013-01-16 23:08:36 +00002024 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002025}
2026
2027static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002028vec_lvewx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002029{
David Blaikie3302f2b2013-01-16 23:08:36 +00002030 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002031}
2032
2033/* vec_ldl */
2034
2035static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002036vec_ldl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002037{
David Blaikie3302f2b2013-01-16 23:08:36 +00002038 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002039}
2040
2041static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002042vec_ldl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002043{
David Blaikie3302f2b2013-01-16 23:08:36 +00002044 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002045}
2046
2047static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002048vec_ldl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002049{
David Blaikie3302f2b2013-01-16 23:08:36 +00002050 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002051}
2052
2053static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002054vec_ldl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002055{
David Blaikie3302f2b2013-01-16 23:08:36 +00002056 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002057}
2058
Anton Yartsevfc83c602010-08-19 03:21:36 +00002059static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002060vec_ldl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002061{
David Blaikie3302f2b2013-01-16 23:08:36 +00002062 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002063}
2064
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002065static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002066vec_ldl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002067{
David Blaikie3302f2b2013-01-16 23:08:36 +00002068 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002069}
2070
2071static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002072vec_ldl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002073{
David Blaikie3302f2b2013-01-16 23:08:36 +00002074 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002075}
2076
2077static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002078vec_ldl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002079{
David Blaikie3302f2b2013-01-16 23:08:36 +00002080 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002081}
2082
2083static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002084vec_ldl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002085{
David Blaikie3302f2b2013-01-16 23:08:36 +00002086 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002087}
2088
Anton Yartsevfc83c602010-08-19 03:21:36 +00002089static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002090vec_ldl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002091{
David Blaikie3302f2b2013-01-16 23:08:36 +00002092 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002093}
2094
2095static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002096vec_ldl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002097{
David Blaikie3302f2b2013-01-16 23:08:36 +00002098 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002099}
2100
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002101static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002102vec_ldl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002103{
David Blaikie3302f2b2013-01-16 23:08:36 +00002104 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002105}
2106
2107static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002108vec_ldl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002109{
David Blaikie3302f2b2013-01-16 23:08:36 +00002110 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002111}
2112
2113static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002114vec_ldl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002115{
David Blaikie3302f2b2013-01-16 23:08:36 +00002116 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002117}
2118
2119static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002120vec_ldl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002121{
David Blaikie3302f2b2013-01-16 23:08:36 +00002122 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002123}
2124
Anton Yartsevfc83c602010-08-19 03:21:36 +00002125static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002126vec_ldl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002127{
David Blaikie3302f2b2013-01-16 23:08:36 +00002128 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002129}
2130
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002131static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002132vec_ldl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002133{
David Blaikie3302f2b2013-01-16 23:08:36 +00002134 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002135}
2136
2137static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002138vec_ldl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002139{
David Blaikie3302f2b2013-01-16 23:08:36 +00002140 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002141}
2142
2143/* vec_lvxl */
2144
2145static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002146vec_lvxl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002147{
David Blaikie3302f2b2013-01-16 23:08:36 +00002148 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002149}
2150
2151static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002152vec_lvxl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002153{
David Blaikie3302f2b2013-01-16 23:08:36 +00002154 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002155}
2156
2157static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002158vec_lvxl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002159{
David Blaikie3302f2b2013-01-16 23:08:36 +00002160 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002161}
2162
2163static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002164vec_lvxl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002165{
David Blaikie3302f2b2013-01-16 23:08:36 +00002166 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002167}
2168
Anton Yartsevfc83c602010-08-19 03:21:36 +00002169static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002170vec_lvxl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002171{
David Blaikie3302f2b2013-01-16 23:08:36 +00002172 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002173}
2174
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002175static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002176vec_lvxl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002177{
David Blaikie3302f2b2013-01-16 23:08:36 +00002178 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002179}
2180
2181static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002182vec_lvxl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002183{
David Blaikie3302f2b2013-01-16 23:08:36 +00002184 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002185}
2186
2187static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002188vec_lvxl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002189{
David Blaikie3302f2b2013-01-16 23:08:36 +00002190 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002191}
2192
2193static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002194vec_lvxl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002195{
David Blaikie3302f2b2013-01-16 23:08:36 +00002196 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002197}
2198
Anton Yartsevfc83c602010-08-19 03:21:36 +00002199static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002200vec_lvxl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002201{
David Blaikie3302f2b2013-01-16 23:08:36 +00002202 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002203}
2204
2205static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002206vec_lvxl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002207{
David Blaikie3302f2b2013-01-16 23:08:36 +00002208 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002209}
2210
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002211static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002212vec_lvxl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002213{
David Blaikie3302f2b2013-01-16 23:08:36 +00002214 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002215}
2216
2217static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002218vec_lvxl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002219{
David Blaikie3302f2b2013-01-16 23:08:36 +00002220 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002221}
2222
2223static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002224vec_lvxl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002225{
David Blaikie3302f2b2013-01-16 23:08:36 +00002226 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002227}
2228
2229static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002230vec_lvxl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002231{
David Blaikie3302f2b2013-01-16 23:08:36 +00002232 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002233}
2234
Anton Yartsevfc83c602010-08-19 03:21:36 +00002235static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002236vec_lvxl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002237{
David Blaikie3302f2b2013-01-16 23:08:36 +00002238 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002239}
2240
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002241static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002242vec_lvxl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002243{
David Blaikie3302f2b2013-01-16 23:08:36 +00002244 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002245}
2246
2247static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002248vec_lvxl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002249{
David Blaikie3302f2b2013-01-16 23:08:36 +00002250 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002251}
2252
2253/* vec_loge */
2254
2255static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002256vec_loge(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002257{
David Blaikie3302f2b2013-01-16 23:08:36 +00002258 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002259}
2260
2261/* vec_vlogefp */
2262
2263static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002264vec_vlogefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002265{
David Blaikie3302f2b2013-01-16 23:08:36 +00002266 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002267}
2268
2269/* vec_lvsl */
2270
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002271#ifdef __LITTLE_ENDIAN__
2272static vector unsigned char __ATTRS_o_ai
2273__attribute__((deprecated("use assignment for unaligned little endian \
2274loads/stores")))
2275vec_lvsl(int __a, const signed char *__b)
2276{
2277 vector unsigned char mask =
2278 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2279 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2280 return vec_perm(mask, mask, reverse);
2281}
2282#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002283static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002284vec_lvsl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002285{
David Blaikie3302f2b2013-01-16 23:08:36 +00002286 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002287}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002288#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002289
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002290#ifdef __LITTLE_ENDIAN__
2291static vector unsigned char __ATTRS_o_ai
2292__attribute__((deprecated("use assignment for unaligned little endian \
2293loads/stores")))
2294vec_lvsl(int __a, const unsigned char *__b)
2295{
2296 vector unsigned char mask =
2297 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2298 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2299 return vec_perm(mask, mask, reverse);
2300}
2301#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002302static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002303vec_lvsl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002304{
David Blaikie3302f2b2013-01-16 23:08:36 +00002305 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002306}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002307#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002308
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002309#ifdef __LITTLE_ENDIAN__
2310static vector unsigned char __ATTRS_o_ai
2311__attribute__((deprecated("use assignment for unaligned little endian \
2312loads/stores")))
2313vec_lvsl(int __a, const short *__b)
2314{
2315 vector unsigned char mask =
2316 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2317 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2318 return vec_perm(mask, mask, reverse);
2319}
2320#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002321static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002322vec_lvsl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002323{
David Blaikie3302f2b2013-01-16 23:08:36 +00002324 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002325}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002326#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002327
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002328#ifdef __LITTLE_ENDIAN__
2329static vector unsigned char __ATTRS_o_ai
2330__attribute__((deprecated("use assignment for unaligned little endian \
2331loads/stores")))
2332vec_lvsl(int __a, const unsigned short *__b)
2333{
2334 vector unsigned char mask =
2335 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2336 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2337 return vec_perm(mask, mask, reverse);
2338}
2339#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002340static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002341vec_lvsl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002342{
David Blaikie3302f2b2013-01-16 23:08:36 +00002343 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002344}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002345#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002346
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002347#ifdef __LITTLE_ENDIAN__
2348static vector unsigned char __ATTRS_o_ai
2349__attribute__((deprecated("use assignment for unaligned little endian \
2350loads/stores")))
2351vec_lvsl(int __a, const int *__b)
2352{
2353 vector unsigned char mask =
2354 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2355 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2356 return vec_perm(mask, mask, reverse);
2357}
2358#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002359static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002360vec_lvsl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002361{
David Blaikie3302f2b2013-01-16 23:08:36 +00002362 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002363}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002364#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002365
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002366#ifdef __LITTLE_ENDIAN__
2367static vector unsigned char __ATTRS_o_ai
2368__attribute__((deprecated("use assignment for unaligned little endian \
2369loads/stores")))
2370vec_lvsl(int __a, const unsigned int *__b)
2371{
2372 vector unsigned char mask =
2373 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2374 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2375 return vec_perm(mask, mask, reverse);
2376}
2377#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002378static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002379vec_lvsl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002380{
David Blaikie3302f2b2013-01-16 23:08:36 +00002381 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002382}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002383#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002384
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002385#ifdef __LITTLE_ENDIAN__
2386static vector unsigned char __ATTRS_o_ai
2387__attribute__((deprecated("use assignment for unaligned little endian \
2388loads/stores")))
2389vec_lvsl(int __a, const float *__b)
2390{
2391 vector unsigned char mask =
2392 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2393 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2394 return vec_perm(mask, mask, reverse);
2395}
2396#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002397static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002398vec_lvsl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002399{
David Blaikie3302f2b2013-01-16 23:08:36 +00002400 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002401}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002402#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002403
2404/* vec_lvsr */
2405
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002406#ifdef __LITTLE_ENDIAN__
2407static vector unsigned char __ATTRS_o_ai
2408__attribute__((deprecated("use assignment for unaligned little endian \
2409loads/stores")))
2410vec_lvsr(int __a, const signed char *__b)
2411{
2412 vector unsigned char mask =
2413 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2414 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2415 return vec_perm(mask, mask, reverse);
2416}
2417#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002418static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002419vec_lvsr(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002420{
David Blaikie3302f2b2013-01-16 23:08:36 +00002421 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002422}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002423#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002424
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002425#ifdef __LITTLE_ENDIAN__
2426static vector unsigned char __ATTRS_o_ai
2427__attribute__((deprecated("use assignment for unaligned little endian \
2428loads/stores")))
2429vec_lvsr(int __a, const unsigned char *__b)
2430{
2431 vector unsigned char mask =
2432 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2433 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2434 return vec_perm(mask, mask, reverse);
2435}
2436#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002437static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002438vec_lvsr(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002439{
David Blaikie3302f2b2013-01-16 23:08:36 +00002440 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002441}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002442#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002443
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002444#ifdef __LITTLE_ENDIAN__
2445static vector unsigned char __ATTRS_o_ai
2446__attribute__((deprecated("use assignment for unaligned little endian \
2447loads/stores")))
2448vec_lvsr(int __a, const short *__b)
2449{
2450 vector unsigned char mask =
2451 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2452 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2453 return vec_perm(mask, mask, reverse);
2454}
2455#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002456static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002457vec_lvsr(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002458{
David Blaikie3302f2b2013-01-16 23:08:36 +00002459 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002460}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002461#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002462
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002463#ifdef __LITTLE_ENDIAN__
2464static vector unsigned char __ATTRS_o_ai
2465__attribute__((deprecated("use assignment for unaligned little endian \
2466loads/stores")))
2467vec_lvsr(int __a, const unsigned short *__b)
2468{
2469 vector unsigned char mask =
2470 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2471 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2472 return vec_perm(mask, mask, reverse);
2473}
2474#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002475static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002476vec_lvsr(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002477{
David Blaikie3302f2b2013-01-16 23:08:36 +00002478 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002479}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002480#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002481
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002482#ifdef __LITTLE_ENDIAN__
2483static vector unsigned char __ATTRS_o_ai
2484__attribute__((deprecated("use assignment for unaligned little endian \
2485loads/stores")))
2486vec_lvsr(int __a, const int *__b)
2487{
2488 vector unsigned char mask =
2489 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2490 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2491 return vec_perm(mask, mask, reverse);
2492}
2493#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002494static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002495vec_lvsr(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002496{
David Blaikie3302f2b2013-01-16 23:08:36 +00002497 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002498}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002499#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002500
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002501#ifdef __LITTLE_ENDIAN__
2502static vector unsigned char __ATTRS_o_ai
2503__attribute__((deprecated("use assignment for unaligned little endian \
2504loads/stores")))
2505vec_lvsr(int __a, const unsigned int *__b)
2506{
2507 vector unsigned char mask =
2508 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2509 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2510 return vec_perm(mask, mask, reverse);
2511}
2512#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002513static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002514vec_lvsr(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002515{
David Blaikie3302f2b2013-01-16 23:08:36 +00002516 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002517}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002518#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002519
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002520#ifdef __LITTLE_ENDIAN__
2521static vector unsigned char __ATTRS_o_ai
2522__attribute__((deprecated("use assignment for unaligned little endian \
2523loads/stores")))
2524vec_lvsr(int __a, const float *__b)
2525{
2526 vector unsigned char mask =
2527 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2528 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2529 return vec_perm(mask, mask, reverse);
2530}
2531#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002532static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002533vec_lvsr(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002534{
David Blaikie3302f2b2013-01-16 23:08:36 +00002535 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002536}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002537#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002538
2539/* vec_madd */
2540
2541static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002542vec_madd(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002543{
David Blaikie3302f2b2013-01-16 23:08:36 +00002544 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002545}
2546
2547/* vec_vmaddfp */
2548
2549static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002550vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002551{
David Blaikie3302f2b2013-01-16 23:08:36 +00002552 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002553}
2554
2555/* vec_madds */
2556
2557static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002558vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002559{
David Blaikie3302f2b2013-01-16 23:08:36 +00002560 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002561}
2562
2563/* vec_vmhaddshs */
2564static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002565vec_vmhaddshs(vector signed short __a,
2566 vector signed short __b,
2567 vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002568{
David Blaikie3302f2b2013-01-16 23:08:36 +00002569 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002570}
2571
Chris Lattnerdad40622010-04-14 03:54:58 +00002572/* vec_max */
2573
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002574static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002575vec_max(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002576{
David Blaikie3302f2b2013-01-16 23:08:36 +00002577 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002578}
2579
Anton Yartsevfc83c602010-08-19 03:21:36 +00002580static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002581vec_max(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002582{
David Blaikie3302f2b2013-01-16 23:08:36 +00002583 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002584}
2585
2586static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002587vec_max(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002588{
David Blaikie3302f2b2013-01-16 23:08:36 +00002589 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002590}
2591
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002592static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002593vec_max(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002594{
David Blaikie3302f2b2013-01-16 23:08:36 +00002595 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002596}
2597
Anton Yartsevfc83c602010-08-19 03:21:36 +00002598static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002599vec_max(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002600{
David Blaikie3302f2b2013-01-16 23:08:36 +00002601 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002602}
2603
2604static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002605vec_max(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002606{
David Blaikie3302f2b2013-01-16 23:08:36 +00002607 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002608}
2609
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002610static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002611vec_max(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002612{
David Blaikie3302f2b2013-01-16 23:08:36 +00002613 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002614}
2615
Anton Yartsevfc83c602010-08-19 03:21:36 +00002616static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002617vec_max(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002618{
David Blaikie3302f2b2013-01-16 23:08:36 +00002619 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002620}
2621
2622static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002623vec_max(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002624{
David Blaikie3302f2b2013-01-16 23:08:36 +00002625 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002626}
2627
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002628static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002629vec_max(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002630{
David Blaikie3302f2b2013-01-16 23:08:36 +00002631 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002632}
2633
Anton Yartsevfc83c602010-08-19 03:21:36 +00002634static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002635vec_max(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002636{
David Blaikie3302f2b2013-01-16 23:08:36 +00002637 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002638}
2639
2640static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002641vec_max(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002642{
David Blaikie3302f2b2013-01-16 23:08:36 +00002643 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002644}
2645
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002646static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002647vec_max(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002648{
David Blaikie3302f2b2013-01-16 23:08:36 +00002649 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002650}
2651
Anton Yartsevfc83c602010-08-19 03:21:36 +00002652static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002653vec_max(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002654{
David Blaikie3302f2b2013-01-16 23:08:36 +00002655 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002656}
2657
2658static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002659vec_max(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002660{
David Blaikie3302f2b2013-01-16 23:08:36 +00002661 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002662}
2663
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002664static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002665vec_max(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002666{
David Blaikie3302f2b2013-01-16 23:08:36 +00002667 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002668}
2669
Anton Yartsevfc83c602010-08-19 03:21:36 +00002670static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002671vec_max(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002672{
David Blaikie3302f2b2013-01-16 23:08:36 +00002673 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002674}
2675
2676static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002677vec_max(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002678{
David Blaikie3302f2b2013-01-16 23:08:36 +00002679 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002680}
2681
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002682static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002683vec_max(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002684{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002685#ifdef __VSX__
2686 return __builtin_vsx_xvmaxsp(__a, __b);
2687#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002688 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002689#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00002690}
2691
Bill Schmidt691e01d2014-10-31 19:19:24 +00002692#ifdef __VSX__
2693static vector double __ATTRS_o_ai
2694vec_max(vector double __a, vector double __b)
2695{
2696 return __builtin_vsx_xvmaxdp(__a, __b);
2697}
2698#endif
2699
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002700/* vec_vmaxsb */
2701
Anton Yartsevfc83c602010-08-19 03:21:36 +00002702static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002703vec_vmaxsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002704{
David Blaikie3302f2b2013-01-16 23:08:36 +00002705 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002706}
2707
Anton Yartsevfc83c602010-08-19 03:21:36 +00002708static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002709vec_vmaxsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002710{
David Blaikie3302f2b2013-01-16 23:08:36 +00002711 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002712}
2713
2714static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002715vec_vmaxsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002716{
David Blaikie3302f2b2013-01-16 23:08:36 +00002717 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002718}
2719
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002720/* vec_vmaxub */
2721
Anton Yartsevfc83c602010-08-19 03:21:36 +00002722static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002723vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002724{
David Blaikie3302f2b2013-01-16 23:08:36 +00002725 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002726}
2727
Anton Yartsevfc83c602010-08-19 03:21:36 +00002728static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002729vec_vmaxub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002730{
David Blaikie3302f2b2013-01-16 23:08:36 +00002731 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002732}
2733
2734static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002735vec_vmaxub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002736{
David Blaikie3302f2b2013-01-16 23:08:36 +00002737 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002738}
2739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002740/* vec_vmaxsh */
2741
Anton Yartsevfc83c602010-08-19 03:21:36 +00002742static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002743vec_vmaxsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002744{
David Blaikie3302f2b2013-01-16 23:08:36 +00002745 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002746}
2747
Anton Yartsevfc83c602010-08-19 03:21:36 +00002748static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002749vec_vmaxsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002750{
David Blaikie3302f2b2013-01-16 23:08:36 +00002751 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002752}
2753
2754static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002755vec_vmaxsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002756{
David Blaikie3302f2b2013-01-16 23:08:36 +00002757 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002758}
2759
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002760/* vec_vmaxuh */
2761
Anton Yartsevfc83c602010-08-19 03:21:36 +00002762static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002763vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002764{
David Blaikie3302f2b2013-01-16 23:08:36 +00002765 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002766}
2767
Anton Yartsevfc83c602010-08-19 03:21:36 +00002768static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002769vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002770{
David Blaikie3302f2b2013-01-16 23:08:36 +00002771 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002772}
2773
2774static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002775vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002776{
David Blaikie3302f2b2013-01-16 23:08:36 +00002777 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002778}
2779
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002780/* vec_vmaxsw */
2781
Anton Yartsevfc83c602010-08-19 03:21:36 +00002782static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002783vec_vmaxsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002784{
David Blaikie3302f2b2013-01-16 23:08:36 +00002785 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002786}
2787
Anton Yartsevfc83c602010-08-19 03:21:36 +00002788static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002789vec_vmaxsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002790{
David Blaikie3302f2b2013-01-16 23:08:36 +00002791 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002792}
2793
2794static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002795vec_vmaxsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002796{
David Blaikie3302f2b2013-01-16 23:08:36 +00002797 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002798}
2799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002800/* vec_vmaxuw */
2801
Anton Yartsevfc83c602010-08-19 03:21:36 +00002802static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002803vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002804{
David Blaikie3302f2b2013-01-16 23:08:36 +00002805 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002806}
2807
Anton Yartsevfc83c602010-08-19 03:21:36 +00002808static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002809vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002810{
David Blaikie3302f2b2013-01-16 23:08:36 +00002811 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002812}
2813
2814static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002815vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002816{
David Blaikie3302f2b2013-01-16 23:08:36 +00002817 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002818}
2819
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002820/* vec_vmaxfp */
2821
2822static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002823vec_vmaxfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002824{
Bill Schmidt691e01d2014-10-31 19:19:24 +00002825#ifdef __VSX__
2826 return __builtin_vsx_xvmaxsp(__a, __b);
2827#else
David Blaikie3302f2b2013-01-16 23:08:36 +00002828 return __builtin_altivec_vmaxfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00002829#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002830}
2831
2832/* vec_mergeh */
2833
2834static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002835vec_mergeh(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002836{
David Blaikie3302f2b2013-01-16 23:08:36 +00002837 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002838 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2839 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2840}
2841
2842static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002843vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002844{
David Blaikie3302f2b2013-01-16 23:08:36 +00002845 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002846 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2847 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2848}
2849
Anton Yartsev9e968982010-08-19 03:00:09 +00002850static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002851vec_mergeh(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002852{
David Blaikie3302f2b2013-01-16 23:08:36 +00002853 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002854 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2855 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2856}
2857
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002858static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002859vec_mergeh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002860{
David Blaikie3302f2b2013-01-16 23:08:36 +00002861 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002862 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2863 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2864}
2865
2866static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002867vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002868{
David Blaikie3302f2b2013-01-16 23:08:36 +00002869 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002870 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2871 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2872}
2873
Anton Yartsev9e968982010-08-19 03:00:09 +00002874static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002875vec_mergeh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002876{
David Blaikie3302f2b2013-01-16 23:08:36 +00002877 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002878 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2879 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2880}
2881
2882static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002883vec_mergeh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002884{
David Blaikie3302f2b2013-01-16 23:08:36 +00002885 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002886 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2887 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2888}
2889
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002890static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002891vec_mergeh(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002892{
David Blaikie3302f2b2013-01-16 23:08:36 +00002893 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002894 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2895 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2896}
2897
2898static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002899vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002900{
David Blaikie3302f2b2013-01-16 23:08:36 +00002901 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002902 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2903 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2904}
2905
Anton Yartsev9e968982010-08-19 03:00:09 +00002906static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002907vec_mergeh(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002908{
David Blaikie3302f2b2013-01-16 23:08:36 +00002909 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002910 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2911 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2912}
2913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002914static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002915vec_mergeh(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002916{
David Blaikie3302f2b2013-01-16 23:08:36 +00002917 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002918 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2919 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2920}
2921
2922/* vec_vmrghb */
2923
2924#define __builtin_altivec_vmrghb vec_vmrghb
2925
2926static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002927vec_vmrghb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002928{
David Blaikie3302f2b2013-01-16 23:08:36 +00002929 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002930 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2931 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2932}
2933
2934static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002935vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002936{
David Blaikie3302f2b2013-01-16 23:08:36 +00002937 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002938 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2939 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2940}
2941
Anton Yartsev9e968982010-08-19 03:00:09 +00002942static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002943vec_vmrghb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002944{
David Blaikie3302f2b2013-01-16 23:08:36 +00002945 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002946 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2947 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2948}
2949
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002950/* vec_vmrghh */
2951
2952#define __builtin_altivec_vmrghh vec_vmrghh
2953
2954static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002955vec_vmrghh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002956{
David Blaikie3302f2b2013-01-16 23:08:36 +00002957 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002958 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2959 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2960}
2961
2962static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002963vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002964{
David Blaikie3302f2b2013-01-16 23:08:36 +00002965 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002966 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2967 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2968}
2969
Anton Yartsev9e968982010-08-19 03:00:09 +00002970static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002971vec_vmrghh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002972{
David Blaikie3302f2b2013-01-16 23:08:36 +00002973 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002974 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2975 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2976}
2977
2978static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002979vec_vmrghh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002980{
David Blaikie3302f2b2013-01-16 23:08:36 +00002981 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002982 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2983 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2984}
2985
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002986/* vec_vmrghw */
2987
2988#define __builtin_altivec_vmrghw vec_vmrghw
2989
2990static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002991vec_vmrghw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002992{
David Blaikie3302f2b2013-01-16 23:08:36 +00002993 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002994 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2995 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2996}
2997
2998static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002999vec_vmrghw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003000{
David Blaikie3302f2b2013-01-16 23:08:36 +00003001 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003002 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3003 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3004}
3005
Anton Yartsev9e968982010-08-19 03:00:09 +00003006static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003007vec_vmrghw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003008{
David Blaikie3302f2b2013-01-16 23:08:36 +00003009 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003010 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3011 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3012}
3013
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003014static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003015vec_vmrghw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003016{
David Blaikie3302f2b2013-01-16 23:08:36 +00003017 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003018 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3019 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3020}
3021
3022/* vec_mergel */
3023
3024static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003025vec_mergel(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003026{
David Blaikie3302f2b2013-01-16 23:08:36 +00003027 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003028 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3029 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3030}
3031
3032static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003033vec_mergel(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003034{
David Blaikie3302f2b2013-01-16 23:08:36 +00003035 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003036 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3037 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3038}
3039
Anton Yartsev9e968982010-08-19 03:00:09 +00003040static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003041vec_mergel(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003042{
David Blaikie3302f2b2013-01-16 23:08:36 +00003043 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003044 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3045 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3046}
3047
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003048static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003049vec_mergel(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003050{
David Blaikie3302f2b2013-01-16 23:08:36 +00003051 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003052 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3053 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3054}
3055
3056static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003057vec_mergel(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003058{
David Blaikie3302f2b2013-01-16 23:08:36 +00003059 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003060 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3061 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3062}
3063
Anton Yartsev9e968982010-08-19 03:00:09 +00003064static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003065vec_mergel(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003066{
David Blaikie3302f2b2013-01-16 23:08:36 +00003067 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003068 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3069 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3070}
3071
3072static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003073vec_mergel(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003074{
David Blaikie3302f2b2013-01-16 23:08:36 +00003075 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003076 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3077 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3078}
3079
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003080static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003081vec_mergel(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003082{
David Blaikie3302f2b2013-01-16 23:08:36 +00003083 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003084 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3085 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3086}
3087
3088static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003089vec_mergel(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003090{
David Blaikie3302f2b2013-01-16 23:08:36 +00003091 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003092 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3093 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3094}
3095
Anton Yartsev9e968982010-08-19 03:00:09 +00003096static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003097vec_mergel(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003098{
David Blaikie3302f2b2013-01-16 23:08:36 +00003099 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003100 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3101 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3102}
3103
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003104static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003105vec_mergel(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003106{
David Blaikie3302f2b2013-01-16 23:08:36 +00003107 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003108 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3109 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3110}
3111
3112/* vec_vmrglb */
3113
3114#define __builtin_altivec_vmrglb vec_vmrglb
3115
3116static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003117vec_vmrglb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003118{
David Blaikie3302f2b2013-01-16 23:08:36 +00003119 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003120 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3121 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3122}
3123
3124static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003125vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003126{
David Blaikie3302f2b2013-01-16 23:08:36 +00003127 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003128 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3129 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3130}
3131
Anton Yartsev9e968982010-08-19 03:00:09 +00003132static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003133vec_vmrglb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003134{
David Blaikie3302f2b2013-01-16 23:08:36 +00003135 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003136 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3137 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3138}
3139
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003140/* vec_vmrglh */
3141
3142#define __builtin_altivec_vmrglh vec_vmrglh
3143
3144static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003145vec_vmrglh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003146{
David Blaikie3302f2b2013-01-16 23:08:36 +00003147 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003148 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3149 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3150}
3151
3152static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003153vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003154{
David Blaikie3302f2b2013-01-16 23:08:36 +00003155 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003156 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3157 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3158}
3159
Anton Yartsev9e968982010-08-19 03:00:09 +00003160static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003161vec_vmrglh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003162{
David Blaikie3302f2b2013-01-16 23:08:36 +00003163 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003164 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3165 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3166}
3167
3168static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003169vec_vmrglh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003170{
David Blaikie3302f2b2013-01-16 23:08:36 +00003171 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003172 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3173 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3174}
3175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003176/* vec_vmrglw */
3177
3178#define __builtin_altivec_vmrglw vec_vmrglw
3179
3180static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003181vec_vmrglw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003182{
David Blaikie3302f2b2013-01-16 23:08:36 +00003183 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003184 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3185 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3186}
3187
3188static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003189vec_vmrglw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003190{
David Blaikie3302f2b2013-01-16 23:08:36 +00003191 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003192 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3193 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3194}
3195
Anton Yartsev9e968982010-08-19 03:00:09 +00003196static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003197vec_vmrglw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003198{
David Blaikie3302f2b2013-01-16 23:08:36 +00003199 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003200 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3201 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3202}
3203
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003204static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003205vec_vmrglw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003206{
David Blaikie3302f2b2013-01-16 23:08:36 +00003207 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003208 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3209 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3210}
3211
Chris Lattnerdad40622010-04-14 03:54:58 +00003212/* vec_mfvscr */
3213
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003214static vector unsigned short __attribute__((__always_inline__))
3215vec_mfvscr(void)
3216{
3217 return __builtin_altivec_mfvscr();
3218}
Chris Lattnerdad40622010-04-14 03:54:58 +00003219
3220/* vec_min */
3221
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003222static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003223vec_min(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003224{
David Blaikie3302f2b2013-01-16 23:08:36 +00003225 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003226}
3227
Anton Yartsevfc83c602010-08-19 03:21:36 +00003228static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003229vec_min(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003230{
David Blaikie3302f2b2013-01-16 23:08:36 +00003231 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003232}
3233
3234static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003235vec_min(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003236{
David Blaikie3302f2b2013-01-16 23:08:36 +00003237 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003238}
3239
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003240static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003241vec_min(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003242{
David Blaikie3302f2b2013-01-16 23:08:36 +00003243 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003244}
3245
Anton Yartsevfc83c602010-08-19 03:21:36 +00003246static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003247vec_min(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003248{
David Blaikie3302f2b2013-01-16 23:08:36 +00003249 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003250}
3251
3252static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003253vec_min(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003254{
David Blaikie3302f2b2013-01-16 23:08:36 +00003255 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003256}
3257
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003258static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003259vec_min(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003260{
David Blaikie3302f2b2013-01-16 23:08:36 +00003261 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003262}
3263
Anton Yartsevfc83c602010-08-19 03:21:36 +00003264static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003265vec_min(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003266{
David Blaikie3302f2b2013-01-16 23:08:36 +00003267 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003268}
3269
3270static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003271vec_min(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003272{
David Blaikie3302f2b2013-01-16 23:08:36 +00003273 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003274}
3275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003276static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003277vec_min(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003278{
David Blaikie3302f2b2013-01-16 23:08:36 +00003279 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003280}
3281
Anton Yartsevfc83c602010-08-19 03:21:36 +00003282static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003283vec_min(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003284{
David Blaikie3302f2b2013-01-16 23:08:36 +00003285 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003286}
3287
3288static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003289vec_min(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003290{
David Blaikie3302f2b2013-01-16 23:08:36 +00003291 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003292}
3293
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003294static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003295vec_min(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003296{
David Blaikie3302f2b2013-01-16 23:08:36 +00003297 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003298}
3299
Anton Yartsevfc83c602010-08-19 03:21:36 +00003300static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003301vec_min(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003302{
David Blaikie3302f2b2013-01-16 23:08:36 +00003303 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003304}
3305
3306static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003307vec_min(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003308{
David Blaikie3302f2b2013-01-16 23:08:36 +00003309 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003310}
3311
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003312static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003313vec_min(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003314{
David Blaikie3302f2b2013-01-16 23:08:36 +00003315 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003316}
3317
Anton Yartsevfc83c602010-08-19 03:21:36 +00003318static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003319vec_min(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003320{
David Blaikie3302f2b2013-01-16 23:08:36 +00003321 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003322}
3323
3324static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003325vec_min(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003326{
David Blaikie3302f2b2013-01-16 23:08:36 +00003327 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003328}
3329
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003330static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003331vec_min(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003332{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003333#ifdef __VSX__
3334 return __builtin_vsx_xvminsp(__a, __b);
3335#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003336 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003337#endif
Chris Lattnerdad40622010-04-14 03:54:58 +00003338}
3339
Bill Schmidt691e01d2014-10-31 19:19:24 +00003340#ifdef __VSX__
3341static vector double __ATTRS_o_ai
3342vec_min(vector double __a, vector double __b)
3343{
3344 return __builtin_vsx_xvmindp(__a, __b);
3345}
3346#endif
3347
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003348/* vec_vminsb */
3349
Anton Yartsevfc83c602010-08-19 03:21:36 +00003350static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003351vec_vminsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003352{
David Blaikie3302f2b2013-01-16 23:08:36 +00003353 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003354}
3355
Anton Yartsevfc83c602010-08-19 03:21:36 +00003356static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003357vec_vminsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003358{
David Blaikie3302f2b2013-01-16 23:08:36 +00003359 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003360}
3361
3362static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003363vec_vminsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003364{
David Blaikie3302f2b2013-01-16 23:08:36 +00003365 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003366}
3367
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003368/* vec_vminub */
3369
Anton Yartsevfc83c602010-08-19 03:21:36 +00003370static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003371vec_vminub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003372{
David Blaikie3302f2b2013-01-16 23:08:36 +00003373 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003374}
3375
Anton Yartsevfc83c602010-08-19 03:21:36 +00003376static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003377vec_vminub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003378{
David Blaikie3302f2b2013-01-16 23:08:36 +00003379 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003380}
3381
3382static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003383vec_vminub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003384{
David Blaikie3302f2b2013-01-16 23:08:36 +00003385 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003386}
3387
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003388/* vec_vminsh */
3389
Anton Yartsevfc83c602010-08-19 03:21:36 +00003390static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003391vec_vminsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003392{
David Blaikie3302f2b2013-01-16 23:08:36 +00003393 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003394}
3395
Anton Yartsevfc83c602010-08-19 03:21:36 +00003396static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003397vec_vminsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003398{
David Blaikie3302f2b2013-01-16 23:08:36 +00003399 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003400}
3401
3402static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003403vec_vminsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003404{
David Blaikie3302f2b2013-01-16 23:08:36 +00003405 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003406}
3407
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003408/* vec_vminuh */
3409
Anton Yartsevfc83c602010-08-19 03:21:36 +00003410static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003411vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003412{
David Blaikie3302f2b2013-01-16 23:08:36 +00003413 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003414}
3415
Anton Yartsevfc83c602010-08-19 03:21:36 +00003416static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003417vec_vminuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003418{
David Blaikie3302f2b2013-01-16 23:08:36 +00003419 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003420}
3421
3422static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003423vec_vminuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003424{
David Blaikie3302f2b2013-01-16 23:08:36 +00003425 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003426}
3427
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003428/* vec_vminsw */
3429
Anton Yartsevfc83c602010-08-19 03:21:36 +00003430static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003431vec_vminsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003432{
David Blaikie3302f2b2013-01-16 23:08:36 +00003433 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003434}
3435
Anton Yartsevfc83c602010-08-19 03:21:36 +00003436static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003437vec_vminsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003438{
David Blaikie3302f2b2013-01-16 23:08:36 +00003439 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003440}
3441
3442static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003443vec_vminsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003444{
David Blaikie3302f2b2013-01-16 23:08:36 +00003445 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003446}
3447
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003448/* vec_vminuw */
3449
Anton Yartsevfc83c602010-08-19 03:21:36 +00003450static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003451vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003452{
David Blaikie3302f2b2013-01-16 23:08:36 +00003453 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003454}
3455
Anton Yartsevfc83c602010-08-19 03:21:36 +00003456static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003457vec_vminuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003458{
David Blaikie3302f2b2013-01-16 23:08:36 +00003459 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003460}
3461
3462static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003463vec_vminuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003464{
David Blaikie3302f2b2013-01-16 23:08:36 +00003465 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003466}
3467
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003468/* vec_vminfp */
3469
3470static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003471vec_vminfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003472{
Bill Schmidt691e01d2014-10-31 19:19:24 +00003473#ifdef __VSX__
3474 return __builtin_vsx_xvminsp(__a, __b);
3475#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003476 return __builtin_altivec_vminfp(__a, __b);
Bill Schmidt691e01d2014-10-31 19:19:24 +00003477#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003478}
3479
3480/* vec_mladd */
3481
3482#define __builtin_altivec_vmladduhm vec_mladd
3483
3484static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003485vec_mladd(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003486{
David Blaikie3302f2b2013-01-16 23:08:36 +00003487 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003488}
3489
3490static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003491vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003492{
David Blaikie3302f2b2013-01-16 23:08:36 +00003493 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003494}
3495
3496static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003497vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003498{
David Blaikie3302f2b2013-01-16 23:08:36 +00003499 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003500}
3501
3502static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003503vec_mladd(vector unsigned short __a,
3504 vector unsigned short __b,
3505 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003506{
David Blaikie3302f2b2013-01-16 23:08:36 +00003507 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003508}
3509
3510/* vec_vmladduhm */
3511
3512static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003513vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003514{
David Blaikie3302f2b2013-01-16 23:08:36 +00003515 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003516}
3517
3518static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003519vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003520{
David Blaikie3302f2b2013-01-16 23:08:36 +00003521 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003522}
3523
3524static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003525vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003526{
David Blaikie3302f2b2013-01-16 23:08:36 +00003527 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003528}
3529
3530static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003531vec_vmladduhm(vector unsigned short __a,
3532 vector unsigned short __b,
3533 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003534{
David Blaikie3302f2b2013-01-16 23:08:36 +00003535 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003536}
3537
3538/* vec_mradds */
3539
3540static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003541vec_mradds(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003542{
David Blaikie3302f2b2013-01-16 23:08:36 +00003543 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003544}
3545
3546/* vec_vmhraddshs */
3547
3548static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003549vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003550{
David Blaikie3302f2b2013-01-16 23:08:36 +00003551 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003552}
3553
3554/* vec_msum */
3555
3556static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003557vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003558{
David Blaikie3302f2b2013-01-16 23:08:36 +00003559 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003560}
3561
3562static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003563vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003564{
David Blaikie3302f2b2013-01-16 23:08:36 +00003565 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003566}
3567
3568static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003569vec_msum(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003570{
David Blaikie3302f2b2013-01-16 23:08:36 +00003571 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003572}
3573
3574static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003575vec_msum(vector unsigned short __a,
3576 vector unsigned short __b,
3577 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003578{
David Blaikie3302f2b2013-01-16 23:08:36 +00003579 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003580}
3581
3582/* vec_vmsummbm */
3583
3584static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003585vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003586{
David Blaikie3302f2b2013-01-16 23:08:36 +00003587 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003588}
3589
3590/* vec_vmsumubm */
3591
3592static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003593vec_vmsumubm(vector unsigned char __a,
3594 vector unsigned char __b,
3595 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003596{
David Blaikie3302f2b2013-01-16 23:08:36 +00003597 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003598}
3599
3600/* vec_vmsumshm */
3601
3602static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003603vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003604{
David Blaikie3302f2b2013-01-16 23:08:36 +00003605 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003606}
3607
3608/* vec_vmsumuhm */
3609
3610static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003611vec_vmsumuhm(vector unsigned short __a,
3612 vector unsigned short __b,
3613 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003614{
David Blaikie3302f2b2013-01-16 23:08:36 +00003615 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003616}
3617
3618/* vec_msums */
3619
3620static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003621vec_msums(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003622{
David Blaikie3302f2b2013-01-16 23:08:36 +00003623 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003624}
3625
3626static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003627vec_msums(vector unsigned short __a,
3628 vector unsigned short __b,
3629 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003630{
David Blaikie3302f2b2013-01-16 23:08:36 +00003631 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003632}
3633
3634/* vec_vmsumshs */
3635
3636static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003637vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003638{
David Blaikie3302f2b2013-01-16 23:08:36 +00003639 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003640}
3641
3642/* vec_vmsumuhs */
3643
3644static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003645vec_vmsumuhs(vector unsigned short __a,
3646 vector unsigned short __b,
3647 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003648{
David Blaikie3302f2b2013-01-16 23:08:36 +00003649 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003650}
3651
Chris Lattnerdad40622010-04-14 03:54:58 +00003652/* vec_mtvscr */
3653
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003654static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003655vec_mtvscr(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003656{
David Blaikie3302f2b2013-01-16 23:08:36 +00003657 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003658}
3659
3660static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003661vec_mtvscr(vector unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003662{
David Blaikie3302f2b2013-01-16 23:08:36 +00003663 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003664}
3665
3666static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003667vec_mtvscr(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003668{
David Blaikie3302f2b2013-01-16 23:08:36 +00003669 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003670}
3671
3672static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003673vec_mtvscr(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003674{
David Blaikie3302f2b2013-01-16 23:08:36 +00003675 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003676}
3677
3678static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003679vec_mtvscr(vector unsigned short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003680{
David Blaikie3302f2b2013-01-16 23:08:36 +00003681 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003682}
3683
3684static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003685vec_mtvscr(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003686{
David Blaikie3302f2b2013-01-16 23:08:36 +00003687 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003688}
3689
3690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003691vec_mtvscr(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003692{
David Blaikie3302f2b2013-01-16 23:08:36 +00003693 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003694}
3695
3696static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003697vec_mtvscr(vector int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003698{
David Blaikie3302f2b2013-01-16 23:08:36 +00003699 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003700}
3701
3702static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003703vec_mtvscr(vector unsigned int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003704{
David Blaikie3302f2b2013-01-16 23:08:36 +00003705 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003706}
3707
3708static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003709vec_mtvscr(vector bool int __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003710{
David Blaikie3302f2b2013-01-16 23:08:36 +00003711 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003712}
3713
3714static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003715vec_mtvscr(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003716{
David Blaikie3302f2b2013-01-16 23:08:36 +00003717 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003718}
3719
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003720/* The vmulos* and vmules* instructions have a big endian bias, so
3721 we must reverse the meaning of "even" and "odd" for little endian. */
3722
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003723/* vec_mule */
3724
3725static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003726vec_mule(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003727{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003728#ifdef __LITTLE_ENDIAN__
3729 return __builtin_altivec_vmulosb(__a, __b);
3730#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003731 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003732#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003733}
3734
3735static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003736vec_mule(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003737{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003738#ifdef __LITTLE_ENDIAN__
3739 return __builtin_altivec_vmuloub(__a, __b);
3740#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003741 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003742#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003743}
3744
3745static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003746vec_mule(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003747{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003748#ifdef __LITTLE_ENDIAN__
3749 return __builtin_altivec_vmulosh(__a, __b);
3750#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003751 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003752#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003753}
3754
3755static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003756vec_mule(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003757{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003758#ifdef __LITTLE_ENDIAN__
3759 return __builtin_altivec_vmulouh(__a, __b);
3760#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003761 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003762#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003763}
3764
3765/* vec_vmulesb */
3766
3767static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003768vec_vmulesb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003769{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003770#ifdef __LITTLE_ENDIAN__
3771 return __builtin_altivec_vmulosb(__a, __b);
3772#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003773 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003774#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003775}
3776
3777/* vec_vmuleub */
3778
3779static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003780vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003781{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003782#ifdef __LITTLE_ENDIAN__
3783 return __builtin_altivec_vmuloub(__a, __b);
3784#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003785 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003786#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003787}
3788
3789/* vec_vmulesh */
3790
3791static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003792vec_vmulesh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003793{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003794#ifdef __LITTLE_ENDIAN__
3795 return __builtin_altivec_vmulosh(__a, __b);
3796#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003797 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003798#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003799}
3800
3801/* vec_vmuleuh */
3802
3803static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003804vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003805{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003806#ifdef __LITTLE_ENDIAN__
3807 return __builtin_altivec_vmulouh(__a, __b);
3808#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003809 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003810#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003811}
3812
3813/* vec_mulo */
3814
3815static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003816vec_mulo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003817{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003818#ifdef __LITTLE_ENDIAN__
3819 return __builtin_altivec_vmulesb(__a, __b);
3820#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003821 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003822#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003823}
3824
3825static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003826vec_mulo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003827{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003828#ifdef __LITTLE_ENDIAN__
3829 return __builtin_altivec_vmuleub(__a, __b);
3830#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003831 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003832#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003833}
3834
3835static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003836vec_mulo(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003837{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003838#ifdef __LITTLE_ENDIAN__
3839 return __builtin_altivec_vmulesh(__a, __b);
3840#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003841 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003842#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003843}
3844
3845static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003846vec_mulo(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003847{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003848#ifdef __LITTLE_ENDIAN__
3849 return __builtin_altivec_vmuleuh(__a, __b);
3850#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003851 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003852#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003853}
3854
3855/* vec_vmulosb */
3856
3857static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003858vec_vmulosb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003859{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003860#ifdef __LITTLE_ENDIAN__
3861 return __builtin_altivec_vmulesb(__a, __b);
3862#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003863 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003864#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003865}
3866
3867/* vec_vmuloub */
3868
3869static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003870vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003871{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003872#ifdef __LITTLE_ENDIAN__
3873 return __builtin_altivec_vmuleub(__a, __b);
3874#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003875 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003876#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003877}
3878
3879/* vec_vmulosh */
3880
3881static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003882vec_vmulosh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003883{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003884#ifdef __LITTLE_ENDIAN__
3885 return __builtin_altivec_vmulesh(__a, __b);
3886#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003887 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003888#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003889}
3890
3891/* vec_vmulouh */
3892
3893static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003894vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003895{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003896#ifdef __LITTLE_ENDIAN__
3897 return __builtin_altivec_vmuleuh(__a, __b);
3898#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003899 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003900#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003901}
3902
3903/* vec_nmsub */
3904
3905static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003906vec_nmsub(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003907{
David Blaikie3302f2b2013-01-16 23:08:36 +00003908 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003909}
3910
3911/* vec_vnmsubfp */
3912
3913static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003914vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003915{
David Blaikie3302f2b2013-01-16 23:08:36 +00003916 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003917}
3918
3919/* vec_nor */
3920
3921#define __builtin_altivec_vnor vec_nor
3922
3923static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003924vec_nor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003925{
David Blaikie3302f2b2013-01-16 23:08:36 +00003926 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003927}
3928
3929static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003930vec_nor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003931{
David Blaikie3302f2b2013-01-16 23:08:36 +00003932 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003933}
3934
Anton Yartsevfc83c602010-08-19 03:21:36 +00003935static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003936vec_nor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003937{
David Blaikie3302f2b2013-01-16 23:08:36 +00003938 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003939}
3940
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003941static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003942vec_nor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003943{
David Blaikie3302f2b2013-01-16 23:08:36 +00003944 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003945}
3946
3947static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003948vec_nor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003949{
David Blaikie3302f2b2013-01-16 23:08:36 +00003950 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003951}
3952
Anton Yartsevfc83c602010-08-19 03:21:36 +00003953static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003954vec_nor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003955{
David Blaikie3302f2b2013-01-16 23:08:36 +00003956 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003957}
3958
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003959static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003960vec_nor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003961{
David Blaikie3302f2b2013-01-16 23:08:36 +00003962 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003963}
3964
3965static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003966vec_nor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003967{
David Blaikie3302f2b2013-01-16 23:08:36 +00003968 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003969}
3970
Anton Yartsevfc83c602010-08-19 03:21:36 +00003971static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003972vec_nor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003973{
David Blaikie3302f2b2013-01-16 23:08:36 +00003974 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003975}
3976
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003977static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003978vec_nor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003979{
David Blaikie3302f2b2013-01-16 23:08:36 +00003980 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
3981 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003982}
3983
3984/* vec_vnor */
3985
3986static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003987vec_vnor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003988{
David Blaikie3302f2b2013-01-16 23:08:36 +00003989 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003990}
3991
3992static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003993vec_vnor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003994{
David Blaikie3302f2b2013-01-16 23:08:36 +00003995 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003996}
3997
Anton Yartsevfc83c602010-08-19 03:21:36 +00003998static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003999vec_vnor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004000{
David Blaikie3302f2b2013-01-16 23:08:36 +00004001 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004002}
4003
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004004static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004005vec_vnor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004006{
David Blaikie3302f2b2013-01-16 23:08:36 +00004007 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004008}
4009
4010static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004011vec_vnor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004012{
David Blaikie3302f2b2013-01-16 23:08:36 +00004013 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004014}
4015
Anton Yartsevfc83c602010-08-19 03:21:36 +00004016static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004017vec_vnor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004018{
David Blaikie3302f2b2013-01-16 23:08:36 +00004019 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004020}
4021
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004022static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004023vec_vnor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004024{
David Blaikie3302f2b2013-01-16 23:08:36 +00004025 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004026}
4027
4028static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004029vec_vnor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004030{
David Blaikie3302f2b2013-01-16 23:08:36 +00004031 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004032}
4033
Anton Yartsevfc83c602010-08-19 03:21:36 +00004034static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004035vec_vnor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004036{
David Blaikie3302f2b2013-01-16 23:08:36 +00004037 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00004038}
4039
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004040static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004041vec_vnor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004042{
David Blaikie3302f2b2013-01-16 23:08:36 +00004043 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4044 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004045}
4046
4047/* vec_or */
4048
4049#define __builtin_altivec_vor vec_or
4050
4051static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004052vec_or(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004053{
David Blaikie3302f2b2013-01-16 23:08:36 +00004054 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004055}
4056
Anton Yartsevfc83c602010-08-19 03:21:36 +00004057static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004058vec_or(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004059{
David Blaikie3302f2b2013-01-16 23:08:36 +00004060 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004061}
4062
4063static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004064vec_or(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004065{
David Blaikie3302f2b2013-01-16 23:08:36 +00004066 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004067}
4068
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004069static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004070vec_or(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004071{
David Blaikie3302f2b2013-01-16 23:08:36 +00004072 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004073}
4074
Anton Yartsevfc83c602010-08-19 03:21:36 +00004075static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004076vec_or(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004077{
David Blaikie3302f2b2013-01-16 23:08:36 +00004078 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004079}
4080
4081static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004082vec_or(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004083{
David Blaikie3302f2b2013-01-16 23:08:36 +00004084 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004085}
4086
4087static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004088vec_or(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004089{
David Blaikie3302f2b2013-01-16 23:08:36 +00004090 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004091}
4092
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004093static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004094vec_or(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004095{
David Blaikie3302f2b2013-01-16 23:08:36 +00004096 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004097}
4098
Anton Yartsevfc83c602010-08-19 03:21:36 +00004099static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004100vec_or(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004101{
David Blaikie3302f2b2013-01-16 23:08:36 +00004102 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004103}
4104
4105static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004106vec_or(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004107{
David Blaikie3302f2b2013-01-16 23:08:36 +00004108 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004109}
4110
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004111static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004112vec_or(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004113{
David Blaikie3302f2b2013-01-16 23:08:36 +00004114 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004115}
4116
Anton Yartsevfc83c602010-08-19 03:21:36 +00004117static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004118vec_or(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004119{
David Blaikie3302f2b2013-01-16 23:08:36 +00004120 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004121}
4122
4123static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004124vec_or(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004125{
David Blaikie3302f2b2013-01-16 23:08:36 +00004126 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004127}
4128
4129static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004130vec_or(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004131{
David Blaikie3302f2b2013-01-16 23:08:36 +00004132 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004133}
4134
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004135static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004136vec_or(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004137{
David Blaikie3302f2b2013-01-16 23:08:36 +00004138 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004139}
4140
Anton Yartsevfc83c602010-08-19 03:21:36 +00004141static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004142vec_or(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004143{
David Blaikie3302f2b2013-01-16 23:08:36 +00004144 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004145}
4146
4147static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004148vec_or(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004149{
David Blaikie3302f2b2013-01-16 23:08:36 +00004150 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004151}
4152
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004153static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004154vec_or(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004155{
David Blaikie3302f2b2013-01-16 23:08:36 +00004156 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004157}
4158
Anton Yartsevfc83c602010-08-19 03:21:36 +00004159static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004160vec_or(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004161{
David Blaikie3302f2b2013-01-16 23:08:36 +00004162 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004163}
4164
4165static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004166vec_or(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004167{
David Blaikie3302f2b2013-01-16 23:08:36 +00004168 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004169}
4170
4171static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004172vec_or(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004173{
David Blaikie3302f2b2013-01-16 23:08:36 +00004174 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004175}
4176
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004177static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004178vec_or(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004179{
David Blaikie3302f2b2013-01-16 23:08:36 +00004180 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4181 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004182}
4183
Anton Yartsevfc83c602010-08-19 03:21:36 +00004184static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004185vec_or(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004186{
David Blaikie3302f2b2013-01-16 23:08:36 +00004187 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4188 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004189}
4190
4191static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004192vec_or(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004193{
David Blaikie3302f2b2013-01-16 23:08:36 +00004194 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4195 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004196}
4197
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004198/* vec_vor */
4199
4200static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004201vec_vor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004202{
David Blaikie3302f2b2013-01-16 23:08:36 +00004203 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004204}
4205
Anton Yartsevfc83c602010-08-19 03:21:36 +00004206static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004207vec_vor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004208{
David Blaikie3302f2b2013-01-16 23:08:36 +00004209 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004210}
4211
4212static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004213vec_vor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004214{
David Blaikie3302f2b2013-01-16 23:08:36 +00004215 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004216}
4217
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004218static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004219vec_vor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004220{
David Blaikie3302f2b2013-01-16 23:08:36 +00004221 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004222}
4223
Anton Yartsevfc83c602010-08-19 03:21:36 +00004224static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004225vec_vor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004226{
David Blaikie3302f2b2013-01-16 23:08:36 +00004227 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004228}
4229
4230static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004231vec_vor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004232{
David Blaikie3302f2b2013-01-16 23:08:36 +00004233 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004234}
4235
4236static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004237vec_vor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004238{
David Blaikie3302f2b2013-01-16 23:08:36 +00004239 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004240}
4241
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004242static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004243vec_vor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004244{
David Blaikie3302f2b2013-01-16 23:08:36 +00004245 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004246}
4247
Anton Yartsevfc83c602010-08-19 03:21:36 +00004248static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004249vec_vor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004250{
David Blaikie3302f2b2013-01-16 23:08:36 +00004251 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004252}
4253
4254static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004255vec_vor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004256{
David Blaikie3302f2b2013-01-16 23:08:36 +00004257 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004258}
4259
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004260static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004261vec_vor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004262{
David Blaikie3302f2b2013-01-16 23:08:36 +00004263 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004264}
4265
Anton Yartsevfc83c602010-08-19 03:21:36 +00004266static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004267vec_vor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004268{
David Blaikie3302f2b2013-01-16 23:08:36 +00004269 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004270}
4271
4272static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004273vec_vor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004274{
David Blaikie3302f2b2013-01-16 23:08:36 +00004275 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004276}
4277
4278static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004279vec_vor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004280{
David Blaikie3302f2b2013-01-16 23:08:36 +00004281 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004282}
4283
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004284static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004285vec_vor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004286{
David Blaikie3302f2b2013-01-16 23:08:36 +00004287 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004288}
4289
Anton Yartsevfc83c602010-08-19 03:21:36 +00004290static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004291vec_vor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004292{
David Blaikie3302f2b2013-01-16 23:08:36 +00004293 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004294}
4295
4296static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004297vec_vor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004298{
David Blaikie3302f2b2013-01-16 23:08:36 +00004299 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004300}
4301
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004302static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004303vec_vor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004304{
David Blaikie3302f2b2013-01-16 23:08:36 +00004305 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004306}
4307
Anton Yartsevfc83c602010-08-19 03:21:36 +00004308static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004309vec_vor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004310{
David Blaikie3302f2b2013-01-16 23:08:36 +00004311 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004312}
4313
4314static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004315vec_vor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004316{
David Blaikie3302f2b2013-01-16 23:08:36 +00004317 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004318}
4319
4320static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004321vec_vor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004322{
David Blaikie3302f2b2013-01-16 23:08:36 +00004323 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004324}
4325
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004326static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004327vec_vor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004328{
David Blaikie3302f2b2013-01-16 23:08:36 +00004329 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4330 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004331}
4332
Anton Yartsevfc83c602010-08-19 03:21:36 +00004333static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004334vec_vor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004335{
David Blaikie3302f2b2013-01-16 23:08:36 +00004336 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4337 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004338}
4339
4340static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004341vec_vor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004342{
David Blaikie3302f2b2013-01-16 23:08:36 +00004343 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4344 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004345}
4346
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004347/* vec_pack */
4348
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004349/* The various vector pack instructions have a big-endian bias, so for
4350 little endian we must handle reversed element numbering. */
4351
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004352static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004353vec_pack(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004354{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004355#ifdef __LITTLE_ENDIAN__
4356 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4357 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4358 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4359#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004360 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004361 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4362 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004363#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004364}
4365
4366static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004367vec_pack(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004368{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004369#ifdef __LITTLE_ENDIAN__
4370 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4371 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4372 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4373#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004374 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004375 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4376 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004377#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004378}
4379
Anton Yartsev9e968982010-08-19 03:00:09 +00004380static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004381vec_pack(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004382{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004383#ifdef __LITTLE_ENDIAN__
4384 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4385 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4386 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4387#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004388 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004389 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4390 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004391#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004392}
4393
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004394static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004395vec_pack(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004396{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004397#ifdef __LITTLE_ENDIAN__
4398 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4399 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4400 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4401#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004402 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004403 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4404 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004405#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004406}
4407
4408static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004409vec_pack(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004410{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004411#ifdef __LITTLE_ENDIAN__
4412 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4413 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4414 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4415#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004416 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004417 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4418 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004419#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004420}
4421
Anton Yartsev9e968982010-08-19 03:00:09 +00004422static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004423vec_pack(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004424{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004425#ifdef __LITTLE_ENDIAN__
Bill Schmidt1cf7c642014-06-13 18:30:06 +00004426 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004427 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4428 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4429#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004430 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004431 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4432 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004433#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004434}
4435
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004436/* vec_vpkuhum */
4437
4438#define __builtin_altivec_vpkuhum vec_vpkuhum
4439
4440static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004441vec_vpkuhum(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004442{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004443#ifdef __LITTLE_ENDIAN__
4444 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4445 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4446 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4447#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004448 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004449 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4450 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004451#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004452}
4453
4454static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004455vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004456{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004457#ifdef __LITTLE_ENDIAN__
4458 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4459 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4460 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4461#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004462 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004463 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4464 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004465#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004466}
4467
Anton Yartsev9e968982010-08-19 03:00:09 +00004468static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004469vec_vpkuhum(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004470{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004471#ifdef __LITTLE_ENDIAN__
4472 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4473 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4474 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4475#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004476 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004477 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4478 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004479#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004480}
4481
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004482/* vec_vpkuwum */
4483
4484#define __builtin_altivec_vpkuwum vec_vpkuwum
4485
4486static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004487vec_vpkuwum(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004488{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004489#ifdef __LITTLE_ENDIAN__
4490 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4491 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4492 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4493#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004494 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004495 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4496 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004497#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004498}
4499
4500static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004501vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004502{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004503#ifdef __LITTLE_ENDIAN__
4504 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4505 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4506 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4507#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004508 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004509 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4510 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004511#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004512}
4513
Anton Yartsev9e968982010-08-19 03:00:09 +00004514static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004515vec_vpkuwum(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004516{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004517#ifdef __LITTLE_ENDIAN__
4518 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4519 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4520 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4521#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004522 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004523 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4524 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004525#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004526}
4527
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004528/* vec_packpx */
4529
4530static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004531vec_packpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004532{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004533#ifdef __LITTLE_ENDIAN__
4534 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4535#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004536 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004537#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004538}
4539
4540/* vec_vpkpx */
4541
4542static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004543vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004544{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004545#ifdef __LITTLE_ENDIAN__
4546 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4547#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004548 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004549#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004550}
4551
4552/* vec_packs */
4553
4554static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004555vec_packs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004556{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004557#ifdef __LITTLE_ENDIAN__
4558 return __builtin_altivec_vpkshss(__b, __a);
4559#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004560 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004561#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004562}
4563
4564static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004565vec_packs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004566{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004567#ifdef __LITTLE_ENDIAN__
4568 return __builtin_altivec_vpkuhus(__b, __a);
4569#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004570 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004571#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004572}
4573
4574static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004575vec_packs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004576{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004577#ifdef __LITTLE_ENDIAN__
4578 return __builtin_altivec_vpkswss(__b, __a);
4579#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004580 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004581#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004582}
4583
4584static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004585vec_packs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004586{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004587#ifdef __LITTLE_ENDIAN__
4588 return __builtin_altivec_vpkuwus(__b, __a);
4589#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004590 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004591#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004592}
4593
4594/* vec_vpkshss */
4595
4596static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004597vec_vpkshss(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004598{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004599#ifdef __LITTLE_ENDIAN__
4600 return __builtin_altivec_vpkshss(__b, __a);
4601#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004602 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004603#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004604}
4605
4606/* vec_vpkuhus */
4607
4608static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004609vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004610{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004611#ifdef __LITTLE_ENDIAN__
4612 return __builtin_altivec_vpkuhus(__b, __a);
4613#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004614 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004615#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004616}
4617
4618/* vec_vpkswss */
4619
4620static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004621vec_vpkswss(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004622{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004623#ifdef __LITTLE_ENDIAN__
4624 return __builtin_altivec_vpkswss(__b, __a);
4625#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004626 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004627#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004628}
4629
4630/* vec_vpkuwus */
4631
4632static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004633vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004634{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004635#ifdef __LITTLE_ENDIAN__
4636 return __builtin_altivec_vpkuwus(__b, __a);
4637#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004638 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004639#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004640}
4641
4642/* vec_packsu */
4643
4644static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004645vec_packsu(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004646{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004647#ifdef __LITTLE_ENDIAN__
4648 return __builtin_altivec_vpkshus(__b, __a);
4649#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004650 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004651#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004652}
4653
4654static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004655vec_packsu(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004656{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004657#ifdef __LITTLE_ENDIAN__
4658 return __builtin_altivec_vpkuhus(__b, __a);
4659#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004660 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004661#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004662}
4663
4664static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004665vec_packsu(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004666{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004667#ifdef __LITTLE_ENDIAN__
4668 return __builtin_altivec_vpkswus(__b, __a);
4669#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004670 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004671#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004672}
4673
4674static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004675vec_packsu(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004676{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004677#ifdef __LITTLE_ENDIAN__
4678 return __builtin_altivec_vpkuwus(__b, __a);
4679#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004680 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004681#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004682}
4683
4684/* vec_vpkshus */
4685
4686static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004687vec_vpkshus(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004688{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004689#ifdef __LITTLE_ENDIAN__
4690 return __builtin_altivec_vpkshus(__b, __a);
4691#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004692 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004693#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004694}
4695
4696static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004697vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004698{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004699#ifdef __LITTLE_ENDIAN__
4700 return __builtin_altivec_vpkuhus(__b, __a);
4701#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004702 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004703#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004704}
4705
4706/* vec_vpkswus */
4707
4708static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004709vec_vpkswus(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004710{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004711#ifdef __LITTLE_ENDIAN__
4712 return __builtin_altivec_vpkswus(__b, __a);
4713#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004714 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004715#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004716}
4717
4718static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004719vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004720{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004721#ifdef __LITTLE_ENDIAN__
4722 return __builtin_altivec_vpkuwus(__b, __a);
4723#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004724 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004725#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004726}
4727
4728/* vec_perm */
4729
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004730// The vperm instruction is defined architecturally with a big-endian bias.
4731// For little endian, we swap the input operands and invert the permute
4732// control vector. Only the rightmost 5 bits matter, so we could use
4733// a vector of all 31s instead of all 255s to perform the inversion.
4734// However, when the PCV is not a constant, using 255 has an advantage
4735// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4736// later, possibly a vec_nand).
4737
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004738vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004739vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004740{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004741#ifdef __LITTLE_ENDIAN__
4742 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4743 255,255,255,255,255,255,255,255};
4744 __d = vec_xor(__c, __d);
4745 return (vector signed char)
4746 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4747#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004748 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004749 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004750#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004751}
4752
4753vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004754vec_perm(vector unsigned char __a,
4755 vector unsigned char __b,
4756 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004757{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004758#ifdef __LITTLE_ENDIAN__
4759 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4760 255,255,255,255,255,255,255,255};
4761 __d = vec_xor(__c, __d);
4762 return (vector unsigned char)
4763 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4764#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004765 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004766 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004767#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004768}
4769
Anton Yartsev9e968982010-08-19 03:00:09 +00004770vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004771vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004772{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004773#ifdef __LITTLE_ENDIAN__
4774 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4775 255,255,255,255,255,255,255,255};
4776 __d = vec_xor(__c, __d);
4777 return (vector bool char)
4778 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4779#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004780 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004781 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004782#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004783}
4784
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004785vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004786vec_perm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004787{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004788#ifdef __LITTLE_ENDIAN__
4789 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4790 255,255,255,255,255,255,255,255};
4791 __d = vec_xor(__c, __d);
4792 return (vector short)
4793 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4794#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004795 return (vector short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004796 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004797#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004798}
4799
4800vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004801vec_perm(vector unsigned short __a,
4802 vector unsigned short __b,
4803 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004804{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004805#ifdef __LITTLE_ENDIAN__
4806 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4807 255,255,255,255,255,255,255,255};
4808 __d = vec_xor(__c, __d);
4809 return (vector unsigned short)
4810 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4811#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004812 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004813 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004814#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004815}
4816
Anton Yartsev9e968982010-08-19 03:00:09 +00004817vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004818vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004819{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004820#ifdef __LITTLE_ENDIAN__
4821 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4822 255,255,255,255,255,255,255,255};
4823 __d = vec_xor(__c, __d);
4824 return (vector bool short)
4825 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4826#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004827 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00004828 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004829#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004830}
4831
4832vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004833vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004834{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004835#ifdef __LITTLE_ENDIAN__
4836 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4837 255,255,255,255,255,255,255,255};
4838 __d = vec_xor(__c, __d);
4839 return (vector pixel)
4840 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4841#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004842 return (vector pixel)
David Blaikie3302f2b2013-01-16 23:08:36 +00004843 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004844#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004845}
4846
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004847vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004848vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004849{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004850#ifdef __LITTLE_ENDIAN__
4851 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4852 255,255,255,255,255,255,255,255};
4853 __d = vec_xor(__c, __d);
4854 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4855#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004856 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004857#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004858}
4859
4860vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004861vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004862{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004863#ifdef __LITTLE_ENDIAN__
4864 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4865 255,255,255,255,255,255,255,255};
4866 __d = vec_xor(__c, __d);
4867 return (vector unsigned int)
4868 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4869#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004870 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004871 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004872#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004873}
4874
Anton Yartsev9e968982010-08-19 03:00:09 +00004875vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004876vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004877{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004878#ifdef __LITTLE_ENDIAN__
4879 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4880 255,255,255,255,255,255,255,255};
4881 __d = vec_xor(__c, __d);
4882 return (vector bool int)
4883 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4884#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004885 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004886 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004887#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004888}
4889
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004890vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004891vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004892{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004893#ifdef __LITTLE_ENDIAN__
4894 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4895 255,255,255,255,255,255,255,255};
4896 __d = vec_xor(__c, __d);
4897 return (vector float)
4898 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4899#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004900 return (vector float)
David Blaikie3302f2b2013-01-16 23:08:36 +00004901 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004902#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004903}
4904
4905/* vec_vperm */
4906
Ulrich Weigand9936f132012-10-31 18:17:07 +00004907static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004908vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004909{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004910 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004911}
4912
Ulrich Weigand9936f132012-10-31 18:17:07 +00004913static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004914vec_vperm(vector unsigned char __a,
4915 vector unsigned char __b,
4916 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004917{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004918 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004919}
4920
Ulrich Weigand9936f132012-10-31 18:17:07 +00004921static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004922vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004923{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004924 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004925}
4926
Ulrich Weigand9936f132012-10-31 18:17:07 +00004927static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004928vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004929{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004930 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004931}
4932
Ulrich Weigand9936f132012-10-31 18:17:07 +00004933static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004934vec_vperm(vector unsigned short __a,
4935 vector unsigned short __b,
4936 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004937{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004938 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004939}
4940
Ulrich Weigand9936f132012-10-31 18:17:07 +00004941static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004942vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004943{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004944 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004945}
4946
Ulrich Weigand9936f132012-10-31 18:17:07 +00004947static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004948vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004949{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004950 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004951}
4952
Ulrich Weigand9936f132012-10-31 18:17:07 +00004953static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004954vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004955{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004956 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004957}
4958
Ulrich Weigand9936f132012-10-31 18:17:07 +00004959static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004960vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004961{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004962 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004963}
4964
Ulrich Weigand9936f132012-10-31 18:17:07 +00004965static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004966vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004967{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004968 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004969}
4970
Ulrich Weigand9936f132012-10-31 18:17:07 +00004971static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004972vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004973{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004974 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004975}
4976
4977/* vec_re */
4978
Ulrich Weigand9936f132012-10-31 18:17:07 +00004979static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004980vec_re(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004981{
David Blaikie3302f2b2013-01-16 23:08:36 +00004982 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004983}
4984
4985/* vec_vrefp */
4986
Ulrich Weigand9936f132012-10-31 18:17:07 +00004987static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004988vec_vrefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004989{
David Blaikie3302f2b2013-01-16 23:08:36 +00004990 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004991}
4992
4993/* vec_rl */
4994
4995static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004996vec_rl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004997{
David Blaikie3302f2b2013-01-16 23:08:36 +00004998 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004999}
5000
5001static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005002vec_rl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005003{
David Blaikie3302f2b2013-01-16 23:08:36 +00005004 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005005}
5006
5007static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005008vec_rl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005009{
David Blaikie3302f2b2013-01-16 23:08:36 +00005010 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005011}
5012
5013static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005014vec_rl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005015{
David Blaikie3302f2b2013-01-16 23:08:36 +00005016 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005017}
5018
5019static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005020vec_rl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005021{
David Blaikie3302f2b2013-01-16 23:08:36 +00005022 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005023}
5024
5025static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005026vec_rl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005027{
David Blaikie3302f2b2013-01-16 23:08:36 +00005028 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005029}
5030
5031/* vec_vrlb */
5032
5033static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005034vec_vrlb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005035{
David Blaikie3302f2b2013-01-16 23:08:36 +00005036 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005037}
5038
5039static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005040vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005041{
David Blaikie3302f2b2013-01-16 23:08:36 +00005042 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005043}
5044
5045/* vec_vrlh */
5046
5047static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005048vec_vrlh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005049{
David Blaikie3302f2b2013-01-16 23:08:36 +00005050 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005051}
5052
5053static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005054vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005055{
David Blaikie3302f2b2013-01-16 23:08:36 +00005056 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005057}
5058
5059/* vec_vrlw */
5060
5061static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005062vec_vrlw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005063{
David Blaikie3302f2b2013-01-16 23:08:36 +00005064 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005065}
5066
5067static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005068vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005069{
David Blaikie3302f2b2013-01-16 23:08:36 +00005070 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005071}
5072
5073/* vec_round */
5074
5075static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005076vec_round(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005077{
David Blaikie3302f2b2013-01-16 23:08:36 +00005078 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005079}
5080
5081/* vec_vrfin */
5082
5083static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005084vec_vrfin(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005085{
David Blaikie3302f2b2013-01-16 23:08:36 +00005086 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005087}
5088
5089/* vec_rsqrte */
5090
5091static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005092vec_rsqrte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005093{
David Blaikie3302f2b2013-01-16 23:08:36 +00005094 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005095}
5096
5097/* vec_vrsqrtefp */
5098
5099static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005100vec_vrsqrtefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005101{
David Blaikie3302f2b2013-01-16 23:08:36 +00005102 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005103}
5104
5105/* vec_sel */
5106
5107#define __builtin_altivec_vsel_4si vec_sel
5108
5109static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005110vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005111{
David Blaikie3302f2b2013-01-16 23:08:36 +00005112 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005113}
5114
Anton Yartsevfc83c602010-08-19 03:21:36 +00005115static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005116vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005117{
David Blaikie3302f2b2013-01-16 23:08:36 +00005118 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005119}
5120
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005121static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005122vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005123{
David Blaikie3302f2b2013-01-16 23:08:36 +00005124 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005125}
5126
Anton Yartsevfc83c602010-08-19 03:21:36 +00005127static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005128vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005129{
David Blaikie3302f2b2013-01-16 23:08:36 +00005130 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005131}
5132
5133static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005134vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005135{
David Blaikie3302f2b2013-01-16 23:08:36 +00005136 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005137}
5138
5139static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005140vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005141{
David Blaikie3302f2b2013-01-16 23:08:36 +00005142 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005143}
5144
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005145static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005146vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005147{
David Blaikie3302f2b2013-01-16 23:08:36 +00005148 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005149}
5150
Anton Yartsevfc83c602010-08-19 03:21:36 +00005151static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005152vec_sel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005153{
David Blaikie3302f2b2013-01-16 23:08:36 +00005154 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005155}
5156
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005157static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005158vec_sel(vector unsigned short __a,
5159 vector unsigned short __b,
5160 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005161{
David Blaikie3302f2b2013-01-16 23:08:36 +00005162 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005163}
5164
Anton Yartsevfc83c602010-08-19 03:21:36 +00005165static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005166vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005167{
David Blaikie3302f2b2013-01-16 23:08:36 +00005168 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005169}
5170
5171static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005172vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005173{
David Blaikie3302f2b2013-01-16 23:08:36 +00005174 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005175}
5176
5177static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005178vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005179{
David Blaikie3302f2b2013-01-16 23:08:36 +00005180 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005181}
5182
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005183static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005184vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005185{
David Blaikie3302f2b2013-01-16 23:08:36 +00005186 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005187}
5188
Anton Yartsevfc83c602010-08-19 03:21:36 +00005189static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005190vec_sel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005191{
David Blaikie3302f2b2013-01-16 23:08:36 +00005192 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005193}
5194
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005195static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005196vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005197{
David Blaikie3302f2b2013-01-16 23:08:36 +00005198 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005199}
5200
Anton Yartsevfc83c602010-08-19 03:21:36 +00005201static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005202vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005203{
David Blaikie3302f2b2013-01-16 23:08:36 +00005204 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005205}
5206
5207static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005208vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005209{
David Blaikie3302f2b2013-01-16 23:08:36 +00005210 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005211}
5212
5213static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005214vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005215{
David Blaikie3302f2b2013-01-16 23:08:36 +00005216 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005217}
5218
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005219static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005220vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005221{
David Blaikie3302f2b2013-01-16 23:08:36 +00005222 vector int __res = ((vector int)__a & ~(vector int)__c)
5223 | ((vector int)__b & (vector int)__c);
5224 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005225}
5226
Anton Yartsevfc83c602010-08-19 03:21:36 +00005227static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005228vec_sel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005229{
David Blaikie3302f2b2013-01-16 23:08:36 +00005230 vector int __res = ((vector int)__a & ~(vector int)__c)
5231 | ((vector int)__b & (vector int)__c);
5232 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005233}
5234
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005235/* vec_vsel */
5236
5237static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005238vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005239{
David Blaikie3302f2b2013-01-16 23:08:36 +00005240 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005241}
5242
Anton Yartsevfc83c602010-08-19 03:21:36 +00005243static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005244vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005245{
David Blaikie3302f2b2013-01-16 23:08:36 +00005246 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005247}
5248
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005249static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005250vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005251{
David Blaikie3302f2b2013-01-16 23:08:36 +00005252 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005253}
5254
Anton Yartsevfc83c602010-08-19 03:21:36 +00005255static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005256vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005257{
David Blaikie3302f2b2013-01-16 23:08:36 +00005258 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005259}
5260
5261static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005262vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005263{
David Blaikie3302f2b2013-01-16 23:08:36 +00005264 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005265}
5266
5267static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005268vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005269{
David Blaikie3302f2b2013-01-16 23:08:36 +00005270 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005271}
5272
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005273static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005274vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005275{
David Blaikie3302f2b2013-01-16 23:08:36 +00005276 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005277}
5278
Anton Yartsevfc83c602010-08-19 03:21:36 +00005279static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005280vec_vsel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005281{
David Blaikie3302f2b2013-01-16 23:08:36 +00005282 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005283}
5284
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005285static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005286vec_vsel(vector unsigned short __a,
5287 vector unsigned short __b,
5288 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005289{
David Blaikie3302f2b2013-01-16 23:08:36 +00005290 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005291}
5292
Anton Yartsevfc83c602010-08-19 03:21:36 +00005293static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005294vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005295{
David Blaikie3302f2b2013-01-16 23:08:36 +00005296 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005297}
5298
5299static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005300vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005301{
David Blaikie3302f2b2013-01-16 23:08:36 +00005302 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005303}
5304
5305static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005306vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005307{
David Blaikie3302f2b2013-01-16 23:08:36 +00005308 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005309}
5310
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005311static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005312vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005313{
David Blaikie3302f2b2013-01-16 23:08:36 +00005314 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005315}
5316
Anton Yartsevfc83c602010-08-19 03:21:36 +00005317static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005318vec_vsel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005319{
David Blaikie3302f2b2013-01-16 23:08:36 +00005320 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005321}
5322
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005323static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005324vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005325{
David Blaikie3302f2b2013-01-16 23:08:36 +00005326 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005327}
5328
Anton Yartsevfc83c602010-08-19 03:21:36 +00005329static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005330vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005331{
David Blaikie3302f2b2013-01-16 23:08:36 +00005332 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005333}
5334
5335static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005336vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005337{
David Blaikie3302f2b2013-01-16 23:08:36 +00005338 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005339}
5340
5341static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005342vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005343{
David Blaikie3302f2b2013-01-16 23:08:36 +00005344 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005345}
5346
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005347static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005348vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005349{
David Blaikie3302f2b2013-01-16 23:08:36 +00005350 vector int __res = ((vector int)__a & ~(vector int)__c)
5351 | ((vector int)__b & (vector int)__c);
5352 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005353}
5354
Anton Yartsevfc83c602010-08-19 03:21:36 +00005355static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005356vec_vsel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005357{
David Blaikie3302f2b2013-01-16 23:08:36 +00005358 vector int __res = ((vector int)__a & ~(vector int)__c)
5359 | ((vector int)__b & (vector int)__c);
5360 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005361}
5362
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005363/* vec_sl */
5364
5365static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005366vec_sl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005367{
David Blaikie3302f2b2013-01-16 23:08:36 +00005368 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005369}
5370
5371static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005372vec_sl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005373{
David Blaikie3302f2b2013-01-16 23:08:36 +00005374 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005375}
5376
5377static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005378vec_sl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005379{
David Blaikie3302f2b2013-01-16 23:08:36 +00005380 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005381}
5382
5383static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005384vec_sl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005385{
David Blaikie3302f2b2013-01-16 23:08:36 +00005386 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005387}
5388
5389static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005390vec_sl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005391{
David Blaikie3302f2b2013-01-16 23:08:36 +00005392 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005393}
5394
5395static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005396vec_sl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005397{
David Blaikie3302f2b2013-01-16 23:08:36 +00005398 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005399}
5400
5401/* vec_vslb */
5402
5403#define __builtin_altivec_vslb vec_vslb
5404
5405static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005406vec_vslb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005407{
David Blaikie3302f2b2013-01-16 23:08:36 +00005408 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005409}
5410
5411static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005412vec_vslb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005413{
David Blaikie3302f2b2013-01-16 23:08:36 +00005414 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005415}
5416
5417/* vec_vslh */
5418
5419#define __builtin_altivec_vslh vec_vslh
5420
5421static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005422vec_vslh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005423{
David Blaikie3302f2b2013-01-16 23:08:36 +00005424 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005425}
5426
5427static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005428vec_vslh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005429{
David Blaikie3302f2b2013-01-16 23:08:36 +00005430 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005431}
5432
5433/* vec_vslw */
5434
5435#define __builtin_altivec_vslw vec_vslw
5436
5437static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005438vec_vslw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005439{
David Blaikie3302f2b2013-01-16 23:08:36 +00005440 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005441}
5442
5443static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005444vec_vslw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005445{
David Blaikie3302f2b2013-01-16 23:08:36 +00005446 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005447}
5448
5449/* vec_sld */
5450
5451#define __builtin_altivec_vsldoi_4si vec_sld
5452
5453static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005454vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005455{
David Blaikie3302f2b2013-01-16 23:08:36 +00005456 return vec_perm(__a, __b, (vector unsigned char)
5457 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5458 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005459}
5460
5461static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005462vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005463{
David Blaikie3302f2b2013-01-16 23:08:36 +00005464 return vec_perm(__a, __b, (vector unsigned char)
5465 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5466 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005467}
5468
5469static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005470vec_sld(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005471{
David Blaikie3302f2b2013-01-16 23:08:36 +00005472 return vec_perm(__a, __b, (vector unsigned char)
5473 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5474 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005475}
5476
5477static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005478vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005479{
David Blaikie3302f2b2013-01-16 23:08:36 +00005480 return vec_perm(__a, __b, (vector unsigned char)
5481 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5482 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005483}
5484
5485static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005486vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005487{
David Blaikie3302f2b2013-01-16 23:08:36 +00005488 return vec_perm(__a, __b, (vector unsigned char)
5489 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5490 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005491}
5492
5493static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005494vec_sld(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005495{
David Blaikie3302f2b2013-01-16 23:08:36 +00005496 return vec_perm(__a, __b, (vector unsigned char)
5497 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5498 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005499}
5500
5501static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005502vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005503{
David Blaikie3302f2b2013-01-16 23:08:36 +00005504 return vec_perm(__a, __b, (vector unsigned char)
5505 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5506 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005507}
5508
5509static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005510vec_sld(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005511{
David Blaikie3302f2b2013-01-16 23:08:36 +00005512 return vec_perm(__a, __b, (vector unsigned char)
5513 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5514 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005515}
5516
5517/* vec_vsldoi */
5518
5519static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005520vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005521{
David Blaikie3302f2b2013-01-16 23:08:36 +00005522 return vec_perm(__a, __b, (vector unsigned char)
5523 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5524 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005525}
5526
5527static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005528vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005529{
David Blaikie3302f2b2013-01-16 23:08:36 +00005530 return vec_perm(__a, __b, (vector unsigned char)
5531 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5532 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005533}
5534
5535static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005536vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005537{
David Blaikie3302f2b2013-01-16 23:08:36 +00005538 return vec_perm(__a, __b, (vector unsigned char)
5539 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5540 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005541}
5542
5543static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005544vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005545{
David Blaikie3302f2b2013-01-16 23:08:36 +00005546 return vec_perm(__a, __b, (vector unsigned char)
5547 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5548 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005549}
5550
5551static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005552vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005553{
David Blaikie3302f2b2013-01-16 23:08:36 +00005554 return vec_perm(__a, __b, (vector unsigned char)
5555 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5556 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005557}
5558
5559static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005560vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005561{
David Blaikie3302f2b2013-01-16 23:08:36 +00005562 return vec_perm(__a, __b, (vector unsigned char)
5563 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5564 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005565}
5566
5567static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005568vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005569{
David Blaikie3302f2b2013-01-16 23:08:36 +00005570 return vec_perm(__a, __b, (vector unsigned char)
5571 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5572 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005573}
5574
5575static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005576vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005577{
David Blaikie3302f2b2013-01-16 23:08:36 +00005578 return vec_perm(__a, __b, (vector unsigned char)
5579 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5580 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005581}
5582
5583/* vec_sll */
5584
5585static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005586vec_sll(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005587{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005588 return (vector signed 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
5592static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005593vec_sll(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005594{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005595 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005596 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005597}
5598
5599static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005600vec_sll(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005601{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005602 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005603 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005604}
5605
5606static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005607vec_sll(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005608{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005609 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005610 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005611}
5612
5613static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005614vec_sll(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005615{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005616 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005617 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005618}
5619
5620static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005621vec_sll(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005622{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005623 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005624 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005625}
5626
Anton Yartsevfc83c602010-08-19 03:21:36 +00005627static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005628vec_sll(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005629{
David Blaikie3302f2b2013-01-16 23:08:36 +00005630 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005631}
5632
5633static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005634vec_sll(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005635{
David Blaikie3302f2b2013-01-16 23:08:36 +00005636 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005637}
5638
5639static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005640vec_sll(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005641{
David Blaikie3302f2b2013-01-16 23:08:36 +00005642 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005643}
5644
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005645static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005646vec_sll(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005647{
David Blaikie3302f2b2013-01-16 23:08:36 +00005648 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005649}
5650
5651static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005652vec_sll(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005653{
David Blaikie3302f2b2013-01-16 23:08:36 +00005654 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005655}
5656
5657static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005658vec_sll(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005659{
David Blaikie3302f2b2013-01-16 23:08:36 +00005660 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005661}
5662
5663static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005664vec_sll(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005665{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005666 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005667 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005668}
5669
5670static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005671vec_sll(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005672{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005673 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005674 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005675}
5676
5677static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005678vec_sll(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005679{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005680 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005681 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005682}
5683
Anton Yartsevfc83c602010-08-19 03:21:36 +00005684static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005685vec_sll(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005686{
David Blaikie3302f2b2013-01-16 23:08:36 +00005687 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005688}
5689
5690static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005691vec_sll(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005692{
David Blaikie3302f2b2013-01-16 23:08:36 +00005693 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005694}
5695
5696static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005697vec_sll(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005698{
David Blaikie3302f2b2013-01-16 23:08:36 +00005699 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005700}
5701
5702static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005703vec_sll(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005704{
David Blaikie3302f2b2013-01-16 23:08:36 +00005705 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005706}
5707
5708static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005709vec_sll(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005710{
David Blaikie3302f2b2013-01-16 23:08:36 +00005711 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005712}
5713
5714static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005715vec_sll(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005716{
David Blaikie3302f2b2013-01-16 23:08:36 +00005717 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005718}
5719
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005720static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005721vec_sll(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005722{
David Blaikie3302f2b2013-01-16 23:08:36 +00005723 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005724}
5725
5726static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005727vec_sll(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005728{
David Blaikie3302f2b2013-01-16 23:08:36 +00005729 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005730}
5731
5732static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005733vec_sll(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005734{
David Blaikie3302f2b2013-01-16 23:08:36 +00005735 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005736}
5737
5738static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005739vec_sll(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005740{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005741 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005742 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005743}
5744
5745static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005746vec_sll(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005747{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005748 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005749 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005750}
5751
5752static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005753vec_sll(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005754{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005755 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005756 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005757}
5758
Anton Yartsevfc83c602010-08-19 03:21:36 +00005759static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005760vec_sll(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005761{
David Blaikie3302f2b2013-01-16 23:08:36 +00005762 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005763}
5764
5765static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005766vec_sll(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005767{
David Blaikie3302f2b2013-01-16 23:08:36 +00005768 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005769}
5770
5771static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005772vec_sll(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005773{
David Blaikie3302f2b2013-01-16 23:08:36 +00005774 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005775}
5776
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005777/* vec_vsl */
5778
5779static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005780vec_vsl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005781{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005782 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005783 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005784}
5785
5786static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005787vec_vsl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005788{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005789 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005790 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005791}
5792
5793static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005794vec_vsl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005795{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005796 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005797 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005798}
5799
5800static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005801vec_vsl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005802{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005803 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005804 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005805}
5806
5807static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005808vec_vsl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005809{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005810 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005811 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005812}
5813
5814static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005815vec_vsl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005816{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005817 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005818 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005819}
5820
Anton Yartsevfc83c602010-08-19 03:21:36 +00005821static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005822vec_vsl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005823{
David Blaikie3302f2b2013-01-16 23:08:36 +00005824 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005825}
5826
5827static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005828vec_vsl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005829{
David Blaikie3302f2b2013-01-16 23:08:36 +00005830 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005831}
5832
5833static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005834vec_vsl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005835{
David Blaikie3302f2b2013-01-16 23:08:36 +00005836 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005837}
5838
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005839static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005840vec_vsl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005841{
David Blaikie3302f2b2013-01-16 23:08:36 +00005842 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005843}
5844
5845static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005846vec_vsl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005847{
David Blaikie3302f2b2013-01-16 23:08:36 +00005848 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005849}
5850
5851static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005852vec_vsl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005853{
David Blaikie3302f2b2013-01-16 23:08:36 +00005854 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005855}
5856
5857static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005858vec_vsl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005859{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005860 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005861 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005862}
5863
5864static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005865vec_vsl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005866{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005867 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005868 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005869}
5870
5871static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005872vec_vsl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005873{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005874 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005875 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005876}
5877
Anton Yartsevfc83c602010-08-19 03:21:36 +00005878static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005879vec_vsl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005880{
David Blaikie3302f2b2013-01-16 23:08:36 +00005881 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005882}
5883
5884static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005885vec_vsl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005886{
David Blaikie3302f2b2013-01-16 23:08:36 +00005887 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005888}
5889
5890static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005891vec_vsl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005892{
David Blaikie3302f2b2013-01-16 23:08:36 +00005893 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005894}
5895
5896static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005897vec_vsl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005898{
David Blaikie3302f2b2013-01-16 23:08:36 +00005899 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005900}
5901
5902static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005903vec_vsl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005904{
David Blaikie3302f2b2013-01-16 23:08:36 +00005905 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005906}
5907
5908static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005909vec_vsl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005910{
David Blaikie3302f2b2013-01-16 23:08:36 +00005911 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005912}
5913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005914static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005915vec_vsl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005916{
David Blaikie3302f2b2013-01-16 23:08:36 +00005917 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005918}
5919
5920static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005921vec_vsl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005922{
David Blaikie3302f2b2013-01-16 23:08:36 +00005923 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005924}
5925
5926static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005927vec_vsl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005928{
David Blaikie3302f2b2013-01-16 23:08:36 +00005929 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005930}
5931
5932static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005933vec_vsl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005934{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005935 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005936 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005937}
5938
5939static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005940vec_vsl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005941{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005942 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005943 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005944}
5945
5946static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005947vec_vsl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005948{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005949 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005950 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005951}
5952
Anton Yartsevfc83c602010-08-19 03:21:36 +00005953static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005954vec_vsl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005955{
David Blaikie3302f2b2013-01-16 23:08:36 +00005956 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005957}
5958
5959static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005960vec_vsl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005961{
David Blaikie3302f2b2013-01-16 23:08:36 +00005962 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005963}
5964
5965static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005966vec_vsl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005967{
David Blaikie3302f2b2013-01-16 23:08:36 +00005968 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005969}
5970
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005971/* vec_slo */
5972
5973static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005974vec_slo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005975{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005976 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005977 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005978}
5979
5980static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005981vec_slo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005982{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005983 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005984 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005985}
5986
5987static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005988vec_slo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005989{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005990 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005991 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005992}
5993
5994static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005995vec_slo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005996{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005997 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005998 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005999}
6000
6001static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006002vec_slo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006003{
David Blaikie3302f2b2013-01-16 23:08:36 +00006004 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006005}
6006
6007static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006008vec_slo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006009{
David Blaikie3302f2b2013-01-16 23:08:36 +00006010 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006011}
6012
6013static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006014vec_slo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006015{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006016 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006017 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006018}
6019
6020static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006021vec_slo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006022{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006023 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006024 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006025}
6026
Anton Yartsevfc83c602010-08-19 03:21:36 +00006027static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006028vec_slo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006029{
David Blaikie3302f2b2013-01-16 23:08:36 +00006030 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006031}
6032
6033static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006034vec_slo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006035{
David Blaikie3302f2b2013-01-16 23:08:36 +00006036 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006037}
6038
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006039static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006040vec_slo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006041{
David Blaikie3302f2b2013-01-16 23:08:36 +00006042 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006043}
6044
6045static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006046vec_slo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006047{
David Blaikie3302f2b2013-01-16 23:08:36 +00006048 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006049}
6050
6051static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006052vec_slo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006053{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006054 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006055 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006056}
6057
6058static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006059vec_slo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006060{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006061 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006062 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006063}
6064
6065static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006066vec_slo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006067{
David Blaikie3302f2b2013-01-16 23:08:36 +00006068 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006069}
6070
6071static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006072vec_slo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006073{
David Blaikie3302f2b2013-01-16 23:08:36 +00006074 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006075}
6076
6077/* vec_vslo */
6078
6079static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006080vec_vslo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006081{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006082 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006083 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006084}
6085
6086static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006087vec_vslo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006088{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006089 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006090 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006091}
6092
6093static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006094vec_vslo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006095{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006096 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006097 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006098}
6099
6100static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006101vec_vslo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006102{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006103 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006104 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006105}
6106
6107static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006108vec_vslo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006109{
David Blaikie3302f2b2013-01-16 23:08:36 +00006110 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006111}
6112
6113static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006114vec_vslo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006115{
David Blaikie3302f2b2013-01-16 23:08:36 +00006116 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006117}
6118
6119static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006120vec_vslo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006121{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006122 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006123 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006124}
6125
6126static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006127vec_vslo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006128{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006129 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006130 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006131}
6132
Anton Yartsevfc83c602010-08-19 03:21:36 +00006133static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006134vec_vslo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006135{
David Blaikie3302f2b2013-01-16 23:08:36 +00006136 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006137}
6138
6139static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006140vec_vslo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006141{
David Blaikie3302f2b2013-01-16 23:08:36 +00006142 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006143}
6144
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006145static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006146vec_vslo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006147{
David Blaikie3302f2b2013-01-16 23:08:36 +00006148 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006149}
6150
6151static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006152vec_vslo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006153{
David Blaikie3302f2b2013-01-16 23:08:36 +00006154 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006155}
6156
6157static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006158vec_vslo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006159{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006160 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006161 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006162}
6163
6164static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006165vec_vslo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006166{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006167 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006168 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006169}
6170
6171static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006172vec_vslo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006173{
David Blaikie3302f2b2013-01-16 23:08:36 +00006174 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006175}
6176
6177static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006178vec_vslo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006179{
David Blaikie3302f2b2013-01-16 23:08:36 +00006180 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006181}
6182
6183/* vec_splat */
6184
6185static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006186vec_splat(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006187{
David Blaikie3302f2b2013-01-16 23:08:36 +00006188 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006189}
6190
6191static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006192vec_splat(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006193{
David Blaikie3302f2b2013-01-16 23:08:36 +00006194 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006195}
6196
6197static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006198vec_splat(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006199{
David Blaikie3302f2b2013-01-16 23:08:36 +00006200 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006201}
6202
6203static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006204vec_splat(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006205{
David Blaikie3302f2b2013-01-16 23:08:36 +00006206 __b *= 2;
6207 unsigned char b1=__b+1;
6208 return vec_perm(__a, __a, (vector unsigned char)
6209 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006210}
6211
6212static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006213vec_splat(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006214{
David Blaikie3302f2b2013-01-16 23:08:36 +00006215 __b *= 2;
6216 unsigned char b1=__b+1;
6217 return vec_perm(__a, __a, (vector unsigned char)
6218 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006219}
6220
6221static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006222vec_splat(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006223{
David Blaikie3302f2b2013-01-16 23:08:36 +00006224 __b *= 2;
6225 unsigned char b1=__b+1;
6226 return vec_perm(__a, __a, (vector unsigned char)
6227 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006228}
6229
6230static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006231vec_splat(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006232{
David Blaikie3302f2b2013-01-16 23:08:36 +00006233 __b *= 2;
6234 unsigned char b1=__b+1;
6235 return vec_perm(__a, __a, (vector unsigned char)
6236 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006237}
6238
6239static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006240vec_splat(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006241{
David Blaikie3302f2b2013-01-16 23:08:36 +00006242 __b *= 4;
6243 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6244 return vec_perm(__a, __a, (vector unsigned char)
6245 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006246}
6247
6248static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006249vec_splat(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006250{
David Blaikie3302f2b2013-01-16 23:08:36 +00006251 __b *= 4;
6252 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6253 return vec_perm(__a, __a, (vector unsigned char)
6254 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006255}
6256
6257static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006258vec_splat(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006259{
David Blaikie3302f2b2013-01-16 23:08:36 +00006260 __b *= 4;
6261 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6262 return vec_perm(__a, __a, (vector unsigned char)
6263 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006264}
6265
6266static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006267vec_splat(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006268{
David Blaikie3302f2b2013-01-16 23:08:36 +00006269 __b *= 4;
6270 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6271 return vec_perm(__a, __a, (vector unsigned char)
6272 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006273}
6274
6275/* vec_vspltb */
6276
6277#define __builtin_altivec_vspltb vec_vspltb
6278
6279static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006280vec_vspltb(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006281{
David Blaikie3302f2b2013-01-16 23:08:36 +00006282 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006283}
6284
6285static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006286vec_vspltb(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006287{
David Blaikie3302f2b2013-01-16 23:08:36 +00006288 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006289}
6290
6291static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006292vec_vspltb(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006293{
David Blaikie3302f2b2013-01-16 23:08:36 +00006294 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006295}
6296
6297/* vec_vsplth */
6298
6299#define __builtin_altivec_vsplth vec_vsplth
6300
6301static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006302vec_vsplth(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006303{
David Blaikie3302f2b2013-01-16 23:08:36 +00006304 __b *= 2;
6305 unsigned char b1=__b+1;
6306 return vec_perm(__a, __a, (vector unsigned char)
6307 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006308}
6309
6310static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006311vec_vsplth(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006312{
David Blaikie3302f2b2013-01-16 23:08:36 +00006313 __b *= 2;
6314 unsigned char b1=__b+1;
6315 return vec_perm(__a, __a, (vector unsigned char)
6316 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006317}
6318
6319static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006320vec_vsplth(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006321{
David Blaikie3302f2b2013-01-16 23:08:36 +00006322 __b *= 2;
6323 unsigned char b1=__b+1;
6324 return vec_perm(__a, __a, (vector unsigned char)
6325 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006326}
6327
6328static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006329vec_vsplth(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006330{
David Blaikie3302f2b2013-01-16 23:08:36 +00006331 __b *= 2;
6332 unsigned char b1=__b+1;
6333 return vec_perm(__a, __a, (vector unsigned char)
6334 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006335}
6336
6337/* vec_vspltw */
6338
6339#define __builtin_altivec_vspltw vec_vspltw
6340
6341static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006342vec_vspltw(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006343{
David Blaikie3302f2b2013-01-16 23:08:36 +00006344 __b *= 4;
6345 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6346 return vec_perm(__a, __a, (vector unsigned char)
6347 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006348}
6349
6350static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006351vec_vspltw(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006352{
David Blaikie3302f2b2013-01-16 23:08:36 +00006353 __b *= 4;
6354 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6355 return vec_perm(__a, __a, (vector unsigned char)
6356 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006357}
6358
6359static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006360vec_vspltw(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006361{
David Blaikie3302f2b2013-01-16 23:08:36 +00006362 __b *= 4;
6363 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6364 return vec_perm(__a, __a, (vector unsigned char)
6365 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006366}
6367
6368static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006369vec_vspltw(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006370{
David Blaikie3302f2b2013-01-16 23:08:36 +00006371 __b *= 4;
6372 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6373 return vec_perm(__a, __a, (vector unsigned char)
6374 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006375}
6376
6377/* vec_splat_s8 */
6378
6379#define __builtin_altivec_vspltisb vec_splat_s8
6380
6381// FIXME: parameter should be treated as 5-bit signed literal
6382static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006383vec_splat_s8(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006384{
David Blaikie3302f2b2013-01-16 23:08:36 +00006385 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006386}
6387
6388/* vec_vspltisb */
6389
6390// FIXME: parameter should be treated as 5-bit signed literal
6391static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006392vec_vspltisb(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006393{
David Blaikie3302f2b2013-01-16 23:08:36 +00006394 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006395}
6396
6397/* vec_splat_s16 */
6398
6399#define __builtin_altivec_vspltish vec_splat_s16
6400
6401// FIXME: parameter should be treated as 5-bit signed literal
6402static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006403vec_splat_s16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006404{
David Blaikie3302f2b2013-01-16 23:08:36 +00006405 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006406}
6407
6408/* vec_vspltish */
6409
6410// FIXME: parameter should be treated as 5-bit signed literal
6411static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006412vec_vspltish(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006413{
David Blaikie3302f2b2013-01-16 23:08:36 +00006414 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006415}
6416
6417/* vec_splat_s32 */
6418
6419#define __builtin_altivec_vspltisw vec_splat_s32
6420
6421// FIXME: parameter should be treated as 5-bit signed literal
6422static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006423vec_splat_s32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006424{
David Blaikie3302f2b2013-01-16 23:08:36 +00006425 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006426}
6427
6428/* vec_vspltisw */
6429
6430// FIXME: parameter should be treated as 5-bit signed literal
6431static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006432vec_vspltisw(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006433{
David Blaikie3302f2b2013-01-16 23:08:36 +00006434 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006435}
6436
6437/* vec_splat_u8 */
6438
6439// FIXME: parameter should be treated as 5-bit signed literal
6440static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006441vec_splat_u8(unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006442{
David Blaikie3302f2b2013-01-16 23:08:36 +00006443 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006444}
6445
6446/* vec_splat_u16 */
6447
6448// FIXME: parameter should be treated as 5-bit signed literal
6449static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006450vec_splat_u16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006451{
David Blaikie3302f2b2013-01-16 23:08:36 +00006452 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006453}
6454
6455/* vec_splat_u32 */
6456
6457// FIXME: parameter should be treated as 5-bit signed literal
6458static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006459vec_splat_u32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006460{
David Blaikie3302f2b2013-01-16 23:08:36 +00006461 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006462}
6463
6464/* vec_sr */
6465
6466static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006467vec_sr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006468{
David Blaikie3302f2b2013-01-16 23:08:36 +00006469 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006470}
6471
6472static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006473vec_sr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006474{
David Blaikie3302f2b2013-01-16 23:08:36 +00006475 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006476}
6477
6478static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006479vec_sr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006480{
David Blaikie3302f2b2013-01-16 23:08:36 +00006481 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006482}
6483
6484static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006485vec_sr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006486{
David Blaikie3302f2b2013-01-16 23:08:36 +00006487 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006488}
6489
6490static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006491vec_sr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006492{
David Blaikie3302f2b2013-01-16 23:08:36 +00006493 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006494}
6495
6496static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006497vec_sr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006498{
David Blaikie3302f2b2013-01-16 23:08:36 +00006499 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006500}
6501
6502/* vec_vsrb */
6503
6504#define __builtin_altivec_vsrb vec_vsrb
6505
6506static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006507vec_vsrb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006508{
David Blaikie3302f2b2013-01-16 23:08:36 +00006509 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006510}
6511
6512static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006513vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006514{
David Blaikie3302f2b2013-01-16 23:08:36 +00006515 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006516}
6517
6518/* vec_vsrh */
6519
6520#define __builtin_altivec_vsrh vec_vsrh
6521
6522static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006523vec_vsrh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006524{
David Blaikie3302f2b2013-01-16 23:08:36 +00006525 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006526}
6527
6528static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006529vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006530{
David Blaikie3302f2b2013-01-16 23:08:36 +00006531 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006532}
6533
6534/* vec_vsrw */
6535
6536#define __builtin_altivec_vsrw vec_vsrw
6537
6538static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006539vec_vsrw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006540{
David Blaikie3302f2b2013-01-16 23:08:36 +00006541 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006542}
6543
6544static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006545vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006546{
David Blaikie3302f2b2013-01-16 23:08:36 +00006547 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006548}
6549
6550/* vec_sra */
6551
6552static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006553vec_sra(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006554{
David Blaikie3302f2b2013-01-16 23:08:36 +00006555 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006556}
6557
6558static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006559vec_sra(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006560{
David Blaikie3302f2b2013-01-16 23:08:36 +00006561 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006562}
6563
6564static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006565vec_sra(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006566{
David Blaikie3302f2b2013-01-16 23:08:36 +00006567 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006568}
6569
6570static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006571vec_sra(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006572{
David Blaikie3302f2b2013-01-16 23:08:36 +00006573 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006574}
6575
6576static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006577vec_sra(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006578{
David Blaikie3302f2b2013-01-16 23:08:36 +00006579 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006580}
6581
6582static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006583vec_sra(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006584{
David Blaikie3302f2b2013-01-16 23:08:36 +00006585 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006586}
6587
6588/* vec_vsrab */
6589
6590static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006591vec_vsrab(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006592{
David Blaikie3302f2b2013-01-16 23:08:36 +00006593 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006594}
6595
6596static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006597vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006598{
David Blaikie3302f2b2013-01-16 23:08:36 +00006599 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006600}
6601
6602/* vec_vsrah */
6603
6604static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006605vec_vsrah(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006606{
David Blaikie3302f2b2013-01-16 23:08:36 +00006607 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006608}
6609
6610static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006611vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006612{
David Blaikie3302f2b2013-01-16 23:08:36 +00006613 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006614}
6615
6616/* vec_vsraw */
6617
6618static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006619vec_vsraw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006620{
David Blaikie3302f2b2013-01-16 23:08:36 +00006621 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006622}
6623
6624static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006625vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006626{
David Blaikie3302f2b2013-01-16 23:08:36 +00006627 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006628}
6629
6630/* vec_srl */
6631
6632static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006633vec_srl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006634{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006635 return (vector signed 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
6639static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006640vec_srl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006641{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006642 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006643 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006644}
6645
6646static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006647vec_srl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006648{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006649 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006650 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006651}
6652
6653static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006654vec_srl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006655{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006656 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006657 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006658}
6659
6660static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006661vec_srl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006662{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006663 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006664 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006665}
6666
6667static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006668vec_srl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006669{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006670 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006671 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006672}
6673
Anton Yartsevfc83c602010-08-19 03:21:36 +00006674static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006675vec_srl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006676{
David Blaikie3302f2b2013-01-16 23:08:36 +00006677 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006678}
6679
6680static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006681vec_srl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006682{
David Blaikie3302f2b2013-01-16 23:08:36 +00006683 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006684}
6685
6686static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006687vec_srl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006688{
David Blaikie3302f2b2013-01-16 23:08:36 +00006689 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006690}
6691
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006692static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006693vec_srl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006694{
David Blaikie3302f2b2013-01-16 23:08:36 +00006695 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006696}
6697
6698static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006699vec_srl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006700{
David Blaikie3302f2b2013-01-16 23:08:36 +00006701 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006702}
6703
6704static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006705vec_srl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006706{
David Blaikie3302f2b2013-01-16 23:08:36 +00006707 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006708}
6709
6710static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006711vec_srl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006712{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006713 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006714 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006715}
6716
6717static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006718vec_srl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006719{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006720 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006721 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006722}
6723
6724static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006725vec_srl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006726{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006727 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006728 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006729}
6730
Anton Yartsevfc83c602010-08-19 03:21:36 +00006731static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006732vec_srl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006733{
David Blaikie3302f2b2013-01-16 23:08:36 +00006734 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006735}
6736
6737static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006738vec_srl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006739{
David Blaikie3302f2b2013-01-16 23:08:36 +00006740 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006741}
6742
6743static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006744vec_srl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006745{
David Blaikie3302f2b2013-01-16 23:08:36 +00006746 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006747}
6748
6749static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006750vec_srl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006751{
David Blaikie3302f2b2013-01-16 23:08:36 +00006752 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006753}
6754
6755static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006756vec_srl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006757{
David Blaikie3302f2b2013-01-16 23:08:36 +00006758 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006759}
6760
6761static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006762vec_srl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006763{
David Blaikie3302f2b2013-01-16 23:08:36 +00006764 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006765}
6766
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006767static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006768vec_srl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006769{
David Blaikie3302f2b2013-01-16 23:08:36 +00006770 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006771}
6772
6773static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006774vec_srl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006775{
David Blaikie3302f2b2013-01-16 23:08:36 +00006776 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006777}
6778
6779static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006780vec_srl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006781{
David Blaikie3302f2b2013-01-16 23:08:36 +00006782 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006783}
6784
6785static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006786vec_srl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006787{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006788 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006789 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006790}
6791
6792static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006793vec_srl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006794{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006795 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006796 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006797}
6798
6799static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006800vec_srl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006801{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006802 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006803 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006804}
6805
Anton Yartsevfc83c602010-08-19 03:21:36 +00006806static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006807vec_srl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006808{
David Blaikie3302f2b2013-01-16 23:08:36 +00006809 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006810}
6811
6812static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006813vec_srl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006814{
David Blaikie3302f2b2013-01-16 23:08:36 +00006815 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006816}
6817
6818static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006819vec_srl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006820{
David Blaikie3302f2b2013-01-16 23:08:36 +00006821 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006822}
6823
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006824/* vec_vsr */
6825
6826static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006827vec_vsr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006828{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006829 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006830 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006831}
6832
6833static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006834vec_vsr(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006835{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006836 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006837 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006838}
6839
6840static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006841vec_vsr(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006842{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006843 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006844 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006845}
6846
6847static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006848vec_vsr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006849{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006850 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006851 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006852}
6853
6854static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006855vec_vsr(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006856{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006857 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006858 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006859}
6860
6861static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006862vec_vsr(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006863{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006864 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006865 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006866}
6867
Anton Yartsevfc83c602010-08-19 03:21:36 +00006868static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006869vec_vsr(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006870{
David Blaikie3302f2b2013-01-16 23:08:36 +00006871 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006872}
6873
6874static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006875vec_vsr(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006876{
David Blaikie3302f2b2013-01-16 23:08:36 +00006877 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006878}
6879
6880static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006881vec_vsr(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006882{
David Blaikie3302f2b2013-01-16 23:08:36 +00006883 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006884}
6885
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006886static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006887vec_vsr(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006888{
David Blaikie3302f2b2013-01-16 23:08:36 +00006889 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006890}
6891
6892static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006893vec_vsr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006894{
David Blaikie3302f2b2013-01-16 23:08:36 +00006895 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006896}
6897
6898static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006899vec_vsr(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006900{
David Blaikie3302f2b2013-01-16 23:08:36 +00006901 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006902}
6903
6904static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006905vec_vsr(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006906{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006907 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006908 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006909}
6910
6911static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006912vec_vsr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006913{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006914 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006915 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006916}
6917
6918static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006919vec_vsr(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006920{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006921 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006922 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006923}
6924
Anton Yartsevfc83c602010-08-19 03:21:36 +00006925static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006926vec_vsr(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006927{
David Blaikie3302f2b2013-01-16 23:08:36 +00006928 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006929}
6930
6931static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006932vec_vsr(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006933{
David Blaikie3302f2b2013-01-16 23:08:36 +00006934 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006935}
6936
6937static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006938vec_vsr(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006939{
David Blaikie3302f2b2013-01-16 23:08:36 +00006940 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006941}
6942
6943static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006944vec_vsr(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006945{
David Blaikie3302f2b2013-01-16 23:08:36 +00006946 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006947}
6948
6949static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006950vec_vsr(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006951{
David Blaikie3302f2b2013-01-16 23:08:36 +00006952 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006953}
6954
6955static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006956vec_vsr(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006957{
David Blaikie3302f2b2013-01-16 23:08:36 +00006958 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006959}
6960
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006961static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006962vec_vsr(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006963{
David Blaikie3302f2b2013-01-16 23:08:36 +00006964 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006965}
6966
6967static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006968vec_vsr(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006969{
David Blaikie3302f2b2013-01-16 23:08:36 +00006970 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006971}
6972
6973static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006974vec_vsr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006975{
David Blaikie3302f2b2013-01-16 23:08:36 +00006976 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006977}
6978
6979static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006980vec_vsr(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006981{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006982 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006983 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006984}
6985
6986static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006987vec_vsr(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006988{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006989 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006990 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006991}
6992
6993static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006994vec_vsr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006995{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006996 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006997 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006998}
6999
Anton Yartsevfc83c602010-08-19 03:21:36 +00007000static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007001vec_vsr(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007002{
David Blaikie3302f2b2013-01-16 23:08:36 +00007003 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007004}
7005
7006static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007007vec_vsr(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007008{
David Blaikie3302f2b2013-01-16 23:08:36 +00007009 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007010}
7011
7012static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007013vec_vsr(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007014{
David Blaikie3302f2b2013-01-16 23:08:36 +00007015 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007016}
7017
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007018/* vec_sro */
7019
7020static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007021vec_sro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007022{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007023 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007024 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007025}
7026
7027static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007028vec_sro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007029{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007030 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007031 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007032}
7033
7034static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007035vec_sro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007036{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007037 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007038 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007039}
7040
7041static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007042vec_sro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007043{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007044 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007045 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007046}
7047
7048static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007049vec_sro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007050{
David Blaikie3302f2b2013-01-16 23:08:36 +00007051 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007052}
7053
7054static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007055vec_sro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007056{
David Blaikie3302f2b2013-01-16 23:08:36 +00007057 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007058}
7059
7060static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007061vec_sro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007062{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007063 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007064 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007065}
7066
7067static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007068vec_sro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007069{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007070 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007071 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007072}
7073
Anton Yartsevfc83c602010-08-19 03:21:36 +00007074static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007075vec_sro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007076{
David Blaikie3302f2b2013-01-16 23:08:36 +00007077 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007078}
7079
7080static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007081vec_sro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007082{
David Blaikie3302f2b2013-01-16 23:08:36 +00007083 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007084}
7085
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007086static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007087vec_sro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007088{
David Blaikie3302f2b2013-01-16 23:08:36 +00007089 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007090}
7091
7092static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007093vec_sro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007094{
David Blaikie3302f2b2013-01-16 23:08:36 +00007095 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007096}
7097
7098static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007099vec_sro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007100{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007101 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007102 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007103}
7104
7105static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007106vec_sro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007107{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007108 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007109 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007110}
7111
7112static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007113vec_sro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007114{
David Blaikie3302f2b2013-01-16 23:08:36 +00007115 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007116}
7117
7118static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007119vec_sro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007120{
David Blaikie3302f2b2013-01-16 23:08:36 +00007121 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007122}
7123
7124/* vec_vsro */
7125
7126static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007127vec_vsro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007128{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007129 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007130 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007131}
7132
7133static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007134vec_vsro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007135{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007136 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007137 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007138}
7139
7140static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007141vec_vsro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007142{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007143 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007144 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007145}
7146
7147static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007148vec_vsro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007149{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007150 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007151 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007152}
7153
7154static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007155vec_vsro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007156{
David Blaikie3302f2b2013-01-16 23:08:36 +00007157 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007158}
7159
7160static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007161vec_vsro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007162{
David Blaikie3302f2b2013-01-16 23:08:36 +00007163 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007164}
7165
7166static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007167vec_vsro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007168{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007169 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007170 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007171}
7172
7173static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007174vec_vsro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007175{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007176 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007177 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007178}
7179
Anton Yartsevfc83c602010-08-19 03:21:36 +00007180static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007181vec_vsro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007182{
David Blaikie3302f2b2013-01-16 23:08:36 +00007183 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007184}
7185
7186static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007187vec_vsro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007188{
David Blaikie3302f2b2013-01-16 23:08:36 +00007189 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007190}
7191
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007192static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007193vec_vsro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007194{
David Blaikie3302f2b2013-01-16 23:08:36 +00007195 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007196}
7197
7198static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007199vec_vsro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007200{
David Blaikie3302f2b2013-01-16 23:08:36 +00007201 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007202}
7203
7204static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007205vec_vsro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007206{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007207 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007208 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007209}
7210
7211static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007212vec_vsro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007213{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007214 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007215 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007216}
7217
7218static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007219vec_vsro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007220{
David Blaikie3302f2b2013-01-16 23:08:36 +00007221 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007222}
7223
7224static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007225vec_vsro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007226{
David Blaikie3302f2b2013-01-16 23:08:36 +00007227 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007228}
7229
7230/* vec_st */
7231
7232static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007233vec_st(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007234{
David Blaikie3302f2b2013-01-16 23:08:36 +00007235 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007236}
7237
7238static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007239vec_st(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007240{
David Blaikie3302f2b2013-01-16 23:08:36 +00007241 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007242}
7243
7244static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007245vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007246{
David Blaikie3302f2b2013-01-16 23:08:36 +00007247 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007248}
7249
7250static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007251vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007252{
David Blaikie3302f2b2013-01-16 23:08:36 +00007253 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007254}
7255
7256static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007257vec_st(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007258{
David Blaikie3302f2b2013-01-16 23:08:36 +00007259 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007260}
7261
7262static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007263vec_st(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007264{
David Blaikie3302f2b2013-01-16 23:08:36 +00007265 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007266}
7267
7268static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007269vec_st(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007270{
David Blaikie3302f2b2013-01-16 23:08:36 +00007271 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007272}
7273
7274static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007275vec_st(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007276{
David Blaikie3302f2b2013-01-16 23:08:36 +00007277 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007278}
7279
7280static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007281vec_st(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007282{
David Blaikie3302f2b2013-01-16 23:08:36 +00007283 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007284}
7285
7286static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007287vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007288{
David Blaikie3302f2b2013-01-16 23:08:36 +00007289 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007290}
7291
7292static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007293vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007294{
David Blaikie3302f2b2013-01-16 23:08:36 +00007295 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007296}
7297
7298static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007299vec_st(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007300{
David Blaikie3302f2b2013-01-16 23:08:36 +00007301 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007302}
7303
7304static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007305vec_st(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007306{
David Blaikie3302f2b2013-01-16 23:08:36 +00007307 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007308}
7309
7310static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007311vec_st(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007312{
David Blaikie3302f2b2013-01-16 23:08:36 +00007313 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007314}
7315
7316static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007317vec_st(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007318{
David Blaikie3302f2b2013-01-16 23:08:36 +00007319 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007320}
7321
7322static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007323vec_st(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007324{
David Blaikie3302f2b2013-01-16 23:08:36 +00007325 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007326}
7327
7328static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007329vec_st(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007330{
David Blaikie3302f2b2013-01-16 23:08:36 +00007331 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007332}
7333
7334static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007335vec_st(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007336{
David Blaikie3302f2b2013-01-16 23:08:36 +00007337 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007338}
7339
7340static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007341vec_st(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007342{
David Blaikie3302f2b2013-01-16 23:08:36 +00007343 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007344}
7345
7346static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007347vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007348{
David Blaikie3302f2b2013-01-16 23:08:36 +00007349 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007350}
7351
7352static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007353vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007354{
David Blaikie3302f2b2013-01-16 23:08:36 +00007355 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007356}
7357
7358static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007359vec_st(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007360{
David Blaikie3302f2b2013-01-16 23:08:36 +00007361 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007362}
7363
7364static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007365vec_st(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007366{
David Blaikie3302f2b2013-01-16 23:08:36 +00007367 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007368}
7369
7370static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007371vec_st(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007372{
David Blaikie3302f2b2013-01-16 23:08:36 +00007373 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007374}
7375
7376static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007377vec_st(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007378{
David Blaikie3302f2b2013-01-16 23:08:36 +00007379 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007380}
7381
7382static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007383vec_st(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007384{
David Blaikie3302f2b2013-01-16 23:08:36 +00007385 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007386}
7387
7388/* vec_stvx */
7389
7390static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007391vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007392{
David Blaikie3302f2b2013-01-16 23:08:36 +00007393 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007394}
7395
7396static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007397vec_stvx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007398{
David Blaikie3302f2b2013-01-16 23:08:36 +00007399 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007400}
7401
7402static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007403vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007404{
David Blaikie3302f2b2013-01-16 23:08:36 +00007405 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007406}
7407
7408static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007409vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007410{
David Blaikie3302f2b2013-01-16 23:08:36 +00007411 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007412}
7413
7414static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007415vec_stvx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007416{
David Blaikie3302f2b2013-01-16 23:08:36 +00007417 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007418}
7419
7420static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007421vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007422{
David Blaikie3302f2b2013-01-16 23:08:36 +00007423 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007424}
7425
7426static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007427vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007428{
David Blaikie3302f2b2013-01-16 23:08:36 +00007429 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007430}
7431
7432static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007433vec_stvx(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007434{
David Blaikie3302f2b2013-01-16 23:08:36 +00007435 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007436}
7437
7438static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007439vec_stvx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007440{
David Blaikie3302f2b2013-01-16 23:08:36 +00007441 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007442}
7443
7444static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007445vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007446{
David Blaikie3302f2b2013-01-16 23:08:36 +00007447 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007448}
7449
7450static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007451vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007452{
David Blaikie3302f2b2013-01-16 23:08:36 +00007453 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007454}
7455
7456static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007457vec_stvx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007458{
David Blaikie3302f2b2013-01-16 23:08:36 +00007459 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007460}
7461
7462static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007463vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007464{
David Blaikie3302f2b2013-01-16 23:08:36 +00007465 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007466}
7467
7468static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007469vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007470{
David Blaikie3302f2b2013-01-16 23:08:36 +00007471 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007472}
7473
7474static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007475vec_stvx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007476{
David Blaikie3302f2b2013-01-16 23:08:36 +00007477 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007478}
7479
7480static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007481vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007482{
David Blaikie3302f2b2013-01-16 23:08:36 +00007483 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007484}
7485
7486static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007487vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007488{
David Blaikie3302f2b2013-01-16 23:08:36 +00007489 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007490}
7491
7492static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007493vec_stvx(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007494{
David Blaikie3302f2b2013-01-16 23:08:36 +00007495 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007496}
7497
7498static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007499vec_stvx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007500{
David Blaikie3302f2b2013-01-16 23:08:36 +00007501 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007502}
7503
7504static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007505vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007506{
David Blaikie3302f2b2013-01-16 23:08:36 +00007507 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007508}
7509
7510static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007511vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007512{
David Blaikie3302f2b2013-01-16 23:08:36 +00007513 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007514}
7515
7516static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007517vec_stvx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007518{
David Blaikie3302f2b2013-01-16 23:08:36 +00007519 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007520}
7521
7522static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007523vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007524{
David Blaikie3302f2b2013-01-16 23:08:36 +00007525 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007526}
7527
7528static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007529vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007530{
David Blaikie3302f2b2013-01-16 23:08:36 +00007531 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007532}
7533
7534static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007535vec_stvx(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007536{
David Blaikie3302f2b2013-01-16 23:08:36 +00007537 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007538}
7539
7540static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007541vec_stvx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007542{
David Blaikie3302f2b2013-01-16 23:08:36 +00007543 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007544}
7545
7546/* vec_ste */
7547
7548static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007549vec_ste(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007550{
David Blaikie3302f2b2013-01-16 23:08:36 +00007551 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007552}
7553
7554static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007555vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007556{
David Blaikie3302f2b2013-01-16 23:08:36 +00007557 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007558}
7559
7560static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007561vec_ste(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007562{
David Blaikie3302f2b2013-01-16 23:08:36 +00007563 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007564}
7565
7566static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007567vec_ste(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007568{
David Blaikie3302f2b2013-01-16 23:08:36 +00007569 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007570}
7571
7572static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007573vec_ste(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007574{
David Blaikie3302f2b2013-01-16 23:08:36 +00007575 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007576}
7577
7578static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007579vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007580{
David Blaikie3302f2b2013-01-16 23:08:36 +00007581 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007582}
7583
7584static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007585vec_ste(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007586{
David Blaikie3302f2b2013-01-16 23:08:36 +00007587 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007588}
7589
7590static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007591vec_ste(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007592{
David Blaikie3302f2b2013-01-16 23:08:36 +00007593 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007594}
7595
7596static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007597vec_ste(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007598{
David Blaikie3302f2b2013-01-16 23:08:36 +00007599 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007600}
7601
7602static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007603vec_ste(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007604{
David Blaikie3302f2b2013-01-16 23:08:36 +00007605 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007606}
7607
7608static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007609vec_ste(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007610{
David Blaikie3302f2b2013-01-16 23:08:36 +00007611 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007612}
7613
7614static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007615vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007616{
David Blaikie3302f2b2013-01-16 23:08:36 +00007617 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007618}
7619
7620static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007621vec_ste(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007622{
David Blaikie3302f2b2013-01-16 23:08:36 +00007623 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007624}
7625
7626static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007627vec_ste(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007628{
David Blaikie3302f2b2013-01-16 23:08:36 +00007629 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007630}
7631
7632static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007633vec_ste(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007634{
David Blaikie3302f2b2013-01-16 23:08:36 +00007635 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007636}
7637
7638/* vec_stvebx */
7639
7640static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007641vec_stvebx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007642{
David Blaikie3302f2b2013-01-16 23:08:36 +00007643 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007644}
7645
7646static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007647vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007648{
David Blaikie3302f2b2013-01-16 23:08:36 +00007649 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007650}
7651
Anton Yartsevfc83c602010-08-19 03:21:36 +00007652static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007653vec_stvebx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007654{
David Blaikie3302f2b2013-01-16 23:08:36 +00007655 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007656}
7657
7658static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007659vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007660{
David Blaikie3302f2b2013-01-16 23:08:36 +00007661 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007662}
7663
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007664/* vec_stvehx */
7665
7666static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007667vec_stvehx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007668{
David Blaikie3302f2b2013-01-16 23:08:36 +00007669 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007670}
7671
7672static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007673vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007674{
David Blaikie3302f2b2013-01-16 23:08:36 +00007675 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007676}
7677
Anton Yartsevfc83c602010-08-19 03:21:36 +00007678static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007679vec_stvehx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007680{
David Blaikie3302f2b2013-01-16 23:08:36 +00007681 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007682}
7683
7684static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007685vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007686{
David Blaikie3302f2b2013-01-16 23:08:36 +00007687 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007688}
7689
7690static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007691vec_stvehx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007692{
David Blaikie3302f2b2013-01-16 23:08:36 +00007693 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007694}
7695
7696static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007697vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007698{
David Blaikie3302f2b2013-01-16 23:08:36 +00007699 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007700}
7701
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007702/* vec_stvewx */
7703
7704static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007705vec_stvewx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007706{
David Blaikie3302f2b2013-01-16 23:08:36 +00007707 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007708}
7709
7710static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007711vec_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007712{
David Blaikie3302f2b2013-01-16 23:08:36 +00007713 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007714}
7715
7716static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007717vec_stvewx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007718{
David Blaikie3302f2b2013-01-16 23:08:36 +00007719 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007720}
7721
7722static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007723vec_stvewx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007724{
David Blaikie3302f2b2013-01-16 23:08:36 +00007725 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007726}
7727
7728static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007729vec_stvewx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007730{
David Blaikie3302f2b2013-01-16 23:08:36 +00007731 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007732}
7733
7734/* vec_stl */
7735
7736static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007737vec_stl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007738{
David Blaikie3302f2b2013-01-16 23:08:36 +00007739 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007740}
7741
7742static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007743vec_stl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007744{
David Blaikie3302f2b2013-01-16 23:08:36 +00007745 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007746}
7747
7748static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007749vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007750{
David Blaikie3302f2b2013-01-16 23:08:36 +00007751 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007752}
7753
7754static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007755vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007756{
David Blaikie3302f2b2013-01-16 23:08:36 +00007757 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007758}
7759
7760static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007761vec_stl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007762{
David Blaikie3302f2b2013-01-16 23:08:36 +00007763 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007764}
7765
7766static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007767vec_stl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007768{
David Blaikie3302f2b2013-01-16 23:08:36 +00007769 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007770}
7771
7772static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007773vec_stl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007774{
David Blaikie3302f2b2013-01-16 23:08:36 +00007775 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007776}
7777
7778static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007779vec_stl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007780{
David Blaikie3302f2b2013-01-16 23:08:36 +00007781 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007782}
7783
7784static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007785vec_stl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007786{
David Blaikie3302f2b2013-01-16 23:08:36 +00007787 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007788}
7789
7790static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007791vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007792{
David Blaikie3302f2b2013-01-16 23:08:36 +00007793 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007794}
7795
7796static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007797vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007798{
David Blaikie3302f2b2013-01-16 23:08:36 +00007799 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007800}
7801
7802static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007803vec_stl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007804{
David Blaikie3302f2b2013-01-16 23:08:36 +00007805 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007806}
7807
7808static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007809vec_stl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007810{
David Blaikie3302f2b2013-01-16 23:08:36 +00007811 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007812}
7813
7814static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007815vec_stl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007816{
David Blaikie3302f2b2013-01-16 23:08:36 +00007817 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007818}
7819
7820static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007821vec_stl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007822{
David Blaikie3302f2b2013-01-16 23:08:36 +00007823 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007824}
7825
7826static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007827vec_stl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007828{
David Blaikie3302f2b2013-01-16 23:08:36 +00007829 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007830}
7831
7832static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007833vec_stl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007834{
David Blaikie3302f2b2013-01-16 23:08:36 +00007835 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007836}
7837
7838static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007839vec_stl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007840{
David Blaikie3302f2b2013-01-16 23:08:36 +00007841 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007842}
7843
7844static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007845vec_stl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007846{
David Blaikie3302f2b2013-01-16 23:08:36 +00007847 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007848}
7849
7850static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007851vec_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007852{
David Blaikie3302f2b2013-01-16 23:08:36 +00007853 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007854}
7855
7856static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007857vec_stl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007858{
David Blaikie3302f2b2013-01-16 23:08:36 +00007859 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007860}
7861
7862static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007863vec_stl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007864{
David Blaikie3302f2b2013-01-16 23:08:36 +00007865 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007866}
7867
7868static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007869vec_stl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007870{
David Blaikie3302f2b2013-01-16 23:08:36 +00007871 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007872}
7873
7874static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007875vec_stl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007876{
David Blaikie3302f2b2013-01-16 23:08:36 +00007877 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007878}
7879
7880static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007881vec_stl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007882{
David Blaikie3302f2b2013-01-16 23:08:36 +00007883 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007884}
7885
7886static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007887vec_stl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007888{
David Blaikie3302f2b2013-01-16 23:08:36 +00007889 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007890}
7891
7892/* vec_stvxl */
7893
7894static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007895vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007896{
David Blaikie3302f2b2013-01-16 23:08:36 +00007897 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007898}
7899
7900static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007901vec_stvxl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007902{
David Blaikie3302f2b2013-01-16 23:08:36 +00007903 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007904}
7905
7906static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007907vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007908{
David Blaikie3302f2b2013-01-16 23:08:36 +00007909 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007910}
7911
7912static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007913vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007914{
David Blaikie3302f2b2013-01-16 23:08:36 +00007915 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007916}
7917
7918static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007919vec_stvxl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007920{
David Blaikie3302f2b2013-01-16 23:08:36 +00007921 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007922}
7923
7924static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007925vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007926{
David Blaikie3302f2b2013-01-16 23:08:36 +00007927 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007928}
7929
7930static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007931vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007932{
David Blaikie3302f2b2013-01-16 23:08:36 +00007933 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007934}
7935
7936static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007937vec_stvxl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007938{
David Blaikie3302f2b2013-01-16 23:08:36 +00007939 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007940}
7941
7942static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007943vec_stvxl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007944{
David Blaikie3302f2b2013-01-16 23:08:36 +00007945 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007946}
7947
7948static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007949vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007950{
David Blaikie3302f2b2013-01-16 23:08:36 +00007951 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007952}
7953
7954static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007955vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007956{
David Blaikie3302f2b2013-01-16 23:08:36 +00007957 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007958}
7959
7960static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007961vec_stvxl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007962{
David Blaikie3302f2b2013-01-16 23:08:36 +00007963 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007964}
7965
7966static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007967vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007968{
David Blaikie3302f2b2013-01-16 23:08:36 +00007969 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007970}
7971
7972static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007973vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007974{
David Blaikie3302f2b2013-01-16 23:08:36 +00007975 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007976}
7977
7978static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007979vec_stvxl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007980{
David Blaikie3302f2b2013-01-16 23:08:36 +00007981 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007982}
7983
7984static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007985vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007986{
David Blaikie3302f2b2013-01-16 23:08:36 +00007987 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007988}
7989
7990static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007991vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007992{
David Blaikie3302f2b2013-01-16 23:08:36 +00007993 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007994}
7995
7996static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007997vec_stvxl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007998{
David Blaikie3302f2b2013-01-16 23:08:36 +00007999 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008000}
8001
8002static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008003vec_stvxl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008004{
David Blaikie3302f2b2013-01-16 23:08:36 +00008005 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008006}
8007
8008static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008009vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008010{
David Blaikie3302f2b2013-01-16 23:08:36 +00008011 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008012}
8013
8014static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008015vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008016{
David Blaikie3302f2b2013-01-16 23:08:36 +00008017 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008018}
8019
8020static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008021vec_stvxl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008022{
David Blaikie3302f2b2013-01-16 23:08:36 +00008023 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008024}
8025
8026static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008027vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008028{
David Blaikie3302f2b2013-01-16 23:08:36 +00008029 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008030}
8031
8032static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008033vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008034{
David Blaikie3302f2b2013-01-16 23:08:36 +00008035 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008036}
8037
8038static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008039vec_stvxl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008040{
David Blaikie3302f2b2013-01-16 23:08:36 +00008041 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008042}
8043
8044static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008045vec_stvxl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008046{
David Blaikie3302f2b2013-01-16 23:08:36 +00008047 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008048}
8049
8050/* vec_sub */
8051
8052static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008053vec_sub(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008054{
David Blaikie3302f2b2013-01-16 23:08:36 +00008055 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008056}
8057
Anton Yartsevfc83c602010-08-19 03:21:36 +00008058static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008059vec_sub(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008060{
David Blaikie3302f2b2013-01-16 23:08:36 +00008061 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008062}
8063
8064static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008065vec_sub(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008066{
David Blaikie3302f2b2013-01-16 23:08:36 +00008067 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008068}
8069
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008070static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008071vec_sub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008072{
David Blaikie3302f2b2013-01-16 23:08:36 +00008073 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008074}
8075
Anton Yartsevfc83c602010-08-19 03:21:36 +00008076static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008077vec_sub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008078{
David Blaikie3302f2b2013-01-16 23:08:36 +00008079 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008080}
8081
8082static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008083vec_sub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008084{
David Blaikie3302f2b2013-01-16 23:08:36 +00008085 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008086}
8087
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008088static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008089vec_sub(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008090{
David Blaikie3302f2b2013-01-16 23:08:36 +00008091 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008092}
8093
Anton Yartsevfc83c602010-08-19 03:21:36 +00008094static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008095vec_sub(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008096{
David Blaikie3302f2b2013-01-16 23:08:36 +00008097 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008098}
8099
8100static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008101vec_sub(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008102{
David Blaikie3302f2b2013-01-16 23:08:36 +00008103 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008104}
8105
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008106static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008107vec_sub(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008108{
David Blaikie3302f2b2013-01-16 23:08:36 +00008109 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008110}
8111
Anton Yartsevfc83c602010-08-19 03:21:36 +00008112static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008113vec_sub(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008114{
David Blaikie3302f2b2013-01-16 23:08:36 +00008115 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008116}
8117
8118static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008119vec_sub(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008120{
David Blaikie3302f2b2013-01-16 23:08:36 +00008121 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008122}
8123
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008124static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008125vec_sub(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008126{
David Blaikie3302f2b2013-01-16 23:08:36 +00008127 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008128}
8129
Anton Yartsevfc83c602010-08-19 03:21:36 +00008130static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008131vec_sub(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008132{
David Blaikie3302f2b2013-01-16 23:08:36 +00008133 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008134}
8135
8136static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008137vec_sub(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008138{
David Blaikie3302f2b2013-01-16 23:08:36 +00008139 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008140}
8141
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008142static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008143vec_sub(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008144{
David Blaikie3302f2b2013-01-16 23:08:36 +00008145 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008146}
8147
Anton Yartsevfc83c602010-08-19 03:21:36 +00008148static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008149vec_sub(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008150{
David Blaikie3302f2b2013-01-16 23:08:36 +00008151 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008152}
8153
8154static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008155vec_sub(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008156{
David Blaikie3302f2b2013-01-16 23:08:36 +00008157 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008158}
8159
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008160static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008161vec_sub(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008162{
David Blaikie3302f2b2013-01-16 23:08:36 +00008163 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008164}
8165
8166/* vec_vsububm */
8167
8168#define __builtin_altivec_vsububm vec_vsububm
8169
8170static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008171vec_vsububm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008172{
David Blaikie3302f2b2013-01-16 23:08:36 +00008173 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008174}
8175
Anton Yartsevfc83c602010-08-19 03:21:36 +00008176static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008177vec_vsububm(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008178{
David Blaikie3302f2b2013-01-16 23:08:36 +00008179 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008180}
8181
8182static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008183vec_vsububm(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008184{
David Blaikie3302f2b2013-01-16 23:08:36 +00008185 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008186}
8187
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008188static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008189vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008190{
David Blaikie3302f2b2013-01-16 23:08:36 +00008191 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008192}
8193
Anton Yartsevfc83c602010-08-19 03:21:36 +00008194static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008195vec_vsububm(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008196{
David Blaikie3302f2b2013-01-16 23:08:36 +00008197 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008198}
8199
8200static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008201vec_vsububm(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008202{
David Blaikie3302f2b2013-01-16 23:08:36 +00008203 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008204}
8205
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008206/* vec_vsubuhm */
8207
8208#define __builtin_altivec_vsubuhm vec_vsubuhm
8209
8210static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008211vec_vsubuhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008212{
David Blaikie3302f2b2013-01-16 23:08:36 +00008213 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008214}
8215
Anton Yartsevfc83c602010-08-19 03:21:36 +00008216static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008217vec_vsubuhm(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008218{
David Blaikie3302f2b2013-01-16 23:08:36 +00008219 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008220}
8221
8222static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008223vec_vsubuhm(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008224{
David Blaikie3302f2b2013-01-16 23:08:36 +00008225 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008226}
8227
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008228static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008229vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008230{
David Blaikie3302f2b2013-01-16 23:08:36 +00008231 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008232}
8233
Anton Yartsevfc83c602010-08-19 03:21:36 +00008234static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008235vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008236{
David Blaikie3302f2b2013-01-16 23:08:36 +00008237 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008238}
8239
8240static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008241vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008242{
David Blaikie3302f2b2013-01-16 23:08:36 +00008243 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008244}
8245
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008246/* vec_vsubuwm */
8247
8248#define __builtin_altivec_vsubuwm vec_vsubuwm
8249
8250static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008251vec_vsubuwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008252{
David Blaikie3302f2b2013-01-16 23:08:36 +00008253 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008254}
8255
Anton Yartsevfc83c602010-08-19 03:21:36 +00008256static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008257vec_vsubuwm(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008258{
David Blaikie3302f2b2013-01-16 23:08:36 +00008259 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008260}
8261
8262static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008263vec_vsubuwm(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008264{
David Blaikie3302f2b2013-01-16 23:08:36 +00008265 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008266}
8267
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008268static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008269vec_vsubuwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008270{
David Blaikie3302f2b2013-01-16 23:08:36 +00008271 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008272}
8273
Anton Yartsevfc83c602010-08-19 03:21:36 +00008274static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008275vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008276{
David Blaikie3302f2b2013-01-16 23:08:36 +00008277 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008278}
8279
8280static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008281vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008282{
David Blaikie3302f2b2013-01-16 23:08:36 +00008283 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008284}
8285
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008286/* vec_vsubfp */
8287
8288#define __builtin_altivec_vsubfp vec_vsubfp
8289
8290static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008291vec_vsubfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008292{
David Blaikie3302f2b2013-01-16 23:08:36 +00008293 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008294}
8295
8296/* vec_subc */
8297
8298static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008299vec_subc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008300{
David Blaikie3302f2b2013-01-16 23:08:36 +00008301 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008302}
8303
8304/* vec_vsubcuw */
8305
8306static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008307vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008308{
David Blaikie3302f2b2013-01-16 23:08:36 +00008309 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008310}
8311
8312/* vec_subs */
8313
8314static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008315vec_subs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008316{
David Blaikie3302f2b2013-01-16 23:08:36 +00008317 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008318}
8319
Anton Yartsevfc83c602010-08-19 03:21:36 +00008320static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008321vec_subs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008322{
David Blaikie3302f2b2013-01-16 23:08:36 +00008323 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008324}
8325
8326static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008327vec_subs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008328{
David Blaikie3302f2b2013-01-16 23:08:36 +00008329 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008330}
8331
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008332static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008333vec_subs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008334{
David Blaikie3302f2b2013-01-16 23:08:36 +00008335 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008336}
8337
Anton Yartsevfc83c602010-08-19 03:21:36 +00008338static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008339vec_subs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008340{
David Blaikie3302f2b2013-01-16 23:08:36 +00008341 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008342}
8343
8344static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008345vec_subs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008346{
David Blaikie3302f2b2013-01-16 23:08:36 +00008347 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008348}
8349
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008350static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008351vec_subs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008352{
David Blaikie3302f2b2013-01-16 23:08:36 +00008353 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008354}
8355
Anton Yartsevfc83c602010-08-19 03:21:36 +00008356static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008357vec_subs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008358{
David Blaikie3302f2b2013-01-16 23:08:36 +00008359 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008360}
8361
8362static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008363vec_subs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008364{
David Blaikie3302f2b2013-01-16 23:08:36 +00008365 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008366}
8367
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008368static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008369vec_subs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008370{
David Blaikie3302f2b2013-01-16 23:08:36 +00008371 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008372}
8373
Anton Yartsevfc83c602010-08-19 03:21:36 +00008374static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008375vec_subs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008376{
David Blaikie3302f2b2013-01-16 23:08:36 +00008377 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008378}
8379
8380static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008381vec_subs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008382{
David Blaikie3302f2b2013-01-16 23:08:36 +00008383 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008384}
8385
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008386static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008387vec_subs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008388{
David Blaikie3302f2b2013-01-16 23:08:36 +00008389 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008390}
8391
Anton Yartsevfc83c602010-08-19 03:21:36 +00008392static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008393vec_subs(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008394{
David Blaikie3302f2b2013-01-16 23:08:36 +00008395 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008396}
8397
8398static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008399vec_subs(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008400{
David Blaikie3302f2b2013-01-16 23:08:36 +00008401 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008402}
8403
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008404static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008405vec_subs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008406{
David Blaikie3302f2b2013-01-16 23:08:36 +00008407 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008408}
8409
Anton Yartsevfc83c602010-08-19 03:21:36 +00008410static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008411vec_subs(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008412{
David Blaikie3302f2b2013-01-16 23:08:36 +00008413 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008414}
8415
8416static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008417vec_subs(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008418{
David Blaikie3302f2b2013-01-16 23:08:36 +00008419 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008420}
8421
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008422/* vec_vsubsbs */
8423
Anton Yartsevfc83c602010-08-19 03:21:36 +00008424static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008425vec_vsubsbs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008426{
David Blaikie3302f2b2013-01-16 23:08:36 +00008427 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008428}
8429
Anton Yartsevfc83c602010-08-19 03:21:36 +00008430static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008431vec_vsubsbs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008432{
David Blaikie3302f2b2013-01-16 23:08:36 +00008433 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008434}
8435
8436static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008437vec_vsubsbs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008438{
David Blaikie3302f2b2013-01-16 23:08:36 +00008439 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008440}
8441
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008442/* vec_vsububs */
8443
Anton Yartsevfc83c602010-08-19 03:21:36 +00008444static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008445vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008446{
David Blaikie3302f2b2013-01-16 23:08:36 +00008447 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008448}
8449
Anton Yartsevfc83c602010-08-19 03:21:36 +00008450static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008451vec_vsububs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008452{
David Blaikie3302f2b2013-01-16 23:08:36 +00008453 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008454}
8455
8456static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008457vec_vsububs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008458{
David Blaikie3302f2b2013-01-16 23:08:36 +00008459 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008460}
8461
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008462/* vec_vsubshs */
8463
Anton Yartsevfc83c602010-08-19 03:21:36 +00008464static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008465vec_vsubshs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008466{
David Blaikie3302f2b2013-01-16 23:08:36 +00008467 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008468}
8469
Anton Yartsevfc83c602010-08-19 03:21:36 +00008470static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008471vec_vsubshs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008472{
David Blaikie3302f2b2013-01-16 23:08:36 +00008473 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008474}
8475
8476static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008477vec_vsubshs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008478{
David Blaikie3302f2b2013-01-16 23:08:36 +00008479 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008480}
8481
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008482/* vec_vsubuhs */
8483
Anton Yartsevfc83c602010-08-19 03:21:36 +00008484static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008485vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008486{
David Blaikie3302f2b2013-01-16 23:08:36 +00008487 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008488}
8489
Anton Yartsevfc83c602010-08-19 03:21:36 +00008490static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008491vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008492{
David Blaikie3302f2b2013-01-16 23:08:36 +00008493 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008494}
8495
8496static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008497vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008498{
David Blaikie3302f2b2013-01-16 23:08:36 +00008499 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008500}
8501
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008502/* vec_vsubsws */
8503
Anton Yartsevfc83c602010-08-19 03:21:36 +00008504static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008505vec_vsubsws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008506{
David Blaikie3302f2b2013-01-16 23:08:36 +00008507 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008508}
8509
Anton Yartsevfc83c602010-08-19 03:21:36 +00008510static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008511vec_vsubsws(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008512{
David Blaikie3302f2b2013-01-16 23:08:36 +00008513 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008514}
8515
8516static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008517vec_vsubsws(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008518{
David Blaikie3302f2b2013-01-16 23:08:36 +00008519 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008520}
8521
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008522/* vec_vsubuws */
8523
Anton Yartsevfc83c602010-08-19 03:21:36 +00008524static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008525vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008526{
David Blaikie3302f2b2013-01-16 23:08:36 +00008527 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008528}
8529
Anton Yartsevfc83c602010-08-19 03:21:36 +00008530static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008531vec_vsubuws(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008532{
David Blaikie3302f2b2013-01-16 23:08:36 +00008533 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008534}
8535
8536static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008537vec_vsubuws(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008538{
David Blaikie3302f2b2013-01-16 23:08:36 +00008539 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008540}
8541
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008542/* vec_sum4s */
8543
8544static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008545vec_sum4s(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008546{
David Blaikie3302f2b2013-01-16 23:08:36 +00008547 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008548}
8549
8550static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008551vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008552{
David Blaikie3302f2b2013-01-16 23:08:36 +00008553 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008554}
8555
8556static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008557vec_sum4s(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008558{
David Blaikie3302f2b2013-01-16 23:08:36 +00008559 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008560}
8561
8562/* vec_vsum4sbs */
8563
8564static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008565vec_vsum4sbs(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008566{
David Blaikie3302f2b2013-01-16 23:08:36 +00008567 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008568}
8569
8570/* vec_vsum4ubs */
8571
8572static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008573vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008574{
David Blaikie3302f2b2013-01-16 23:08:36 +00008575 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008576}
8577
8578/* vec_vsum4shs */
8579
8580static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008581vec_vsum4shs(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008582{
David Blaikie3302f2b2013-01-16 23:08:36 +00008583 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008584}
8585
8586/* vec_sum2s */
8587
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008588/* The vsum2sws instruction has a big-endian bias, so that the second
8589 input vector and the result always reference big-endian elements
8590 1 and 3 (little-endian element 0 and 2). For ease of porting the
8591 programmer wants elements 1 and 3 in both cases, so for little
8592 endian we must perform some permutes. */
8593
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008594static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008595vec_sum2s(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008596{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008597#ifdef __LITTLE_ENDIAN__
8598 vector int __c = (vector signed int)
8599 vec_perm(__b, __b, (vector unsigned char)
8600 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8601 __c = __builtin_altivec_vsum2sws(__a, __c);
8602 return (vector signed int)
8603 vec_perm(__c, __c, (vector unsigned char)
8604 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8605#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008606 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008607#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008608}
8609
8610/* vec_vsum2sws */
8611
8612static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008613vec_vsum2sws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008614{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008615#ifdef __LITTLE_ENDIAN__
8616 vector int __c = (vector signed int)
8617 vec_perm(__b, __b, (vector unsigned char)
8618 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8619 __c = __builtin_altivec_vsum2sws(__a, __c);
8620 return (vector signed int)
8621 vec_perm(__c, __c, (vector unsigned char)
8622 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8623#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008624 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008625#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008626}
8627
8628/* vec_sums */
8629
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008630/* The vsumsws instruction has a big-endian bias, so that the second
8631 input vector and the result always reference big-endian element 3
8632 (little-endian element 0). For ease of porting the programmer
8633 wants element 3 in both cases, so for little endian we must perform
8634 some permutes. */
8635
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008636static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008637vec_sums(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008638{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008639#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008640 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008641 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008642 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008643#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008644 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008645#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008646}
8647
8648/* vec_vsumsws */
8649
8650static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008651vec_vsumsws(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008652{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008653#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008654 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008655 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008656 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008657#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008658 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008659#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008660}
8661
8662/* vec_trunc */
8663
8664static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008665vec_trunc(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008666{
David Blaikie3302f2b2013-01-16 23:08:36 +00008667 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008668}
8669
8670/* vec_vrfiz */
8671
8672static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008673vec_vrfiz(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008674{
David Blaikie3302f2b2013-01-16 23:08:36 +00008675 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008676}
8677
8678/* vec_unpackh */
8679
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008680/* The vector unpack instructions all have a big-endian bias, so for
8681 little endian we must reverse the meanings of "high" and "low." */
8682
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008683static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008684vec_unpackh(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008685{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008686#ifdef __LITTLE_ENDIAN__
8687 return __builtin_altivec_vupklsb((vector char)__a);
8688#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008689 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008690#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008691}
8692
Anton Yartsevfc83c602010-08-19 03:21:36 +00008693static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008694vec_unpackh(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008695{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008696#ifdef __LITTLE_ENDIAN__
8697 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8698#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008699 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008700#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008701}
8702
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008703static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008704vec_unpackh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008705{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008706#ifdef __LITTLE_ENDIAN__
8707 return __builtin_altivec_vupklsh(__a);
8708#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008709 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008710#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008711}
8712
Anton Yartsevfc83c602010-08-19 03:21:36 +00008713static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008714vec_unpackh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008715{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008716#ifdef __LITTLE_ENDIAN__
8717 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8718#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008719 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008720#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008721}
8722
8723static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008724vec_unpackh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008725{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008726#ifdef __LITTLE_ENDIAN__
8727 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8728#else
8729 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8730#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008731}
8732
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008733/* vec_vupkhsb */
8734
Anton Yartsevfc83c602010-08-19 03:21:36 +00008735static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008736vec_vupkhsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008737{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008738#ifdef __LITTLE_ENDIAN__
8739 return __builtin_altivec_vupklsb((vector char)__a);
8740#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008741 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008742#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008743}
8744
Anton Yartsevfc83c602010-08-19 03:21:36 +00008745static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008746vec_vupkhsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008747{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008748#ifdef __LITTLE_ENDIAN__
8749 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8750#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008751 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008752#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008753}
8754
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008755/* vec_vupkhsh */
8756
Anton Yartsevfc83c602010-08-19 03:21:36 +00008757static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008758vec_vupkhsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008759{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008760#ifdef __LITTLE_ENDIAN__
8761 return __builtin_altivec_vupklsh(__a);
8762#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008763 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008764#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008765}
8766
Anton Yartsevfc83c602010-08-19 03:21:36 +00008767static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008768vec_vupkhsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008769{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008770#ifdef __LITTLE_ENDIAN__
8771 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8772#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008773 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008774#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008775}
8776
8777static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008778vec_vupkhsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008779{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008780#ifdef __LITTLE_ENDIAN__
8781 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8782#else
8783 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8784#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008785}
8786
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008787/* vec_unpackl */
8788
8789static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008790vec_unpackl(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008791{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008792#ifdef __LITTLE_ENDIAN__
8793 return __builtin_altivec_vupkhsb((vector char)__a);
8794#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008795 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008796#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008797}
8798
Anton Yartsevfc83c602010-08-19 03:21:36 +00008799static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008800vec_unpackl(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008801{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008802#ifdef __LITTLE_ENDIAN__
8803 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8804#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008805 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008806#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008807}
8808
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008809static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008810vec_unpackl(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008811{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008812#ifdef __LITTLE_ENDIAN__
8813 return __builtin_altivec_vupkhsh(__a);
8814#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008815 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008816#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008817}
8818
Anton Yartsevfc83c602010-08-19 03:21:36 +00008819static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008820vec_unpackl(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008821{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008822#ifdef __LITTLE_ENDIAN__
8823 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8824#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008825 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008826#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008827}
8828
8829static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008830vec_unpackl(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008831{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008832#ifdef __LITTLE_ENDIAN__
8833 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8834#else
8835 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8836#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008837}
8838
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008839/* vec_vupklsb */
8840
Anton Yartsevfc83c602010-08-19 03:21:36 +00008841static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008842vec_vupklsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008843{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008844#ifdef __LITTLE_ENDIAN__
8845 return __builtin_altivec_vupkhsb((vector char)__a);
8846#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008847 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008848#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008849}
8850
Anton Yartsevfc83c602010-08-19 03:21:36 +00008851static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008852vec_vupklsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008853{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008854#ifdef __LITTLE_ENDIAN__
8855 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8856#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008857 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008858#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008859}
8860
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008861/* vec_vupklsh */
8862
Anton Yartsevfc83c602010-08-19 03:21:36 +00008863static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008864vec_vupklsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008865{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008866#ifdef __LITTLE_ENDIAN__
8867 return __builtin_altivec_vupkhsh(__a);
8868#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008869 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008870#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008871}
8872
Anton Yartsevfc83c602010-08-19 03:21:36 +00008873static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008874vec_vupklsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008875{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008876#ifdef __LITTLE_ENDIAN__
8877 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8878#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008879 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008880#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008881}
8882
8883static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008884vec_vupklsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008885{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008886#ifdef __LITTLE_ENDIAN__
8887 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8888#else
8889 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8890#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008891}
8892
Bill Schmidt9ec8cea2014-11-12 04:19:56 +00008893/* vec_vsx_ld */
8894
8895#ifdef __VSX__
8896
8897static vector signed int __ATTRS_o_ai
8898vec_vsx_ld(int __a, const vector signed int *__b)
8899{
8900 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
8901}
8902
8903static vector unsigned int __ATTRS_o_ai
8904vec_vsx_ld(int __a, const vector unsigned int *__b)
8905{
8906 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
8907}
8908
8909static vector float __ATTRS_o_ai
8910vec_vsx_ld(int __a, const vector float *__b)
8911{
8912 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
8913}
8914
8915static vector signed long long __ATTRS_o_ai
8916vec_vsx_ld(int __a, const vector signed long long *__b)
8917{
8918 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
8919}
8920
8921static vector unsigned long long __ATTRS_o_ai
8922vec_vsx_ld(int __a, const vector unsigned long long *__b)
8923{
8924 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
8925}
8926
8927static vector double __ATTRS_o_ai
8928vec_vsx_ld(int __a, const vector double *__b)
8929{
8930 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
8931}
8932
8933#endif
8934
8935/* vec_vsx_st */
8936
8937#ifdef __VSX__
8938
8939static void __ATTRS_o_ai
8940vec_vsx_st(vector signed int __a, int __b, vector signed int *__c)
8941{
8942 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8943}
8944
8945static void __ATTRS_o_ai
8946vec_vsx_st(vector unsigned int __a, int __b, vector unsigned int *__c)
8947{
8948 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8949}
8950
8951static void __ATTRS_o_ai
8952vec_vsx_st(vector float __a, int __b, vector float *__c)
8953{
8954 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
8955}
8956
8957static void __ATTRS_o_ai
8958vec_vsx_st(vector signed long long __a, int __b, vector signed long long *__c)
8959{
8960 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8961}
8962
8963static void __ATTRS_o_ai
8964vec_vsx_st(vector unsigned long long __a, int __b,
8965 vector unsigned long long *__c)
8966{
8967 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8968}
8969
8970static void __ATTRS_o_ai
8971vec_vsx_st(vector double __a, int __b, vector double *__c)
8972{
8973 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
8974}
8975
8976#endif
8977
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008978/* vec_xor */
8979
8980#define __builtin_altivec_vxor vec_xor
8981
8982static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008983vec_xor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008984{
David Blaikie3302f2b2013-01-16 23:08:36 +00008985 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008986}
8987
Anton Yartsevfc83c602010-08-19 03:21:36 +00008988static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008989vec_xor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008990{
David Blaikie3302f2b2013-01-16 23:08:36 +00008991 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008992}
8993
8994static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008995vec_xor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008996{
David Blaikie3302f2b2013-01-16 23:08:36 +00008997 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008998}
8999
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009000static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009001vec_xor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009002{
David Blaikie3302f2b2013-01-16 23:08:36 +00009003 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009004}
9005
Anton Yartsevfc83c602010-08-19 03:21:36 +00009006static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009007vec_xor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009008{
David Blaikie3302f2b2013-01-16 23:08:36 +00009009 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009010}
9011
9012static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009013vec_xor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009014{
David Blaikie3302f2b2013-01-16 23:08:36 +00009015 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009016}
9017
9018static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009019vec_xor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009020{
David Blaikie3302f2b2013-01-16 23:08:36 +00009021 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009022}
9023
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009024static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009025vec_xor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009026{
David Blaikie3302f2b2013-01-16 23:08:36 +00009027 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009028}
9029
Anton Yartsevfc83c602010-08-19 03:21:36 +00009030static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009031vec_xor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009032{
David Blaikie3302f2b2013-01-16 23:08:36 +00009033 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009034}
9035
9036static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009037vec_xor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009038{
David Blaikie3302f2b2013-01-16 23:08:36 +00009039 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009040}
9041
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009042static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009043vec_xor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009044{
David Blaikie3302f2b2013-01-16 23:08:36 +00009045 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009046}
9047
Anton Yartsevfc83c602010-08-19 03:21:36 +00009048static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009049vec_xor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009050{
David Blaikie3302f2b2013-01-16 23:08:36 +00009051 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009052}
9053
9054static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009055vec_xor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009056{
David Blaikie3302f2b2013-01-16 23:08:36 +00009057 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009058}
9059
9060static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009061vec_xor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009062{
David Blaikie3302f2b2013-01-16 23:08:36 +00009063 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009064}
9065
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009066static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009067vec_xor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009068{
David Blaikie3302f2b2013-01-16 23:08:36 +00009069 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009070}
9071
Anton Yartsevfc83c602010-08-19 03:21:36 +00009072static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009073vec_xor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009074{
David Blaikie3302f2b2013-01-16 23:08:36 +00009075 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009076}
9077
9078static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009079vec_xor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009080{
David Blaikie3302f2b2013-01-16 23:08:36 +00009081 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009082}
9083
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009084static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009085vec_xor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009086{
David Blaikie3302f2b2013-01-16 23:08:36 +00009087 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009088}
9089
Anton Yartsevfc83c602010-08-19 03:21:36 +00009090static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009091vec_xor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009092{
David Blaikie3302f2b2013-01-16 23:08:36 +00009093 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009094}
9095
9096static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009097vec_xor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009098{
David Blaikie3302f2b2013-01-16 23:08:36 +00009099 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009100}
9101
9102static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009103vec_xor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009104{
David Blaikie3302f2b2013-01-16 23:08:36 +00009105 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009106}
9107
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009108static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009109vec_xor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009110{
David Blaikie3302f2b2013-01-16 23:08:36 +00009111 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9112 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009113}
9114
Anton Yartsevfc83c602010-08-19 03:21:36 +00009115static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009116vec_xor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009117{
David Blaikie3302f2b2013-01-16 23:08:36 +00009118 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9119 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009120}
9121
9122static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009123vec_xor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009124{
David Blaikie3302f2b2013-01-16 23:08:36 +00009125 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9126 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009127}
9128
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009129/* vec_vxor */
9130
9131static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009132vec_vxor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009133{
David Blaikie3302f2b2013-01-16 23:08:36 +00009134 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009135}
9136
Anton Yartsevfc83c602010-08-19 03:21:36 +00009137static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009138vec_vxor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009139{
David Blaikie3302f2b2013-01-16 23:08:36 +00009140 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009141}
9142
9143static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009144vec_vxor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009145{
David Blaikie3302f2b2013-01-16 23:08:36 +00009146 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009147}
9148
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009149static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009150vec_vxor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009151{
David Blaikie3302f2b2013-01-16 23:08:36 +00009152 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009153}
9154
Anton Yartsevfc83c602010-08-19 03:21:36 +00009155static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009156vec_vxor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009157{
David Blaikie3302f2b2013-01-16 23:08:36 +00009158 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009159}
9160
9161static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009162vec_vxor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009163{
David Blaikie3302f2b2013-01-16 23:08:36 +00009164 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009165}
9166
9167static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009168vec_vxor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009169{
David Blaikie3302f2b2013-01-16 23:08:36 +00009170 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009171}
9172
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009173static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009174vec_vxor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009175{
David Blaikie3302f2b2013-01-16 23:08:36 +00009176 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009177}
9178
Anton Yartsevfc83c602010-08-19 03:21:36 +00009179static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009180vec_vxor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009181{
David Blaikie3302f2b2013-01-16 23:08:36 +00009182 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009183}
9184
9185static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009186vec_vxor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009187{
David Blaikie3302f2b2013-01-16 23:08:36 +00009188 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009189}
9190
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009191static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009192vec_vxor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009193{
David Blaikie3302f2b2013-01-16 23:08:36 +00009194 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009195}
9196
Anton Yartsevfc83c602010-08-19 03:21:36 +00009197static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009198vec_vxor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009199{
David Blaikie3302f2b2013-01-16 23:08:36 +00009200 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009201}
9202
9203static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009204vec_vxor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009205{
David Blaikie3302f2b2013-01-16 23:08:36 +00009206 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009207}
9208
9209static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009210vec_vxor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009211{
David Blaikie3302f2b2013-01-16 23:08:36 +00009212 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009213}
9214
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009215static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009216vec_vxor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009217{
David Blaikie3302f2b2013-01-16 23:08:36 +00009218 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009219}
9220
Anton Yartsevfc83c602010-08-19 03:21:36 +00009221static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009222vec_vxor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009223{
David Blaikie3302f2b2013-01-16 23:08:36 +00009224 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009225}
9226
9227static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009228vec_vxor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009229{
David Blaikie3302f2b2013-01-16 23:08:36 +00009230 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009231}
9232
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009233static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009234vec_vxor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009235{
David Blaikie3302f2b2013-01-16 23:08:36 +00009236 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009237}
9238
Anton Yartsevfc83c602010-08-19 03:21:36 +00009239static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009240vec_vxor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009241{
David Blaikie3302f2b2013-01-16 23:08:36 +00009242 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009243}
9244
9245static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009246vec_vxor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009247{
David Blaikie3302f2b2013-01-16 23:08:36 +00009248 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009249}
9250
9251static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009252vec_vxor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009253{
David Blaikie3302f2b2013-01-16 23:08:36 +00009254 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009255}
9256
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009257static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009258vec_vxor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009259{
David Blaikie3302f2b2013-01-16 23:08:36 +00009260 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9261 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009262}
Chris Lattnerdad40622010-04-14 03:54:58 +00009263
Anton Yartsevfc83c602010-08-19 03:21:36 +00009264static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009265vec_vxor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009266{
David Blaikie3302f2b2013-01-16 23:08:36 +00009267 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9268 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009269}
9270
9271static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009272vec_vxor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009273{
David Blaikie3302f2b2013-01-16 23:08:36 +00009274 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9275 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009276}
9277
Anton Yartsev79d6af32010-09-18 00:39:16 +00009278/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009279
9280/* vec_extract */
9281
9282static signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009283vec_extract(vector signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009284{
David Blaikie3302f2b2013-01-16 23:08:36 +00009285 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009286}
9287
9288static unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009289vec_extract(vector unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009290{
David Blaikie3302f2b2013-01-16 23:08:36 +00009291 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009292}
9293
9294static short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009295vec_extract(vector short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009296{
David Blaikie3302f2b2013-01-16 23:08:36 +00009297 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009298}
9299
9300static unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009301vec_extract(vector unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009302{
David Blaikie3302f2b2013-01-16 23:08:36 +00009303 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009304}
9305
9306static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009307vec_extract(vector int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009308{
David Blaikie3302f2b2013-01-16 23:08:36 +00009309 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009310}
9311
9312static unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009313vec_extract(vector unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009314{
David Blaikie3302f2b2013-01-16 23:08:36 +00009315 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009316}
9317
9318static float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009319vec_extract(vector float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009320{
David Blaikie3302f2b2013-01-16 23:08:36 +00009321 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009322}
9323
9324/* vec_insert */
9325
9326static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009327vec_insert(signed char __a, vector signed char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009328{
David Blaikie3302f2b2013-01-16 23:08:36 +00009329 __b[__c] = __a;
9330 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009331}
9332
9333static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009334vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009335{
David Blaikie3302f2b2013-01-16 23:08:36 +00009336 __b[__c] = __a;
9337 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009338}
9339
9340static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009341vec_insert(short __a, vector short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009342{
David Blaikie3302f2b2013-01-16 23:08:36 +00009343 __b[__c] = __a;
9344 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009345}
9346
9347static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009348vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009349{
David Blaikie3302f2b2013-01-16 23:08:36 +00009350 __b[__c] = __a;
9351 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009352}
9353
9354static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009355vec_insert(int __a, vector int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009356{
David Blaikie3302f2b2013-01-16 23:08:36 +00009357 __b[__c] = __a;
9358 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009359}
9360
9361static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009362vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009363{
David Blaikie3302f2b2013-01-16 23:08:36 +00009364 __b[__c] = __a;
9365 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009366}
9367
9368static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009369vec_insert(float __a, vector float __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009370{
David Blaikie3302f2b2013-01-16 23:08:36 +00009371 __b[__c] = __a;
9372 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009373}
9374
9375/* vec_lvlx */
9376
9377static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009378vec_lvlx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009379{
David Blaikie3302f2b2013-01-16 23:08:36 +00009380 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009381 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009382 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009383}
9384
9385static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009386vec_lvlx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009387{
David Blaikie3302f2b2013-01-16 23:08:36 +00009388 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009389 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009390 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009391}
9392
9393static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009394vec_lvlx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009395{
David Blaikie3302f2b2013-01-16 23:08:36 +00009396 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009397 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009398 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009399}
9400
9401static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009402vec_lvlx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009403{
David Blaikie3302f2b2013-01-16 23:08:36 +00009404 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009405 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009406 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009407}
9408
9409static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009410vec_lvlx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009411{
David Blaikie3302f2b2013-01-16 23:08:36 +00009412 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009413 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009414 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009415}
9416
9417static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009418vec_lvlx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009419{
David Blaikie3302f2b2013-01-16 23:08:36 +00009420 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009421 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009422 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009423}
9424
9425static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009426vec_lvlx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009427{
David Blaikie3302f2b2013-01-16 23:08:36 +00009428 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009429 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009430 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009431}
9432
9433static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009434vec_lvlx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009435{
David Blaikie3302f2b2013-01-16 23:08:36 +00009436 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009437 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009438 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009439}
9440
9441static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009442vec_lvlx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009443{
David Blaikie3302f2b2013-01-16 23:08:36 +00009444 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009445 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009446 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009447}
9448
9449static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009450vec_lvlx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009451{
David Blaikie3302f2b2013-01-16 23:08:36 +00009452 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009453 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009454 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009455}
9456
9457static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009458vec_lvlx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009459{
David Blaikie3302f2b2013-01-16 23:08:36 +00009460 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009461 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009462 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009463}
9464
9465static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009466vec_lvlx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009467{
David Blaikie3302f2b2013-01-16 23:08:36 +00009468 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009469 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009470 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009471}
9472
9473static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009474vec_lvlx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009475{
David Blaikie3302f2b2013-01-16 23:08:36 +00009476 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009477 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009478 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009479}
9480
9481static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009482vec_lvlx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009483{
David Blaikie3302f2b2013-01-16 23:08:36 +00009484 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009485 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009486 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009487}
9488
9489static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009490vec_lvlx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009491{
David Blaikie3302f2b2013-01-16 23:08:36 +00009492 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009493 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009494 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009495}
9496
9497static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009498vec_lvlx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009499{
David Blaikie3302f2b2013-01-16 23:08:36 +00009500 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009501 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009502 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009503}
9504
9505static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009506vec_lvlx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009507{
David Blaikie3302f2b2013-01-16 23:08:36 +00009508 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009509 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009510 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009511}
9512
9513static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009514vec_lvlx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009515{
David Blaikie3302f2b2013-01-16 23:08:36 +00009516 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009517 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009518 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009519}
9520
9521/* vec_lvlxl */
9522
9523static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009524vec_lvlxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009525{
David Blaikie3302f2b2013-01-16 23:08:36 +00009526 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009527 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009528 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009529}
9530
9531static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009532vec_lvlxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009533{
David Blaikie3302f2b2013-01-16 23:08:36 +00009534 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009535 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009536 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009537}
9538
9539static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009540vec_lvlxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009541{
David Blaikie3302f2b2013-01-16 23:08:36 +00009542 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009543 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009544 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009545}
9546
9547static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009548vec_lvlxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009549{
David Blaikie3302f2b2013-01-16 23:08:36 +00009550 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009551 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009552 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009553}
9554
9555static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009556vec_lvlxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009557{
David Blaikie3302f2b2013-01-16 23:08:36 +00009558 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009559 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009560 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009561}
9562
9563static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009564vec_lvlxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009565{
David Blaikie3302f2b2013-01-16 23:08:36 +00009566 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009567 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009568 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009569}
9570
9571static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009572vec_lvlxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009573{
David Blaikie3302f2b2013-01-16 23:08:36 +00009574 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009575 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009576 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009577}
9578
9579static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009580vec_lvlxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009581{
David Blaikie3302f2b2013-01-16 23:08:36 +00009582 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009583 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009584 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009585}
9586
9587static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009588vec_lvlxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009589{
David Blaikie3302f2b2013-01-16 23:08:36 +00009590 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009591 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009592 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009593}
9594
9595static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009596vec_lvlxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009597{
David Blaikie3302f2b2013-01-16 23:08:36 +00009598 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009599 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009600 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009601}
9602
9603static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009604vec_lvlxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009605{
David Blaikie3302f2b2013-01-16 23:08:36 +00009606 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009607 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009608 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009609}
9610
9611static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009612vec_lvlxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009613{
David Blaikie3302f2b2013-01-16 23:08:36 +00009614 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009615 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009616 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009617}
9618
9619static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009620vec_lvlxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009621{
David Blaikie3302f2b2013-01-16 23:08:36 +00009622 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009623 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009624 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009625}
9626
9627static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009628vec_lvlxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009629{
David Blaikie3302f2b2013-01-16 23:08:36 +00009630 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009631 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009632 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009633}
9634
9635static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009636vec_lvlxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009637{
David Blaikie3302f2b2013-01-16 23:08:36 +00009638 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009639 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009640 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009641}
9642
9643static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009644vec_lvlxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009645{
David Blaikie3302f2b2013-01-16 23:08:36 +00009646 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009647 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009648 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009649}
9650
9651static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009652vec_lvlxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009653{
David Blaikie3302f2b2013-01-16 23:08:36 +00009654 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009655 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009656 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009657}
9658
9659static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009660vec_lvlxl(int __a, vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009661{
David Blaikie3302f2b2013-01-16 23:08:36 +00009662 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009663 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009664 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009665}
9666
9667/* vec_lvrx */
9668
9669static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009670vec_lvrx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009671{
9672 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009673 vec_ld(__a, __b),
9674 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009675}
9676
9677static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009678vec_lvrx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009679{
9680 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009681 vec_ld(__a, __b),
9682 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009683}
9684
9685static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009686vec_lvrx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009687{
9688 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009689 vec_ld(__a, __b),
9690 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009691}
9692
9693static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009694vec_lvrx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009695{
9696 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009697 vec_ld(__a, __b),
9698 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009699}
9700
9701static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009702vec_lvrx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009703{
9704 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009705 vec_ld(__a, __b),
9706 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009707}
9708
9709static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009710vec_lvrx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009711{
9712 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009713 vec_ld(__a, __b),
9714 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009715}
9716
9717static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009718vec_lvrx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009719{
9720 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009721 vec_ld(__a, __b),
9722 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009723}
9724
9725static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009726vec_lvrx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009727{
9728 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009729 vec_ld(__a, __b),
9730 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009731}
9732
9733static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009734vec_lvrx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009735{
9736 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009737 vec_ld(__a, __b),
9738 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009739}
9740
9741static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009742vec_lvrx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009743{
9744 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009745 vec_ld(__a, __b),
9746 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009747}
9748
9749static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009750vec_lvrx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009751{
9752 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009753 vec_ld(__a, __b),
9754 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009755}
9756
9757static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009758vec_lvrx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009759{
9760 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009761 vec_ld(__a, __b),
9762 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009763}
9764
9765static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009766vec_lvrx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009767{
9768 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009769 vec_ld(__a, __b),
9770 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009771}
9772
9773static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009774vec_lvrx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009775{
9776 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009777 vec_ld(__a, __b),
9778 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009779}
9780
9781static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009782vec_lvrx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009783{
9784 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009785 vec_ld(__a, __b),
9786 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009787}
9788
9789static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009790vec_lvrx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009791{
9792 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009793 vec_ld(__a, __b),
9794 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009795}
9796
9797static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009798vec_lvrx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009799{
9800 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009801 vec_ld(__a, __b),
9802 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009803}
9804
9805static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009806vec_lvrx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009807{
9808 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009809 vec_ld(__a, __b),
9810 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009811}
9812
9813/* vec_lvrxl */
9814
9815static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009816vec_lvrxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009817{
9818 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009819 vec_ldl(__a, __b),
9820 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009821}
9822
9823static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009824vec_lvrxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009825{
9826 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009827 vec_ldl(__a, __b),
9828 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009829}
9830
9831static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009832vec_lvrxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009833{
9834 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009835 vec_ldl(__a, __b),
9836 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009837}
9838
9839static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009840vec_lvrxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009841{
9842 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009843 vec_ldl(__a, __b),
9844 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009845}
9846
9847static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009848vec_lvrxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009849{
9850 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009851 vec_ldl(__a, __b),
9852 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009853}
9854
9855static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009856vec_lvrxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009857{
9858 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009859 vec_ldl(__a, __b),
9860 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009861}
9862
9863static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009864vec_lvrxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009865{
9866 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009867 vec_ldl(__a, __b),
9868 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009869}
9870
9871static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009872vec_lvrxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009873{
9874 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009875 vec_ldl(__a, __b),
9876 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009877}
9878
9879static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009880vec_lvrxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009881{
9882 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009883 vec_ldl(__a, __b),
9884 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009885}
9886
9887static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009888vec_lvrxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009889{
9890 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009891 vec_ldl(__a, __b),
9892 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009893}
9894
9895static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009896vec_lvrxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009897{
9898 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009899 vec_ldl(__a, __b),
9900 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009901}
9902
9903static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009904vec_lvrxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009905{
9906 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009907 vec_ldl(__a, __b),
9908 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009909}
9910
9911static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009912vec_lvrxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009913{
9914 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009915 vec_ldl(__a, __b),
9916 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009917}
9918
9919static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009920vec_lvrxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009921{
9922 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009923 vec_ldl(__a, __b),
9924 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009925}
9926
9927static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009928vec_lvrxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009929{
9930 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009931 vec_ldl(__a, __b),
9932 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009933}
9934
9935static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009936vec_lvrxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009937{
9938 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009939 vec_ldl(__a, __b),
9940 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009941}
9942
9943static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009944vec_lvrxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009945{
9946 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009947 vec_ldl(__a, __b),
9948 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009949}
9950
9951static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009952vec_lvrxl(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009953{
9954 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009955 vec_ldl(__a, __b),
9956 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009957}
9958
9959/* vec_stvlx */
9960
9961static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009962vec_stvlx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009963{
David Blaikie3302f2b2013-01-16 23:08:36 +00009964 return vec_st(vec_perm(vec_lvrx(__b, __c),
9965 __a,
9966 vec_lvsr(__b, __c)),
9967 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009968}
9969
9970static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009971vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009972{
David Blaikie3302f2b2013-01-16 23:08:36 +00009973 return vec_st(vec_perm(vec_lvrx(__b, __c),
9974 __a,
9975 vec_lvsr(__b, (unsigned char *)__c)),
9976 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009977}
9978
9979static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009980vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009981{
David Blaikie3302f2b2013-01-16 23:08:36 +00009982 return vec_st(vec_perm(vec_lvrx(__b, __c),
9983 __a,
9984 vec_lvsr(__b, __c)),
9985 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009986}
9987
9988static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009989vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009990{
David Blaikie3302f2b2013-01-16 23:08:36 +00009991 return vec_st(vec_perm(vec_lvrx(__b, __c),
9992 __a,
9993 vec_lvsr(__b, (unsigned char *)__c)),
9994 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009995}
9996
9997static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009998vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009999{
David Blaikie3302f2b2013-01-16 23:08:36 +000010000 return vec_st(vec_perm(vec_lvrx(__b, __c),
10001 __a,
10002 vec_lvsr(__b, (unsigned char *)__c)),
10003 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010004}
10005
10006static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010007vec_stvlx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010008{
David Blaikie3302f2b2013-01-16 23:08:36 +000010009 return vec_st(vec_perm(vec_lvrx(__b, __c),
10010 __a,
10011 vec_lvsr(__b, __c)),
10012 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010013}
10014
10015static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010016vec_stvlx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010017{
David Blaikie3302f2b2013-01-16 23:08:36 +000010018 return vec_st(vec_perm(vec_lvrx(__b, __c),
10019 __a,
10020 vec_lvsr(__b, (unsigned char *)__c)),
10021 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010022}
10023
10024static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010025vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010026{
David Blaikie3302f2b2013-01-16 23:08:36 +000010027 return vec_st(vec_perm(vec_lvrx(__b, __c),
10028 __a,
10029 vec_lvsr(__b, __c)),
10030 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010031}
10032
10033static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010034vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010035{
David Blaikie3302f2b2013-01-16 23:08:36 +000010036 return vec_st(vec_perm(vec_lvrx(__b, __c),
10037 __a,
10038 vec_lvsr(__b, (unsigned char *)__c)),
10039 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010040}
10041
10042static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010043vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010044{
David Blaikie3302f2b2013-01-16 23:08:36 +000010045 return vec_st(vec_perm(vec_lvrx(__b, __c),
10046 __a,
10047 vec_lvsr(__b, (unsigned char *)__c)),
10048 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010049}
10050
10051static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010052vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010053{
David Blaikie3302f2b2013-01-16 23:08:36 +000010054 return vec_st(vec_perm(vec_lvrx(__b, __c),
10055 __a,
10056 vec_lvsr(__b, (unsigned char *)__c)),
10057 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010058}
10059
10060static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010061vec_stvlx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010062{
David Blaikie3302f2b2013-01-16 23:08:36 +000010063 return vec_st(vec_perm(vec_lvrx(__b, __c),
10064 __a,
10065 vec_lvsr(__b, __c)),
10066 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010067}
10068
10069static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010070vec_stvlx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010071{
David Blaikie3302f2b2013-01-16 23:08:36 +000010072 return vec_st(vec_perm(vec_lvrx(__b, __c),
10073 __a,
10074 vec_lvsr(__b, (unsigned char *)__c)),
10075 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010076}
10077
10078static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010079vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010080{
David Blaikie3302f2b2013-01-16 23:08:36 +000010081 return vec_st(vec_perm(vec_lvrx(__b, __c),
10082 __a,
10083 vec_lvsr(__b, __c)),
10084 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010085}
10086
10087static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010088vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010089{
David Blaikie3302f2b2013-01-16 23:08:36 +000010090 return vec_st(vec_perm(vec_lvrx(__b, __c),
10091 __a,
10092 vec_lvsr(__b, (unsigned char *)__c)),
10093 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010094}
10095
10096static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010097vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010098{
David Blaikie3302f2b2013-01-16 23:08:36 +000010099 return vec_st(vec_perm(vec_lvrx(__b, __c),
10100 __a,
10101 vec_lvsr(__b, (unsigned char *)__c)),
10102 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010103}
10104
10105static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010106vec_stvlx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010107{
David Blaikie3302f2b2013-01-16 23:08:36 +000010108 return vec_st(vec_perm(vec_lvrx(__b, __c),
10109 __a,
10110 vec_lvsr(__b, (unsigned char *)__c)),
10111 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010112}
10113
10114/* vec_stvlxl */
10115
10116static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010117vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010118{
David Blaikie3302f2b2013-01-16 23:08:36 +000010119 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10120 __a,
10121 vec_lvsr(__b, __c)),
10122 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010123}
10124
10125static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010126vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010127{
David Blaikie3302f2b2013-01-16 23:08:36 +000010128 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10129 __a,
10130 vec_lvsr(__b, (unsigned char *)__c)),
10131 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010132}
10133
10134static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010135vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010136{
David Blaikie3302f2b2013-01-16 23:08:36 +000010137 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10138 __a,
10139 vec_lvsr(__b, __c)),
10140 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010141}
10142
10143static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010144vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010145{
David Blaikie3302f2b2013-01-16 23:08:36 +000010146 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10147 __a,
10148 vec_lvsr(__b, (unsigned char *)__c)),
10149 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010150}
10151
10152static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010153vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010154{
David Blaikie3302f2b2013-01-16 23:08:36 +000010155 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10156 __a,
10157 vec_lvsr(__b, (unsigned char *)__c)),
10158 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010159}
10160
10161static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010162vec_stvlxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010163{
David Blaikie3302f2b2013-01-16 23:08:36 +000010164 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10165 __a,
10166 vec_lvsr(__b, __c)),
10167 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010168}
10169
10170static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010171vec_stvlxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010172{
David Blaikie3302f2b2013-01-16 23:08:36 +000010173 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10174 __a,
10175 vec_lvsr(__b, (unsigned char *)__c)),
10176 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010177}
10178
10179static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010180vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010181{
David Blaikie3302f2b2013-01-16 23:08:36 +000010182 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10183 __a,
10184 vec_lvsr(__b, __c)),
10185 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010186}
10187
10188static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010189vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010190{
David Blaikie3302f2b2013-01-16 23:08:36 +000010191 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10192 __a,
10193 vec_lvsr(__b, (unsigned char *)__c)),
10194 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010195}
10196
10197static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010198vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010199{
David Blaikie3302f2b2013-01-16 23:08:36 +000010200 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10201 __a,
10202 vec_lvsr(__b, (unsigned char *)__c)),
10203 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010204}
10205
10206static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010207vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010208{
David Blaikie3302f2b2013-01-16 23:08:36 +000010209 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10210 __a,
10211 vec_lvsr(__b, (unsigned char *)__c)),
10212 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010213}
10214
10215static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010216vec_stvlxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010217{
David Blaikie3302f2b2013-01-16 23:08:36 +000010218 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10219 __a,
10220 vec_lvsr(__b, __c)),
10221 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010222}
10223
10224static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010225vec_stvlxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010226{
David Blaikie3302f2b2013-01-16 23:08:36 +000010227 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10228 __a,
10229 vec_lvsr(__b, (unsigned char *)__c)),
10230 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010231}
10232
10233static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010234vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010235{
David Blaikie3302f2b2013-01-16 23:08:36 +000010236 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10237 __a,
10238 vec_lvsr(__b, __c)),
10239 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010240}
10241
10242static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010243vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010244{
David Blaikie3302f2b2013-01-16 23:08:36 +000010245 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10246 __a,
10247 vec_lvsr(__b, (unsigned char *)__c)),
10248 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010249}
10250
10251static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010252vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010253{
David Blaikie3302f2b2013-01-16 23:08:36 +000010254 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10255 __a,
10256 vec_lvsr(__b, (unsigned char *)__c)),
10257 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010258}
10259
10260static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010261vec_stvlxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010262{
David Blaikie3302f2b2013-01-16 23:08:36 +000010263 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10264 __a,
10265 vec_lvsr(__b, (unsigned char *)__c)),
10266 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010267}
10268
10269/* vec_stvrx */
10270
10271static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010272vec_stvrx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010273{
David Blaikie3302f2b2013-01-16 23:08:36 +000010274 return vec_st(vec_perm(__a,
10275 vec_lvlx(__b, __c),
10276 vec_lvsr(__b, __c)),
10277 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010278}
10279
10280static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010281vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010282{
David Blaikie3302f2b2013-01-16 23:08:36 +000010283 return vec_st(vec_perm(__a,
10284 vec_lvlx(__b, __c),
10285 vec_lvsr(__b, (unsigned char *)__c)),
10286 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010287}
10288
10289static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010290vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010291{
David Blaikie3302f2b2013-01-16 23:08:36 +000010292 return vec_st(vec_perm(__a,
10293 vec_lvlx(__b, __c),
10294 vec_lvsr(__b, __c)),
10295 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010296}
10297
10298static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010299vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010300{
David Blaikie3302f2b2013-01-16 23:08:36 +000010301 return vec_st(vec_perm(__a,
10302 vec_lvlx(__b, __c),
10303 vec_lvsr(__b, (unsigned char *)__c)),
10304 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010305}
10306
10307static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010308vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010309{
David Blaikie3302f2b2013-01-16 23:08:36 +000010310 return vec_st(vec_perm(__a,
10311 vec_lvlx(__b, __c),
10312 vec_lvsr(__b, (unsigned char *)__c)),
10313 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010314}
10315
10316static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010317vec_stvrx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010318{
David Blaikie3302f2b2013-01-16 23:08:36 +000010319 return vec_st(vec_perm(__a,
10320 vec_lvlx(__b, __c),
10321 vec_lvsr(__b, __c)),
10322 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010323}
10324
10325static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010326vec_stvrx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010327{
David Blaikie3302f2b2013-01-16 23:08:36 +000010328 return vec_st(vec_perm(__a,
10329 vec_lvlx(__b, __c),
10330 vec_lvsr(__b, (unsigned char *)__c)),
10331 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010332}
10333
10334static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010335vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010336{
David Blaikie3302f2b2013-01-16 23:08:36 +000010337 return vec_st(vec_perm(__a,
10338 vec_lvlx(__b, __c),
10339 vec_lvsr(__b, __c)),
10340 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010341}
10342
10343static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010344vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010345{
David Blaikie3302f2b2013-01-16 23:08:36 +000010346 return vec_st(vec_perm(__a,
10347 vec_lvlx(__b, __c),
10348 vec_lvsr(__b, (unsigned char *)__c)),
10349 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010350}
10351
10352static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010353vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010354{
David Blaikie3302f2b2013-01-16 23:08:36 +000010355 return vec_st(vec_perm(__a,
10356 vec_lvlx(__b, __c),
10357 vec_lvsr(__b, (unsigned char *)__c)),
10358 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010359}
10360
10361static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010362vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010363{
David Blaikie3302f2b2013-01-16 23:08:36 +000010364 return vec_st(vec_perm(__a,
10365 vec_lvlx(__b, __c),
10366 vec_lvsr(__b, (unsigned char *)__c)),
10367 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010368}
10369
10370static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010371vec_stvrx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010372{
David Blaikie3302f2b2013-01-16 23:08:36 +000010373 return vec_st(vec_perm(__a,
10374 vec_lvlx(__b, __c),
10375 vec_lvsr(__b, __c)),
10376 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010377}
10378
10379static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010380vec_stvrx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010381{
David Blaikie3302f2b2013-01-16 23:08:36 +000010382 return vec_st(vec_perm(__a,
10383 vec_lvlx(__b, __c),
10384 vec_lvsr(__b, (unsigned char *)__c)),
10385 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010386}
10387
10388static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010389vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010390{
David Blaikie3302f2b2013-01-16 23:08:36 +000010391 return vec_st(vec_perm(__a,
10392 vec_lvlx(__b, __c),
10393 vec_lvsr(__b, __c)),
10394 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010395}
10396
10397static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010398vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010399{
David Blaikie3302f2b2013-01-16 23:08:36 +000010400 return vec_st(vec_perm(__a,
10401 vec_lvlx(__b, __c),
10402 vec_lvsr(__b, (unsigned char *)__c)),
10403 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010404}
10405
10406static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010407vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010408{
David Blaikie3302f2b2013-01-16 23:08:36 +000010409 return vec_st(vec_perm(__a,
10410 vec_lvlx(__b, __c),
10411 vec_lvsr(__b, (unsigned char *)__c)),
10412 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010413}
10414
10415static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010416vec_stvrx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010417{
David Blaikie3302f2b2013-01-16 23:08:36 +000010418 return vec_st(vec_perm(__a,
10419 vec_lvlx(__b, __c),
10420 vec_lvsr(__b, (unsigned char *)__c)),
10421 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010422}
10423
10424/* vec_stvrxl */
10425
10426static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010427vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010428{
David Blaikie3302f2b2013-01-16 23:08:36 +000010429 return vec_stl(vec_perm(__a,
10430 vec_lvlx(__b, __c),
10431 vec_lvsr(__b, __c)),
10432 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010433}
10434
10435static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010436vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010437{
David Blaikie3302f2b2013-01-16 23:08:36 +000010438 return vec_stl(vec_perm(__a,
10439 vec_lvlx(__b, __c),
10440 vec_lvsr(__b, (unsigned char *)__c)),
10441 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010442}
10443
10444static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010445vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010446{
David Blaikie3302f2b2013-01-16 23:08:36 +000010447 return vec_stl(vec_perm(__a,
10448 vec_lvlx(__b, __c),
10449 vec_lvsr(__b, __c)),
10450 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010451}
10452
10453static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010454vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010455{
David Blaikie3302f2b2013-01-16 23:08:36 +000010456 return vec_stl(vec_perm(__a,
10457 vec_lvlx(__b, __c),
10458 vec_lvsr(__b, (unsigned char *)__c)),
10459 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010460}
10461
10462static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010463vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010464{
David Blaikie3302f2b2013-01-16 23:08:36 +000010465 return vec_stl(vec_perm(__a,
10466 vec_lvlx(__b, __c),
10467 vec_lvsr(__b, (unsigned char *)__c)),
10468 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010469}
10470
10471static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010472vec_stvrxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010473{
David Blaikie3302f2b2013-01-16 23:08:36 +000010474 return vec_stl(vec_perm(__a,
10475 vec_lvlx(__b, __c),
10476 vec_lvsr(__b, __c)),
10477 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010478}
10479
10480static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010481vec_stvrxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010482{
David Blaikie3302f2b2013-01-16 23:08:36 +000010483 return vec_stl(vec_perm(__a,
10484 vec_lvlx(__b, __c),
10485 vec_lvsr(__b, (unsigned char *)__c)),
10486 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010487}
10488
10489static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010490vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010491{
David Blaikie3302f2b2013-01-16 23:08:36 +000010492 return vec_stl(vec_perm(__a,
10493 vec_lvlx(__b, __c),
10494 vec_lvsr(__b, __c)),
10495 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010496}
10497
10498static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010499vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010500{
David Blaikie3302f2b2013-01-16 23:08:36 +000010501 return vec_stl(vec_perm(__a,
10502 vec_lvlx(__b, __c),
10503 vec_lvsr(__b, (unsigned char *)__c)),
10504 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010505}
10506
10507static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010508vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010509{
David Blaikie3302f2b2013-01-16 23:08:36 +000010510 return vec_stl(vec_perm(__a,
10511 vec_lvlx(__b, __c),
10512 vec_lvsr(__b, (unsigned char *)__c)),
10513 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010514}
10515
10516static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010517vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010518{
David Blaikie3302f2b2013-01-16 23:08:36 +000010519 return vec_stl(vec_perm(__a,
10520 vec_lvlx(__b, __c),
10521 vec_lvsr(__b, (unsigned char *)__c)),
10522 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010523}
10524
10525static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010526vec_stvrxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010527{
David Blaikie3302f2b2013-01-16 23:08:36 +000010528 return vec_stl(vec_perm(__a,
10529 vec_lvlx(__b, __c),
10530 vec_lvsr(__b, __c)),
10531 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010532}
10533
10534static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010535vec_stvrxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010536{
David Blaikie3302f2b2013-01-16 23:08:36 +000010537 return vec_stl(vec_perm(__a,
10538 vec_lvlx(__b, __c),
10539 vec_lvsr(__b, (unsigned char *)__c)),
10540 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010541}
10542
10543static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010544vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010545{
David Blaikie3302f2b2013-01-16 23:08:36 +000010546 return vec_stl(vec_perm(__a,
10547 vec_lvlx(__b, __c),
10548 vec_lvsr(__b, __c)),
10549 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010550}
10551
10552static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010553vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010554{
David Blaikie3302f2b2013-01-16 23:08:36 +000010555 return vec_stl(vec_perm(__a,
10556 vec_lvlx(__b, __c),
10557 vec_lvsr(__b, (unsigned char *)__c)),
10558 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010559}
10560
10561static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010562vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010563{
David Blaikie3302f2b2013-01-16 23:08:36 +000010564 return vec_stl(vec_perm(__a,
10565 vec_lvlx(__b, __c),
10566 vec_lvsr(__b, (unsigned char *)__c)),
10567 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010568}
10569
10570static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010571vec_stvrxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010572{
David Blaikie3302f2b2013-01-16 23:08:36 +000010573 return vec_stl(vec_perm(__a,
10574 vec_lvlx(__b, __c),
10575 vec_lvsr(__b, (unsigned char *)__c)),
10576 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010577}
10578
10579/* vec_promote */
10580
10581static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010582vec_promote(signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010583{
David Blaikie3302f2b2013-01-16 23:08:36 +000010584 vector signed char __res = (vector signed char)(0);
10585 __res[__b] = __a;
10586 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010587}
10588
10589static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010590vec_promote(unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010591{
David Blaikie3302f2b2013-01-16 23:08:36 +000010592 vector unsigned char __res = (vector unsigned char)(0);
10593 __res[__b] = __a;
10594 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010595}
10596
10597static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010598vec_promote(short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010599{
David Blaikie3302f2b2013-01-16 23:08:36 +000010600 vector short __res = (vector short)(0);
10601 __res[__b] = __a;
10602 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010603}
10604
10605static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010606vec_promote(unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010607{
David Blaikie3302f2b2013-01-16 23:08:36 +000010608 vector unsigned short __res = (vector unsigned short)(0);
10609 __res[__b] = __a;
10610 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010611}
10612
10613static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010614vec_promote(int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010615{
David Blaikie3302f2b2013-01-16 23:08:36 +000010616 vector int __res = (vector int)(0);
10617 __res[__b] = __a;
10618 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010619}
10620
10621static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010622vec_promote(unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010623{
David Blaikie3302f2b2013-01-16 23:08:36 +000010624 vector unsigned int __res = (vector unsigned int)(0);
10625 __res[__b] = __a;
10626 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010627}
10628
10629static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010630vec_promote(float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010631{
David Blaikie3302f2b2013-01-16 23:08:36 +000010632 vector float __res = (vector float)(0);
10633 __res[__b] = __a;
10634 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010635}
10636
10637/* vec_splats */
10638
10639static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010640vec_splats(signed char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010641{
David Blaikie3302f2b2013-01-16 23:08:36 +000010642 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010643}
10644
10645static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010646vec_splats(unsigned char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010647{
David Blaikie3302f2b2013-01-16 23:08:36 +000010648 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010649}
10650
10651static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010652vec_splats(short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010653{
David Blaikie3302f2b2013-01-16 23:08:36 +000010654 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010655}
10656
10657static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010658vec_splats(unsigned short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010659{
David Blaikie3302f2b2013-01-16 23:08:36 +000010660 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010661}
10662
10663static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010664vec_splats(int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010665{
David Blaikie3302f2b2013-01-16 23:08:36 +000010666 return (vector int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010667}
10668
10669static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010670vec_splats(unsigned int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010671{
David Blaikie3302f2b2013-01-16 23:08:36 +000010672 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010673}
10674
10675static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010676vec_splats(float __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010677{
David Blaikie3302f2b2013-01-16 23:08:36 +000010678 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010679}
10680
Anton Yartsev79d6af32010-09-18 00:39:16 +000010681/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000010682
Chris Lattnerdad40622010-04-14 03:54:58 +000010683/* vec_all_eq */
10684
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010685static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010686vec_all_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010687{
David Blaikie3302f2b2013-01-16 23:08:36 +000010688 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010689}
10690
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010691static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010692vec_all_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010693{
David Blaikie3302f2b2013-01-16 23:08:36 +000010694 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010695}
10696
10697static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010698vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010699{
David Blaikie3302f2b2013-01-16 23:08:36 +000010700 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010701}
10702
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010703static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010704vec_all_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010705{
David Blaikie3302f2b2013-01-16 23:08:36 +000010706 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010707}
10708
10709static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010710vec_all_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010711{
David Blaikie3302f2b2013-01-16 23:08:36 +000010712 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010713}
10714
10715static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010716vec_all_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010717{
David Blaikie3302f2b2013-01-16 23:08:36 +000010718 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010719}
10720
10721static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010722vec_all_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010723{
David Blaikie3302f2b2013-01-16 23:08:36 +000010724 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010725}
10726
10727static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010728vec_all_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010729{
David Blaikie3302f2b2013-01-16 23:08:36 +000010730 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010731}
10732
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010733static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010734vec_all_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010735{
David Blaikie3302f2b2013-01-16 23:08:36 +000010736 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010737}
10738
10739static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010740vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010741{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010742 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010743 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010744}
10745
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010746static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010747vec_all_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010748{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010749 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010750 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010751}
10752
10753static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010754vec_all_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010755{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010756 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010757 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010758}
10759
10760static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010761vec_all_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010762{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010763 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010764 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010765}
10766
10767static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010768vec_all_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010769{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010770 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010771 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__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_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010776{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010777 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010778 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010779}
10780
10781static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010782vec_all_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010783{
David Blaikie3302f2b2013-01-16 23:08:36 +000010784 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010785}
10786
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010787static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010788vec_all_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010789{
David Blaikie3302f2b2013-01-16 23:08:36 +000010790 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010791}
10792
10793static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010794vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010795{
David Blaikie3302f2b2013-01-16 23:08:36 +000010796 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010797}
10798
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010799static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010800vec_all_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010801{
David Blaikie3302f2b2013-01-16 23:08:36 +000010802 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010803}
10804
10805static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010806vec_all_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010807{
David Blaikie3302f2b2013-01-16 23:08:36 +000010808 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010809}
10810
10811static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010812vec_all_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010813{
David Blaikie3302f2b2013-01-16 23:08:36 +000010814 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010815}
10816
10817static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010818vec_all_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010819{
David Blaikie3302f2b2013-01-16 23:08:36 +000010820 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010821}
10822
10823static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010824vec_all_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010825{
David Blaikie3302f2b2013-01-16 23:08:36 +000010826 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010827}
10828
10829/* vec_all_ge */
10830
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010831static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010832vec_all_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010833{
David Blaikie3302f2b2013-01-16 23:08:36 +000010834 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010835}
10836
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010837static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010838vec_all_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010839{
David Blaikie3302f2b2013-01-16 23:08:36 +000010840 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010841}
10842
10843static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010844vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010845{
David Blaikie3302f2b2013-01-16 23:08:36 +000010846 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010847}
10848
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010849static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010850vec_all_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010851{
David Blaikie3302f2b2013-01-16 23:08:36 +000010852 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010853}
10854
10855static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010856vec_all_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010857{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010858 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010859 (vector unsigned char)__b,
10860 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010861}
10862
10863static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010864vec_all_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010865{
David Blaikie3302f2b2013-01-16 23:08:36 +000010866 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010867}
10868
10869static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010870vec_all_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010871{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010872 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010873 (vector unsigned char)__b,
10874 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010875}
10876
10877static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010878vec_all_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010879{
David Blaikie3302f2b2013-01-16 23:08:36 +000010880 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010881}
10882
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010883static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010884vec_all_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010885{
David Blaikie3302f2b2013-01-16 23:08:36 +000010886 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010887}
10888
10889static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010890vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010891{
David Blaikie3302f2b2013-01-16 23:08:36 +000010892 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010893}
10894
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010895static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010896vec_all_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010897{
David Blaikie3302f2b2013-01-16 23:08:36 +000010898 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010899}
10900
10901static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010902vec_all_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010903{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010904 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010905 (vector unsigned short)__b,
10906 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010907}
10908
10909static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010910vec_all_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010911{
David Blaikie3302f2b2013-01-16 23:08:36 +000010912 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010913}
10914
10915static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010916vec_all_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010917{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010918 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010919 (vector unsigned short)__b,
10920 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010921}
10922
10923static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010924vec_all_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010925{
David Blaikie3302f2b2013-01-16 23:08:36 +000010926 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010927}
10928
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010929static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010930vec_all_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010931{
David Blaikie3302f2b2013-01-16 23:08:36 +000010932 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010933}
10934
10935static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010936vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010937{
David Blaikie3302f2b2013-01-16 23:08:36 +000010938 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010939}
10940
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010941static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010942vec_all_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010943{
David Blaikie3302f2b2013-01-16 23:08:36 +000010944 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010945}
10946
10947static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010948vec_all_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010949{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010950 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010951 (vector unsigned int)__b,
10952 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010953}
10954
10955static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010956vec_all_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010957{
David Blaikie3302f2b2013-01-16 23:08:36 +000010958 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010959}
10960
10961static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010962vec_all_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010963{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010964 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010965 (vector unsigned int)__b,
10966 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010967}
10968
10969static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010970vec_all_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010971{
David Blaikie3302f2b2013-01-16 23:08:36 +000010972 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010973}
10974
10975/* vec_all_gt */
10976
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010977static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010978vec_all_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010979{
David Blaikie3302f2b2013-01-16 23:08:36 +000010980 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010981}
10982
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010983static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010984vec_all_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010985{
David Blaikie3302f2b2013-01-16 23:08:36 +000010986 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010987}
10988
10989static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010990vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010991{
David Blaikie3302f2b2013-01-16 23:08:36 +000010992 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010993}
10994
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010995static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010996vec_all_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010997{
David Blaikie3302f2b2013-01-16 23:08:36 +000010998 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010999}
11000
11001static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011002vec_all_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011003{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011004 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011005 (vector unsigned char)__a,
11006 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011007}
11008
11009static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011010vec_all_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011011{
David Blaikie3302f2b2013-01-16 23:08:36 +000011012 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011013}
11014
11015static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011016vec_all_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011017{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011018 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011019 (vector unsigned char)__a,
11020 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011021}
11022
11023static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011024vec_all_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011025{
David Blaikie3302f2b2013-01-16 23:08:36 +000011026 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011027}
11028
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011029static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011030vec_all_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011031{
David Blaikie3302f2b2013-01-16 23:08:36 +000011032 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011033}
11034
11035static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011036vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011037{
David Blaikie3302f2b2013-01-16 23:08:36 +000011038 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011039}
11040
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011041static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011042vec_all_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011043{
David Blaikie3302f2b2013-01-16 23:08:36 +000011044 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011045}
11046
11047static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011048vec_all_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011049{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011050 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011051 (vector unsigned short)__a,
11052 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011053}
11054
11055static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011056vec_all_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011057{
David Blaikie3302f2b2013-01-16 23:08:36 +000011058 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011059}
11060
11061static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011062vec_all_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011063{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011064 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011065 (vector unsigned short)__a,
11066 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011067}
11068
11069static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011070vec_all_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011071{
David Blaikie3302f2b2013-01-16 23:08:36 +000011072 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011073}
11074
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011075static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011076vec_all_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011077{
David Blaikie3302f2b2013-01-16 23:08:36 +000011078 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011079}
11080
11081static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011082vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011083{
David Blaikie3302f2b2013-01-16 23:08:36 +000011084 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011085}
11086
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011087static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011088vec_all_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011089{
David Blaikie3302f2b2013-01-16 23:08:36 +000011090 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011091}
11092
11093static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011094vec_all_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011095{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011096 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011097 (vector unsigned int)__a,
11098 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011099}
11100
11101static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011102vec_all_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011103{
David Blaikie3302f2b2013-01-16 23:08:36 +000011104 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011105}
11106
11107static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011108vec_all_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011109{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011110 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011111 (vector unsigned int)__a,
11112 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011113}
11114
11115static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011116vec_all_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011117{
David Blaikie3302f2b2013-01-16 23:08:36 +000011118 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011119}
11120
11121/* vec_all_in */
11122
11123static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011124vec_all_in(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011125{
David Blaikie3302f2b2013-01-16 23:08:36 +000011126 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011127}
11128
11129/* vec_all_le */
11130
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011131static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011132vec_all_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011133{
David Blaikie3302f2b2013-01-16 23:08:36 +000011134 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011135}
11136
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011137static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011138vec_all_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011139{
David Blaikie3302f2b2013-01-16 23:08:36 +000011140 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011141}
11142
11143static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011144vec_all_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011145{
David Blaikie3302f2b2013-01-16 23:08:36 +000011146 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011147}
11148
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011149static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011150vec_all_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011151{
David Blaikie3302f2b2013-01-16 23:08:36 +000011152 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011153}
11154
11155static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011156vec_all_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011157{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011158 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011159 (vector unsigned char)__a,
11160 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011161}
11162
11163static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011164vec_all_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011165{
David Blaikie3302f2b2013-01-16 23:08:36 +000011166 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011167}
11168
11169static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011170vec_all_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011171{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011172 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011173 (vector unsigned char)__a,
11174 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011175}
11176
11177static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011178vec_all_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011179{
David Blaikie3302f2b2013-01-16 23:08:36 +000011180 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011181}
11182
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011183static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011184vec_all_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011185{
David Blaikie3302f2b2013-01-16 23:08:36 +000011186 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011187}
11188
11189static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011190vec_all_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011191{
David Blaikie3302f2b2013-01-16 23:08:36 +000011192 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011193}
11194
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011195static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011196vec_all_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011197{
David Blaikie3302f2b2013-01-16 23:08:36 +000011198 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011199}
11200
11201static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011202vec_all_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011203{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011204 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011205 (vector unsigned short)__a,
11206 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011207}
11208
11209static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011210vec_all_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011211{
David Blaikie3302f2b2013-01-16 23:08:36 +000011212 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011213}
11214
11215static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011216vec_all_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011217{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011218 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011219 (vector unsigned short)__a,
11220 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011221}
11222
11223static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011224vec_all_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011225{
David Blaikie3302f2b2013-01-16 23:08:36 +000011226 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011227}
11228
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011229static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011230vec_all_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011231{
David Blaikie3302f2b2013-01-16 23:08:36 +000011232 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011233}
11234
11235static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011236vec_all_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011237{
David Blaikie3302f2b2013-01-16 23:08:36 +000011238 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011239}
11240
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011241static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011242vec_all_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011243{
David Blaikie3302f2b2013-01-16 23:08:36 +000011244 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011245}
11246
11247static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011248vec_all_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011249{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011250 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011251 (vector unsigned int)__a,
11252 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011253}
11254
11255static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011256vec_all_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011257{
David Blaikie3302f2b2013-01-16 23:08:36 +000011258 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011259}
11260
11261static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011262vec_all_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011263{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011264 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011265 (vector unsigned int)__a,
11266 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011267}
11268
11269static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011270vec_all_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011271{
David Blaikie3302f2b2013-01-16 23:08:36 +000011272 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011273}
11274
11275/* vec_all_lt */
11276
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011277static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011278vec_all_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011279{
David Blaikie3302f2b2013-01-16 23:08:36 +000011280 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011281}
11282
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011283static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011284vec_all_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011285{
David Blaikie3302f2b2013-01-16 23:08:36 +000011286 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011287}
11288
11289static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011290vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011291{
David Blaikie3302f2b2013-01-16 23:08:36 +000011292 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011293}
11294
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011295static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011296vec_all_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011297{
David Blaikie3302f2b2013-01-16 23:08:36 +000011298 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011299}
11300
11301static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011302vec_all_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011303{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011304 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011305 (vector unsigned char)__b,
11306 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011307}
11308
11309static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011310vec_all_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011311{
David Blaikie3302f2b2013-01-16 23:08:36 +000011312 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011313}
11314
11315static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011316vec_all_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011317{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011318 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011319 (vector unsigned char)__b,
11320 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011321}
11322
11323static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011324vec_all_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011325{
David Blaikie3302f2b2013-01-16 23:08:36 +000011326 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011327}
11328
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011329static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011330vec_all_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011331{
David Blaikie3302f2b2013-01-16 23:08:36 +000011332 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011333}
11334
11335static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011336vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011337{
David Blaikie3302f2b2013-01-16 23:08:36 +000011338 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011339}
11340
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011341static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011342vec_all_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011343{
David Blaikie3302f2b2013-01-16 23:08:36 +000011344 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011345}
11346
11347static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011348vec_all_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011349{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011350 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011351 (vector unsigned short)__b,
11352 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011353}
11354
11355static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011356vec_all_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011357{
David Blaikie3302f2b2013-01-16 23:08:36 +000011358 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011359}
11360
11361static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011362vec_all_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011363{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011364 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011365 (vector unsigned short)__b,
11366 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011367}
11368
11369static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011370vec_all_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011371{
David Blaikie3302f2b2013-01-16 23:08:36 +000011372 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011373}
11374
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011375static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011376vec_all_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011377{
David Blaikie3302f2b2013-01-16 23:08:36 +000011378 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011379}
11380
11381static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011382vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011383{
David Blaikie3302f2b2013-01-16 23:08:36 +000011384 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011385}
11386
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011387static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011388vec_all_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011389{
David Blaikie3302f2b2013-01-16 23:08:36 +000011390 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011391}
11392
11393static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011394vec_all_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011395{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011396 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011397 (vector unsigned int)__b,
11398 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011399}
11400
11401static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011402vec_all_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011403{
David Blaikie3302f2b2013-01-16 23:08:36 +000011404 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011405}
11406
11407static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011408vec_all_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011409{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011410 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011411 (vector unsigned int)__b,
11412 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011413}
11414
11415static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011416vec_all_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011417{
David Blaikie3302f2b2013-01-16 23:08:36 +000011418 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011419}
11420
11421/* vec_all_nan */
11422
11423static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011424vec_all_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011425{
David Blaikie3302f2b2013-01-16 23:08:36 +000011426 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011427}
11428
11429/* vec_all_ne */
11430
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011431static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011432vec_all_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011433{
David Blaikie3302f2b2013-01-16 23:08:36 +000011434 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011435}
11436
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011437static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011438vec_all_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011439{
David Blaikie3302f2b2013-01-16 23:08:36 +000011440 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011441}
11442
11443static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011444vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011445{
David Blaikie3302f2b2013-01-16 23:08:36 +000011446 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011447}
11448
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011449static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011450vec_all_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011451{
David Blaikie3302f2b2013-01-16 23:08:36 +000011452 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011453}
11454
11455static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011456vec_all_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011457{
David Blaikie3302f2b2013-01-16 23:08:36 +000011458 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011459}
11460
11461static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011462vec_all_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011463{
David Blaikie3302f2b2013-01-16 23:08:36 +000011464 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011465}
11466
11467static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011468vec_all_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011469{
David Blaikie3302f2b2013-01-16 23:08:36 +000011470 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011471}
11472
11473static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011474vec_all_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011475{
David Blaikie3302f2b2013-01-16 23:08:36 +000011476 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011477}
11478
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011479static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011480vec_all_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011481{
David Blaikie3302f2b2013-01-16 23:08:36 +000011482 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011483}
11484
11485static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011486vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011487{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011488 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011489 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011490}
11491
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011492static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011493vec_all_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011494{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011495 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011496 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011497}
11498
11499static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011500vec_all_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011501{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011502 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011503 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011504}
11505
11506static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011507vec_all_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011508{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011509 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011510 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011511}
11512
11513static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011514vec_all_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011515{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011516 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011517 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011518}
11519
11520static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011521vec_all_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011522{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011523 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011524 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011525}
11526
11527static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011528vec_all_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011529{
David Blaikie3302f2b2013-01-16 23:08:36 +000011530 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011531}
11532
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011533static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011534vec_all_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011535{
David Blaikie3302f2b2013-01-16 23:08:36 +000011536 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011537}
11538
11539static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011540vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011541{
David Blaikie3302f2b2013-01-16 23:08:36 +000011542 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011543}
11544
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011545static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011546vec_all_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011547{
David Blaikie3302f2b2013-01-16 23:08:36 +000011548 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011549}
11550
11551static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011552vec_all_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011553{
David Blaikie3302f2b2013-01-16 23:08:36 +000011554 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011555}
11556
11557static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011558vec_all_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011559{
David Blaikie3302f2b2013-01-16 23:08:36 +000011560 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011561}
11562
11563static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011564vec_all_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011565{
David Blaikie3302f2b2013-01-16 23:08:36 +000011566 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011567}
11568
11569static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011570vec_all_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011571{
David Blaikie3302f2b2013-01-16 23:08:36 +000011572 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011573}
11574
11575/* vec_all_nge */
11576
11577static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011578vec_all_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011579{
David Blaikie3302f2b2013-01-16 23:08:36 +000011580 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011581}
11582
11583/* vec_all_ngt */
11584
11585static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011586vec_all_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011587{
David Blaikie3302f2b2013-01-16 23:08:36 +000011588 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011589}
11590
11591/* vec_all_nle */
11592
11593static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011594vec_all_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011595{
David Blaikie3302f2b2013-01-16 23:08:36 +000011596 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011597}
11598
11599/* vec_all_nlt */
11600
11601static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011602vec_all_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011603{
David Blaikie3302f2b2013-01-16 23:08:36 +000011604 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011605}
11606
11607/* vec_all_numeric */
11608
11609static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011610vec_all_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011611{
David Blaikie3302f2b2013-01-16 23:08:36 +000011612 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011613}
11614
11615/* vec_any_eq */
11616
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011617static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011618vec_any_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011619{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011620 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011621 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011622}
11623
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011624static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011625vec_any_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011626{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011627 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011628 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011629}
11630
11631static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011632vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011633{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011634 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011635 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011636}
11637
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011638static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011639vec_any_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011640{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011641 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011642 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011643}
11644
11645static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011646vec_any_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011647{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011648 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011649 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011650}
11651
11652static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011653vec_any_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011654{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011655 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011656 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011657}
11658
11659static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011660vec_any_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011661{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011662 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011663 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011664}
11665
11666static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011667vec_any_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011668{
David Blaikie3302f2b2013-01-16 23:08:36 +000011669 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011670}
11671
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011672static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011673vec_any_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011674{
David Blaikie3302f2b2013-01-16 23:08:36 +000011675 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011676}
11677
11678static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011679vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011680{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011681 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011682 (vector short)__a,
11683 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011684}
11685
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011686static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011687vec_any_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011688{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011689 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011690 (vector short)__a,
11691 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011692}
11693
11694static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011695vec_any_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011696{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011697 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011698 (vector short)__a,
11699 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011700}
11701
11702static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011703vec_any_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011704{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011705 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011706 (vector short)__a,
11707 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011708}
11709
11710static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011711vec_any_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011712{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011713 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011714 (vector short)__a,
11715 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011716}
11717
11718static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011719vec_any_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011720{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011721 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011722 (vector short)__a,
11723 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011724}
11725
11726static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011727vec_any_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011728{
David Blaikie3302f2b2013-01-16 23:08:36 +000011729 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011730}
11731
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011732static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011733vec_any_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011734{
David Blaikie3302f2b2013-01-16 23:08:36 +000011735 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011736}
11737
11738static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011739vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011740{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011741 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011742 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011743}
11744
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011745static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011746vec_any_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011747{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011748 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011749 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011750}
11751
11752static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011753vec_any_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011754{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011755 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011756 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011757}
11758
11759static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011760vec_any_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011761{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011762 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011763 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011764}
11765
11766static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011767vec_any_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011768{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011769 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011770 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011771}
11772
11773static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011774vec_any_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011775{
David Blaikie3302f2b2013-01-16 23:08:36 +000011776 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011777}
11778
11779/* vec_any_ge */
11780
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011781static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011782vec_any_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011783{
David Blaikie3302f2b2013-01-16 23:08:36 +000011784 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011785}
11786
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011787static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011788vec_any_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011789{
David Blaikie3302f2b2013-01-16 23:08:36 +000011790 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011791}
11792
11793static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011794vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011795{
David Blaikie3302f2b2013-01-16 23:08:36 +000011796 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011797}
11798
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011799static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011800vec_any_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011801{
David Blaikie3302f2b2013-01-16 23:08:36 +000011802 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011803}
11804
11805static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011806vec_any_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011807{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011808 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011809 (vector unsigned char)__b,
11810 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011811}
11812
11813static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011814vec_any_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011815{
David Blaikie3302f2b2013-01-16 23:08:36 +000011816 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011817}
11818
11819static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011820vec_any_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011821{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011822 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011823 (vector unsigned char)__b,
11824 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011825}
11826
11827static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011828vec_any_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011829{
David Blaikie3302f2b2013-01-16 23:08:36 +000011830 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011831}
11832
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011833static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011834vec_any_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011835{
David Blaikie3302f2b2013-01-16 23:08:36 +000011836 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__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_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011841{
David Blaikie3302f2b2013-01-16 23:08:36 +000011842 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011843}
11844
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011845static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011846vec_any_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011847{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011848 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011849 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011850}
11851
11852static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011853vec_any_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011854{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011855 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011856 (vector unsigned short)__b,
11857 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011858}
11859
11860static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011861vec_any_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011862{
11863 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011864 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011865}
11866
11867static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011868vec_any_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011869{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011870 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011871 (vector unsigned short)__b,
11872 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011873}
11874
11875static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011876vec_any_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011877{
David Blaikie3302f2b2013-01-16 23:08:36 +000011878 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011879}
11880
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011881static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011882vec_any_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011883{
David Blaikie3302f2b2013-01-16 23:08:36 +000011884 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__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_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011889{
David Blaikie3302f2b2013-01-16 23:08:36 +000011890 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011891}
11892
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011893static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011894vec_any_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011895{
David Blaikie3302f2b2013-01-16 23:08:36 +000011896 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011897}
11898
11899static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011900vec_any_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011901{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011902 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011903 (vector unsigned int)__b,
11904 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011905}
11906
11907static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011908vec_any_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011909{
David Blaikie3302f2b2013-01-16 23:08:36 +000011910 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011911}
11912
11913static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011914vec_any_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011915{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011916 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011917 (vector unsigned int)__b,
11918 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011919}
11920
11921static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011922vec_any_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011923{
David Blaikie3302f2b2013-01-16 23:08:36 +000011924 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011925}
11926
11927/* vec_any_gt */
11928
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011929static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011930vec_any_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011931{
David Blaikie3302f2b2013-01-16 23:08:36 +000011932 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011933}
11934
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011935static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011936vec_any_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011937{
David Blaikie3302f2b2013-01-16 23:08:36 +000011938 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011939}
11940
11941static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011942vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011943{
David Blaikie3302f2b2013-01-16 23:08:36 +000011944 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011945}
11946
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011947static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011948vec_any_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011949{
11950 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011951 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011952}
11953
11954static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011955vec_any_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011956{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011957 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011958 (vector unsigned char)__a,
11959 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011960}
11961
11962static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011963vec_any_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011964{
11965 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011966 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011967}
11968
11969static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011970vec_any_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011971{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011972 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011973 (vector unsigned char)__a,
11974 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011975}
11976
11977static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011978vec_any_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011979{
David Blaikie3302f2b2013-01-16 23:08:36 +000011980 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011981}
11982
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011983static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011984vec_any_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011985{
David Blaikie3302f2b2013-01-16 23:08:36 +000011986 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011987}
11988
11989static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011990vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011991{
David Blaikie3302f2b2013-01-16 23:08:36 +000011992 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011993}
11994
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011995static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011996vec_any_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011997{
11998 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011999 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012000}
12001
12002static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012003vec_any_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012004{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012005 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012006 (vector unsigned short)__a,
12007 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012008}
12009
12010static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012011vec_any_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012012{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012013 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012014 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012015}
12016
12017static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012018vec_any_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012019{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012020 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012021 (vector unsigned short)__a,
12022 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012023}
12024
12025static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012026vec_any_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012027{
David Blaikie3302f2b2013-01-16 23:08:36 +000012028 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012029}
12030
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012031static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012032vec_any_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012033{
David Blaikie3302f2b2013-01-16 23:08:36 +000012034 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012035}
12036
12037static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012038vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012039{
David Blaikie3302f2b2013-01-16 23:08:36 +000012040 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012041}
12042
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012043static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012044vec_any_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012045{
David Blaikie3302f2b2013-01-16 23:08:36 +000012046 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012047}
12048
12049static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012050vec_any_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012051{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012052 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012053 (vector unsigned int)__a,
12054 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012055}
12056
12057static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012058vec_any_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012059{
David Blaikie3302f2b2013-01-16 23:08:36 +000012060 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012061}
12062
12063static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012064vec_any_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012065{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012066 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012067 (vector unsigned int)__a,
12068 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012069}
12070
12071static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012072vec_any_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012073{
David Blaikie3302f2b2013-01-16 23:08:36 +000012074 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012075}
12076
12077/* vec_any_le */
12078
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012079static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012080vec_any_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012081{
David Blaikie3302f2b2013-01-16 23:08:36 +000012082 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012083}
12084
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012085static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012086vec_any_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012087{
David Blaikie3302f2b2013-01-16 23:08:36 +000012088 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012089}
12090
12091static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012092vec_any_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012093{
David Blaikie3302f2b2013-01-16 23:08:36 +000012094 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012095}
12096
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012097static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012098vec_any_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012099{
12100 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012101 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012102}
12103
12104static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012105vec_any_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012106{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012107 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012108 (vector unsigned char)__a,
12109 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012110}
12111
12112static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012113vec_any_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012114{
12115 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012116 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012117}
12118
12119static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012120vec_any_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012121{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012122 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012123 (vector unsigned char)__a,
12124 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012125}
12126
12127static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012128vec_any_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012129{
David Blaikie3302f2b2013-01-16 23:08:36 +000012130 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012131}
12132
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012133static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012134vec_any_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012135{
David Blaikie3302f2b2013-01-16 23:08:36 +000012136 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012137}
12138
12139static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012140vec_any_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012141{
David Blaikie3302f2b2013-01-16 23:08:36 +000012142 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012143}
12144
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012145static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012146vec_any_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012147{
12148 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012149 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012150}
12151
12152static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012153vec_any_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012154{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012155 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012156 (vector unsigned short)__a,
12157 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012158}
12159
12160static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012161vec_any_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012162{
12163 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012164 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012165}
12166
12167static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012168vec_any_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012169{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012170 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012171 (vector unsigned short)__a,
12172 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012173}
12174
12175static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012176vec_any_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012177{
David Blaikie3302f2b2013-01-16 23:08:36 +000012178 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012179}
12180
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012181static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012182vec_any_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012183{
David Blaikie3302f2b2013-01-16 23:08:36 +000012184 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012185}
12186
12187static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012188vec_any_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012189{
David Blaikie3302f2b2013-01-16 23:08:36 +000012190 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012191}
12192
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012193static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012194vec_any_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012195{
David Blaikie3302f2b2013-01-16 23:08:36 +000012196 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012197}
12198
12199static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012200vec_any_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012201{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012202 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012203 (vector unsigned int)__a,
12204 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012205}
12206
12207static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012208vec_any_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012209{
David Blaikie3302f2b2013-01-16 23:08:36 +000012210 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012211}
12212
12213static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012214vec_any_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012215{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012216 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012217 (vector unsigned int)__a,
12218 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012219}
12220
12221static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012222vec_any_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012223{
David Blaikie3302f2b2013-01-16 23:08:36 +000012224 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012225}
12226
12227/* vec_any_lt */
12228
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012229static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012230vec_any_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012231{
David Blaikie3302f2b2013-01-16 23:08:36 +000012232 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012233}
12234
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012235static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012236vec_any_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012237{
David Blaikie3302f2b2013-01-16 23:08:36 +000012238 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012239}
12240
12241static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012242vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012243{
David Blaikie3302f2b2013-01-16 23:08:36 +000012244 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012245}
12246
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012247static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012248vec_any_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012249{
12250 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012251 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012252}
12253
12254static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012255vec_any_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012256{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012257 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012258 (vector unsigned char)__b,
12259 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012260}
12261
12262static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012263vec_any_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012264{
12265 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012266 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012267}
12268
12269static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012270vec_any_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012271{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012272 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012273 (vector unsigned char)__b,
12274 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012275}
12276
12277static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012278vec_any_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012279{
David Blaikie3302f2b2013-01-16 23:08:36 +000012280 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012281}
12282
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012283static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012284vec_any_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012285{
David Blaikie3302f2b2013-01-16 23:08:36 +000012286 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012287}
12288
12289static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012290vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012291{
David Blaikie3302f2b2013-01-16 23:08:36 +000012292 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012293}
12294
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012295static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012296vec_any_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012297{
12298 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012299 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012300}
12301
12302static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012303vec_any_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012304{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012305 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012306 (vector unsigned short)__b,
12307 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012308}
12309
12310static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012311vec_any_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012312{
12313 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012314 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012315}
12316
12317static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012318vec_any_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012319{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012320 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012321 (vector unsigned short)__b,
12322 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012323}
12324
12325static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012326vec_any_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012327{
David Blaikie3302f2b2013-01-16 23:08:36 +000012328 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012329}
12330
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012331static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012332vec_any_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012333{
David Blaikie3302f2b2013-01-16 23:08:36 +000012334 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012335}
12336
12337static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012338vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012339{
David Blaikie3302f2b2013-01-16 23:08:36 +000012340 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012341}
12342
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012343static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012344vec_any_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012345{
David Blaikie3302f2b2013-01-16 23:08:36 +000012346 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012347}
12348
12349static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012350vec_any_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012351{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012352 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012353 (vector unsigned int)__b,
12354 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012355}
12356
12357static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012358vec_any_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012359{
David Blaikie3302f2b2013-01-16 23:08:36 +000012360 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012361}
12362
12363static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012364vec_any_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012365{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012366 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012367 (vector unsigned int)__b,
12368 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012369}
12370
12371static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012372vec_any_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012373{
David Blaikie3302f2b2013-01-16 23:08:36 +000012374 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012375}
12376
12377/* vec_any_nan */
12378
12379static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012380vec_any_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012381{
David Blaikie3302f2b2013-01-16 23:08:36 +000012382 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012383}
12384
12385/* vec_any_ne */
12386
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012387static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012388vec_any_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012389{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012390 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012391 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012392}
12393
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012394static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012395vec_any_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012396{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012397 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012398 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012399}
12400
12401static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012402vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012403{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012404 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012405 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012406}
12407
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012408static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012409vec_any_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012410{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012411 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012412 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012413}
12414
12415static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012416vec_any_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012417{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012418 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012419 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012420}
12421
12422static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012423vec_any_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012424{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012425 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012426 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012427}
12428
12429static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012430vec_any_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012431{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012432 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012433 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012434}
12435
12436static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012437vec_any_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012438{
David Blaikie3302f2b2013-01-16 23:08:36 +000012439 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012440}
12441
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012442static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012443vec_any_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012444{
David Blaikie3302f2b2013-01-16 23:08:36 +000012445 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012446}
12447
12448static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012449vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012450{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012451 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012452 (vector short)__a,
12453 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012454}
12455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012456static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012457vec_any_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012458{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012459 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012460 (vector short)__a,
12461 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012462}
12463
12464static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012465vec_any_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012466{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012467 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012468 (vector short)__a,
12469 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012470}
12471
12472static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012473vec_any_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012474{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012475 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012476 (vector short)__a,
12477 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012478}
12479
12480static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012481vec_any_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012482{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012483 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012484 (vector short)__a,
12485 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012486}
12487
12488static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012489vec_any_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012490{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012491 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012492 (vector short)__a,
12493 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012494}
12495
12496static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012497vec_any_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012498{
David Blaikie3302f2b2013-01-16 23:08:36 +000012499 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012500}
12501
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012502static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012503vec_any_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012504{
David Blaikie3302f2b2013-01-16 23:08:36 +000012505 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012506}
12507
12508static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012509vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012510{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012511 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012512 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012513}
12514
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012515static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012516vec_any_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012517{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012518 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012519 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012520}
12521
12522static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012523vec_any_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012524{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012525 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012526 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012527}
12528
12529static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012530vec_any_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012531{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012532 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012533 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012534}
12535
12536static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012537vec_any_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012538{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012539 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012540 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012541}
12542
12543static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012544vec_any_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012545{
David Blaikie3302f2b2013-01-16 23:08:36 +000012546 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012547}
12548
12549/* vec_any_nge */
12550
12551static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012552vec_any_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012553{
David Blaikie3302f2b2013-01-16 23:08:36 +000012554 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012555}
12556
12557/* vec_any_ngt */
12558
12559static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012560vec_any_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012561{
David Blaikie3302f2b2013-01-16 23:08:36 +000012562 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012563}
12564
12565/* vec_any_nle */
12566
12567static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012568vec_any_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012569{
David Blaikie3302f2b2013-01-16 23:08:36 +000012570 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012571}
12572
12573/* vec_any_nlt */
12574
12575static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012576vec_any_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012577{
David Blaikie3302f2b2013-01-16 23:08:36 +000012578 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012579}
12580
12581/* vec_any_numeric */
12582
12583static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012584vec_any_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012585{
David Blaikie3302f2b2013-01-16 23:08:36 +000012586 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012587}
12588
12589/* vec_any_out */
12590
12591static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012592vec_any_out(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012593{
David Blaikie3302f2b2013-01-16 23:08:36 +000012594 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012595}
12596
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012597#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012598
12599#endif /* __ALTIVEC_H */