blob: 373eded482fcb0ec8b4b16cabbb04a1850b9e802 [file] [log] [blame]
Chris Lattnerdad40622010-04-14 03:54:58 +00001/*===---- altivec.h - Standard header for type generic math ---------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __ALTIVEC_H
24#define __ALTIVEC_H
25
26#ifndef __ALTIVEC__
27#error "AltiVec support not enabled"
28#endif
29
30/* constants for mapping CR6 bits to predicate result. */
31
32#define __CR6_EQ 0
33#define __CR6_EQ_REV 1
34#define __CR6_LT 2
35#define __CR6_LT_REV 3
36
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000037#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000040vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000041
42static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000043vec_perm(vector unsigned char __a,
44 vector unsigned char __b,
45 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000046
Anton Yartsev9e968982010-08-19 03:00:09 +000047static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000048vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000050static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000051vec_perm(vector short __a, vector short __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000052
53static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000054vec_perm(vector unsigned short __a,
55 vector unsigned short __b,
56 vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000057
Anton Yartsev9e968982010-08-19 03:00:09 +000058static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000059vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000060
61static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000062vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000063
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000064static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000065vec_perm(vector int __a, vector int __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000066
67static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000068vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000069
Anton Yartsev9e968982010-08-19 03:00:09 +000070static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000071vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
Anton Yartsev9e968982010-08-19 03:00:09 +000072
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000073static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000074vec_perm(vector float __a, vector float __b, vector unsigned char __c);
Chris Lattnerdad40622010-04-14 03:54:58 +000075
Bill Schmidtf7e289c2014-06-05 19:07:40 +000076static vector unsigned char __ATTRS_o_ai
77vec_xor(vector unsigned char __a, vector unsigned char __b);
78
Chris Lattnerdad40622010-04-14 03:54:58 +000079/* vec_abs */
80
Chris Lattnerdad40622010-04-14 03:54:58 +000081#define __builtin_altivec_abs_v16qi vec_abs
82#define __builtin_altivec_abs_v8hi vec_abs
83#define __builtin_altivec_abs_v4si vec_abs
84
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000085static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000086vec_abs(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000087{
David Blaikie3302f2b2013-01-16 23:08:36 +000088 return __builtin_altivec_vmaxsb(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +000089}
90
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000091static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000092vec_abs(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000093{
David Blaikie3302f2b2013-01-16 23:08:36 +000094 return __builtin_altivec_vmaxsh(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +000095}
96
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000097static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000098vec_abs(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000099{
David Blaikie3302f2b2013-01-16 23:08:36 +0000100 return __builtin_altivec_vmaxsw(__a, -__a);
Chris Lattnerdad40622010-04-14 03:54:58 +0000101}
102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000103static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000104vec_abs(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000105{
David Blaikie3302f2b2013-01-16 23:08:36 +0000106 vector unsigned int __res = (vector unsigned int)__a
Anton Yartsev79d6af32010-09-18 00:39:16 +0000107 & (vector unsigned int)(0x7FFFFFFF);
David Blaikie3302f2b2013-01-16 23:08:36 +0000108 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +0000109}
110
111/* vec_abss */
112
Chris Lattnerdad40622010-04-14 03:54:58 +0000113#define __builtin_altivec_abss_v16qi vec_abss
114#define __builtin_altivec_abss_v8hi vec_abss
115#define __builtin_altivec_abss_v4si vec_abss
116
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000117static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000118vec_abss(vector signed char __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000119{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000120 return __builtin_altivec_vmaxsb
David Blaikie3302f2b2013-01-16 23:08:36 +0000121 (__a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000122}
123
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000124static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000125vec_abss(vector signed short __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000126{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000127 return __builtin_altivec_vmaxsh
David Blaikie3302f2b2013-01-16 23:08:36 +0000128 (__a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000129}
130
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000131static vector signed int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000132vec_abss(vector signed int __a)
Chris Lattnerdad40622010-04-14 03:54:58 +0000133{
Anton Yartsev79d6af32010-09-18 00:39:16 +0000134 return __builtin_altivec_vmaxsw
David Blaikie3302f2b2013-01-16 23:08:36 +0000135 (__a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Chris Lattnerdad40622010-04-14 03:54:58 +0000136}
137
138/* vec_add */
139
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000140static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000141vec_add(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000142{
David Blaikie3302f2b2013-01-16 23:08:36 +0000143 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000144}
145
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000146static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000147vec_add(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000148{
David Blaikie3302f2b2013-01-16 23:08:36 +0000149 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000150}
151
152static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000153vec_add(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000154{
David Blaikie3302f2b2013-01-16 23:08:36 +0000155 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000156}
157
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000158static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000159vec_add(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000160{
David Blaikie3302f2b2013-01-16 23:08:36 +0000161 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000162}
163
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000164static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000165vec_add(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000166{
David Blaikie3302f2b2013-01-16 23:08:36 +0000167 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000168}
169
170static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000171vec_add(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000172{
David Blaikie3302f2b2013-01-16 23:08:36 +0000173 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000174}
175
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000176static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000177vec_add(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000178{
David Blaikie3302f2b2013-01-16 23:08:36 +0000179 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000180}
181
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000182static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000183vec_add(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000184{
David Blaikie3302f2b2013-01-16 23:08:36 +0000185 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000186}
187
188static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000189vec_add(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000190{
David Blaikie3302f2b2013-01-16 23:08:36 +0000191 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000192}
193
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000194static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000195vec_add(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000196{
David Blaikie3302f2b2013-01-16 23:08:36 +0000197 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000198}
199
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000200static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000201vec_add(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000202{
David Blaikie3302f2b2013-01-16 23:08:36 +0000203 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000204}
205
206static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000207vec_add(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000208{
David Blaikie3302f2b2013-01-16 23:08:36 +0000209 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000210}
211
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000212static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000213vec_add(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000214{
David Blaikie3302f2b2013-01-16 23:08:36 +0000215 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000216}
217
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000218static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000219vec_add(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000220{
David Blaikie3302f2b2013-01-16 23:08:36 +0000221 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000222}
223
224static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000225vec_add(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000226{
David Blaikie3302f2b2013-01-16 23:08:36 +0000227 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000228}
229
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000230static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000231vec_add(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000232{
David Blaikie3302f2b2013-01-16 23:08:36 +0000233 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000234}
235
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000236static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000237vec_add(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000238{
David Blaikie3302f2b2013-01-16 23:08:36 +0000239 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000240}
241
242static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000243vec_add(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000244{
David Blaikie3302f2b2013-01-16 23:08:36 +0000245 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000246}
247
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000248static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000249vec_add(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000250{
David Blaikie3302f2b2013-01-16 23:08:36 +0000251 return __a + __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000252}
253
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000254/* vec_vaddubm */
255
256#define __builtin_altivec_vaddubm vec_vaddubm
257
258static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000259vec_vaddubm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000260{
David Blaikie3302f2b2013-01-16 23:08:36 +0000261 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000262}
263
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000264static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000265vec_vaddubm(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000266{
David Blaikie3302f2b2013-01-16 23:08:36 +0000267 return (vector signed char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000268}
269
270static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000271vec_vaddubm(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000272{
David Blaikie3302f2b2013-01-16 23:08:36 +0000273 return __a + (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000274}
275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000276static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000277vec_vaddubm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000278{
David Blaikie3302f2b2013-01-16 23:08:36 +0000279 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000280}
281
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000282static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000283vec_vaddubm(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000284{
David Blaikie3302f2b2013-01-16 23:08:36 +0000285 return (vector unsigned char)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000286}
287
288static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000289vec_vaddubm(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000290{
David Blaikie3302f2b2013-01-16 23:08:36 +0000291 return __a + (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000292}
293
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000294/* vec_vadduhm */
295
296#define __builtin_altivec_vadduhm vec_vadduhm
297
298static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000299vec_vadduhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000300{
David Blaikie3302f2b2013-01-16 23:08:36 +0000301 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000302}
303
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000304static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000305vec_vadduhm(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000306{
David Blaikie3302f2b2013-01-16 23:08:36 +0000307 return (vector short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000308}
309
310static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000311vec_vadduhm(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000312{
David Blaikie3302f2b2013-01-16 23:08:36 +0000313 return __a + (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000314}
315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000316static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000317vec_vadduhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000318{
David Blaikie3302f2b2013-01-16 23:08:36 +0000319 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000320}
321
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000322static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000323vec_vadduhm(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000324{
David Blaikie3302f2b2013-01-16 23:08:36 +0000325 return (vector unsigned short)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000326}
327
328static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000329vec_vadduhm(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000330{
David Blaikie3302f2b2013-01-16 23:08:36 +0000331 return __a + (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000332}
333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000334/* vec_vadduwm */
335
336#define __builtin_altivec_vadduwm vec_vadduwm
337
338static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000339vec_vadduwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000340{
David Blaikie3302f2b2013-01-16 23:08:36 +0000341 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000342}
343
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000344static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000345vec_vadduwm(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000346{
David Blaikie3302f2b2013-01-16 23:08:36 +0000347 return (vector int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000348}
349
350static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000351vec_vadduwm(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000352{
David Blaikie3302f2b2013-01-16 23:08:36 +0000353 return __a + (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000354}
355
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000356static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000357vec_vadduwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000358{
David Blaikie3302f2b2013-01-16 23:08:36 +0000359 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000360}
361
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000362static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000363vec_vadduwm(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000364{
David Blaikie3302f2b2013-01-16 23:08:36 +0000365 return (vector unsigned int)__a + __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000366}
367
368static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000369vec_vadduwm(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000370{
David Blaikie3302f2b2013-01-16 23:08:36 +0000371 return __a + (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000372}
373
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000374/* vec_vaddfp */
375
376#define __builtin_altivec_vaddfp vec_vaddfp
377
378static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000379vec_vaddfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000380{
David Blaikie3302f2b2013-01-16 23:08:36 +0000381 return __a + __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000382}
383
Chris Lattnerdad40622010-04-14 03:54:58 +0000384/* vec_addc */
385
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000386static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000387vec_addc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000388{
David Blaikie3302f2b2013-01-16 23:08:36 +0000389 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000390}
391
392/* vec_vaddcuw */
393
394static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +0000395vec_vaddcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000396{
David Blaikie3302f2b2013-01-16 23:08:36 +0000397 return __builtin_altivec_vaddcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000398}
Chris Lattnerdad40622010-04-14 03:54:58 +0000399
400/* vec_adds */
401
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000402static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000403vec_adds(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000404{
David Blaikie3302f2b2013-01-16 23:08:36 +0000405 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000406}
407
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000408static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000409vec_adds(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000410{
David Blaikie3302f2b2013-01-16 23:08:36 +0000411 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000412}
413
414static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000415vec_adds(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000416{
David Blaikie3302f2b2013-01-16 23:08:36 +0000417 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000418}
419
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000420static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000421vec_adds(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000422{
David Blaikie3302f2b2013-01-16 23:08:36 +0000423 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000424}
425
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000426static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000427vec_adds(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000428{
David Blaikie3302f2b2013-01-16 23:08:36 +0000429 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000430}
431
432static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000433vec_adds(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000434{
David Blaikie3302f2b2013-01-16 23:08:36 +0000435 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000436}
437
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000438static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000439vec_adds(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000440{
David Blaikie3302f2b2013-01-16 23:08:36 +0000441 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000442}
443
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000444static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000445vec_adds(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000446{
David Blaikie3302f2b2013-01-16 23:08:36 +0000447 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000448}
449
450static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000451vec_adds(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000452{
David Blaikie3302f2b2013-01-16 23:08:36 +0000453 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000454}
455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000456static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000457vec_adds(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000458{
David Blaikie3302f2b2013-01-16 23:08:36 +0000459 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000460}
461
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000462static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000463vec_adds(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000464{
David Blaikie3302f2b2013-01-16 23:08:36 +0000465 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000466}
467
468static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000469vec_adds(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000470{
David Blaikie3302f2b2013-01-16 23:08:36 +0000471 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000472}
473
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000474static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000475vec_adds(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000476{
David Blaikie3302f2b2013-01-16 23:08:36 +0000477 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000478}
479
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000480static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000481vec_adds(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000482{
David Blaikie3302f2b2013-01-16 23:08:36 +0000483 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000484}
485
486static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000487vec_adds(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000488{
David Blaikie3302f2b2013-01-16 23:08:36 +0000489 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000490}
491
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000492static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000493vec_adds(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000494{
David Blaikie3302f2b2013-01-16 23:08:36 +0000495 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000496}
497
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000498static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000499vec_adds(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000500{
David Blaikie3302f2b2013-01-16 23:08:36 +0000501 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000502}
503
504static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000505vec_adds(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000506{
David Blaikie3302f2b2013-01-16 23:08:36 +0000507 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000508}
509
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000510/* vec_vaddsbs */
Chris Lattnerdad40622010-04-14 03:54:58 +0000511
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000512static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000513vec_vaddsbs(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000514{
David Blaikie3302f2b2013-01-16 23:08:36 +0000515 return __builtin_altivec_vaddsbs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000516}
517
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000518static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000519vec_vaddsbs(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000520{
David Blaikie3302f2b2013-01-16 23:08:36 +0000521 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000522}
523
524static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000525vec_vaddsbs(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000526{
David Blaikie3302f2b2013-01-16 23:08:36 +0000527 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000528}
529
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000530/* vec_vaddubs */
531
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000532static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000533vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000534{
David Blaikie3302f2b2013-01-16 23:08:36 +0000535 return __builtin_altivec_vaddubs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000536}
537
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000538static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000539vec_vaddubs(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000540{
David Blaikie3302f2b2013-01-16 23:08:36 +0000541 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000542}
543
544static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000545vec_vaddubs(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000546{
David Blaikie3302f2b2013-01-16 23:08:36 +0000547 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000548}
549
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000550/* vec_vaddshs */
551
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000552static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000553vec_vaddshs(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000554{
David Blaikie3302f2b2013-01-16 23:08:36 +0000555 return __builtin_altivec_vaddshs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000556}
557
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000558static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000559vec_vaddshs(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000560{
David Blaikie3302f2b2013-01-16 23:08:36 +0000561 return __builtin_altivec_vaddshs((vector short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000562}
563
564static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000565vec_vaddshs(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000566{
David Blaikie3302f2b2013-01-16 23:08:36 +0000567 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000568}
569
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000570/* vec_vadduhs */
571
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000572static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000573vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000574{
David Blaikie3302f2b2013-01-16 23:08:36 +0000575 return __builtin_altivec_vadduhs(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000576}
577
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000578static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000579vec_vadduhs(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000580{
David Blaikie3302f2b2013-01-16 23:08:36 +0000581 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000582}
583
584static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000585vec_vadduhs(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000586{
David Blaikie3302f2b2013-01-16 23:08:36 +0000587 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000588}
589
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000590/* vec_vaddsws */
591
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000592static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000593vec_vaddsws(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000594{
David Blaikie3302f2b2013-01-16 23:08:36 +0000595 return __builtin_altivec_vaddsws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000596}
597
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000598static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000599vec_vaddsws(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000600{
David Blaikie3302f2b2013-01-16 23:08:36 +0000601 return __builtin_altivec_vaddsws((vector int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000602}
603
604static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000605vec_vaddsws(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000606{
David Blaikie3302f2b2013-01-16 23:08:36 +0000607 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000608}
609
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000610/* vec_vadduws */
611
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000612static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000613vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000614{
David Blaikie3302f2b2013-01-16 23:08:36 +0000615 return __builtin_altivec_vadduws(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +0000616}
617
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000618static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000619vec_vadduws(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000620{
David Blaikie3302f2b2013-01-16 23:08:36 +0000621 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000622}
623
624static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000625vec_vadduws(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000626{
David Blaikie3302f2b2013-01-16 23:08:36 +0000627 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000628}
629
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000630/* vec_and */
631
632#define __builtin_altivec_vand vec_and
633
634static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000635vec_and(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000636{
David Blaikie3302f2b2013-01-16 23:08:36 +0000637 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000638}
639
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000640static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000641vec_and(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000642{
David Blaikie3302f2b2013-01-16 23:08:36 +0000643 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000644}
645
646static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000647vec_and(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000648{
David Blaikie3302f2b2013-01-16 23:08:36 +0000649 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000650}
651
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000652static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000653vec_and(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000654{
David Blaikie3302f2b2013-01-16 23:08:36 +0000655 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000656}
657
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000658static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000659vec_and(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000660{
David Blaikie3302f2b2013-01-16 23:08:36 +0000661 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000662}
663
664static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000665vec_and(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000666{
David Blaikie3302f2b2013-01-16 23:08:36 +0000667 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000668}
669
670static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000671vec_and(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000672{
David Blaikie3302f2b2013-01-16 23:08:36 +0000673 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000674}
675
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000676static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000677vec_and(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000678{
David Blaikie3302f2b2013-01-16 23:08:36 +0000679 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000680}
681
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000682static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000683vec_and(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000684{
David Blaikie3302f2b2013-01-16 23:08:36 +0000685 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000686}
687
688static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000689vec_and(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000690{
David Blaikie3302f2b2013-01-16 23:08:36 +0000691 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000692}
693
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000694static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000695vec_and(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000696{
David Blaikie3302f2b2013-01-16 23:08:36 +0000697 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000698}
699
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000700static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000701vec_and(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000702{
David Blaikie3302f2b2013-01-16 23:08:36 +0000703 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000704}
705
706static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000707vec_and(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000708{
David Blaikie3302f2b2013-01-16 23:08:36 +0000709 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000710}
711
712static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000713vec_and(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000714{
David Blaikie3302f2b2013-01-16 23:08:36 +0000715 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000716}
717
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000718static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000719vec_and(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000720{
David Blaikie3302f2b2013-01-16 23:08:36 +0000721 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000722}
723
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000724static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000725vec_and(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000726{
David Blaikie3302f2b2013-01-16 23:08:36 +0000727 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000728}
729
730static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000731vec_and(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000732{
David Blaikie3302f2b2013-01-16 23:08:36 +0000733 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000734}
735
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000736static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000737vec_and(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000738{
David Blaikie3302f2b2013-01-16 23:08:36 +0000739 return __a & __b;
Chris Lattnerdad40622010-04-14 03:54:58 +0000740}
741
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000742static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000743vec_and(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000744{
David Blaikie3302f2b2013-01-16 23:08:36 +0000745 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000746}
747
748static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000749vec_and(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000750{
David Blaikie3302f2b2013-01-16 23:08:36 +0000751 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000752}
753
754static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000755vec_and(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000756{
David Blaikie3302f2b2013-01-16 23:08:36 +0000757 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000758}
759
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000760static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000761vec_and(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +0000762{
David Blaikie3302f2b2013-01-16 23:08:36 +0000763 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
764 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000765}
766
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000767static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000768vec_and(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000769{
David Blaikie3302f2b2013-01-16 23:08:36 +0000770 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
771 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000772}
773
774static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000775vec_and(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000776{
David Blaikie3302f2b2013-01-16 23:08:36 +0000777 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
778 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000779}
780
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000781/* vec_vand */
782
783static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000784vec_vand(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000785{
David Blaikie3302f2b2013-01-16 23:08:36 +0000786 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000787}
788
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000789static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000790vec_vand(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000791{
David Blaikie3302f2b2013-01-16 23:08:36 +0000792 return (vector signed char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000793}
794
795static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000796vec_vand(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000797{
David Blaikie3302f2b2013-01-16 23:08:36 +0000798 return __a & (vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000799}
800
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000801static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000802vec_vand(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000803{
David Blaikie3302f2b2013-01-16 23:08:36 +0000804 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000805}
806
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000807static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000808vec_vand(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000809{
David Blaikie3302f2b2013-01-16 23:08:36 +0000810 return (vector unsigned char)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000811}
812
813static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000814vec_vand(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000815{
David Blaikie3302f2b2013-01-16 23:08:36 +0000816 return __a & (vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000817}
818
819static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000820vec_vand(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000821{
David Blaikie3302f2b2013-01-16 23:08:36 +0000822 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000823}
824
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000825static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000826vec_vand(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000827{
David Blaikie3302f2b2013-01-16 23:08:36 +0000828 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000829}
830
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000831static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000832vec_vand(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000833{
David Blaikie3302f2b2013-01-16 23:08:36 +0000834 return (vector short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000835}
836
837static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000838vec_vand(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000839{
David Blaikie3302f2b2013-01-16 23:08:36 +0000840 return __a & (vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000841}
842
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000843static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000844vec_vand(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000845{
David Blaikie3302f2b2013-01-16 23:08:36 +0000846 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000847}
848
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000849static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000850vec_vand(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000851{
David Blaikie3302f2b2013-01-16 23:08:36 +0000852 return (vector unsigned short)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000853}
854
855static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000856vec_vand(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000857{
David Blaikie3302f2b2013-01-16 23:08:36 +0000858 return __a & (vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000859}
860
861static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000862vec_vand(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000863{
David Blaikie3302f2b2013-01-16 23:08:36 +0000864 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000865}
866
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000868vec_vand(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000869{
David Blaikie3302f2b2013-01-16 23:08:36 +0000870 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000871}
872
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000873static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000874vec_vand(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000875{
David Blaikie3302f2b2013-01-16 23:08:36 +0000876 return (vector int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000877}
878
879static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000880vec_vand(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000881{
David Blaikie3302f2b2013-01-16 23:08:36 +0000882 return __a & (vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000883}
884
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000885static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000886vec_vand(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000887{
David Blaikie3302f2b2013-01-16 23:08:36 +0000888 return __a & __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000889}
890
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000891static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000892vec_vand(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000893{
David Blaikie3302f2b2013-01-16 23:08:36 +0000894 return (vector unsigned int)__a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000895}
896
897static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000898vec_vand(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000899{
David Blaikie3302f2b2013-01-16 23:08:36 +0000900 return __a & (vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000901}
902
903static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000904vec_vand(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000905{
David Blaikie3302f2b2013-01-16 23:08:36 +0000906 return __a & __b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000907}
908
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000909static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000910vec_vand(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000911{
David Blaikie3302f2b2013-01-16 23:08:36 +0000912 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
913 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000914}
915
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000916static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000917vec_vand(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000918{
David Blaikie3302f2b2013-01-16 23:08:36 +0000919 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
920 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000921}
922
923static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000924vec_vand(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000925{
David Blaikie3302f2b2013-01-16 23:08:36 +0000926 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
927 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000928}
929
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000930/* vec_andc */
931
932#define __builtin_altivec_vandc vec_andc
933
934static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000935vec_andc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000936{
David Blaikie3302f2b2013-01-16 23:08:36 +0000937 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000938}
939
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000940static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000941vec_andc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000942{
David Blaikie3302f2b2013-01-16 23:08:36 +0000943 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000944}
945
946static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000947vec_andc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000948{
David Blaikie3302f2b2013-01-16 23:08:36 +0000949 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000950}
951
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000952static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000953vec_andc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000954{
David Blaikie3302f2b2013-01-16 23:08:36 +0000955 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000956}
957
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000958static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000959vec_andc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000960{
David Blaikie3302f2b2013-01-16 23:08:36 +0000961 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000962}
963
964static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000965vec_andc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000966{
David Blaikie3302f2b2013-01-16 23:08:36 +0000967 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000968}
969
970static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000971vec_andc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000972{
David Blaikie3302f2b2013-01-16 23:08:36 +0000973 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000974}
975
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000976static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000977vec_andc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000978{
David Blaikie3302f2b2013-01-16 23:08:36 +0000979 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000980}
981
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000982static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000983vec_andc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000984{
David Blaikie3302f2b2013-01-16 23:08:36 +0000985 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000986}
987
988static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000989vec_andc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000990{
David Blaikie3302f2b2013-01-16 23:08:36 +0000991 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +0000992}
993
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000994static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +0000995vec_andc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000996{
David Blaikie3302f2b2013-01-16 23:08:36 +0000997 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +0000998}
999
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001000static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001001vec_andc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001002{
David Blaikie3302f2b2013-01-16 23:08:36 +00001003 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001004}
1005
1006static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001007vec_andc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001008{
David Blaikie3302f2b2013-01-16 23:08:36 +00001009 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001010}
1011
1012static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001013vec_andc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001014{
David Blaikie3302f2b2013-01-16 23:08:36 +00001015 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001016}
1017
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001018static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001019vec_andc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001020{
David Blaikie3302f2b2013-01-16 23:08:36 +00001021 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001022}
1023
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001024static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001025vec_andc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001026{
David Blaikie3302f2b2013-01-16 23:08:36 +00001027 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001028}
1029
1030static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001031vec_andc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001032{
David Blaikie3302f2b2013-01-16 23:08:36 +00001033 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001034}
1035
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001036static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001037vec_andc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001038{
David Blaikie3302f2b2013-01-16 23:08:36 +00001039 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001040}
1041
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001042static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001043vec_andc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001044{
David Blaikie3302f2b2013-01-16 23:08:36 +00001045 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001046}
1047
1048static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001049vec_andc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001050{
David Blaikie3302f2b2013-01-16 23:08:36 +00001051 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001052}
1053
1054static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001055vec_andc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001056{
David Blaikie3302f2b2013-01-16 23:08:36 +00001057 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001058}
1059
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001060static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001061vec_andc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001062{
David Blaikie3302f2b2013-01-16 23:08:36 +00001063 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1064 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001065}
1066
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001067static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001068vec_andc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001069{
David Blaikie3302f2b2013-01-16 23:08:36 +00001070 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1071 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001072}
1073
1074static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001075vec_andc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001076{
David Blaikie3302f2b2013-01-16 23:08:36 +00001077 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1078 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001079}
1080
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001081/* vec_vandc */
1082
1083static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001084vec_vandc(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001085{
David Blaikie3302f2b2013-01-16 23:08:36 +00001086 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001087}
1088
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001089static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001090vec_vandc(vector bool char __a, vector signed char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001091{
David Blaikie3302f2b2013-01-16 23:08:36 +00001092 return (vector signed char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001093}
1094
1095static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001096vec_vandc(vector signed char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001097{
David Blaikie3302f2b2013-01-16 23:08:36 +00001098 return __a & ~(vector signed char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001099}
1100
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001101static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001102vec_vandc(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001103{
David Blaikie3302f2b2013-01-16 23:08:36 +00001104 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001105}
1106
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001107static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001108vec_vandc(vector bool char __a, vector unsigned char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001109{
David Blaikie3302f2b2013-01-16 23:08:36 +00001110 return (vector unsigned char)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001111}
1112
1113static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001114vec_vandc(vector unsigned char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001115{
David Blaikie3302f2b2013-01-16 23:08:36 +00001116 return __a & ~(vector unsigned char)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001117}
1118
1119static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001120vec_vandc(vector bool char __a, vector bool char __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001121{
David Blaikie3302f2b2013-01-16 23:08:36 +00001122 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001123}
1124
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001125static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001126vec_vandc(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001127{
David Blaikie3302f2b2013-01-16 23:08:36 +00001128 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001129}
1130
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001131static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001132vec_vandc(vector bool short __a, vector short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001133{
David Blaikie3302f2b2013-01-16 23:08:36 +00001134 return (vector short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001135}
1136
1137static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001138vec_vandc(vector short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001139{
David Blaikie3302f2b2013-01-16 23:08:36 +00001140 return __a & ~(vector short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001141}
1142
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001143static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001144vec_vandc(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001145{
David Blaikie3302f2b2013-01-16 23:08:36 +00001146 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001147}
1148
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001149static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001150vec_vandc(vector bool short __a, vector unsigned short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001151{
David Blaikie3302f2b2013-01-16 23:08:36 +00001152 return (vector unsigned short)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001153}
1154
1155static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001156vec_vandc(vector unsigned short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001157{
David Blaikie3302f2b2013-01-16 23:08:36 +00001158 return __a & ~(vector unsigned short)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001159}
1160
1161static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001162vec_vandc(vector bool short __a, vector bool short __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001163{
David Blaikie3302f2b2013-01-16 23:08:36 +00001164 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001165}
1166
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001167static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001168vec_vandc(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001169{
David Blaikie3302f2b2013-01-16 23:08:36 +00001170 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001171}
1172
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001173static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001174vec_vandc(vector bool int __a, vector int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001175{
David Blaikie3302f2b2013-01-16 23:08:36 +00001176 return (vector int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001177}
1178
1179static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001180vec_vandc(vector int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001181{
David Blaikie3302f2b2013-01-16 23:08:36 +00001182 return __a & ~(vector int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001183}
1184
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001185static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001186vec_vandc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001187{
David Blaikie3302f2b2013-01-16 23:08:36 +00001188 return __a & ~__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001189}
1190
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001191static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001192vec_vandc(vector bool int __a, vector unsigned int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001193{
David Blaikie3302f2b2013-01-16 23:08:36 +00001194 return (vector unsigned int)__a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001195}
1196
1197static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001198vec_vandc(vector unsigned int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001199{
David Blaikie3302f2b2013-01-16 23:08:36 +00001200 return __a & ~(vector unsigned int)__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001201}
1202
1203static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001204vec_vandc(vector bool int __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001205{
David Blaikie3302f2b2013-01-16 23:08:36 +00001206 return __a & ~__b;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001207}
1208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001209static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001210vec_vandc(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001211{
David Blaikie3302f2b2013-01-16 23:08:36 +00001212 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1213 return (vector float)__res;
Chris Lattnerdad40622010-04-14 03:54:58 +00001214}
1215
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001216static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001217vec_vandc(vector bool int __a, vector float __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001218{
David Blaikie3302f2b2013-01-16 23:08:36 +00001219 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1220 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001221}
1222
1223static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001224vec_vandc(vector float __a, vector bool int __b)
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001225{
David Blaikie3302f2b2013-01-16 23:08:36 +00001226 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1227 return (vector float)__res;
Anton Yartsev2cc136d2010-08-16 16:22:12 +00001228}
1229
Chris Lattnerdad40622010-04-14 03:54:58 +00001230/* vec_avg */
1231
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001232static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001233vec_avg(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001234{
David Blaikie3302f2b2013-01-16 23:08:36 +00001235 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001236}
1237
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001238static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001239vec_avg(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001240{
David Blaikie3302f2b2013-01-16 23:08:36 +00001241 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001242}
1243
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001244static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001245vec_avg(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001246{
David Blaikie3302f2b2013-01-16 23:08:36 +00001247 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001248}
1249
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001250static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001251vec_avg(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001252{
David Blaikie3302f2b2013-01-16 23:08:36 +00001253 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001254}
1255
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001256static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001257vec_avg(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001258{
David Blaikie3302f2b2013-01-16 23:08:36 +00001259 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001260}
1261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001262static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001263vec_avg(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001264{
David Blaikie3302f2b2013-01-16 23:08:36 +00001265 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001266}
1267
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001268/* vec_vavgsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001269
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001270static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001271vec_vavgsb(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001272{
David Blaikie3302f2b2013-01-16 23:08:36 +00001273 return __builtin_altivec_vavgsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001274}
1275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001276/* vec_vavgub */
1277
1278static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001279vec_vavgub(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001280{
David Blaikie3302f2b2013-01-16 23:08:36 +00001281 return __builtin_altivec_vavgub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001282}
1283
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001284/* vec_vavgsh */
1285
1286static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001287vec_vavgsh(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001288{
David Blaikie3302f2b2013-01-16 23:08:36 +00001289 return __builtin_altivec_vavgsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001290}
1291
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001292/* vec_vavguh */
1293
1294static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001295vec_vavguh(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001296{
David Blaikie3302f2b2013-01-16 23:08:36 +00001297 return __builtin_altivec_vavguh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001298}
1299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001300/* vec_vavgsw */
1301
1302static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001303vec_vavgsw(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001304{
David Blaikie3302f2b2013-01-16 23:08:36 +00001305 return __builtin_altivec_vavgsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001306}
1307
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001308/* vec_vavguw */
1309
1310static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001311vec_vavguw(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001312{
David Blaikie3302f2b2013-01-16 23:08:36 +00001313 return __builtin_altivec_vavguw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001314}
1315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001316/* vec_ceil */
1317
1318static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001319vec_ceil(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001320{
David Blaikie3302f2b2013-01-16 23:08:36 +00001321 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001322}
1323
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001324/* vec_vrfip */
Chris Lattnerdad40622010-04-14 03:54:58 +00001325
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001326static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001327vec_vrfip(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +00001328{
David Blaikie3302f2b2013-01-16 23:08:36 +00001329 return __builtin_altivec_vrfip(__a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001330}
1331
1332/* vec_cmpb */
1333
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001334static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001335vec_cmpb(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001336{
David Blaikie3302f2b2013-01-16 23:08:36 +00001337 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001338}
1339
1340/* vec_vcmpbfp */
1341
1342static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001343vec_vcmpbfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001344{
David Blaikie3302f2b2013-01-16 23:08:36 +00001345 return __builtin_altivec_vcmpbfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001346}
Chris Lattnerdad40622010-04-14 03:54:58 +00001347
1348/* vec_cmpeq */
1349
Anton Yartsevfc83c602010-08-19 03:21:36 +00001350static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001351vec_cmpeq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001352{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001353 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001354 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001355}
1356
Anton Yartsevfc83c602010-08-19 03:21:36 +00001357static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001358vec_cmpeq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001359{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001360 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00001361 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001362}
1363
Anton Yartsevfc83c602010-08-19 03:21:36 +00001364static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001365vec_cmpeq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001366{
David Blaikie3302f2b2013-01-16 23:08:36 +00001367 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001368}
1369
Anton Yartsevfc83c602010-08-19 03:21:36 +00001370static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001371vec_cmpeq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001372{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001373 return (vector bool short)
David Blaikie3302f2b2013-01-16 23:08:36 +00001374 __builtin_altivec_vcmpequh((vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001375}
1376
Anton Yartsevfc83c602010-08-19 03:21:36 +00001377static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001378vec_cmpeq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001379{
David Blaikie3302f2b2013-01-16 23:08:36 +00001380 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001381}
1382
Anton Yartsevfc83c602010-08-19 03:21:36 +00001383static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001384vec_cmpeq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001385{
Anton Yartsevfc83c602010-08-19 03:21:36 +00001386 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00001387 __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001388}
1389
Anton Yartsevfc83c602010-08-19 03:21:36 +00001390static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001391vec_cmpeq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001392{
David Blaikie3302f2b2013-01-16 23:08:36 +00001393 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001394}
1395
1396/* vec_cmpge */
1397
Anton Yartsevfc83c602010-08-19 03:21:36 +00001398static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001399vec_cmpge(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001400{
David Blaikie3302f2b2013-01-16 23:08:36 +00001401 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001402}
1403
1404/* vec_vcmpgefp */
1405
Anton Yartsevfc83c602010-08-19 03:21:36 +00001406static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001407vec_vcmpgefp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001408{
David Blaikie3302f2b2013-01-16 23:08:36 +00001409 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001410}
Chris Lattnerdad40622010-04-14 03:54:58 +00001411
1412/* vec_cmpgt */
1413
Anton Yartsevfc83c602010-08-19 03:21:36 +00001414static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001415vec_cmpgt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001416{
David Blaikie3302f2b2013-01-16 23:08:36 +00001417 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001418}
1419
Anton Yartsevfc83c602010-08-19 03:21:36 +00001420static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001421vec_cmpgt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001422{
David Blaikie3302f2b2013-01-16 23:08:36 +00001423 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001424}
1425
Anton Yartsevfc83c602010-08-19 03:21:36 +00001426static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001427vec_cmpgt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001428{
David Blaikie3302f2b2013-01-16 23:08:36 +00001429 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001430}
1431
Anton Yartsevfc83c602010-08-19 03:21:36 +00001432static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001433vec_cmpgt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001434{
David Blaikie3302f2b2013-01-16 23:08:36 +00001435 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001436}
1437
Anton Yartsevfc83c602010-08-19 03:21:36 +00001438static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001439vec_cmpgt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001440{
David Blaikie3302f2b2013-01-16 23:08:36 +00001441 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001442}
1443
Anton Yartsevfc83c602010-08-19 03:21:36 +00001444static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001445vec_cmpgt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001446{
David Blaikie3302f2b2013-01-16 23:08:36 +00001447 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001448}
1449
Anton Yartsevfc83c602010-08-19 03:21:36 +00001450static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001451vec_cmpgt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001452{
David Blaikie3302f2b2013-01-16 23:08:36 +00001453 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00001454}
1455
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001456/* vec_vcmpgtsb */
Chris Lattnerdad40622010-04-14 03:54:58 +00001457
Anton Yartsevfc83c602010-08-19 03:21:36 +00001458static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001459vec_vcmpgtsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001460{
David Blaikie3302f2b2013-01-16 23:08:36 +00001461 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001462}
1463
1464/* vec_vcmpgtub */
1465
Anton Yartsevfc83c602010-08-19 03:21:36 +00001466static vector bool char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001467vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001468{
David Blaikie3302f2b2013-01-16 23:08:36 +00001469 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001470}
1471
1472/* vec_vcmpgtsh */
1473
Anton Yartsevfc83c602010-08-19 03:21:36 +00001474static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001475vec_vcmpgtsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001476{
David Blaikie3302f2b2013-01-16 23:08:36 +00001477 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001478}
1479
1480/* vec_vcmpgtuh */
1481
Anton Yartsevfc83c602010-08-19 03:21:36 +00001482static vector bool short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001483vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001484{
David Blaikie3302f2b2013-01-16 23:08:36 +00001485 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001486}
1487
1488/* vec_vcmpgtsw */
1489
Anton Yartsevfc83c602010-08-19 03:21:36 +00001490static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001491vec_vcmpgtsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001492{
David Blaikie3302f2b2013-01-16 23:08:36 +00001493 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001494}
1495
1496/* vec_vcmpgtuw */
1497
Anton Yartsevfc83c602010-08-19 03:21:36 +00001498static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001499vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001500{
David Blaikie3302f2b2013-01-16 23:08:36 +00001501 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001502}
1503
1504/* vec_vcmpgtfp */
1505
Anton Yartsevfc83c602010-08-19 03:21:36 +00001506static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001507vec_vcmpgtfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001508{
David Blaikie3302f2b2013-01-16 23:08:36 +00001509 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001510}
1511
1512/* vec_cmple */
Chris Lattnerdad40622010-04-14 03:54:58 +00001513
Anton Yartsevfc83c602010-08-19 03:21:36 +00001514static vector bool int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001515vec_cmple(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001516{
David Blaikie3302f2b2013-01-16 23:08:36 +00001517 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001518}
1519
1520/* vec_cmplt */
1521
Anton Yartsevfc83c602010-08-19 03:21:36 +00001522static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001523vec_cmplt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001524{
David Blaikie3302f2b2013-01-16 23:08:36 +00001525 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001526}
1527
Anton Yartsevfc83c602010-08-19 03:21:36 +00001528static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001529vec_cmplt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001530{
David Blaikie3302f2b2013-01-16 23:08:36 +00001531 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001532}
1533
Anton Yartsevfc83c602010-08-19 03:21:36 +00001534static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001535vec_cmplt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001536{
David Blaikie3302f2b2013-01-16 23:08:36 +00001537 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001538}
1539
Anton Yartsevfc83c602010-08-19 03:21:36 +00001540static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001541vec_cmplt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001542{
David Blaikie3302f2b2013-01-16 23:08:36 +00001543 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001544}
1545
Anton Yartsevfc83c602010-08-19 03:21:36 +00001546static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001547vec_cmplt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001548{
David Blaikie3302f2b2013-01-16 23:08:36 +00001549 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001550}
1551
Anton Yartsevfc83c602010-08-19 03:21:36 +00001552static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001553vec_cmplt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001554{
David Blaikie3302f2b2013-01-16 23:08:36 +00001555 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001556}
1557
Anton Yartsevfc83c602010-08-19 03:21:36 +00001558static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001559vec_cmplt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00001560{
David Blaikie3302f2b2013-01-16 23:08:36 +00001561 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +00001562}
1563
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001564/* vec_ctf */
1565
1566static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001567vec_ctf(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001568{
David Blaikie3302f2b2013-01-16 23:08:36 +00001569 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001570}
1571
1572static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001573vec_ctf(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001574{
David Blaikie3302f2b2013-01-16 23:08:36 +00001575 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001576}
1577
1578/* vec_vcfsx */
1579
1580static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001581vec_vcfsx(vector int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001582{
David Blaikie3302f2b2013-01-16 23:08:36 +00001583 return __builtin_altivec_vcfsx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001584}
1585
1586/* vec_vcfux */
1587
1588static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001589vec_vcfux(vector unsigned int __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001590{
David Blaikie3302f2b2013-01-16 23:08:36 +00001591 return __builtin_altivec_vcfux((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001592}
1593
1594/* vec_cts */
1595
1596static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001597vec_cts(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001598{
David Blaikie3302f2b2013-01-16 23:08:36 +00001599 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001600}
1601
1602/* vec_vctsxs */
1603
1604static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001605vec_vctsxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001606{
David Blaikie3302f2b2013-01-16 23:08:36 +00001607 return __builtin_altivec_vctsxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001608}
1609
1610/* vec_ctu */
1611
1612static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001613vec_ctu(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001614{
David Blaikie3302f2b2013-01-16 23:08:36 +00001615 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001616}
1617
1618/* vec_vctuxs */
1619
1620static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001621vec_vctuxs(vector float __a, int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001622{
David Blaikie3302f2b2013-01-16 23:08:36 +00001623 return __builtin_altivec_vctuxs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001624}
1625
1626/* vec_dss */
1627
1628static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001629vec_dss(int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001630{
David Blaikie3302f2b2013-01-16 23:08:36 +00001631 __builtin_altivec_dss(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001632}
1633
1634/* vec_dssall */
1635
1636static void __attribute__((__always_inline__))
1637vec_dssall(void)
1638{
1639 __builtin_altivec_dssall();
1640}
1641
1642/* vec_dst */
1643
1644static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001645vec_dst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001646{
David Blaikie3302f2b2013-01-16 23:08:36 +00001647 __builtin_altivec_dst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001648}
1649
1650/* vec_dstst */
1651
1652static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001653vec_dstst(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001654{
David Blaikie3302f2b2013-01-16 23:08:36 +00001655 __builtin_altivec_dstst(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001656}
1657
1658/* vec_dststt */
1659
1660static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001661vec_dststt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001662{
David Blaikie3302f2b2013-01-16 23:08:36 +00001663 __builtin_altivec_dststt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001664}
1665
1666/* vec_dstt */
1667
1668static void __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001669vec_dstt(const void *__a, int __b, int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001670{
David Blaikie3302f2b2013-01-16 23:08:36 +00001671 __builtin_altivec_dstt(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001672}
1673
1674/* vec_expte */
1675
1676static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001677vec_expte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001678{
David Blaikie3302f2b2013-01-16 23:08:36 +00001679 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001680}
1681
1682/* vec_vexptefp */
1683
1684static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001685vec_vexptefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001686{
David Blaikie3302f2b2013-01-16 23:08:36 +00001687 return __builtin_altivec_vexptefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001688}
1689
1690/* vec_floor */
1691
1692static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001693vec_floor(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001694{
David Blaikie3302f2b2013-01-16 23:08:36 +00001695 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001696}
1697
1698/* vec_vrfim */
1699
1700static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00001701vec_vrfim(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001702{
David Blaikie3302f2b2013-01-16 23:08:36 +00001703 return __builtin_altivec_vrfim(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001704}
1705
1706/* vec_ld */
1707
1708static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001709vec_ld(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001710{
David Blaikie3302f2b2013-01-16 23:08:36 +00001711 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001712}
1713
1714static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001715vec_ld(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001716{
David Blaikie3302f2b2013-01-16 23:08:36 +00001717 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001718}
1719
1720static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001721vec_ld(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001722{
David Blaikie3302f2b2013-01-16 23:08:36 +00001723 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001724}
1725
1726static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001727vec_ld(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001728{
David Blaikie3302f2b2013-01-16 23:08:36 +00001729 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001730}
1731
Anton Yartsevfc83c602010-08-19 03:21:36 +00001732static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001733vec_ld(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001734{
David Blaikie3302f2b2013-01-16 23:08:36 +00001735 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001736}
1737
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001738static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001739vec_ld(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001740{
David Blaikie3302f2b2013-01-16 23:08:36 +00001741 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001742}
1743
1744static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001745vec_ld(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001746{
David Blaikie3302f2b2013-01-16 23:08:36 +00001747 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001748}
1749
1750static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001751vec_ld(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001752{
David Blaikie3302f2b2013-01-16 23:08:36 +00001753 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001754}
1755
1756static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001757vec_ld(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001758{
David Blaikie3302f2b2013-01-16 23:08:36 +00001759 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001760}
1761
Anton Yartsevfc83c602010-08-19 03:21:36 +00001762static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001763vec_ld(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001764{
David Blaikie3302f2b2013-01-16 23:08:36 +00001765 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001766}
1767
1768static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001769vec_ld(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001770{
David Blaikie3302f2b2013-01-16 23:08:36 +00001771 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001772}
1773
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001774static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001775vec_ld(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001776{
David Blaikie3302f2b2013-01-16 23:08:36 +00001777 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001778}
1779
1780static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001781vec_ld(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001782{
David Blaikie3302f2b2013-01-16 23:08:36 +00001783 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001784}
1785
1786static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001787vec_ld(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001788{
David Blaikie3302f2b2013-01-16 23:08:36 +00001789 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001790}
1791
1792static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001793vec_ld(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001794{
David Blaikie3302f2b2013-01-16 23:08:36 +00001795 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001796}
1797
Anton Yartsevfc83c602010-08-19 03:21:36 +00001798static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001799vec_ld(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001800{
David Blaikie3302f2b2013-01-16 23:08:36 +00001801 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001802}
1803
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001804static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001805vec_ld(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001806{
David Blaikie3302f2b2013-01-16 23:08:36 +00001807 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001808}
1809
1810static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001811vec_ld(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001812{
David Blaikie3302f2b2013-01-16 23:08:36 +00001813 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001814}
1815
1816/* vec_lvx */
1817
1818static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001819vec_lvx(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001820{
David Blaikie3302f2b2013-01-16 23:08:36 +00001821 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001822}
1823
1824static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001825vec_lvx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001826{
David Blaikie3302f2b2013-01-16 23:08:36 +00001827 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001828}
1829
1830static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001831vec_lvx(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001832{
David Blaikie3302f2b2013-01-16 23:08:36 +00001833 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001834}
1835
1836static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001837vec_lvx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001838{
David Blaikie3302f2b2013-01-16 23:08:36 +00001839 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001840}
1841
Anton Yartsevfc83c602010-08-19 03:21:36 +00001842static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001843vec_lvx(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001844{
David Blaikie3302f2b2013-01-16 23:08:36 +00001845 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001846}
1847
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001848static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001849vec_lvx(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001850{
David Blaikie3302f2b2013-01-16 23:08:36 +00001851 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001852}
1853
1854static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001855vec_lvx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001856{
David Blaikie3302f2b2013-01-16 23:08:36 +00001857 return (vector short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001858}
1859
1860static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001861vec_lvx(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001862{
David Blaikie3302f2b2013-01-16 23:08:36 +00001863 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001864}
1865
1866static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001867vec_lvx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001868{
David Blaikie3302f2b2013-01-16 23:08:36 +00001869 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001870}
1871
Anton Yartsevfc83c602010-08-19 03:21:36 +00001872static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001873vec_lvx(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001874{
David Blaikie3302f2b2013-01-16 23:08:36 +00001875 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001876}
1877
1878static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001879vec_lvx(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001880{
David Blaikie3302f2b2013-01-16 23:08:36 +00001881 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001882}
1883
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001884static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001885vec_lvx(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001886{
David Blaikie3302f2b2013-01-16 23:08:36 +00001887 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001888}
1889
1890static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001891vec_lvx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001892{
David Blaikie3302f2b2013-01-16 23:08:36 +00001893 return (vector int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001894}
1895
1896static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001897vec_lvx(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001898{
David Blaikie3302f2b2013-01-16 23:08:36 +00001899 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001900}
1901
1902static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001903vec_lvx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001904{
David Blaikie3302f2b2013-01-16 23:08:36 +00001905 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001906}
1907
Anton Yartsevfc83c602010-08-19 03:21:36 +00001908static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001909vec_lvx(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00001910{
David Blaikie3302f2b2013-01-16 23:08:36 +00001911 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00001912}
1913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001914static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001915vec_lvx(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001916{
David Blaikie3302f2b2013-01-16 23:08:36 +00001917 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001918}
1919
1920static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00001921vec_lvx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001922{
David Blaikie3302f2b2013-01-16 23:08:36 +00001923 return (vector float)__builtin_altivec_lvx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001924}
1925
1926/* vec_lde */
1927
1928static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001929vec_lde(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001930{
David Blaikie3302f2b2013-01-16 23:08:36 +00001931 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001932}
1933
1934static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001935vec_lde(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001936{
David Blaikie3302f2b2013-01-16 23:08:36 +00001937 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001938}
1939
1940static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001941vec_lde(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001942{
David Blaikie3302f2b2013-01-16 23:08:36 +00001943 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001944}
1945
1946static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001947vec_lde(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001948{
David Blaikie3302f2b2013-01-16 23:08:36 +00001949 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001950}
1951
1952static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001953vec_lde(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001954{
David Blaikie3302f2b2013-01-16 23:08:36 +00001955 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001956}
1957
1958static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001959vec_lde(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001960{
David Blaikie3302f2b2013-01-16 23:08:36 +00001961 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001962}
1963
1964static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001965vec_lde(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001966{
David Blaikie3302f2b2013-01-16 23:08:36 +00001967 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001968}
1969
1970/* vec_lvebx */
1971
1972static vector signed char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001973vec_lvebx(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001974{
David Blaikie3302f2b2013-01-16 23:08:36 +00001975 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001976}
1977
1978static vector unsigned char __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001979vec_lvebx(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001980{
David Blaikie3302f2b2013-01-16 23:08:36 +00001981 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001982}
1983
1984/* vec_lvehx */
1985
1986static vector short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001987vec_lvehx(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001988{
David Blaikie3302f2b2013-01-16 23:08:36 +00001989 return (vector short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001990}
1991
1992static vector unsigned short __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00001993vec_lvehx(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001994{
David Blaikie3302f2b2013-01-16 23:08:36 +00001995 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00001996}
1997
1998/* vec_lvewx */
1999
2000static vector int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002001vec_lvewx(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002002{
David Blaikie3302f2b2013-01-16 23:08:36 +00002003 return (vector int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002004}
2005
2006static vector unsigned int __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002007vec_lvewx(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002008{
David Blaikie3302f2b2013-01-16 23:08:36 +00002009 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002010}
2011
2012static vector float __ATTRS_o_ai
Anton Yartseva3c9ba32013-03-10 16:25:43 +00002013vec_lvewx(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002014{
David Blaikie3302f2b2013-01-16 23:08:36 +00002015 return (vector float)__builtin_altivec_lvewx(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002016}
2017
2018/* vec_ldl */
2019
2020static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002021vec_ldl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002022{
David Blaikie3302f2b2013-01-16 23:08:36 +00002023 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002024}
2025
2026static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002027vec_ldl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002028{
David Blaikie3302f2b2013-01-16 23:08:36 +00002029 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002030}
2031
2032static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002033vec_ldl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002034{
David Blaikie3302f2b2013-01-16 23:08:36 +00002035 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002036}
2037
2038static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002039vec_ldl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002040{
David Blaikie3302f2b2013-01-16 23:08:36 +00002041 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002042}
2043
Anton Yartsevfc83c602010-08-19 03:21:36 +00002044static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002045vec_ldl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002046{
David Blaikie3302f2b2013-01-16 23:08:36 +00002047 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002048}
2049
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002050static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002051vec_ldl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002052{
David Blaikie3302f2b2013-01-16 23:08:36 +00002053 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002054}
2055
2056static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002057vec_ldl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002058{
David Blaikie3302f2b2013-01-16 23:08:36 +00002059 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002060}
2061
2062static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002063vec_ldl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002064{
David Blaikie3302f2b2013-01-16 23:08:36 +00002065 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002066}
2067
2068static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002069vec_ldl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002070{
David Blaikie3302f2b2013-01-16 23:08:36 +00002071 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002072}
2073
Anton Yartsevfc83c602010-08-19 03:21:36 +00002074static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002075vec_ldl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002076{
David Blaikie3302f2b2013-01-16 23:08:36 +00002077 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002078}
2079
2080static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002081vec_ldl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002082{
David Blaikie3302f2b2013-01-16 23:08:36 +00002083 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002084}
2085
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002086static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002087vec_ldl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002088{
David Blaikie3302f2b2013-01-16 23:08:36 +00002089 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002090}
2091
2092static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002093vec_ldl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002094{
David Blaikie3302f2b2013-01-16 23:08:36 +00002095 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002096}
2097
2098static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002099vec_ldl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002100{
David Blaikie3302f2b2013-01-16 23:08:36 +00002101 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002102}
2103
2104static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002105vec_ldl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002106{
David Blaikie3302f2b2013-01-16 23:08:36 +00002107 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002108}
2109
Anton Yartsevfc83c602010-08-19 03:21:36 +00002110static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002111vec_ldl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002112{
David Blaikie3302f2b2013-01-16 23:08:36 +00002113 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002114}
2115
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002116static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002117vec_ldl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002118{
David Blaikie3302f2b2013-01-16 23:08:36 +00002119 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002120}
2121
2122static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002123vec_ldl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002124{
David Blaikie3302f2b2013-01-16 23:08:36 +00002125 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002126}
2127
2128/* vec_lvxl */
2129
2130static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002131vec_lvxl(int __a, const vector signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002132{
David Blaikie3302f2b2013-01-16 23:08:36 +00002133 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002134}
2135
2136static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002137vec_lvxl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002138{
David Blaikie3302f2b2013-01-16 23:08:36 +00002139 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002140}
2141
2142static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002143vec_lvxl(int __a, const vector unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002144{
David Blaikie3302f2b2013-01-16 23:08:36 +00002145 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002146}
2147
2148static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002149vec_lvxl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002150{
David Blaikie3302f2b2013-01-16 23:08:36 +00002151 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002152}
2153
Anton Yartsevfc83c602010-08-19 03:21:36 +00002154static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002155vec_lvxl(int __a, const vector bool char *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002156{
David Blaikie3302f2b2013-01-16 23:08:36 +00002157 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002158}
2159
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002160static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002161vec_lvxl(int __a, const vector short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002162{
David Blaikie3302f2b2013-01-16 23:08:36 +00002163 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002164}
2165
2166static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002167vec_lvxl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002168{
David Blaikie3302f2b2013-01-16 23:08:36 +00002169 return (vector short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002170}
2171
2172static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002173vec_lvxl(int __a, const vector unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002174{
David Blaikie3302f2b2013-01-16 23:08:36 +00002175 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002176}
2177
2178static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002179vec_lvxl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002180{
David Blaikie3302f2b2013-01-16 23:08:36 +00002181 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002182}
2183
Anton Yartsevfc83c602010-08-19 03:21:36 +00002184static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002185vec_lvxl(int __a, const vector bool short *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002186{
David Blaikie3302f2b2013-01-16 23:08:36 +00002187 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002188}
2189
2190static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002191vec_lvxl(int __a, const vector pixel *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002192{
David Blaikie3302f2b2013-01-16 23:08:36 +00002193 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002194}
2195
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002196static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002197vec_lvxl(int __a, const vector int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002198{
David Blaikie3302f2b2013-01-16 23:08:36 +00002199 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002200}
2201
2202static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002203vec_lvxl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002204{
David Blaikie3302f2b2013-01-16 23:08:36 +00002205 return (vector int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002206}
2207
2208static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002209vec_lvxl(int __a, const vector unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002210{
David Blaikie3302f2b2013-01-16 23:08:36 +00002211 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002212}
2213
2214static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002215vec_lvxl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002216{
David Blaikie3302f2b2013-01-16 23:08:36 +00002217 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002218}
2219
Anton Yartsevfc83c602010-08-19 03:21:36 +00002220static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002221vec_lvxl(int __a, const vector bool int *__b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002222{
David Blaikie3302f2b2013-01-16 23:08:36 +00002223 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002224}
2225
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002226static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002227vec_lvxl(int __a, const vector float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002228{
David Blaikie3302f2b2013-01-16 23:08:36 +00002229 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002230}
2231
2232static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002233vec_lvxl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002234{
David Blaikie3302f2b2013-01-16 23:08:36 +00002235 return (vector float)__builtin_altivec_lvxl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002236}
2237
2238/* vec_loge */
2239
2240static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002241vec_loge(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002242{
David Blaikie3302f2b2013-01-16 23:08:36 +00002243 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002244}
2245
2246/* vec_vlogefp */
2247
2248static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002249vec_vlogefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002250{
David Blaikie3302f2b2013-01-16 23:08:36 +00002251 return __builtin_altivec_vlogefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002252}
2253
2254/* vec_lvsl */
2255
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002256#ifdef __LITTLE_ENDIAN__
2257static vector unsigned char __ATTRS_o_ai
2258__attribute__((deprecated("use assignment for unaligned little endian \
2259loads/stores")))
2260vec_lvsl(int __a, const signed char *__b)
2261{
2262 vector unsigned char mask =
2263 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2264 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2265 return vec_perm(mask, mask, reverse);
2266}
2267#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002268static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002269vec_lvsl(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002270{
David Blaikie3302f2b2013-01-16 23:08:36 +00002271 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002272}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002273#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002274
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002275#ifdef __LITTLE_ENDIAN__
2276static vector unsigned char __ATTRS_o_ai
2277__attribute__((deprecated("use assignment for unaligned little endian \
2278loads/stores")))
2279vec_lvsl(int __a, const unsigned char *__b)
2280{
2281 vector unsigned char mask =
2282 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2283 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2284 return vec_perm(mask, mask, reverse);
2285}
2286#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002287static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002288vec_lvsl(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002289{
David Blaikie3302f2b2013-01-16 23:08:36 +00002290 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002291}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002292#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002293
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002294#ifdef __LITTLE_ENDIAN__
2295static vector unsigned char __ATTRS_o_ai
2296__attribute__((deprecated("use assignment for unaligned little endian \
2297loads/stores")))
2298vec_lvsl(int __a, const short *__b)
2299{
2300 vector unsigned char mask =
2301 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2302 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2303 return vec_perm(mask, mask, reverse);
2304}
2305#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002306static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002307vec_lvsl(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002308{
David Blaikie3302f2b2013-01-16 23:08:36 +00002309 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002310}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002311#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002312
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002313#ifdef __LITTLE_ENDIAN__
2314static vector unsigned char __ATTRS_o_ai
2315__attribute__((deprecated("use assignment for unaligned little endian \
2316loads/stores")))
2317vec_lvsl(int __a, const unsigned short *__b)
2318{
2319 vector unsigned char mask =
2320 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2321 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2322 return vec_perm(mask, mask, reverse);
2323}
2324#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002325static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002326vec_lvsl(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002327{
David Blaikie3302f2b2013-01-16 23:08:36 +00002328 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002329}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002330#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002331
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002332#ifdef __LITTLE_ENDIAN__
2333static vector unsigned char __ATTRS_o_ai
2334__attribute__((deprecated("use assignment for unaligned little endian \
2335loads/stores")))
2336vec_lvsl(int __a, const int *__b)
2337{
2338 vector unsigned char mask =
2339 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2340 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2341 return vec_perm(mask, mask, reverse);
2342}
2343#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002344static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002345vec_lvsl(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002346{
David Blaikie3302f2b2013-01-16 23:08:36 +00002347 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002348}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002349#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002350
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002351#ifdef __LITTLE_ENDIAN__
2352static vector unsigned char __ATTRS_o_ai
2353__attribute__((deprecated("use assignment for unaligned little endian \
2354loads/stores")))
2355vec_lvsl(int __a, const unsigned int *__b)
2356{
2357 vector unsigned char mask =
2358 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2359 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2360 return vec_perm(mask, mask, reverse);
2361}
2362#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002363static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002364vec_lvsl(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002365{
David Blaikie3302f2b2013-01-16 23:08:36 +00002366 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002367}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002368#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002369
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002370#ifdef __LITTLE_ENDIAN__
2371static vector unsigned char __ATTRS_o_ai
2372__attribute__((deprecated("use assignment for unaligned little endian \
2373loads/stores")))
2374vec_lvsl(int __a, const float *__b)
2375{
2376 vector unsigned char mask =
2377 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2378 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2379 return vec_perm(mask, mask, reverse);
2380}
2381#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002382static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002383vec_lvsl(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002384{
David Blaikie3302f2b2013-01-16 23:08:36 +00002385 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002386}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002387#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002388
2389/* vec_lvsr */
2390
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002391#ifdef __LITTLE_ENDIAN__
2392static vector unsigned char __ATTRS_o_ai
2393__attribute__((deprecated("use assignment for unaligned little endian \
2394loads/stores")))
2395vec_lvsr(int __a, const signed char *__b)
2396{
2397 vector unsigned char mask =
2398 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2399 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2400 return vec_perm(mask, mask, reverse);
2401}
2402#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002403static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002404vec_lvsr(int __a, const signed char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002405{
David Blaikie3302f2b2013-01-16 23:08:36 +00002406 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002407}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002408#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002409
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002410#ifdef __LITTLE_ENDIAN__
2411static vector unsigned char __ATTRS_o_ai
2412__attribute__((deprecated("use assignment for unaligned little endian \
2413loads/stores")))
2414vec_lvsr(int __a, const unsigned char *__b)
2415{
2416 vector unsigned char mask =
2417 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2418 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2419 return vec_perm(mask, mask, reverse);
2420}
2421#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002422static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002423vec_lvsr(int __a, const unsigned char *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002424{
David Blaikie3302f2b2013-01-16 23:08:36 +00002425 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002426}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002427#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002428
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002429#ifdef __LITTLE_ENDIAN__
2430static vector unsigned char __ATTRS_o_ai
2431__attribute__((deprecated("use assignment for unaligned little endian \
2432loads/stores")))
2433vec_lvsr(int __a, const short *__b)
2434{
2435 vector unsigned char mask =
2436 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2437 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2438 return vec_perm(mask, mask, reverse);
2439}
2440#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002441static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002442vec_lvsr(int __a, const short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002443{
David Blaikie3302f2b2013-01-16 23:08:36 +00002444 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002445}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002446#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002447
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002448#ifdef __LITTLE_ENDIAN__
2449static vector unsigned char __ATTRS_o_ai
2450__attribute__((deprecated("use assignment for unaligned little endian \
2451loads/stores")))
2452vec_lvsr(int __a, const unsigned short *__b)
2453{
2454 vector unsigned char mask =
2455 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2456 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2457 return vec_perm(mask, mask, reverse);
2458}
2459#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002460static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002461vec_lvsr(int __a, const unsigned short *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002462{
David Blaikie3302f2b2013-01-16 23:08:36 +00002463 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002464}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002465#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002466
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002467#ifdef __LITTLE_ENDIAN__
2468static vector unsigned char __ATTRS_o_ai
2469__attribute__((deprecated("use assignment for unaligned little endian \
2470loads/stores")))
2471vec_lvsr(int __a, const int *__b)
2472{
2473 vector unsigned char mask =
2474 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2475 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2476 return vec_perm(mask, mask, reverse);
2477}
2478#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002479static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002480vec_lvsr(int __a, const int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002481{
David Blaikie3302f2b2013-01-16 23:08:36 +00002482 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002483}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002484#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002485
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002486#ifdef __LITTLE_ENDIAN__
2487static vector unsigned char __ATTRS_o_ai
2488__attribute__((deprecated("use assignment for unaligned little endian \
2489loads/stores")))
2490vec_lvsr(int __a, const unsigned int *__b)
2491{
2492 vector unsigned char mask =
2493 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2494 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2495 return vec_perm(mask, mask, reverse);
2496}
2497#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002498static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002499vec_lvsr(int __a, const unsigned int *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002500{
David Blaikie3302f2b2013-01-16 23:08:36 +00002501 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002502}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002503#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002504
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002505#ifdef __LITTLE_ENDIAN__
2506static vector unsigned char __ATTRS_o_ai
2507__attribute__((deprecated("use assignment for unaligned little endian \
2508loads/stores")))
2509vec_lvsr(int __a, const float *__b)
2510{
2511 vector unsigned char mask =
2512 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2513 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2514 return vec_perm(mask, mask, reverse);
2515}
2516#else
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002517static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002518vec_lvsr(int __a, const float *__b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002519{
David Blaikie3302f2b2013-01-16 23:08:36 +00002520 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002521}
Bill Schmidtcad3a5f2014-10-06 19:02:20 +00002522#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002523
2524/* vec_madd */
2525
2526static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002527vec_madd(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002528{
David Blaikie3302f2b2013-01-16 23:08:36 +00002529 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002530}
2531
2532/* vec_vmaddfp */
2533
2534static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002535vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002536{
David Blaikie3302f2b2013-01-16 23:08:36 +00002537 return __builtin_altivec_vmaddfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002538}
2539
2540/* vec_madds */
2541
2542static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002543vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002544{
David Blaikie3302f2b2013-01-16 23:08:36 +00002545 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002546}
2547
2548/* vec_vmhaddshs */
2549static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002550vec_vmhaddshs(vector signed short __a,
2551 vector signed short __b,
2552 vector signed short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002553{
David Blaikie3302f2b2013-01-16 23:08:36 +00002554 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002555}
2556
Chris Lattnerdad40622010-04-14 03:54:58 +00002557/* vec_max */
2558
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002559static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002560vec_max(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002561{
David Blaikie3302f2b2013-01-16 23:08:36 +00002562 return __builtin_altivec_vmaxsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002563}
2564
Anton Yartsevfc83c602010-08-19 03:21:36 +00002565static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002566vec_max(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002567{
David Blaikie3302f2b2013-01-16 23:08:36 +00002568 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002569}
2570
2571static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002572vec_max(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002573{
David Blaikie3302f2b2013-01-16 23:08:36 +00002574 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002575}
2576
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002577static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002578vec_max(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002579{
David Blaikie3302f2b2013-01-16 23:08:36 +00002580 return __builtin_altivec_vmaxub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002581}
2582
Anton Yartsevfc83c602010-08-19 03:21:36 +00002583static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002584vec_max(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002585{
David Blaikie3302f2b2013-01-16 23:08:36 +00002586 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002587}
2588
2589static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002590vec_max(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002591{
David Blaikie3302f2b2013-01-16 23:08:36 +00002592 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002593}
2594
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002595static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002596vec_max(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002597{
David Blaikie3302f2b2013-01-16 23:08:36 +00002598 return __builtin_altivec_vmaxsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002599}
2600
Anton Yartsevfc83c602010-08-19 03:21:36 +00002601static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002602vec_max(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002603{
David Blaikie3302f2b2013-01-16 23:08:36 +00002604 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002605}
2606
2607static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002608vec_max(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002609{
David Blaikie3302f2b2013-01-16 23:08:36 +00002610 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002611}
2612
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002613static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002614vec_max(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002615{
David Blaikie3302f2b2013-01-16 23:08:36 +00002616 return __builtin_altivec_vmaxuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002617}
2618
Anton Yartsevfc83c602010-08-19 03:21:36 +00002619static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002620vec_max(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002621{
David Blaikie3302f2b2013-01-16 23:08:36 +00002622 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002623}
2624
2625static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002626vec_max(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002627{
David Blaikie3302f2b2013-01-16 23:08:36 +00002628 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002629}
2630
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002631static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002632vec_max(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002633{
David Blaikie3302f2b2013-01-16 23:08:36 +00002634 return __builtin_altivec_vmaxsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002635}
2636
Anton Yartsevfc83c602010-08-19 03:21:36 +00002637static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002638vec_max(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002639{
David Blaikie3302f2b2013-01-16 23:08:36 +00002640 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002641}
2642
2643static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002644vec_max(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002645{
David Blaikie3302f2b2013-01-16 23:08:36 +00002646 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002647}
2648
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002649static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002650vec_max(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002651{
David Blaikie3302f2b2013-01-16 23:08:36 +00002652 return __builtin_altivec_vmaxuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002653}
2654
Anton Yartsevfc83c602010-08-19 03:21:36 +00002655static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002656vec_max(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002657{
David Blaikie3302f2b2013-01-16 23:08:36 +00002658 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002659}
2660
2661static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002662vec_max(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002663{
David Blaikie3302f2b2013-01-16 23:08:36 +00002664 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002665}
2666
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002667static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002668vec_max(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00002669{
David Blaikie3302f2b2013-01-16 23:08:36 +00002670 return __builtin_altivec_vmaxfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00002671}
2672
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002673/* vec_vmaxsb */
2674
Anton Yartsevfc83c602010-08-19 03:21:36 +00002675static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002676vec_vmaxsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002677{
David Blaikie3302f2b2013-01-16 23:08:36 +00002678 return __builtin_altivec_vmaxsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002679}
2680
Anton Yartsevfc83c602010-08-19 03:21:36 +00002681static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002682vec_vmaxsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002683{
David Blaikie3302f2b2013-01-16 23:08:36 +00002684 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002685}
2686
2687static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002688vec_vmaxsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002689{
David Blaikie3302f2b2013-01-16 23:08:36 +00002690 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002691}
2692
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002693/* vec_vmaxub */
2694
Anton Yartsevfc83c602010-08-19 03:21:36 +00002695static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002696vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002697{
David Blaikie3302f2b2013-01-16 23:08:36 +00002698 return __builtin_altivec_vmaxub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002699}
2700
Anton Yartsevfc83c602010-08-19 03:21:36 +00002701static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002702vec_vmaxub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002703{
David Blaikie3302f2b2013-01-16 23:08:36 +00002704 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002705}
2706
2707static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002708vec_vmaxub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002709{
David Blaikie3302f2b2013-01-16 23:08:36 +00002710 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002711}
2712
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002713/* vec_vmaxsh */
2714
Anton Yartsevfc83c602010-08-19 03:21:36 +00002715static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002716vec_vmaxsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002717{
David Blaikie3302f2b2013-01-16 23:08:36 +00002718 return __builtin_altivec_vmaxsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002719}
2720
Anton Yartsevfc83c602010-08-19 03:21:36 +00002721static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002722vec_vmaxsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002723{
David Blaikie3302f2b2013-01-16 23:08:36 +00002724 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002725}
2726
2727static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002728vec_vmaxsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002729{
David Blaikie3302f2b2013-01-16 23:08:36 +00002730 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002731}
2732
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002733/* vec_vmaxuh */
2734
Anton Yartsevfc83c602010-08-19 03:21:36 +00002735static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002736vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002737{
David Blaikie3302f2b2013-01-16 23:08:36 +00002738 return __builtin_altivec_vmaxuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002739}
2740
Anton Yartsevfc83c602010-08-19 03:21:36 +00002741static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002742vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002743{
David Blaikie3302f2b2013-01-16 23:08:36 +00002744 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002745}
2746
2747static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002748vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002749{
David Blaikie3302f2b2013-01-16 23:08:36 +00002750 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002751}
2752
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002753/* vec_vmaxsw */
2754
Anton Yartsevfc83c602010-08-19 03:21:36 +00002755static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002756vec_vmaxsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002757{
David Blaikie3302f2b2013-01-16 23:08:36 +00002758 return __builtin_altivec_vmaxsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002759}
2760
Anton Yartsevfc83c602010-08-19 03:21:36 +00002761static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002762vec_vmaxsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002763{
David Blaikie3302f2b2013-01-16 23:08:36 +00002764 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002765}
2766
2767static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002768vec_vmaxsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002769{
David Blaikie3302f2b2013-01-16 23:08:36 +00002770 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002771}
2772
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002773/* vec_vmaxuw */
2774
Anton Yartsevfc83c602010-08-19 03:21:36 +00002775static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002776vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002777{
David Blaikie3302f2b2013-01-16 23:08:36 +00002778 return __builtin_altivec_vmaxuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002779}
2780
Anton Yartsevfc83c602010-08-19 03:21:36 +00002781static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002782vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002783{
David Blaikie3302f2b2013-01-16 23:08:36 +00002784 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002785}
2786
2787static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002788vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00002789{
David Blaikie3302f2b2013-01-16 23:08:36 +00002790 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00002791}
2792
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002793/* vec_vmaxfp */
2794
2795static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00002796vec_vmaxfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002797{
David Blaikie3302f2b2013-01-16 23:08:36 +00002798 return __builtin_altivec_vmaxfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002799}
2800
2801/* vec_mergeh */
2802
2803static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002804vec_mergeh(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002805{
David Blaikie3302f2b2013-01-16 23:08:36 +00002806 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002807 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2808 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2809}
2810
2811static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002812vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002813{
David Blaikie3302f2b2013-01-16 23:08:36 +00002814 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002815 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2816 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2817}
2818
Anton Yartsev9e968982010-08-19 03:00:09 +00002819static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002820vec_mergeh(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002821{
David Blaikie3302f2b2013-01-16 23:08:36 +00002822 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002823 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2824 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2825}
2826
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002827static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002828vec_mergeh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002829{
David Blaikie3302f2b2013-01-16 23:08:36 +00002830 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002831 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2832 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2833}
2834
2835static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002836vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002837{
David Blaikie3302f2b2013-01-16 23:08:36 +00002838 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002839 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2840 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2841}
2842
Anton Yartsev9e968982010-08-19 03:00:09 +00002843static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002844vec_mergeh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002845{
David Blaikie3302f2b2013-01-16 23:08:36 +00002846 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002847 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2848 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2849}
2850
2851static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002852vec_mergeh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002853{
David Blaikie3302f2b2013-01-16 23:08:36 +00002854 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002855 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2856 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2857}
2858
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002859static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002860vec_mergeh(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002861{
David Blaikie3302f2b2013-01-16 23:08:36 +00002862 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002863 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2864 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2865}
2866
2867static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002868vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002869{
David Blaikie3302f2b2013-01-16 23:08:36 +00002870 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002871 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2872 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2873}
2874
Anton Yartsev9e968982010-08-19 03:00:09 +00002875static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002876vec_mergeh(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002877{
David Blaikie3302f2b2013-01-16 23:08:36 +00002878 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002879 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2880 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2881}
2882
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002883static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002884vec_mergeh(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002885{
David Blaikie3302f2b2013-01-16 23:08:36 +00002886 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002887 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2888 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2889}
2890
2891/* vec_vmrghb */
2892
2893#define __builtin_altivec_vmrghb vec_vmrghb
2894
2895static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002896vec_vmrghb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002897{
David Blaikie3302f2b2013-01-16 23:08:36 +00002898 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002899 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2900 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2901}
2902
2903static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002904vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002905{
David Blaikie3302f2b2013-01-16 23:08:36 +00002906 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002907 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2908 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2909}
2910
Anton Yartsev9e968982010-08-19 03:00:09 +00002911static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002912vec_vmrghb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002913{
David Blaikie3302f2b2013-01-16 23:08:36 +00002914 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002915 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2916 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2917}
2918
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002919/* vec_vmrghh */
2920
2921#define __builtin_altivec_vmrghh vec_vmrghh
2922
2923static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002924vec_vmrghh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002925{
David Blaikie3302f2b2013-01-16 23:08:36 +00002926 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002927 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2928 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2929}
2930
2931static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002932vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002933{
David Blaikie3302f2b2013-01-16 23:08:36 +00002934 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002935 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2936 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2937}
2938
Anton Yartsev9e968982010-08-19 03:00:09 +00002939static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002940vec_vmrghh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002941{
David Blaikie3302f2b2013-01-16 23:08:36 +00002942 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002943 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2944 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2945}
2946
2947static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002948vec_vmrghh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002949{
David Blaikie3302f2b2013-01-16 23:08:36 +00002950 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002951 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2952 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2953}
2954
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002955/* vec_vmrghw */
2956
2957#define __builtin_altivec_vmrghw vec_vmrghw
2958
2959static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002960vec_vmrghw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002961{
David Blaikie3302f2b2013-01-16 23:08:36 +00002962 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002963 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2964 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2965}
2966
2967static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002968vec_vmrghw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002969{
David Blaikie3302f2b2013-01-16 23:08:36 +00002970 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002971 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2972 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2973}
2974
Anton Yartsev9e968982010-08-19 03:00:09 +00002975static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002976vec_vmrghw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00002977{
David Blaikie3302f2b2013-01-16 23:08:36 +00002978 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00002979 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2980 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2981}
2982
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002983static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002984vec_vmrghw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002985{
David Blaikie3302f2b2013-01-16 23:08:36 +00002986 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002987 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2988 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2989}
2990
2991/* vec_mergel */
2992
2993static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00002994vec_mergel(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002995{
David Blaikie3302f2b2013-01-16 23:08:36 +00002996 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00002997 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
2998 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
2999}
3000
3001static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003002vec_mergel(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003003{
David Blaikie3302f2b2013-01-16 23:08:36 +00003004 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003005 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3006 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3007}
3008
Anton Yartsev9e968982010-08-19 03:00:09 +00003009static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003010vec_mergel(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003011{
David Blaikie3302f2b2013-01-16 23:08:36 +00003012 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003013 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3014 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3015}
3016
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003017static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003018vec_mergel(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003019{
David Blaikie3302f2b2013-01-16 23:08:36 +00003020 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003021 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3022 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3023}
3024
3025static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003026vec_mergel(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003027{
David Blaikie3302f2b2013-01-16 23:08:36 +00003028 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003029 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3030 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3031}
3032
Anton Yartsev9e968982010-08-19 03:00:09 +00003033static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003034vec_mergel(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003035{
David Blaikie3302f2b2013-01-16 23:08:36 +00003036 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003037 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3038 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3039}
3040
3041static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003042vec_mergel(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003043{
David Blaikie3302f2b2013-01-16 23:08:36 +00003044 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003045 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3046 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3047}
3048
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003049static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003050vec_mergel(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003051{
David Blaikie3302f2b2013-01-16 23:08:36 +00003052 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003053 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3054 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3055}
3056
3057static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003058vec_mergel(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003059{
David Blaikie3302f2b2013-01-16 23:08:36 +00003060 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003061 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3062 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3063}
3064
Anton Yartsev9e968982010-08-19 03:00:09 +00003065static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003066vec_mergel(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003067{
David Blaikie3302f2b2013-01-16 23:08:36 +00003068 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003069 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3070 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3071}
3072
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003073static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003074vec_mergel(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003075{
David Blaikie3302f2b2013-01-16 23:08:36 +00003076 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003077 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3078 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3079}
3080
3081/* vec_vmrglb */
3082
3083#define __builtin_altivec_vmrglb vec_vmrglb
3084
3085static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003086vec_vmrglb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003087{
David Blaikie3302f2b2013-01-16 23:08:36 +00003088 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003089 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3090 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3091}
3092
3093static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003094vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003095{
David Blaikie3302f2b2013-01-16 23:08:36 +00003096 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003097 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3098 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3099}
3100
Anton Yartsev9e968982010-08-19 03:00:09 +00003101static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003102vec_vmrglb(vector bool char __a, vector bool char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003103{
David Blaikie3302f2b2013-01-16 23:08:36 +00003104 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003105 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3106 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3107}
3108
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003109/* vec_vmrglh */
3110
3111#define __builtin_altivec_vmrglh vec_vmrglh
3112
3113static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003114vec_vmrglh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003115{
David Blaikie3302f2b2013-01-16 23:08:36 +00003116 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003117 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3118 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3119}
3120
3121static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003122vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003123{
David Blaikie3302f2b2013-01-16 23:08:36 +00003124 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003125 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3126 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3127}
3128
Anton Yartsev9e968982010-08-19 03:00:09 +00003129static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003130vec_vmrglh(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003131{
David Blaikie3302f2b2013-01-16 23:08:36 +00003132 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003133 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3134 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3135}
3136
3137static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003138vec_vmrglh(vector pixel __a, vector pixel __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003139{
David Blaikie3302f2b2013-01-16 23:08:36 +00003140 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003141 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3142 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3143}
3144
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003145/* vec_vmrglw */
3146
3147#define __builtin_altivec_vmrglw vec_vmrglw
3148
3149static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003150vec_vmrglw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003151{
David Blaikie3302f2b2013-01-16 23:08:36 +00003152 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003153 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3154 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3155}
3156
3157static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003158vec_vmrglw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003159{
David Blaikie3302f2b2013-01-16 23:08:36 +00003160 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003161 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3162 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3163}
3164
Anton Yartsev9e968982010-08-19 03:00:09 +00003165static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003166vec_vmrglw(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00003167{
David Blaikie3302f2b2013-01-16 23:08:36 +00003168 return vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00003169 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3170 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3171}
3172
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003173static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003174vec_vmrglw(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003175{
David Blaikie3302f2b2013-01-16 23:08:36 +00003176 return vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003177 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3178 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3179}
3180
Chris Lattnerdad40622010-04-14 03:54:58 +00003181/* vec_mfvscr */
3182
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003183static vector unsigned short __attribute__((__always_inline__))
3184vec_mfvscr(void)
3185{
3186 return __builtin_altivec_mfvscr();
3187}
Chris Lattnerdad40622010-04-14 03:54:58 +00003188
3189/* vec_min */
3190
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003191static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003192vec_min(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003193{
David Blaikie3302f2b2013-01-16 23:08:36 +00003194 return __builtin_altivec_vminsb(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003195}
3196
Anton Yartsevfc83c602010-08-19 03:21:36 +00003197static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003198vec_min(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003199{
David Blaikie3302f2b2013-01-16 23:08:36 +00003200 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003201}
3202
3203static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003204vec_min(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003205{
David Blaikie3302f2b2013-01-16 23:08:36 +00003206 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003207}
3208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003209static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003210vec_min(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003211{
David Blaikie3302f2b2013-01-16 23:08:36 +00003212 return __builtin_altivec_vminub(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003213}
3214
Anton Yartsevfc83c602010-08-19 03:21:36 +00003215static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003216vec_min(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003217{
David Blaikie3302f2b2013-01-16 23:08:36 +00003218 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003219}
3220
3221static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003222vec_min(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003223{
David Blaikie3302f2b2013-01-16 23:08:36 +00003224 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003225}
3226
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003227static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003228vec_min(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003229{
David Blaikie3302f2b2013-01-16 23:08:36 +00003230 return __builtin_altivec_vminsh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003231}
3232
Anton Yartsevfc83c602010-08-19 03:21:36 +00003233static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003234vec_min(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003235{
David Blaikie3302f2b2013-01-16 23:08:36 +00003236 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003237}
3238
3239static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003240vec_min(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003241{
David Blaikie3302f2b2013-01-16 23:08:36 +00003242 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003243}
3244
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003245static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003246vec_min(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003247{
David Blaikie3302f2b2013-01-16 23:08:36 +00003248 return __builtin_altivec_vminuh(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003249}
3250
Anton Yartsevfc83c602010-08-19 03:21:36 +00003251static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003252vec_min(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003253{
David Blaikie3302f2b2013-01-16 23:08:36 +00003254 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003255}
3256
3257static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003258vec_min(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003259{
David Blaikie3302f2b2013-01-16 23:08:36 +00003260 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003261}
3262
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003263static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003264vec_min(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003265{
David Blaikie3302f2b2013-01-16 23:08:36 +00003266 return __builtin_altivec_vminsw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003267}
3268
Anton Yartsevfc83c602010-08-19 03:21:36 +00003269static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003270vec_min(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003271{
David Blaikie3302f2b2013-01-16 23:08:36 +00003272 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003273}
3274
3275static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003276vec_min(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003277{
David Blaikie3302f2b2013-01-16 23:08:36 +00003278 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003279}
3280
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003281static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003282vec_min(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003283{
David Blaikie3302f2b2013-01-16 23:08:36 +00003284 return __builtin_altivec_vminuw(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003285}
3286
Anton Yartsevfc83c602010-08-19 03:21:36 +00003287static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003288vec_min(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003289{
David Blaikie3302f2b2013-01-16 23:08:36 +00003290 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003291}
3292
3293static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003294vec_min(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003295{
David Blaikie3302f2b2013-01-16 23:08:36 +00003296 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003297}
3298
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003299static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003300vec_min(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +00003301{
David Blaikie3302f2b2013-01-16 23:08:36 +00003302 return __builtin_altivec_vminfp(__a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +00003303}
3304
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003305/* vec_vminsb */
3306
Anton Yartsevfc83c602010-08-19 03:21:36 +00003307static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003308vec_vminsb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003309{
David Blaikie3302f2b2013-01-16 23:08:36 +00003310 return __builtin_altivec_vminsb(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003311}
3312
Anton Yartsevfc83c602010-08-19 03:21:36 +00003313static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003314vec_vminsb(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003315{
David Blaikie3302f2b2013-01-16 23:08:36 +00003316 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003317}
3318
3319static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003320vec_vminsb(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003321{
David Blaikie3302f2b2013-01-16 23:08:36 +00003322 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003323}
3324
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003325/* vec_vminub */
3326
Anton Yartsevfc83c602010-08-19 03:21:36 +00003327static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003328vec_vminub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003329{
David Blaikie3302f2b2013-01-16 23:08:36 +00003330 return __builtin_altivec_vminub(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003331}
3332
Anton Yartsevfc83c602010-08-19 03:21:36 +00003333static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003334vec_vminub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003335{
David Blaikie3302f2b2013-01-16 23:08:36 +00003336 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003337}
3338
3339static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003340vec_vminub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003341{
David Blaikie3302f2b2013-01-16 23:08:36 +00003342 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003343}
3344
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003345/* vec_vminsh */
3346
Anton Yartsevfc83c602010-08-19 03:21:36 +00003347static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003348vec_vminsh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003349{
David Blaikie3302f2b2013-01-16 23:08:36 +00003350 return __builtin_altivec_vminsh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003351}
3352
Anton Yartsevfc83c602010-08-19 03:21:36 +00003353static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003354vec_vminsh(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003355{
David Blaikie3302f2b2013-01-16 23:08:36 +00003356 return __builtin_altivec_vminsh((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003357}
3358
3359static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003360vec_vminsh(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003361{
David Blaikie3302f2b2013-01-16 23:08:36 +00003362 return __builtin_altivec_vminsh(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003363}
3364
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003365/* vec_vminuh */
3366
Anton Yartsevfc83c602010-08-19 03:21:36 +00003367static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003368vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003369{
David Blaikie3302f2b2013-01-16 23:08:36 +00003370 return __builtin_altivec_vminuh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003371}
3372
Anton Yartsevfc83c602010-08-19 03:21:36 +00003373static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003374vec_vminuh(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003375{
David Blaikie3302f2b2013-01-16 23:08:36 +00003376 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003377}
3378
3379static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003380vec_vminuh(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003381{
David Blaikie3302f2b2013-01-16 23:08:36 +00003382 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003383}
3384
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003385/* vec_vminsw */
3386
Anton Yartsevfc83c602010-08-19 03:21:36 +00003387static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003388vec_vminsw(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003389{
David Blaikie3302f2b2013-01-16 23:08:36 +00003390 return __builtin_altivec_vminsw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003391}
3392
Anton Yartsevfc83c602010-08-19 03:21:36 +00003393static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003394vec_vminsw(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003395{
David Blaikie3302f2b2013-01-16 23:08:36 +00003396 return __builtin_altivec_vminsw((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003397}
3398
3399static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003400vec_vminsw(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003401{
David Blaikie3302f2b2013-01-16 23:08:36 +00003402 return __builtin_altivec_vminsw(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003403}
3404
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003405/* vec_vminuw */
3406
Anton Yartsevfc83c602010-08-19 03:21:36 +00003407static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003408vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003409{
David Blaikie3302f2b2013-01-16 23:08:36 +00003410 return __builtin_altivec_vminuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003411}
3412
Anton Yartsevfc83c602010-08-19 03:21:36 +00003413static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003414vec_vminuw(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003415{
David Blaikie3302f2b2013-01-16 23:08:36 +00003416 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003417}
3418
3419static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003420vec_vminuw(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003421{
David Blaikie3302f2b2013-01-16 23:08:36 +00003422 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003423}
3424
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003425/* vec_vminfp */
3426
3427static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003428vec_vminfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003429{
David Blaikie3302f2b2013-01-16 23:08:36 +00003430 return __builtin_altivec_vminfp(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003431}
3432
3433/* vec_mladd */
3434
3435#define __builtin_altivec_vmladduhm vec_mladd
3436
3437static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003438vec_mladd(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003439{
David Blaikie3302f2b2013-01-16 23:08:36 +00003440 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003441}
3442
3443static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003444vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003445{
David Blaikie3302f2b2013-01-16 23:08:36 +00003446 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003447}
3448
3449static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003450vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003451{
David Blaikie3302f2b2013-01-16 23:08:36 +00003452 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003453}
3454
3455static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003456vec_mladd(vector unsigned short __a,
3457 vector unsigned short __b,
3458 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003459{
David Blaikie3302f2b2013-01-16 23:08:36 +00003460 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003461}
3462
3463/* vec_vmladduhm */
3464
3465static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003466vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003467{
David Blaikie3302f2b2013-01-16 23:08:36 +00003468 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003469}
3470
3471static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003472vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003473{
David Blaikie3302f2b2013-01-16 23:08:36 +00003474 return __a * (vector short)__b + (vector short)__c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003475}
3476
3477static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003478vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003479{
David Blaikie3302f2b2013-01-16 23:08:36 +00003480 return (vector short)__a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003481}
3482
3483static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003484vec_vmladduhm(vector unsigned short __a,
3485 vector unsigned short __b,
3486 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003487{
David Blaikie3302f2b2013-01-16 23:08:36 +00003488 return __a * __b + __c;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003489}
3490
3491/* vec_mradds */
3492
3493static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003494vec_mradds(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003495{
David Blaikie3302f2b2013-01-16 23:08:36 +00003496 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003497}
3498
3499/* vec_vmhraddshs */
3500
3501static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003502vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003503{
David Blaikie3302f2b2013-01-16 23:08:36 +00003504 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003505}
3506
3507/* vec_msum */
3508
3509static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003510vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003511{
David Blaikie3302f2b2013-01-16 23:08:36 +00003512 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003513}
3514
3515static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003516vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003517{
David Blaikie3302f2b2013-01-16 23:08:36 +00003518 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003519}
3520
3521static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003522vec_msum(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003523{
David Blaikie3302f2b2013-01-16 23:08:36 +00003524 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003525}
3526
3527static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003528vec_msum(vector unsigned short __a,
3529 vector unsigned short __b,
3530 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003531{
David Blaikie3302f2b2013-01-16 23:08:36 +00003532 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003533}
3534
3535/* vec_vmsummbm */
3536
3537static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003538vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003539{
David Blaikie3302f2b2013-01-16 23:08:36 +00003540 return __builtin_altivec_vmsummbm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003541}
3542
3543/* vec_vmsumubm */
3544
3545static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003546vec_vmsumubm(vector unsigned char __a,
3547 vector unsigned char __b,
3548 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003549{
David Blaikie3302f2b2013-01-16 23:08:36 +00003550 return __builtin_altivec_vmsumubm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003551}
3552
3553/* vec_vmsumshm */
3554
3555static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003556vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003557{
David Blaikie3302f2b2013-01-16 23:08:36 +00003558 return __builtin_altivec_vmsumshm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003559}
3560
3561/* vec_vmsumuhm */
3562
3563static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003564vec_vmsumuhm(vector unsigned short __a,
3565 vector unsigned short __b,
3566 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003567{
David Blaikie3302f2b2013-01-16 23:08:36 +00003568 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003569}
3570
3571/* vec_msums */
3572
3573static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003574vec_msums(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003575{
David Blaikie3302f2b2013-01-16 23:08:36 +00003576 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003577}
3578
3579static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003580vec_msums(vector unsigned short __a,
3581 vector unsigned short __b,
3582 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003583{
David Blaikie3302f2b2013-01-16 23:08:36 +00003584 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003585}
3586
3587/* vec_vmsumshs */
3588
3589static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003590vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003591{
David Blaikie3302f2b2013-01-16 23:08:36 +00003592 return __builtin_altivec_vmsumshs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003593}
3594
3595/* vec_vmsumuhs */
3596
3597static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003598vec_vmsumuhs(vector unsigned short __a,
3599 vector unsigned short __b,
3600 vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003601{
David Blaikie3302f2b2013-01-16 23:08:36 +00003602 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003603}
3604
Chris Lattnerdad40622010-04-14 03:54:58 +00003605/* vec_mtvscr */
3606
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003607static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003608vec_mtvscr(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003609{
David Blaikie3302f2b2013-01-16 23:08:36 +00003610 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003611}
3612
3613static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003614vec_mtvscr(vector unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003615{
David Blaikie3302f2b2013-01-16 23:08:36 +00003616 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003617}
3618
3619static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003620vec_mtvscr(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003621{
David Blaikie3302f2b2013-01-16 23:08:36 +00003622 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003623}
3624
3625static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003626vec_mtvscr(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003627{
David Blaikie3302f2b2013-01-16 23:08:36 +00003628 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003629}
3630
3631static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003632vec_mtvscr(vector unsigned short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003633{
David Blaikie3302f2b2013-01-16 23:08:36 +00003634 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003635}
3636
3637static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003638vec_mtvscr(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003639{
David Blaikie3302f2b2013-01-16 23:08:36 +00003640 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003641}
3642
3643static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003644vec_mtvscr(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003645{
David Blaikie3302f2b2013-01-16 23:08:36 +00003646 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003647}
3648
3649static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003650vec_mtvscr(vector int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003651{
David Blaikie3302f2b2013-01-16 23:08:36 +00003652 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003653}
3654
3655static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003656vec_mtvscr(vector unsigned int __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003657{
David Blaikie3302f2b2013-01-16 23:08:36 +00003658 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003659}
3660
3661static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003662vec_mtvscr(vector bool int __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003663{
David Blaikie3302f2b2013-01-16 23:08:36 +00003664 __builtin_altivec_mtvscr((vector int)__a);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003665}
3666
3667static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003668vec_mtvscr(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003669{
David Blaikie3302f2b2013-01-16 23:08:36 +00003670 __builtin_altivec_mtvscr((vector int)__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003671}
3672
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003673/* The vmulos* and vmules* instructions have a big endian bias, so
3674 we must reverse the meaning of "even" and "odd" for little endian. */
3675
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003676/* vec_mule */
3677
3678static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003679vec_mule(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003680{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003681#ifdef __LITTLE_ENDIAN__
3682 return __builtin_altivec_vmulosb(__a, __b);
3683#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003684 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003685#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003686}
3687
3688static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003689vec_mule(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003690{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003691#ifdef __LITTLE_ENDIAN__
3692 return __builtin_altivec_vmuloub(__a, __b);
3693#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003694 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003695#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003696}
3697
3698static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003699vec_mule(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003700{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003701#ifdef __LITTLE_ENDIAN__
3702 return __builtin_altivec_vmulosh(__a, __b);
3703#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003704 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003705#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003706}
3707
3708static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003709vec_mule(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003710{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003711#ifdef __LITTLE_ENDIAN__
3712 return __builtin_altivec_vmulouh(__a, __b);
3713#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003714 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003715#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003716}
3717
3718/* vec_vmulesb */
3719
3720static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003721vec_vmulesb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003722{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003723#ifdef __LITTLE_ENDIAN__
3724 return __builtin_altivec_vmulosb(__a, __b);
3725#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003726 return __builtin_altivec_vmulesb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003727#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003728}
3729
3730/* vec_vmuleub */
3731
3732static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003733vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003734{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003735#ifdef __LITTLE_ENDIAN__
3736 return __builtin_altivec_vmuloub(__a, __b);
3737#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003738 return __builtin_altivec_vmuleub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003739#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003740}
3741
3742/* vec_vmulesh */
3743
3744static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003745vec_vmulesh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003746{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003747#ifdef __LITTLE_ENDIAN__
3748 return __builtin_altivec_vmulosh(__a, __b);
3749#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003750 return __builtin_altivec_vmulesh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003751#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003752}
3753
3754/* vec_vmuleuh */
3755
3756static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003757vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003758{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003759#ifdef __LITTLE_ENDIAN__
3760 return __builtin_altivec_vmulouh(__a, __b);
3761#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003762 return __builtin_altivec_vmuleuh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003763#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003764}
3765
3766/* vec_mulo */
3767
3768static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003769vec_mulo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003770{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003771#ifdef __LITTLE_ENDIAN__
3772 return __builtin_altivec_vmulesb(__a, __b);
3773#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003774 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003775#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003776}
3777
3778static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003779vec_mulo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003780{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003781#ifdef __LITTLE_ENDIAN__
3782 return __builtin_altivec_vmuleub(__a, __b);
3783#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003784 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003785#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003786}
3787
3788static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003789vec_mulo(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003790{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003791#ifdef __LITTLE_ENDIAN__
3792 return __builtin_altivec_vmulesh(__a, __b);
3793#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003794 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003795#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003796}
3797
3798static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003799vec_mulo(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003800{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003801#ifdef __LITTLE_ENDIAN__
3802 return __builtin_altivec_vmuleuh(__a, __b);
3803#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003804 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003805#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003806}
3807
3808/* vec_vmulosb */
3809
3810static vector short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003811vec_vmulosb(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003812{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003813#ifdef __LITTLE_ENDIAN__
3814 return __builtin_altivec_vmulesb(__a, __b);
3815#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003816 return __builtin_altivec_vmulosb(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003817#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003818}
3819
3820/* vec_vmuloub */
3821
3822static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003823vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003824{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003825#ifdef __LITTLE_ENDIAN__
3826 return __builtin_altivec_vmuleub(__a, __b);
3827#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003828 return __builtin_altivec_vmuloub(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003829#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003830}
3831
3832/* vec_vmulosh */
3833
3834static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003835vec_vmulosh(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003836{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003837#ifdef __LITTLE_ENDIAN__
3838 return __builtin_altivec_vmulesh(__a, __b);
3839#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003840 return __builtin_altivec_vmulosh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003841#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003842}
3843
3844/* vec_vmulouh */
3845
3846static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003847vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003848{
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003849#ifdef __LITTLE_ENDIAN__
3850 return __builtin_altivec_vmuleuh(__a, __b);
3851#else
David Blaikie3302f2b2013-01-16 23:08:36 +00003852 return __builtin_altivec_vmulouh(__a, __b);
Bill Schmidt7c0114f2014-06-06 14:45:06 +00003853#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003854}
3855
3856/* vec_nmsub */
3857
3858static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003859vec_nmsub(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003860{
David Blaikie3302f2b2013-01-16 23:08:36 +00003861 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003862}
3863
3864/* vec_vnmsubfp */
3865
3866static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00003867vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003868{
David Blaikie3302f2b2013-01-16 23:08:36 +00003869 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003870}
3871
3872/* vec_nor */
3873
3874#define __builtin_altivec_vnor vec_nor
3875
3876static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003877vec_nor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003878{
David Blaikie3302f2b2013-01-16 23:08:36 +00003879 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003880}
3881
3882static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003883vec_nor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003884{
David Blaikie3302f2b2013-01-16 23:08:36 +00003885 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003886}
3887
Anton Yartsevfc83c602010-08-19 03:21:36 +00003888static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003889vec_nor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003890{
David Blaikie3302f2b2013-01-16 23:08:36 +00003891 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003892}
3893
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003894static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003895vec_nor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003896{
David Blaikie3302f2b2013-01-16 23:08:36 +00003897 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003898}
3899
3900static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003901vec_nor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003902{
David Blaikie3302f2b2013-01-16 23:08:36 +00003903 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003904}
3905
Anton Yartsevfc83c602010-08-19 03:21:36 +00003906static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003907vec_nor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003908{
David Blaikie3302f2b2013-01-16 23:08:36 +00003909 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003910}
3911
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003912static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003913vec_nor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003914{
David Blaikie3302f2b2013-01-16 23:08:36 +00003915 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003916}
3917
3918static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003919vec_nor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003920{
David Blaikie3302f2b2013-01-16 23:08:36 +00003921 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003922}
3923
Anton Yartsevfc83c602010-08-19 03:21:36 +00003924static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003925vec_nor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003926{
David Blaikie3302f2b2013-01-16 23:08:36 +00003927 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003928}
3929
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003930static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003931vec_nor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003932{
David Blaikie3302f2b2013-01-16 23:08:36 +00003933 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
3934 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003935}
3936
3937/* vec_vnor */
3938
3939static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003940vec_vnor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003941{
David Blaikie3302f2b2013-01-16 23:08:36 +00003942 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003943}
3944
3945static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003946vec_vnor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003947{
David Blaikie3302f2b2013-01-16 23:08:36 +00003948 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003949}
3950
Anton Yartsevfc83c602010-08-19 03:21:36 +00003951static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003952vec_vnor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003953{
David Blaikie3302f2b2013-01-16 23:08:36 +00003954 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003955}
3956
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003957static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003958vec_vnor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003959{
David Blaikie3302f2b2013-01-16 23:08:36 +00003960 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003961}
3962
3963static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003964vec_vnor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003965{
David Blaikie3302f2b2013-01-16 23:08:36 +00003966 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003967}
3968
Anton Yartsevfc83c602010-08-19 03:21:36 +00003969static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003970vec_vnor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003971{
David Blaikie3302f2b2013-01-16 23:08:36 +00003972 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003973}
3974
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003975static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003976vec_vnor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003977{
David Blaikie3302f2b2013-01-16 23:08:36 +00003978 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003979}
3980
3981static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003982vec_vnor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003983{
David Blaikie3302f2b2013-01-16 23:08:36 +00003984 return ~(__a | __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003985}
3986
Anton Yartsevfc83c602010-08-19 03:21:36 +00003987static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003988vec_vnor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00003989{
David Blaikie3302f2b2013-01-16 23:08:36 +00003990 return ~(__a | __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00003991}
3992
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003993static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00003994vec_vnor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003995{
David Blaikie3302f2b2013-01-16 23:08:36 +00003996 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
3997 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00003998}
3999
4000/* vec_or */
4001
4002#define __builtin_altivec_vor vec_or
4003
4004static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004005vec_or(vector signed char __a, vector signed char __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
Anton Yartsevfc83c602010-08-19 03:21:36 +00004010static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004011vec_or(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004012{
David Blaikie3302f2b2013-01-16 23:08:36 +00004013 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004014}
4015
4016static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004017vec_or(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004018{
David Blaikie3302f2b2013-01-16 23:08:36 +00004019 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004020}
4021
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004022static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004023vec_or(vector unsigned char __a, vector unsigned char __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
Anton Yartsevfc83c602010-08-19 03:21:36 +00004028static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004029vec_or(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004030{
David Blaikie3302f2b2013-01-16 23:08:36 +00004031 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004032}
4033
4034static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004035vec_or(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004036{
David Blaikie3302f2b2013-01-16 23:08:36 +00004037 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004038}
4039
4040static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004041vec_or(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004042{
David Blaikie3302f2b2013-01-16 23:08:36 +00004043 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004044}
4045
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004046static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004047vec_or(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004048{
David Blaikie3302f2b2013-01-16 23:08:36 +00004049 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004050}
4051
Anton Yartsevfc83c602010-08-19 03:21:36 +00004052static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004053vec_or(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004054{
David Blaikie3302f2b2013-01-16 23:08:36 +00004055 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004056}
4057
4058static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004059vec_or(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004060{
David Blaikie3302f2b2013-01-16 23:08:36 +00004061 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004062}
4063
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004064static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004065vec_or(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004066{
David Blaikie3302f2b2013-01-16 23:08:36 +00004067 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004068}
4069
Anton Yartsevfc83c602010-08-19 03:21:36 +00004070static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004071vec_or(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004072{
David Blaikie3302f2b2013-01-16 23:08:36 +00004073 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004074}
4075
4076static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004077vec_or(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004078{
David Blaikie3302f2b2013-01-16 23:08:36 +00004079 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004080}
4081
4082static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004083vec_or(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004084{
David Blaikie3302f2b2013-01-16 23:08:36 +00004085 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004086}
4087
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004088static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004089vec_or(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004090{
David Blaikie3302f2b2013-01-16 23:08:36 +00004091 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004092}
4093
Anton Yartsevfc83c602010-08-19 03:21:36 +00004094static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004095vec_or(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004096{
David Blaikie3302f2b2013-01-16 23:08:36 +00004097 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004098}
4099
4100static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004101vec_or(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004102{
David Blaikie3302f2b2013-01-16 23:08:36 +00004103 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004104}
4105
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004106static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004107vec_or(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004108{
David Blaikie3302f2b2013-01-16 23:08:36 +00004109 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004110}
4111
Anton Yartsevfc83c602010-08-19 03:21:36 +00004112static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004113vec_or(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004114{
David Blaikie3302f2b2013-01-16 23:08:36 +00004115 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004116}
4117
4118static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004119vec_or(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004120{
David Blaikie3302f2b2013-01-16 23:08:36 +00004121 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004122}
4123
4124static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004125vec_or(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004126{
David Blaikie3302f2b2013-01-16 23:08:36 +00004127 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004128}
4129
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004130static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004131vec_or(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004132{
David Blaikie3302f2b2013-01-16 23:08:36 +00004133 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4134 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004135}
4136
Anton Yartsevfc83c602010-08-19 03:21:36 +00004137static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004138vec_or(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004139{
David Blaikie3302f2b2013-01-16 23:08:36 +00004140 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4141 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004142}
4143
4144static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004145vec_or(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004146{
David Blaikie3302f2b2013-01-16 23:08:36 +00004147 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4148 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004149}
4150
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004151/* vec_vor */
4152
4153static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004154vec_vor(vector signed char __a, vector signed char __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 signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004160vec_vor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004161{
David Blaikie3302f2b2013-01-16 23:08:36 +00004162 return (vector signed char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004163}
4164
4165static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004166vec_vor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004167{
David Blaikie3302f2b2013-01-16 23:08:36 +00004168 return __a | (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004169}
4170
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004171static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004172vec_vor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004173{
David Blaikie3302f2b2013-01-16 23:08:36 +00004174 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004175}
4176
Anton Yartsevfc83c602010-08-19 03:21:36 +00004177static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004178vec_vor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004179{
David Blaikie3302f2b2013-01-16 23:08:36 +00004180 return (vector unsigned char)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004181}
4182
4183static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004184vec_vor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004185{
David Blaikie3302f2b2013-01-16 23:08:36 +00004186 return __a | (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004187}
4188
4189static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004190vec_vor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004191{
David Blaikie3302f2b2013-01-16 23:08:36 +00004192 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004193}
4194
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004195static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004196vec_vor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004197{
David Blaikie3302f2b2013-01-16 23:08:36 +00004198 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004199}
4200
Anton Yartsevfc83c602010-08-19 03:21:36 +00004201static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004202vec_vor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004203{
David Blaikie3302f2b2013-01-16 23:08:36 +00004204 return (vector short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004205}
4206
4207static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004208vec_vor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004209{
David Blaikie3302f2b2013-01-16 23:08:36 +00004210 return __a | (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004211}
4212
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004213static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004214vec_vor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004215{
David Blaikie3302f2b2013-01-16 23:08:36 +00004216 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004217}
4218
Anton Yartsevfc83c602010-08-19 03:21:36 +00004219static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004220vec_vor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004221{
David Blaikie3302f2b2013-01-16 23:08:36 +00004222 return (vector unsigned short)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004223}
4224
4225static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004226vec_vor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004227{
David Blaikie3302f2b2013-01-16 23:08:36 +00004228 return __a | (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004229}
4230
4231static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004232vec_vor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004233{
David Blaikie3302f2b2013-01-16 23:08:36 +00004234 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004235}
4236
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004237static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004238vec_vor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004239{
David Blaikie3302f2b2013-01-16 23:08:36 +00004240 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004241}
4242
Anton Yartsevfc83c602010-08-19 03:21:36 +00004243static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004244vec_vor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004245{
David Blaikie3302f2b2013-01-16 23:08:36 +00004246 return (vector int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004247}
4248
4249static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004250vec_vor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004251{
David Blaikie3302f2b2013-01-16 23:08:36 +00004252 return __a | (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004253}
4254
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004255static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004256vec_vor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004257{
David Blaikie3302f2b2013-01-16 23:08:36 +00004258 return __a | __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004259}
4260
Anton Yartsevfc83c602010-08-19 03:21:36 +00004261static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004262vec_vor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004263{
David Blaikie3302f2b2013-01-16 23:08:36 +00004264 return (vector unsigned int)__a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004265}
4266
4267static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004268vec_vor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004269{
David Blaikie3302f2b2013-01-16 23:08:36 +00004270 return __a | (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004271}
4272
4273static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004274vec_vor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004275{
David Blaikie3302f2b2013-01-16 23:08:36 +00004276 return __a | __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004277}
4278
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004279static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004280vec_vor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004281{
David Blaikie3302f2b2013-01-16 23:08:36 +00004282 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4283 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004284}
4285
Anton Yartsevfc83c602010-08-19 03:21:36 +00004286static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004287vec_vor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004288{
David Blaikie3302f2b2013-01-16 23:08:36 +00004289 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4290 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004291}
4292
4293static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004294vec_vor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00004295{
David Blaikie3302f2b2013-01-16 23:08:36 +00004296 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4297 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00004298}
4299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004300/* vec_pack */
4301
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004302/* The various vector pack instructions have a big-endian bias, so for
4303 little endian we must handle reversed element numbering. */
4304
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004305static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004306vec_pack(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004307{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004308#ifdef __LITTLE_ENDIAN__
4309 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4310 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4311 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4312#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004313 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004314 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4315 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004316#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004317}
4318
4319static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004320vec_pack(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004321{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004322#ifdef __LITTLE_ENDIAN__
4323 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4324 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4325 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4326#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004327 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004328 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4329 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004330#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004331}
4332
Anton Yartsev9e968982010-08-19 03:00:09 +00004333static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004334vec_pack(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004335{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004336#ifdef __LITTLE_ENDIAN__
4337 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4338 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4339 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4340#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004341 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004342 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4343 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004344#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004345}
4346
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004347static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004348vec_pack(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004349{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004350#ifdef __LITTLE_ENDIAN__
4351 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4352 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4353 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4354#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004355 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004356 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4357 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004358#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004359}
4360
4361static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004362vec_pack(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004363{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004364#ifdef __LITTLE_ENDIAN__
4365 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4366 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4367 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4368#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004369 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004370 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4371 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004372#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004373}
4374
Anton Yartsev9e968982010-08-19 03:00:09 +00004375static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004376vec_pack(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004377{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004378#ifdef __LITTLE_ENDIAN__
Bill Schmidt1cf7c642014-06-13 18:30:06 +00004379 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004380 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4381 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4382#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004383 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004384 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4385 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004386#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004387}
4388
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004389/* vec_vpkuhum */
4390
4391#define __builtin_altivec_vpkuhum vec_vpkuhum
4392
4393static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004394vec_vpkuhum(vector signed short __a, vector signed short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004395{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004396#ifdef __LITTLE_ENDIAN__
4397 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4398 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4399 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4400#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004401 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004402 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4403 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004404#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004405}
4406
4407static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004408vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004409{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004410#ifdef __LITTLE_ENDIAN__
4411 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4412 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4413 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4414#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004415 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004416 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4417 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004418#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004419}
4420
Anton Yartsev9e968982010-08-19 03:00:09 +00004421static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004422vec_vpkuhum(vector bool short __a, vector bool short __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004423{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004424#ifdef __LITTLE_ENDIAN__
4425 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4426 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4427 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4428#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004429 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004430 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4431 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004432#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004433}
4434
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004435/* vec_vpkuwum */
4436
4437#define __builtin_altivec_vpkuwum vec_vpkuwum
4438
4439static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004440vec_vpkuwum(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004441{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004442#ifdef __LITTLE_ENDIAN__
4443 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4444 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4445 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4446#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004447 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004448 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4449 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004450#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004451}
4452
4453static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004454vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004455{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004456#ifdef __LITTLE_ENDIAN__
4457 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4458 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4459 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4460#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004461 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004462 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4463 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004464#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004465}
4466
Anton Yartsev9e968982010-08-19 03:00:09 +00004467static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004468vec_vpkuwum(vector bool int __a, vector bool int __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00004469{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004470#ifdef __LITTLE_ENDIAN__
4471 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4472 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4473 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4474#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004475 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Anton Yartsev9e968982010-08-19 03:00:09 +00004476 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4477 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004478#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004479}
4480
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004481/* vec_packpx */
4482
4483static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004484vec_packpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004485{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004486#ifdef __LITTLE_ENDIAN__
4487 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4488#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004489 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004490#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004491}
4492
4493/* vec_vpkpx */
4494
4495static vector pixel __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004496vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004497{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004498#ifdef __LITTLE_ENDIAN__
4499 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4500#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004501 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004502#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004503}
4504
4505/* vec_packs */
4506
4507static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004508vec_packs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004509{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004510#ifdef __LITTLE_ENDIAN__
4511 return __builtin_altivec_vpkshss(__b, __a);
4512#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004513 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004514#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004515}
4516
4517static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004518vec_packs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004519{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004520#ifdef __LITTLE_ENDIAN__
4521 return __builtin_altivec_vpkuhus(__b, __a);
4522#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004523 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004524#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004525}
4526
4527static vector signed short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004528vec_packs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004529{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004530#ifdef __LITTLE_ENDIAN__
4531 return __builtin_altivec_vpkswss(__b, __a);
4532#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004533 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004534#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004535}
4536
4537static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004538vec_packs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004539{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004540#ifdef __LITTLE_ENDIAN__
4541 return __builtin_altivec_vpkuwus(__b, __a);
4542#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004543 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004544#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004545}
4546
4547/* vec_vpkshss */
4548
4549static vector signed char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004550vec_vpkshss(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004551{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004552#ifdef __LITTLE_ENDIAN__
4553 return __builtin_altivec_vpkshss(__b, __a);
4554#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004555 return __builtin_altivec_vpkshss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004556#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004557}
4558
4559/* vec_vpkuhus */
4560
4561static vector unsigned char __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004562vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004563{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004564#ifdef __LITTLE_ENDIAN__
4565 return __builtin_altivec_vpkuhus(__b, __a);
4566#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004567 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004568#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004569}
4570
4571/* vec_vpkswss */
4572
4573static vector signed short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004574vec_vpkswss(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004575{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004576#ifdef __LITTLE_ENDIAN__
4577 return __builtin_altivec_vpkswss(__b, __a);
4578#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004579 return __builtin_altivec_vpkswss(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004580#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004581}
4582
4583/* vec_vpkuwus */
4584
4585static vector unsigned short __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004586vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004587{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004588#ifdef __LITTLE_ENDIAN__
4589 return __builtin_altivec_vpkuwus(__b, __a);
4590#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004591 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004592#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004593}
4594
4595/* vec_packsu */
4596
4597static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004598vec_packsu(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004599{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004600#ifdef __LITTLE_ENDIAN__
4601 return __builtin_altivec_vpkshus(__b, __a);
4602#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004603 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004604#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004605}
4606
4607static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004608vec_packsu(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004609{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004610#ifdef __LITTLE_ENDIAN__
4611 return __builtin_altivec_vpkuhus(__b, __a);
4612#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004613 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004614#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004615}
4616
4617static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004618vec_packsu(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004619{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004620#ifdef __LITTLE_ENDIAN__
4621 return __builtin_altivec_vpkswus(__b, __a);
4622#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004623 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004624#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004625}
4626
4627static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004628vec_packsu(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004629{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004630#ifdef __LITTLE_ENDIAN__
4631 return __builtin_altivec_vpkuwus(__b, __a);
4632#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004633 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004634#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004635}
4636
4637/* vec_vpkshus */
4638
4639static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004640vec_vpkshus(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004641{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004642#ifdef __LITTLE_ENDIAN__
4643 return __builtin_altivec_vpkshus(__b, __a);
4644#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004645 return __builtin_altivec_vpkshus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004646#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004647}
4648
4649static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004650vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004651{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004652#ifdef __LITTLE_ENDIAN__
4653 return __builtin_altivec_vpkuhus(__b, __a);
4654#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004655 return __builtin_altivec_vpkuhus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004656#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004657}
4658
4659/* vec_vpkswus */
4660
4661static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004662vec_vpkswus(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004663{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004664#ifdef __LITTLE_ENDIAN__
4665 return __builtin_altivec_vpkswus(__b, __a);
4666#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004667 return __builtin_altivec_vpkswus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004668#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004669}
4670
4671static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004672vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004673{
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004674#ifdef __LITTLE_ENDIAN__
4675 return __builtin_altivec_vpkuwus(__b, __a);
4676#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004677 return __builtin_altivec_vpkuwus(__a, __b);
Bill Schmidt8a7b4f12014-06-06 15:10:47 +00004678#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004679}
4680
4681/* vec_perm */
4682
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004683// The vperm instruction is defined architecturally with a big-endian bias.
4684// For little endian, we swap the input operands and invert the permute
4685// control vector. Only the rightmost 5 bits matter, so we could use
4686// a vector of all 31s instead of all 255s to perform the inversion.
4687// However, when the PCV is not a constant, using 255 has an advantage
4688// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4689// later, possibly a vec_nand).
4690
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004691vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004692vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004693{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004694#ifdef __LITTLE_ENDIAN__
4695 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4696 255,255,255,255,255,255,255,255};
4697 __d = vec_xor(__c, __d);
4698 return (vector signed char)
4699 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4700#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004701 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004702 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004703#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004704}
4705
4706vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004707vec_perm(vector unsigned char __a,
4708 vector unsigned char __b,
4709 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004710{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004711#ifdef __LITTLE_ENDIAN__
4712 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4713 255,255,255,255,255,255,255,255};
4714 __d = vec_xor(__c, __d);
4715 return (vector unsigned char)
4716 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4717#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004718 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004719 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004720#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004721}
4722
Anton Yartsev9e968982010-08-19 03:00:09 +00004723vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004724vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004725{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004726#ifdef __LITTLE_ENDIAN__
4727 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4728 255,255,255,255,255,255,255,255};
4729 __d = vec_xor(__c, __d);
4730 return (vector bool char)
4731 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4732#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004733 return (vector bool char)
David Blaikie3302f2b2013-01-16 23:08:36 +00004734 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004735#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004736}
4737
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004738vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004739vec_perm(vector short __a, vector short __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 short)
4746 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4747#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004748 return (vector short)
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 short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004754vec_perm(vector unsigned short __a,
4755 vector unsigned short __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 short)
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 short)
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 short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004771vec_perm(vector bool short __a, vector bool short __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 short)
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 short)
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
4785vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004786vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +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 pixel)
4793 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4794#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004795 return (vector pixel)
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 Yartsev9e968982010-08-19 03:00:09 +00004798}
4799
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004800vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004801vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004802{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004803#ifdef __LITTLE_ENDIAN__
4804 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4805 255,255,255,255,255,255,255,255};
4806 __d = vec_xor(__c, __d);
4807 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4808#else
David Blaikie3302f2b2013-01-16 23:08:36 +00004809 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004810#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004811}
4812
4813vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004814vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004815{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004816#ifdef __LITTLE_ENDIAN__
4817 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4818 255,255,255,255,255,255,255,255};
4819 __d = vec_xor(__c, __d);
4820 return (vector unsigned int)
4821 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4822#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004823 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004824 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004825#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004826}
4827
Anton Yartsev9e968982010-08-19 03:00:09 +00004828vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004829vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004830{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004831#ifdef __LITTLE_ENDIAN__
4832 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4833 255,255,255,255,255,255,255,255};
4834 __d = vec_xor(__c, __d);
4835 return (vector bool int)
4836 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4837#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004838 return (vector bool int)
David Blaikie3302f2b2013-01-16 23:08:36 +00004839 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004840#endif
Anton Yartsev9e968982010-08-19 03:00:09 +00004841}
4842
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004843vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004844vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004845{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004846#ifdef __LITTLE_ENDIAN__
4847 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4848 255,255,255,255,255,255,255,255};
4849 __d = vec_xor(__c, __d);
4850 return (vector float)
4851 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4852#else
Anton Yartsev79d6af32010-09-18 00:39:16 +00004853 return (vector float)
David Blaikie3302f2b2013-01-16 23:08:36 +00004854 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004855#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004856}
4857
4858/* vec_vperm */
4859
Ulrich Weigand9936f132012-10-31 18:17:07 +00004860static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004861vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004862{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004863 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004864}
4865
Ulrich Weigand9936f132012-10-31 18:17:07 +00004866static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004867vec_vperm(vector unsigned char __a,
4868 vector unsigned char __b,
4869 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004870{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004871 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004872}
4873
Ulrich Weigand9936f132012-10-31 18:17:07 +00004874static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004875vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004876{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004877 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004878}
4879
Ulrich Weigand9936f132012-10-31 18:17:07 +00004880static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004881vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004882{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004883 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004884}
4885
Ulrich Weigand9936f132012-10-31 18:17:07 +00004886static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004887vec_vperm(vector unsigned short __a,
4888 vector unsigned short __b,
4889 vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004890{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004891 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004892}
4893
Ulrich Weigand9936f132012-10-31 18:17:07 +00004894static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004895vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004896{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004897 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004898}
4899
Ulrich Weigand9936f132012-10-31 18:17:07 +00004900static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004901vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004902{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004903 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004904}
4905
Ulrich Weigand9936f132012-10-31 18:17:07 +00004906static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004907vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004908{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004909 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004910}
4911
Ulrich Weigand9936f132012-10-31 18:17:07 +00004912static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004913vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004914{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004915 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004916}
4917
Ulrich Weigand9936f132012-10-31 18:17:07 +00004918static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004919vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00004920{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004921 return vec_perm(__a, __b, __c);
Anton Yartsev9e968982010-08-19 03:00:09 +00004922}
4923
Ulrich Weigand9936f132012-10-31 18:17:07 +00004924static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004925vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004926{
Bill Schmidtf7e289c2014-06-05 19:07:40 +00004927 return vec_perm(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004928}
4929
4930/* vec_re */
4931
Ulrich Weigand9936f132012-10-31 18:17:07 +00004932static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004933vec_re(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004934{
David Blaikie3302f2b2013-01-16 23:08:36 +00004935 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004936}
4937
4938/* vec_vrefp */
4939
Ulrich Weigand9936f132012-10-31 18:17:07 +00004940static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00004941vec_vrefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004942{
David Blaikie3302f2b2013-01-16 23:08:36 +00004943 return __builtin_altivec_vrefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004944}
4945
4946/* vec_rl */
4947
4948static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004949vec_rl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004950{
David Blaikie3302f2b2013-01-16 23:08:36 +00004951 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004952}
4953
4954static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004955vec_rl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004956{
David Blaikie3302f2b2013-01-16 23:08:36 +00004957 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004958}
4959
4960static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004961vec_rl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004962{
David Blaikie3302f2b2013-01-16 23:08:36 +00004963 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004964}
4965
4966static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004967vec_rl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004968{
David Blaikie3302f2b2013-01-16 23:08:36 +00004969 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004970}
4971
4972static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004973vec_rl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004974{
David Blaikie3302f2b2013-01-16 23:08:36 +00004975 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004976}
4977
4978static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004979vec_rl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004980{
David Blaikie3302f2b2013-01-16 23:08:36 +00004981 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004982}
4983
4984/* vec_vrlb */
4985
4986static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004987vec_vrlb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004988{
David Blaikie3302f2b2013-01-16 23:08:36 +00004989 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004990}
4991
4992static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00004993vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004994{
David Blaikie3302f2b2013-01-16 23:08:36 +00004995 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00004996}
4997
4998/* vec_vrlh */
4999
5000static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005001vec_vrlh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005002{
David Blaikie3302f2b2013-01-16 23:08:36 +00005003 return __builtin_altivec_vrlh(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005004}
5005
5006static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005007vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005008{
David Blaikie3302f2b2013-01-16 23:08:36 +00005009 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005010}
5011
5012/* vec_vrlw */
5013
5014static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005015vec_vrlw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005016{
David Blaikie3302f2b2013-01-16 23:08:36 +00005017 return __builtin_altivec_vrlw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005018}
5019
5020static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005021vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005022{
David Blaikie3302f2b2013-01-16 23:08:36 +00005023 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005024}
5025
5026/* vec_round */
5027
5028static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005029vec_round(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005030{
David Blaikie3302f2b2013-01-16 23:08:36 +00005031 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005032}
5033
5034/* vec_vrfin */
5035
5036static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005037vec_vrfin(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005038{
David Blaikie3302f2b2013-01-16 23:08:36 +00005039 return __builtin_altivec_vrfin(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005040}
5041
5042/* vec_rsqrte */
5043
5044static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005045vec_rsqrte(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005046{
David Blaikie3302f2b2013-01-16 23:08:36 +00005047 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005048}
5049
5050/* vec_vrsqrtefp */
5051
5052static __vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00005053vec_vrsqrtefp(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005054{
David Blaikie3302f2b2013-01-16 23:08:36 +00005055 return __builtin_altivec_vrsqrtefp(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005056}
5057
5058/* vec_sel */
5059
5060#define __builtin_altivec_vsel_4si vec_sel
5061
5062static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005063vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005064{
David Blaikie3302f2b2013-01-16 23:08:36 +00005065 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005066}
5067
Anton Yartsevfc83c602010-08-19 03:21:36 +00005068static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005069vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005070{
David Blaikie3302f2b2013-01-16 23:08:36 +00005071 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005072}
5073
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005074static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005075vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005076{
David Blaikie3302f2b2013-01-16 23:08:36 +00005077 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005078}
5079
Anton Yartsevfc83c602010-08-19 03:21:36 +00005080static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005081vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005082{
David Blaikie3302f2b2013-01-16 23:08:36 +00005083 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005084}
5085
5086static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005087vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005088{
David Blaikie3302f2b2013-01-16 23:08:36 +00005089 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005090}
5091
5092static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005093vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005094{
David Blaikie3302f2b2013-01-16 23:08:36 +00005095 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005096}
5097
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005098static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005099vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005100{
David Blaikie3302f2b2013-01-16 23:08:36 +00005101 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005102}
5103
Anton Yartsevfc83c602010-08-19 03:21:36 +00005104static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005105vec_sel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005106{
David Blaikie3302f2b2013-01-16 23:08:36 +00005107 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005108}
5109
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005110static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005111vec_sel(vector unsigned short __a,
5112 vector unsigned short __b,
5113 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005114{
David Blaikie3302f2b2013-01-16 23:08:36 +00005115 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005116}
5117
Anton Yartsevfc83c602010-08-19 03:21:36 +00005118static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005119vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005120{
David Blaikie3302f2b2013-01-16 23:08:36 +00005121 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005122}
5123
5124static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005125vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005126{
David Blaikie3302f2b2013-01-16 23:08:36 +00005127 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005128}
5129
5130static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005131vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005132{
David Blaikie3302f2b2013-01-16 23:08:36 +00005133 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005134}
5135
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005136static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005137vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005138{
David Blaikie3302f2b2013-01-16 23:08:36 +00005139 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005140}
5141
Anton Yartsevfc83c602010-08-19 03:21:36 +00005142static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005143vec_sel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005144{
David Blaikie3302f2b2013-01-16 23:08:36 +00005145 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005146}
5147
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005148static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005149vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005150{
David Blaikie3302f2b2013-01-16 23:08:36 +00005151 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005152}
5153
Anton Yartsevfc83c602010-08-19 03:21:36 +00005154static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005155vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005156{
David Blaikie3302f2b2013-01-16 23:08:36 +00005157 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005158}
5159
5160static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005161vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005162{
David Blaikie3302f2b2013-01-16 23:08:36 +00005163 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005164}
5165
5166static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005167vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005168{
David Blaikie3302f2b2013-01-16 23:08:36 +00005169 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005170}
5171
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005172static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005173vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005174{
David Blaikie3302f2b2013-01-16 23:08:36 +00005175 vector int __res = ((vector int)__a & ~(vector int)__c)
5176 | ((vector int)__b & (vector int)__c);
5177 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005178}
5179
Anton Yartsevfc83c602010-08-19 03:21:36 +00005180static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005181vec_sel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005182{
David Blaikie3302f2b2013-01-16 23:08:36 +00005183 vector int __res = ((vector int)__a & ~(vector int)__c)
5184 | ((vector int)__b & (vector int)__c);
5185 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005186}
5187
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005188/* vec_vsel */
5189
5190static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005191vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005192{
David Blaikie3302f2b2013-01-16 23:08:36 +00005193 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005194}
5195
Anton Yartsevfc83c602010-08-19 03:21:36 +00005196static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005197vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005198{
David Blaikie3302f2b2013-01-16 23:08:36 +00005199 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005200}
5201
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005202static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005203vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005204{
David Blaikie3302f2b2013-01-16 23:08:36 +00005205 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005206}
5207
Anton Yartsevfc83c602010-08-19 03:21:36 +00005208static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005209vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005210{
David Blaikie3302f2b2013-01-16 23:08:36 +00005211 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005212}
5213
5214static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005215vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005216{
David Blaikie3302f2b2013-01-16 23:08:36 +00005217 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005218}
5219
5220static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005221vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005222{
David Blaikie3302f2b2013-01-16 23:08:36 +00005223 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005224}
5225
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005226static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005227vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005228{
David Blaikie3302f2b2013-01-16 23:08:36 +00005229 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005230}
5231
Anton Yartsevfc83c602010-08-19 03:21:36 +00005232static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005233vec_vsel(vector short __a, vector short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005234{
David Blaikie3302f2b2013-01-16 23:08:36 +00005235 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005236}
5237
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005238static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005239vec_vsel(vector unsigned short __a,
5240 vector unsigned short __b,
5241 vector unsigned short __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005242{
David Blaikie3302f2b2013-01-16 23:08:36 +00005243 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005244}
5245
Anton Yartsevfc83c602010-08-19 03:21:36 +00005246static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005247vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005248{
David Blaikie3302f2b2013-01-16 23:08:36 +00005249 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005250}
5251
5252static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005253vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005254{
David Blaikie3302f2b2013-01-16 23:08:36 +00005255 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005256}
5257
5258static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005259vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005260{
David Blaikie3302f2b2013-01-16 23:08:36 +00005261 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005262}
5263
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005264static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005265vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005266{
David Blaikie3302f2b2013-01-16 23:08:36 +00005267 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005268}
5269
Anton Yartsevfc83c602010-08-19 03:21:36 +00005270static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005271vec_vsel(vector int __a, vector int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005272{
David Blaikie3302f2b2013-01-16 23:08:36 +00005273 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005274}
5275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005276static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005277vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005278{
David Blaikie3302f2b2013-01-16 23:08:36 +00005279 return (__a & ~__c) | (__b & __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005280}
5281
Anton Yartsevfc83c602010-08-19 03:21:36 +00005282static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005283vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005284{
David Blaikie3302f2b2013-01-16 23:08:36 +00005285 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005286}
5287
5288static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005289vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005290{
David Blaikie3302f2b2013-01-16 23:08:36 +00005291 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005292}
5293
5294static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005295vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005296{
David Blaikie3302f2b2013-01-16 23:08:36 +00005297 return (__a & ~__c) | (__b & __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005298}
5299
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005300static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005301vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005302{
David Blaikie3302f2b2013-01-16 23:08:36 +00005303 vector int __res = ((vector int)__a & ~(vector int)__c)
5304 | ((vector int)__b & (vector int)__c);
5305 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005306}
5307
Anton Yartsevfc83c602010-08-19 03:21:36 +00005308static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005309vec_vsel(vector float __a, vector float __b, vector bool int __c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005310{
David Blaikie3302f2b2013-01-16 23:08:36 +00005311 vector int __res = ((vector int)__a & ~(vector int)__c)
5312 | ((vector int)__b & (vector int)__c);
5313 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00005314}
5315
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005316/* vec_sl */
5317
5318static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005319vec_sl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005320{
David Blaikie3302f2b2013-01-16 23:08:36 +00005321 return __a << (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005322}
5323
5324static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005325vec_sl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005326{
David Blaikie3302f2b2013-01-16 23:08:36 +00005327 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005328}
5329
5330static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005331vec_sl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005332{
David Blaikie3302f2b2013-01-16 23:08:36 +00005333 return __a << (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005334}
5335
5336static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005337vec_sl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005338{
David Blaikie3302f2b2013-01-16 23:08:36 +00005339 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005340}
5341
5342static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005343vec_sl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005344{
David Blaikie3302f2b2013-01-16 23:08:36 +00005345 return __a << (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005346}
5347
5348static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005349vec_sl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005350{
David Blaikie3302f2b2013-01-16 23:08:36 +00005351 return __a << __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005352}
5353
5354/* vec_vslb */
5355
5356#define __builtin_altivec_vslb vec_vslb
5357
5358static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005359vec_vslb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005360{
David Blaikie3302f2b2013-01-16 23:08:36 +00005361 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005362}
5363
5364static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005365vec_vslb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005366{
David Blaikie3302f2b2013-01-16 23:08:36 +00005367 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005368}
5369
5370/* vec_vslh */
5371
5372#define __builtin_altivec_vslh vec_vslh
5373
5374static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005375vec_vslh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005376{
David Blaikie3302f2b2013-01-16 23:08:36 +00005377 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005378}
5379
5380static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005381vec_vslh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005382{
David Blaikie3302f2b2013-01-16 23:08:36 +00005383 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005384}
5385
5386/* vec_vslw */
5387
5388#define __builtin_altivec_vslw vec_vslw
5389
5390static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005391vec_vslw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005392{
David Blaikie3302f2b2013-01-16 23:08:36 +00005393 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005394}
5395
5396static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005397vec_vslw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005398{
David Blaikie3302f2b2013-01-16 23:08:36 +00005399 return vec_sl(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005400}
5401
5402/* vec_sld */
5403
5404#define __builtin_altivec_vsldoi_4si vec_sld
5405
5406static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005407vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005408{
David Blaikie3302f2b2013-01-16 23:08:36 +00005409 return vec_perm(__a, __b, (vector unsigned char)
5410 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5411 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005412}
5413
5414static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005415vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005416{
David Blaikie3302f2b2013-01-16 23:08:36 +00005417 return vec_perm(__a, __b, (vector unsigned char)
5418 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5419 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005420}
5421
5422static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005423vec_sld(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005424{
David Blaikie3302f2b2013-01-16 23:08:36 +00005425 return vec_perm(__a, __b, (vector unsigned char)
5426 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5427 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005428}
5429
5430static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005431vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005432{
David Blaikie3302f2b2013-01-16 23:08:36 +00005433 return vec_perm(__a, __b, (vector unsigned char)
5434 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5435 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005436}
5437
5438static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005439vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005440{
David Blaikie3302f2b2013-01-16 23:08:36 +00005441 return vec_perm(__a, __b, (vector unsigned char)
5442 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5443 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005444}
5445
5446static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005447vec_sld(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005448{
David Blaikie3302f2b2013-01-16 23:08:36 +00005449 return vec_perm(__a, __b, (vector unsigned char)
5450 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5451 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005452}
5453
5454static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005455vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005456{
David Blaikie3302f2b2013-01-16 23:08:36 +00005457 return vec_perm(__a, __b, (vector unsigned char)
5458 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5459 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005460}
5461
5462static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005463vec_sld(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005464{
David Blaikie3302f2b2013-01-16 23:08:36 +00005465 return vec_perm(__a, __b, (vector unsigned char)
5466 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5467 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005468}
5469
5470/* vec_vsldoi */
5471
5472static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005473vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005474{
David Blaikie3302f2b2013-01-16 23:08:36 +00005475 return vec_perm(__a, __b, (vector unsigned char)
5476 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5477 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005478}
5479
5480static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005481vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005482{
David Blaikie3302f2b2013-01-16 23:08:36 +00005483 return vec_perm(__a, __b, (vector unsigned char)
5484 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5485 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005486}
5487
5488static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005489vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005490{
David Blaikie3302f2b2013-01-16 23:08:36 +00005491 return vec_perm(__a, __b, (vector unsigned char)
5492 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5493 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005494}
5495
5496static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005497vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005498{
David Blaikie3302f2b2013-01-16 23:08:36 +00005499 return vec_perm(__a, __b, (vector unsigned char)
5500 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5501 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Yartsev9e968982010-08-19 03:00:09 +00005502}
5503
5504static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005505vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Anton Yartsev9e968982010-08-19 03:00:09 +00005506{
David Blaikie3302f2b2013-01-16 23:08:36 +00005507 return vec_perm(__a, __b, (vector unsigned char)
5508 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5509 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005510}
5511
5512static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005513vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005514{
David Blaikie3302f2b2013-01-16 23:08:36 +00005515 return vec_perm(__a, __b, (vector unsigned char)
5516 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5517 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005518}
5519
5520static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005521vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005522{
David Blaikie3302f2b2013-01-16 23:08:36 +00005523 return vec_perm(__a, __b, (vector unsigned char)
5524 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5525 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005526}
5527
5528static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005529vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005530{
David Blaikie3302f2b2013-01-16 23:08:36 +00005531 return vec_perm(__a, __b, (vector unsigned char)
5532 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5533 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005534}
5535
5536/* vec_sll */
5537
5538static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005539vec_sll(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005540{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005541 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005542 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005543}
5544
5545static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005546vec_sll(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005547{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005548 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005549 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005550}
5551
5552static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005553vec_sll(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005554{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005555 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005556 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005557}
5558
5559static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005560vec_sll(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005561{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005562 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005563 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005564}
5565
5566static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005567vec_sll(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005568{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005569 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005570 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005571}
5572
5573static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005574vec_sll(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005575{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005576 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005577 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005578}
5579
Anton Yartsevfc83c602010-08-19 03:21:36 +00005580static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005581vec_sll(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005582{
David Blaikie3302f2b2013-01-16 23:08:36 +00005583 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005584}
5585
5586static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005587vec_sll(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005588{
David Blaikie3302f2b2013-01-16 23:08:36 +00005589 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005590}
5591
5592static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005593vec_sll(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005594{
David Blaikie3302f2b2013-01-16 23:08:36 +00005595 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005596}
5597
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005598static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005599vec_sll(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005600{
David Blaikie3302f2b2013-01-16 23:08:36 +00005601 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005602}
5603
5604static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005605vec_sll(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005606{
David Blaikie3302f2b2013-01-16 23:08:36 +00005607 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005608}
5609
5610static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005611vec_sll(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005612{
David Blaikie3302f2b2013-01-16 23:08:36 +00005613 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005614}
5615
5616static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005617vec_sll(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005618{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005619 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005620 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005621}
5622
5623static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005624vec_sll(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005625{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005626 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005627 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005628}
5629
5630static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005631vec_sll(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005632{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005633 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005634 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005635}
5636
Anton Yartsevfc83c602010-08-19 03:21:36 +00005637static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005638vec_sll(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005639{
David Blaikie3302f2b2013-01-16 23:08:36 +00005640 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005641}
5642
5643static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005644vec_sll(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005645{
David Blaikie3302f2b2013-01-16 23:08:36 +00005646 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005647}
5648
5649static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005650vec_sll(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005651{
David Blaikie3302f2b2013-01-16 23:08:36 +00005652 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005653}
5654
5655static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005656vec_sll(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005657{
David Blaikie3302f2b2013-01-16 23:08:36 +00005658 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005659}
5660
5661static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005662vec_sll(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005663{
David Blaikie3302f2b2013-01-16 23:08:36 +00005664 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005665}
5666
5667static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005668vec_sll(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005669{
David Blaikie3302f2b2013-01-16 23:08:36 +00005670 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005671}
5672
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005673static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005674vec_sll(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005675{
David Blaikie3302f2b2013-01-16 23:08:36 +00005676 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005677}
5678
5679static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005680vec_sll(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005681{
David Blaikie3302f2b2013-01-16 23:08:36 +00005682 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005683}
5684
5685static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005686vec_sll(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005687{
David Blaikie3302f2b2013-01-16 23:08:36 +00005688 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005689}
5690
5691static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005692vec_sll(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005693{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005694 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005695 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005696}
5697
5698static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005699vec_sll(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005700{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005701 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005702 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005703}
5704
5705static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005706vec_sll(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005707{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005708 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005709 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005710}
5711
Anton Yartsevfc83c602010-08-19 03:21:36 +00005712static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005713vec_sll(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005714{
David Blaikie3302f2b2013-01-16 23:08:36 +00005715 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005716}
5717
5718static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005719vec_sll(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005720{
David Blaikie3302f2b2013-01-16 23:08:36 +00005721 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005722}
5723
5724static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005725vec_sll(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005726{
David Blaikie3302f2b2013-01-16 23:08:36 +00005727 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005728}
5729
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005730/* vec_vsl */
5731
5732static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005733vec_vsl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005734{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005735 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005736 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005737}
5738
5739static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005740vec_vsl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005741{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005742 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005743 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005744}
5745
5746static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005747vec_vsl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005748{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005749 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005750 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005751}
5752
5753static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005754vec_vsl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005755{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005756 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005757 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005758}
5759
5760static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005761vec_vsl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005762{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005763 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005764 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005765}
5766
5767static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005768vec_vsl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005769{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005770 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005771 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005772}
5773
Anton Yartsevfc83c602010-08-19 03:21:36 +00005774static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005775vec_vsl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005776{
David Blaikie3302f2b2013-01-16 23:08:36 +00005777 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005778}
5779
5780static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005781vec_vsl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005782{
David Blaikie3302f2b2013-01-16 23:08:36 +00005783 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005784}
5785
5786static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005787vec_vsl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005788{
David Blaikie3302f2b2013-01-16 23:08:36 +00005789 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005790}
5791
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005792static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005793vec_vsl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005794{
David Blaikie3302f2b2013-01-16 23:08:36 +00005795 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005796}
5797
5798static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005799vec_vsl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005800{
David Blaikie3302f2b2013-01-16 23:08:36 +00005801 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005802}
5803
5804static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005805vec_vsl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005806{
David Blaikie3302f2b2013-01-16 23:08:36 +00005807 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005808}
5809
5810static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005811vec_vsl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005812{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005813 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005814 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005815}
5816
5817static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005818vec_vsl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005819{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005820 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005821 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005822}
5823
5824static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005825vec_vsl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005826{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005827 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005828 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005829}
5830
Anton Yartsevfc83c602010-08-19 03:21:36 +00005831static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005832vec_vsl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005833{
David Blaikie3302f2b2013-01-16 23:08:36 +00005834 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005835}
5836
5837static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005838vec_vsl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005839{
David Blaikie3302f2b2013-01-16 23:08:36 +00005840 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005841}
5842
5843static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005844vec_vsl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005845{
David Blaikie3302f2b2013-01-16 23:08:36 +00005846 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005847}
5848
5849static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005850vec_vsl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005851{
David Blaikie3302f2b2013-01-16 23:08:36 +00005852 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005853}
5854
5855static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005856vec_vsl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005857{
David Blaikie3302f2b2013-01-16 23:08:36 +00005858 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005859}
5860
5861static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005862vec_vsl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005863{
David Blaikie3302f2b2013-01-16 23:08:36 +00005864 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005865}
5866
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005867static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005868vec_vsl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005869{
David Blaikie3302f2b2013-01-16 23:08:36 +00005870 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005871}
5872
5873static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005874vec_vsl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005875{
David Blaikie3302f2b2013-01-16 23:08:36 +00005876 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005877}
5878
5879static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005880vec_vsl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005881{
David Blaikie3302f2b2013-01-16 23:08:36 +00005882 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005883}
5884
5885static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005886vec_vsl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005887{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005888 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005889 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005890}
5891
5892static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005893vec_vsl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005894{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005895 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005896 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005897}
5898
5899static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005900vec_vsl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005901{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005902 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00005903 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005904}
5905
Anton Yartsevfc83c602010-08-19 03:21:36 +00005906static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005907vec_vsl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005908{
David Blaikie3302f2b2013-01-16 23:08:36 +00005909 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005910}
5911
5912static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005913vec_vsl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005914{
David Blaikie3302f2b2013-01-16 23:08:36 +00005915 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005916}
5917
5918static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005919vec_vsl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005920{
David Blaikie3302f2b2013-01-16 23:08:36 +00005921 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005922}
5923
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005924/* vec_slo */
5925
5926static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005927vec_slo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005928{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005929 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005930 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005931}
5932
5933static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005934vec_slo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005935{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005936 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005937 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005938}
5939
5940static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005941vec_slo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005942{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005943 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005944 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005945}
5946
5947static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005948vec_slo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005949{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005950 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00005951 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005952}
5953
5954static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005955vec_slo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005956{
David Blaikie3302f2b2013-01-16 23:08:36 +00005957 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005958}
5959
5960static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005961vec_slo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005962{
David Blaikie3302f2b2013-01-16 23:08:36 +00005963 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005964}
5965
5966static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005967vec_slo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005968{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005969 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00005970 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005971}
5972
5973static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005974vec_slo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005975{
Anton Yartsev79d6af32010-09-18 00:39:16 +00005976 return (vector unsigned short)
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
Anton Yartsevfc83c602010-08-19 03:21:36 +00005980static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005981vec_slo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005982{
David Blaikie3302f2b2013-01-16 23:08:36 +00005983 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005984}
5985
5986static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005987vec_slo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00005988{
David Blaikie3302f2b2013-01-16 23:08:36 +00005989 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00005990}
5991
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005992static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005993vec_slo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005994{
David Blaikie3302f2b2013-01-16 23:08:36 +00005995 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00005996}
5997
5998static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00005999vec_slo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006000{
David Blaikie3302f2b2013-01-16 23:08:36 +00006001 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006002}
6003
6004static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006005vec_slo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006006{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006007 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006008 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006009}
6010
6011static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006012vec_slo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006013{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006014 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006015 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006016}
6017
6018static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006019vec_slo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006020{
David Blaikie3302f2b2013-01-16 23:08:36 +00006021 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006022}
6023
6024static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006025vec_slo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006026{
David Blaikie3302f2b2013-01-16 23:08:36 +00006027 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006028}
6029
6030/* vec_vslo */
6031
6032static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006033vec_vslo(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006034{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006035 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006036 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006037}
6038
6039static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006040vec_vslo(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006041{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006042 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006043 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006044}
6045
6046static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006047vec_vslo(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006048{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006049 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006050 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006051}
6052
6053static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006054vec_vslo(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006055{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006056 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006057 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006058}
6059
6060static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006061vec_vslo(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006062{
David Blaikie3302f2b2013-01-16 23:08:36 +00006063 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006064}
6065
6066static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006067vec_vslo(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006068{
David Blaikie3302f2b2013-01-16 23:08:36 +00006069 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006070}
6071
6072static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006073vec_vslo(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006074{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006075 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006076 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006077}
6078
6079static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006080vec_vslo(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006081{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006082 return (vector unsigned short)
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
Anton Yartsevfc83c602010-08-19 03:21:36 +00006086static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006087vec_vslo(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006088{
David Blaikie3302f2b2013-01-16 23:08:36 +00006089 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006090}
6091
6092static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006093vec_vslo(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006094{
David Blaikie3302f2b2013-01-16 23:08:36 +00006095 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006096}
6097
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006098static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006099vec_vslo(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006100{
David Blaikie3302f2b2013-01-16 23:08:36 +00006101 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006102}
6103
6104static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006105vec_vslo(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006106{
David Blaikie3302f2b2013-01-16 23:08:36 +00006107 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006108}
6109
6110static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006111vec_vslo(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006112{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006113 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006114 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006115}
6116
6117static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006118vec_vslo(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006119{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006120 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006121 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006122}
6123
6124static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006125vec_vslo(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006126{
David Blaikie3302f2b2013-01-16 23:08:36 +00006127 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006128}
6129
6130static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006131vec_vslo(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006132{
David Blaikie3302f2b2013-01-16 23:08:36 +00006133 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006134}
6135
6136/* vec_splat */
6137
6138static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006139vec_splat(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006140{
David Blaikie3302f2b2013-01-16 23:08:36 +00006141 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006142}
6143
6144static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006145vec_splat(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006146{
David Blaikie3302f2b2013-01-16 23:08:36 +00006147 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006148}
6149
6150static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006151vec_splat(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006152{
David Blaikie3302f2b2013-01-16 23:08:36 +00006153 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006154}
6155
6156static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006157vec_splat(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006158{
David Blaikie3302f2b2013-01-16 23:08:36 +00006159 __b *= 2;
6160 unsigned char b1=__b+1;
6161 return vec_perm(__a, __a, (vector unsigned char)
6162 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006163}
6164
6165static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006166vec_splat(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006167{
David Blaikie3302f2b2013-01-16 23:08:36 +00006168 __b *= 2;
6169 unsigned char b1=__b+1;
6170 return vec_perm(__a, __a, (vector unsigned char)
6171 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006172}
6173
6174static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006175vec_splat(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006176{
David Blaikie3302f2b2013-01-16 23:08:36 +00006177 __b *= 2;
6178 unsigned char b1=__b+1;
6179 return vec_perm(__a, __a, (vector unsigned char)
6180 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006181}
6182
6183static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006184vec_splat(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006185{
David Blaikie3302f2b2013-01-16 23:08:36 +00006186 __b *= 2;
6187 unsigned char b1=__b+1;
6188 return vec_perm(__a, __a, (vector unsigned char)
6189 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006190}
6191
6192static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006193vec_splat(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006194{
David Blaikie3302f2b2013-01-16 23:08:36 +00006195 __b *= 4;
6196 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6197 return vec_perm(__a, __a, (vector unsigned char)
6198 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006199}
6200
6201static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006202vec_splat(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006203{
David Blaikie3302f2b2013-01-16 23:08:36 +00006204 __b *= 4;
6205 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6206 return vec_perm(__a, __a, (vector unsigned char)
6207 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006208}
6209
6210static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006211vec_splat(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006212{
David Blaikie3302f2b2013-01-16 23:08:36 +00006213 __b *= 4;
6214 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6215 return vec_perm(__a, __a, (vector unsigned char)
6216 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006217}
6218
6219static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006220vec_splat(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006221{
David Blaikie3302f2b2013-01-16 23:08:36 +00006222 __b *= 4;
6223 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6224 return vec_perm(__a, __a, (vector unsigned char)
6225 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006226}
6227
6228/* vec_vspltb */
6229
6230#define __builtin_altivec_vspltb vec_vspltb
6231
6232static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006233vec_vspltb(vector signed char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006234{
David Blaikie3302f2b2013-01-16 23:08:36 +00006235 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006236}
6237
6238static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006239vec_vspltb(vector unsigned char __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006240{
David Blaikie3302f2b2013-01-16 23:08:36 +00006241 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Yartsev9e968982010-08-19 03:00:09 +00006242}
6243
6244static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006245vec_vspltb(vector bool char __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006246{
David Blaikie3302f2b2013-01-16 23:08:36 +00006247 return vec_perm(__a, __a, (vector unsigned char)(__b));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006248}
6249
6250/* vec_vsplth */
6251
6252#define __builtin_altivec_vsplth vec_vsplth
6253
6254static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006255vec_vsplth(vector short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006256{
David Blaikie3302f2b2013-01-16 23:08:36 +00006257 __b *= 2;
6258 unsigned char b1=__b+1;
6259 return vec_perm(__a, __a, (vector unsigned char)
6260 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006261}
6262
6263static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006264vec_vsplth(vector unsigned short __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006265{
David Blaikie3302f2b2013-01-16 23:08:36 +00006266 __b *= 2;
6267 unsigned char b1=__b+1;
6268 return vec_perm(__a, __a, (vector unsigned char)
6269 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006270}
6271
6272static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006273vec_vsplth(vector bool short __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006274{
David Blaikie3302f2b2013-01-16 23:08:36 +00006275 __b *= 2;
6276 unsigned char b1=__b+1;
6277 return vec_perm(__a, __a, (vector unsigned char)
6278 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Yartsev9e968982010-08-19 03:00:09 +00006279}
6280
6281static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006282vec_vsplth(vector pixel __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006283{
David Blaikie3302f2b2013-01-16 23:08:36 +00006284 __b *= 2;
6285 unsigned char b1=__b+1;
6286 return vec_perm(__a, __a, (vector unsigned char)
6287 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006288}
6289
6290/* vec_vspltw */
6291
6292#define __builtin_altivec_vspltw vec_vspltw
6293
6294static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006295vec_vspltw(vector int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006296{
David Blaikie3302f2b2013-01-16 23:08:36 +00006297 __b *= 4;
6298 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6299 return vec_perm(__a, __a, (vector unsigned char)
6300 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006301}
6302
6303static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006304vec_vspltw(vector unsigned int __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006305{
David Blaikie3302f2b2013-01-16 23:08:36 +00006306 __b *= 4;
6307 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6308 return vec_perm(__a, __a, (vector unsigned char)
6309 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Yartsev9e968982010-08-19 03:00:09 +00006310}
6311
6312static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006313vec_vspltw(vector bool int __a, unsigned char __b)
Anton Yartsev9e968982010-08-19 03:00:09 +00006314{
David Blaikie3302f2b2013-01-16 23:08:36 +00006315 __b *= 4;
6316 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6317 return vec_perm(__a, __a, (vector unsigned char)
6318 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006319}
6320
6321static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006322vec_vspltw(vector float __a, unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006323{
David Blaikie3302f2b2013-01-16 23:08:36 +00006324 __b *= 4;
6325 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6326 return vec_perm(__a, __a, (vector unsigned char)
6327 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006328}
6329
6330/* vec_splat_s8 */
6331
6332#define __builtin_altivec_vspltisb vec_splat_s8
6333
6334// FIXME: parameter should be treated as 5-bit signed literal
6335static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006336vec_splat_s8(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006337{
David Blaikie3302f2b2013-01-16 23:08:36 +00006338 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006339}
6340
6341/* vec_vspltisb */
6342
6343// FIXME: parameter should be treated as 5-bit signed literal
6344static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006345vec_vspltisb(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006346{
David Blaikie3302f2b2013-01-16 23:08:36 +00006347 return (vector signed char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006348}
6349
6350/* vec_splat_s16 */
6351
6352#define __builtin_altivec_vspltish vec_splat_s16
6353
6354// FIXME: parameter should be treated as 5-bit signed literal
6355static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006356vec_splat_s16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006357{
David Blaikie3302f2b2013-01-16 23:08:36 +00006358 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006359}
6360
6361/* vec_vspltish */
6362
6363// FIXME: parameter should be treated as 5-bit signed literal
6364static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006365vec_vspltish(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006366{
David Blaikie3302f2b2013-01-16 23:08:36 +00006367 return (vector short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006368}
6369
6370/* vec_splat_s32 */
6371
6372#define __builtin_altivec_vspltisw vec_splat_s32
6373
6374// FIXME: parameter should be treated as 5-bit signed literal
6375static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006376vec_splat_s32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006377{
David Blaikie3302f2b2013-01-16 23:08:36 +00006378 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006379}
6380
6381/* vec_vspltisw */
6382
6383// FIXME: parameter should be treated as 5-bit signed literal
6384static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006385vec_vspltisw(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006386{
David Blaikie3302f2b2013-01-16 23:08:36 +00006387 return (vector int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006388}
6389
6390/* vec_splat_u8 */
6391
6392// FIXME: parameter should be treated as 5-bit signed literal
6393static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006394vec_splat_u8(unsigned char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006395{
David Blaikie3302f2b2013-01-16 23:08:36 +00006396 return (vector unsigned char)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006397}
6398
6399/* vec_splat_u16 */
6400
6401// FIXME: parameter should be treated as 5-bit signed literal
6402static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006403vec_splat_u16(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006404{
David Blaikie3302f2b2013-01-16 23:08:36 +00006405 return (vector unsigned short)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006406}
6407
6408/* vec_splat_u32 */
6409
6410// FIXME: parameter should be treated as 5-bit signed literal
6411static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006412vec_splat_u32(signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006413{
David Blaikie3302f2b2013-01-16 23:08:36 +00006414 return (vector unsigned int)(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006415}
6416
6417/* vec_sr */
6418
6419static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006420vec_sr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006421{
David Blaikie3302f2b2013-01-16 23:08:36 +00006422 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006423}
6424
6425static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006426vec_sr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006427{
David Blaikie3302f2b2013-01-16 23:08:36 +00006428 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006429}
6430
6431static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006432vec_sr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006433{
David Blaikie3302f2b2013-01-16 23:08:36 +00006434 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006435}
6436
6437static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006438vec_sr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006439{
David Blaikie3302f2b2013-01-16 23:08:36 +00006440 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006441}
6442
6443static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006444vec_sr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006445{
David Blaikie3302f2b2013-01-16 23:08:36 +00006446 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006447}
6448
6449static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006450vec_sr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006451{
David Blaikie3302f2b2013-01-16 23:08:36 +00006452 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006453}
6454
6455/* vec_vsrb */
6456
6457#define __builtin_altivec_vsrb vec_vsrb
6458
6459static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006460vec_vsrb(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006461{
David Blaikie3302f2b2013-01-16 23:08:36 +00006462 return __a >> (vector signed char)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006463}
6464
6465static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006466vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006467{
David Blaikie3302f2b2013-01-16 23:08:36 +00006468 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006469}
6470
6471/* vec_vsrh */
6472
6473#define __builtin_altivec_vsrh vec_vsrh
6474
6475static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006476vec_vsrh(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006477{
David Blaikie3302f2b2013-01-16 23:08:36 +00006478 return __a >> (vector short)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006479}
6480
6481static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006482vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006483{
David Blaikie3302f2b2013-01-16 23:08:36 +00006484 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006485}
6486
6487/* vec_vsrw */
6488
6489#define __builtin_altivec_vsrw vec_vsrw
6490
6491static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006492vec_vsrw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006493{
David Blaikie3302f2b2013-01-16 23:08:36 +00006494 return __a >> (vector int)__b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006495}
6496
6497static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006498vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006499{
David Blaikie3302f2b2013-01-16 23:08:36 +00006500 return __a >> __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006501}
6502
6503/* vec_sra */
6504
6505static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006506vec_sra(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006507{
David Blaikie3302f2b2013-01-16 23:08:36 +00006508 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006509}
6510
6511static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006512vec_sra(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006513{
David Blaikie3302f2b2013-01-16 23:08:36 +00006514 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006515}
6516
6517static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006518vec_sra(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006519{
David Blaikie3302f2b2013-01-16 23:08:36 +00006520 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006521}
6522
6523static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006524vec_sra(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006525{
David Blaikie3302f2b2013-01-16 23:08:36 +00006526 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006527}
6528
6529static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006530vec_sra(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006531{
David Blaikie3302f2b2013-01-16 23:08:36 +00006532 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006533}
6534
6535static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006536vec_sra(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006537{
David Blaikie3302f2b2013-01-16 23:08:36 +00006538 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006539}
6540
6541/* vec_vsrab */
6542
6543static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006544vec_vsrab(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006545{
David Blaikie3302f2b2013-01-16 23:08:36 +00006546 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006547}
6548
6549static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006550vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006551{
David Blaikie3302f2b2013-01-16 23:08:36 +00006552 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006553}
6554
6555/* vec_vsrah */
6556
6557static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006558vec_vsrah(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006559{
David Blaikie3302f2b2013-01-16 23:08:36 +00006560 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006561}
6562
6563static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006564vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006565{
David Blaikie3302f2b2013-01-16 23:08:36 +00006566 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006567}
6568
6569/* vec_vsraw */
6570
6571static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006572vec_vsraw(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006573{
David Blaikie3302f2b2013-01-16 23:08:36 +00006574 return __builtin_altivec_vsraw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006575}
6576
6577static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006578vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006579{
David Blaikie3302f2b2013-01-16 23:08:36 +00006580 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006581}
6582
6583/* vec_srl */
6584
6585static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006586vec_srl(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006587{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006588 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006589 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006590}
6591
6592static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006593vec_srl(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006594{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006595 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006596 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006597}
6598
6599static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006600vec_srl(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006601{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006602 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006603 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006604}
6605
6606static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006607vec_srl(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006608{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006609 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006610 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006611}
6612
6613static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006614vec_srl(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006615{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006616 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006617 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006618}
6619
6620static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006621vec_srl(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006622{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006623 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006624 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006625}
6626
Anton Yartsevfc83c602010-08-19 03:21:36 +00006627static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006628vec_srl(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006629{
David Blaikie3302f2b2013-01-16 23:08:36 +00006630 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006631}
6632
6633static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006634vec_srl(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006635{
David Blaikie3302f2b2013-01-16 23:08:36 +00006636 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006637}
6638
6639static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006640vec_srl(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006641{
David Blaikie3302f2b2013-01-16 23:08:36 +00006642 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006643}
6644
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006645static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006646vec_srl(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006647{
David Blaikie3302f2b2013-01-16 23:08:36 +00006648 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006649}
6650
6651static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006652vec_srl(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006653{
David Blaikie3302f2b2013-01-16 23:08:36 +00006654 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006655}
6656
6657static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006658vec_srl(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006659{
David Blaikie3302f2b2013-01-16 23:08:36 +00006660 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006661}
6662
6663static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006664vec_srl(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006665{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006666 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006667 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006668}
6669
6670static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006671vec_srl(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006672{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006673 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006674 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006675}
6676
6677static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006678vec_srl(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006679{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006680 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006681 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006682}
6683
Anton Yartsevfc83c602010-08-19 03:21:36 +00006684static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006685vec_srl(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006686{
David Blaikie3302f2b2013-01-16 23:08:36 +00006687 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006688}
6689
6690static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006691vec_srl(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006692{
David Blaikie3302f2b2013-01-16 23:08:36 +00006693 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006694}
6695
6696static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006697vec_srl(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006698{
David Blaikie3302f2b2013-01-16 23:08:36 +00006699 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006700}
6701
6702static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006703vec_srl(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006704{
David Blaikie3302f2b2013-01-16 23:08:36 +00006705 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006706}
6707
6708static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006709vec_srl(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006710{
David Blaikie3302f2b2013-01-16 23:08:36 +00006711 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006712}
6713
6714static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006715vec_srl(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006716{
David Blaikie3302f2b2013-01-16 23:08:36 +00006717 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006718}
6719
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006720static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006721vec_srl(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006722{
David Blaikie3302f2b2013-01-16 23:08:36 +00006723 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006724}
6725
6726static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006727vec_srl(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006728{
David Blaikie3302f2b2013-01-16 23:08:36 +00006729 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006730}
6731
6732static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006733vec_srl(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006734{
David Blaikie3302f2b2013-01-16 23:08:36 +00006735 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006736}
6737
6738static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006739vec_srl(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006740{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006741 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006742 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006743}
6744
6745static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006746vec_srl(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006747{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006748 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006749 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006750}
6751
6752static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006753vec_srl(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006754{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006755 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006756 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006757}
6758
Anton Yartsevfc83c602010-08-19 03:21:36 +00006759static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006760vec_srl(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006761{
David Blaikie3302f2b2013-01-16 23:08:36 +00006762 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006763}
6764
6765static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006766vec_srl(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006767{
David Blaikie3302f2b2013-01-16 23:08:36 +00006768 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006769}
6770
6771static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006772vec_srl(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006773{
David Blaikie3302f2b2013-01-16 23:08:36 +00006774 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006775}
6776
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006777/* vec_vsr */
6778
6779static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006780vec_vsr(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006781{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006782 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006783 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006784}
6785
6786static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006787vec_vsr(vector signed char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006788{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006789 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006790 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006791}
6792
6793static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006794vec_vsr(vector signed char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006795{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006796 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006797 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006798}
6799
6800static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006801vec_vsr(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006802{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006803 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006804 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006805}
6806
6807static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006808vec_vsr(vector unsigned char __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006809{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006810 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006811 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006812}
6813
6814static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006815vec_vsr(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006816{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006817 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006818 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006819}
6820
Anton Yartsevfc83c602010-08-19 03:21:36 +00006821static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006822vec_vsr(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006823{
David Blaikie3302f2b2013-01-16 23:08:36 +00006824 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006825}
6826
6827static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006828vec_vsr(vector bool char __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006829{
David Blaikie3302f2b2013-01-16 23:08:36 +00006830 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006831}
6832
6833static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006834vec_vsr(vector bool char __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006835{
David Blaikie3302f2b2013-01-16 23:08:36 +00006836 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006837}
6838
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006839static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006840vec_vsr(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006841{
David Blaikie3302f2b2013-01-16 23:08:36 +00006842 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006843}
6844
6845static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006846vec_vsr(vector short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006847{
David Blaikie3302f2b2013-01-16 23:08:36 +00006848 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006849}
6850
6851static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006852vec_vsr(vector short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006853{
David Blaikie3302f2b2013-01-16 23:08:36 +00006854 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006855}
6856
6857static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006858vec_vsr(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006859{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006860 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006861 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006862}
6863
6864static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006865vec_vsr(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006866{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006867 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006868 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006869}
6870
6871static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006872vec_vsr(vector unsigned short __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006873{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006874 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00006875 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006876}
6877
Anton Yartsevfc83c602010-08-19 03:21:36 +00006878static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006879vec_vsr(vector bool short __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006880{
David Blaikie3302f2b2013-01-16 23:08:36 +00006881 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006882}
6883
6884static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006885vec_vsr(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006886{
David Blaikie3302f2b2013-01-16 23:08:36 +00006887 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006888}
6889
6890static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006891vec_vsr(vector bool short __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006892{
David Blaikie3302f2b2013-01-16 23:08:36 +00006893 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006894}
6895
6896static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006897vec_vsr(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006898{
David Blaikie3302f2b2013-01-16 23:08:36 +00006899 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006900}
6901
6902static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006903vec_vsr(vector pixel __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006904{
David Blaikie3302f2b2013-01-16 23:08:36 +00006905 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006906}
6907
6908static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006909vec_vsr(vector pixel __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006910{
David Blaikie3302f2b2013-01-16 23:08:36 +00006911 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006912}
6913
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006914static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006915vec_vsr(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006916{
David Blaikie3302f2b2013-01-16 23:08:36 +00006917 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006918}
6919
6920static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006921vec_vsr(vector int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006922{
David Blaikie3302f2b2013-01-16 23:08:36 +00006923 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006924}
6925
6926static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006927vec_vsr(vector int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006928{
David Blaikie3302f2b2013-01-16 23:08:36 +00006929 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006930}
6931
6932static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006933vec_vsr(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006934{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006935 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006936 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006937}
6938
6939static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006940vec_vsr(vector unsigned int __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006941{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006942 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006943 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006944}
6945
6946static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006947vec_vsr(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006948{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006949 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00006950 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006951}
6952
Anton Yartsevfc83c602010-08-19 03:21:36 +00006953static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006954vec_vsr(vector bool int __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006955{
David Blaikie3302f2b2013-01-16 23:08:36 +00006956 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006957}
6958
6959static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006960vec_vsr(vector bool int __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006961{
David Blaikie3302f2b2013-01-16 23:08:36 +00006962 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006963}
6964
6965static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006966vec_vsr(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00006967{
David Blaikie3302f2b2013-01-16 23:08:36 +00006968 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00006969}
6970
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006971/* vec_sro */
6972
6973static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006974vec_sro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006975{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006976 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006977 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006978}
6979
6980static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006981vec_sro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006982{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006983 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006984 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006985}
6986
6987static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006988vec_sro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006989{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006990 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006991 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006992}
6993
6994static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00006995vec_sro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006996{
Anton Yartsev79d6af32010-09-18 00:39:16 +00006997 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00006998 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00006999}
7000
7001static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007002vec_sro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007003{
David Blaikie3302f2b2013-01-16 23:08:36 +00007004 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007005}
7006
7007static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007008vec_sro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007009{
David Blaikie3302f2b2013-01-16 23:08:36 +00007010 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007011}
7012
7013static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007014vec_sro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007015{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007016 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007017 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007018}
7019
7020static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007021vec_sro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007022{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007023 return (vector unsigned short)
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
Anton Yartsevfc83c602010-08-19 03:21:36 +00007027static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007028vec_sro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007029{
David Blaikie3302f2b2013-01-16 23:08:36 +00007030 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007031}
7032
7033static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007034vec_sro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007035{
David Blaikie3302f2b2013-01-16 23:08:36 +00007036 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007037}
7038
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007039static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007040vec_sro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007041{
David Blaikie3302f2b2013-01-16 23:08:36 +00007042 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007043}
7044
7045static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007046vec_sro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007047{
David Blaikie3302f2b2013-01-16 23:08:36 +00007048 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007049}
7050
7051static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007052vec_sro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007053{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007054 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007055 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007056}
7057
7058static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007059vec_sro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007060{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007061 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007062 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007063}
7064
7065static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007066vec_sro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007067{
David Blaikie3302f2b2013-01-16 23:08:36 +00007068 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007069}
7070
7071static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007072vec_sro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007073{
David Blaikie3302f2b2013-01-16 23:08:36 +00007074 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007075}
7076
7077/* vec_vsro */
7078
7079static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007080vec_vsro(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007081{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007082 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007083 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007084}
7085
7086static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007087vec_vsro(vector signed char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007088{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007089 return (vector signed char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007090 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007091}
7092
7093static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007094vec_vsro(vector unsigned char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007095{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007096 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007097 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007098}
7099
7100static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007101vec_vsro(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007102{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007103 return (vector unsigned char)
David Blaikie3302f2b2013-01-16 23:08:36 +00007104 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007105}
7106
7107static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007108vec_vsro(vector short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007109{
David Blaikie3302f2b2013-01-16 23:08:36 +00007110 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007111}
7112
7113static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007114vec_vsro(vector short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007115{
David Blaikie3302f2b2013-01-16 23:08:36 +00007116 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007117}
7118
7119static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007120vec_vsro(vector unsigned short __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007121{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007122 return (vector unsigned short)
David Blaikie3302f2b2013-01-16 23:08:36 +00007123 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007124}
7125
7126static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007127vec_vsro(vector unsigned short __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007128{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007129 return (vector unsigned short)
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
Anton Yartsevfc83c602010-08-19 03:21:36 +00007133static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007134vec_vsro(vector pixel __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007135{
David Blaikie3302f2b2013-01-16 23:08:36 +00007136 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007137}
7138
7139static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007140vec_vsro(vector pixel __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007141{
David Blaikie3302f2b2013-01-16 23:08:36 +00007142 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007143}
7144
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007145static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007146vec_vsro(vector int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007147{
David Blaikie3302f2b2013-01-16 23:08:36 +00007148 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007149}
7150
7151static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007152vec_vsro(vector int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007153{
David Blaikie3302f2b2013-01-16 23:08:36 +00007154 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007155}
7156
7157static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007158vec_vsro(vector unsigned int __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007159{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007160 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007161 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007162}
7163
7164static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007165vec_vsro(vector unsigned int __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007166{
Anton Yartsev79d6af32010-09-18 00:39:16 +00007167 return (vector unsigned int)
David Blaikie3302f2b2013-01-16 23:08:36 +00007168 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007169}
7170
7171static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007172vec_vsro(vector float __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007173{
David Blaikie3302f2b2013-01-16 23:08:36 +00007174 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007175}
7176
7177static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007178vec_vsro(vector float __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007179{
David Blaikie3302f2b2013-01-16 23:08:36 +00007180 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007181}
7182
7183/* vec_st */
7184
7185static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007186vec_st(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007187{
David Blaikie3302f2b2013-01-16 23:08:36 +00007188 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007189}
7190
7191static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007192vec_st(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007193{
David Blaikie3302f2b2013-01-16 23:08:36 +00007194 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007195}
7196
7197static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007198vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007199{
David Blaikie3302f2b2013-01-16 23:08:36 +00007200 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007201}
7202
7203static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007204vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007205{
David Blaikie3302f2b2013-01-16 23:08:36 +00007206 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007207}
7208
7209static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007210vec_st(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007211{
David Blaikie3302f2b2013-01-16 23:08:36 +00007212 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007213}
7214
7215static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007216vec_st(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007217{
David Blaikie3302f2b2013-01-16 23:08:36 +00007218 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007219}
7220
7221static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007222vec_st(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007223{
David Blaikie3302f2b2013-01-16 23:08:36 +00007224 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007225}
7226
7227static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007228vec_st(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007229{
David Blaikie3302f2b2013-01-16 23:08:36 +00007230 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007231}
7232
7233static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007234vec_st(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007235{
David Blaikie3302f2b2013-01-16 23:08:36 +00007236 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007237}
7238
7239static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007240vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007241{
David Blaikie3302f2b2013-01-16 23:08:36 +00007242 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007243}
7244
7245static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007246vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007247{
David Blaikie3302f2b2013-01-16 23:08:36 +00007248 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007249}
7250
7251static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007252vec_st(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007253{
David Blaikie3302f2b2013-01-16 23:08:36 +00007254 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007255}
7256
7257static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007258vec_st(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007259{
David Blaikie3302f2b2013-01-16 23:08:36 +00007260 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007261}
7262
7263static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007264vec_st(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007265{
David Blaikie3302f2b2013-01-16 23:08:36 +00007266 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007267}
7268
7269static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007270vec_st(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007271{
David Blaikie3302f2b2013-01-16 23:08:36 +00007272 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007273}
7274
7275static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007276vec_st(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007277{
David Blaikie3302f2b2013-01-16 23:08:36 +00007278 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007279}
7280
7281static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007282vec_st(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007283{
David Blaikie3302f2b2013-01-16 23:08:36 +00007284 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007285}
7286
7287static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007288vec_st(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007289{
David Blaikie3302f2b2013-01-16 23:08:36 +00007290 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007291}
7292
7293static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007294vec_st(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007295{
David Blaikie3302f2b2013-01-16 23:08:36 +00007296 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007297}
7298
7299static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007300vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007301{
David Blaikie3302f2b2013-01-16 23:08:36 +00007302 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007303}
7304
7305static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007306vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007307{
David Blaikie3302f2b2013-01-16 23:08:36 +00007308 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007309}
7310
7311static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007312vec_st(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007313{
David Blaikie3302f2b2013-01-16 23:08:36 +00007314 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007315}
7316
7317static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007318vec_st(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007319{
David Blaikie3302f2b2013-01-16 23:08:36 +00007320 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007321}
7322
7323static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007324vec_st(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007325{
David Blaikie3302f2b2013-01-16 23:08:36 +00007326 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007327}
7328
7329static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007330vec_st(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007331{
David Blaikie3302f2b2013-01-16 23:08:36 +00007332 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007333}
7334
7335static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007336vec_st(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007337{
David Blaikie3302f2b2013-01-16 23:08:36 +00007338 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007339}
7340
7341/* vec_stvx */
7342
7343static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007344vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007345{
David Blaikie3302f2b2013-01-16 23:08:36 +00007346 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007347}
7348
7349static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007350vec_stvx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007351{
David Blaikie3302f2b2013-01-16 23:08:36 +00007352 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007353}
7354
7355static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007356vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007357{
David Blaikie3302f2b2013-01-16 23:08:36 +00007358 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007359}
7360
7361static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007362vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007363{
David Blaikie3302f2b2013-01-16 23:08:36 +00007364 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007365}
7366
7367static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007368vec_stvx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007369{
David Blaikie3302f2b2013-01-16 23:08:36 +00007370 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007371}
7372
7373static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007374vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007375{
David Blaikie3302f2b2013-01-16 23:08:36 +00007376 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007377}
7378
7379static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007380vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007381{
David Blaikie3302f2b2013-01-16 23:08:36 +00007382 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007383}
7384
7385static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007386vec_stvx(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007387{
David Blaikie3302f2b2013-01-16 23:08:36 +00007388 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007389}
7390
7391static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007392vec_stvx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007393{
David Blaikie3302f2b2013-01-16 23:08:36 +00007394 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007395}
7396
7397static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007398vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007399{
David Blaikie3302f2b2013-01-16 23:08:36 +00007400 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007401}
7402
7403static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007404vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007405{
David Blaikie3302f2b2013-01-16 23:08:36 +00007406 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007407}
7408
7409static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007410vec_stvx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007411{
David Blaikie3302f2b2013-01-16 23:08:36 +00007412 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007413}
7414
7415static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007416vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007417{
David Blaikie3302f2b2013-01-16 23:08:36 +00007418 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007419}
7420
7421static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007422vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007423{
David Blaikie3302f2b2013-01-16 23:08:36 +00007424 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007425}
7426
7427static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007428vec_stvx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007429{
David Blaikie3302f2b2013-01-16 23:08:36 +00007430 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007431}
7432
7433static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007434vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007435{
David Blaikie3302f2b2013-01-16 23:08:36 +00007436 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007437}
7438
7439static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007440vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007441{
David Blaikie3302f2b2013-01-16 23:08:36 +00007442 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007443}
7444
7445static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007446vec_stvx(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007447{
David Blaikie3302f2b2013-01-16 23:08:36 +00007448 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007449}
7450
7451static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007452vec_stvx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007453{
David Blaikie3302f2b2013-01-16 23:08:36 +00007454 __builtin_altivec_stvx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007455}
7456
7457static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007458vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007459{
David Blaikie3302f2b2013-01-16 23:08:36 +00007460 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007461}
7462
7463static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007464vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007465{
David Blaikie3302f2b2013-01-16 23:08:36 +00007466 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007467}
7468
7469static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007470vec_stvx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007471{
David Blaikie3302f2b2013-01-16 23:08:36 +00007472 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007473}
7474
7475static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007476vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007477{
David Blaikie3302f2b2013-01-16 23:08:36 +00007478 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007479}
7480
7481static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007482vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007483{
David Blaikie3302f2b2013-01-16 23:08:36 +00007484 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007485}
7486
7487static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007488vec_stvx(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007489{
David Blaikie3302f2b2013-01-16 23:08:36 +00007490 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007491}
7492
7493static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007494vec_stvx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007495{
David Blaikie3302f2b2013-01-16 23:08:36 +00007496 __builtin_altivec_stvx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007497}
7498
7499/* vec_ste */
7500
7501static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007502vec_ste(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007503{
David Blaikie3302f2b2013-01-16 23:08:36 +00007504 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007505}
7506
7507static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007508vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007509{
David Blaikie3302f2b2013-01-16 23:08:36 +00007510 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007511}
7512
7513static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007514vec_ste(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007515{
David Blaikie3302f2b2013-01-16 23:08:36 +00007516 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007517}
7518
7519static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007520vec_ste(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007521{
David Blaikie3302f2b2013-01-16 23:08:36 +00007522 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007523}
7524
7525static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007526vec_ste(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007527{
David Blaikie3302f2b2013-01-16 23:08:36 +00007528 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007529}
7530
7531static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007532vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007533{
David Blaikie3302f2b2013-01-16 23:08:36 +00007534 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007535}
7536
7537static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007538vec_ste(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007539{
David Blaikie3302f2b2013-01-16 23:08:36 +00007540 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007541}
7542
7543static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007544vec_ste(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007545{
David Blaikie3302f2b2013-01-16 23:08:36 +00007546 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007547}
7548
7549static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007550vec_ste(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007551{
David Blaikie3302f2b2013-01-16 23:08:36 +00007552 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007553}
7554
7555static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007556vec_ste(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007557{
David Blaikie3302f2b2013-01-16 23:08:36 +00007558 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007559}
7560
7561static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007562vec_ste(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007563{
David Blaikie3302f2b2013-01-16 23:08:36 +00007564 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007565}
7566
7567static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007568vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007569{
David Blaikie3302f2b2013-01-16 23:08:36 +00007570 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007571}
7572
7573static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007574vec_ste(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007575{
David Blaikie3302f2b2013-01-16 23:08:36 +00007576 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007577}
7578
7579static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007580vec_ste(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007581{
David Blaikie3302f2b2013-01-16 23:08:36 +00007582 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007583}
7584
7585static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007586vec_ste(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007587{
David Blaikie3302f2b2013-01-16 23:08:36 +00007588 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007589}
7590
7591/* vec_stvebx */
7592
7593static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007594vec_stvebx(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007595{
David Blaikie3302f2b2013-01-16 23:08:36 +00007596 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007597}
7598
7599static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007600vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007601{
David Blaikie3302f2b2013-01-16 23:08:36 +00007602 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007603}
7604
Anton Yartsevfc83c602010-08-19 03:21:36 +00007605static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007606vec_stvebx(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007607{
David Blaikie3302f2b2013-01-16 23:08:36 +00007608 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007609}
7610
7611static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007612vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007613{
David Blaikie3302f2b2013-01-16 23:08:36 +00007614 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007615}
7616
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007617/* vec_stvehx */
7618
7619static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007620vec_stvehx(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007621{
David Blaikie3302f2b2013-01-16 23:08:36 +00007622 __builtin_altivec_stvehx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007623}
7624
7625static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007626vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007627{
David Blaikie3302f2b2013-01-16 23:08:36 +00007628 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007629}
7630
Anton Yartsevfc83c602010-08-19 03:21:36 +00007631static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007632vec_stvehx(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007633{
David Blaikie3302f2b2013-01-16 23:08:36 +00007634 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007635}
7636
7637static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007638vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007639{
David Blaikie3302f2b2013-01-16 23:08:36 +00007640 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007641}
7642
7643static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007644vec_stvehx(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007645{
David Blaikie3302f2b2013-01-16 23:08:36 +00007646 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007647}
7648
7649static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007650vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007651{
David Blaikie3302f2b2013-01-16 23:08:36 +00007652 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007653}
7654
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007655/* vec_stvewx */
7656
7657static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007658vec_stvewx(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007659{
David Blaikie3302f2b2013-01-16 23:08:36 +00007660 __builtin_altivec_stvewx(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007661}
7662
7663static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007664vec_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007665{
David Blaikie3302f2b2013-01-16 23:08:36 +00007666 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007667}
7668
7669static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007670vec_stvewx(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007671{
David Blaikie3302f2b2013-01-16 23:08:36 +00007672 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007673}
7674
7675static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007676vec_stvewx(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007677{
David Blaikie3302f2b2013-01-16 23:08:36 +00007678 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007679}
7680
7681static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007682vec_stvewx(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007683{
David Blaikie3302f2b2013-01-16 23:08:36 +00007684 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007685}
7686
7687/* vec_stl */
7688
7689static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007690vec_stl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007691{
David Blaikie3302f2b2013-01-16 23:08:36 +00007692 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007693}
7694
7695static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007696vec_stl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007697{
David Blaikie3302f2b2013-01-16 23:08:36 +00007698 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007699}
7700
7701static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007702vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007703{
David Blaikie3302f2b2013-01-16 23:08:36 +00007704 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007705}
7706
7707static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007708vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007709{
David Blaikie3302f2b2013-01-16 23:08:36 +00007710 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007711}
7712
7713static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007714vec_stl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007715{
David Blaikie3302f2b2013-01-16 23:08:36 +00007716 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007717}
7718
7719static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007720vec_stl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007721{
David Blaikie3302f2b2013-01-16 23:08:36 +00007722 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007723}
7724
7725static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007726vec_stl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007727{
David Blaikie3302f2b2013-01-16 23:08:36 +00007728 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007729}
7730
7731static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007732vec_stl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007733{
David Blaikie3302f2b2013-01-16 23:08:36 +00007734 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007735}
7736
7737static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007738vec_stl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007739{
David Blaikie3302f2b2013-01-16 23:08:36 +00007740 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007741}
7742
7743static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007744vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007745{
David Blaikie3302f2b2013-01-16 23:08:36 +00007746 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007747}
7748
7749static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007750vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007751{
David Blaikie3302f2b2013-01-16 23:08:36 +00007752 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007753}
7754
7755static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007756vec_stl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007757{
David Blaikie3302f2b2013-01-16 23:08:36 +00007758 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007759}
7760
7761static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007762vec_stl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007763{
David Blaikie3302f2b2013-01-16 23:08:36 +00007764 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007765}
7766
7767static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007768vec_stl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007769{
David Blaikie3302f2b2013-01-16 23:08:36 +00007770 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007771}
7772
7773static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007774vec_stl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007775{
David Blaikie3302f2b2013-01-16 23:08:36 +00007776 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007777}
7778
7779static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007780vec_stl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007781{
David Blaikie3302f2b2013-01-16 23:08:36 +00007782 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007783}
7784
7785static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007786vec_stl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007787{
David Blaikie3302f2b2013-01-16 23:08:36 +00007788 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007789}
7790
7791static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007792vec_stl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007793{
David Blaikie3302f2b2013-01-16 23:08:36 +00007794 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007795}
7796
7797static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007798vec_stl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007799{
David Blaikie3302f2b2013-01-16 23:08:36 +00007800 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007801}
7802
7803static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007804vec_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007805{
David Blaikie3302f2b2013-01-16 23:08:36 +00007806 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007807}
7808
7809static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007810vec_stl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007811{
David Blaikie3302f2b2013-01-16 23:08:36 +00007812 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007813}
7814
7815static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007816vec_stl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007817{
David Blaikie3302f2b2013-01-16 23:08:36 +00007818 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007819}
7820
7821static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007822vec_stl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007823{
David Blaikie3302f2b2013-01-16 23:08:36 +00007824 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007825}
7826
7827static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007828vec_stl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007829{
David Blaikie3302f2b2013-01-16 23:08:36 +00007830 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007831}
7832
7833static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007834vec_stl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007835{
David Blaikie3302f2b2013-01-16 23:08:36 +00007836 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007837}
7838
7839static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007840vec_stl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007841{
David Blaikie3302f2b2013-01-16 23:08:36 +00007842 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007843}
7844
7845/* vec_stvxl */
7846
7847static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007848vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007849{
David Blaikie3302f2b2013-01-16 23:08:36 +00007850 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007851}
7852
7853static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007854vec_stvxl(vector signed char __a, int __b, signed char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007855{
David Blaikie3302f2b2013-01-16 23:08:36 +00007856 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007857}
7858
7859static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007860vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007861{
David Blaikie3302f2b2013-01-16 23:08:36 +00007862 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007863}
7864
7865static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007866vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007867{
David Blaikie3302f2b2013-01-16 23:08:36 +00007868 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007869}
7870
7871static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007872vec_stvxl(vector bool char __a, int __b, signed char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007873{
David Blaikie3302f2b2013-01-16 23:08:36 +00007874 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007875}
7876
7877static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007878vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007879{
David Blaikie3302f2b2013-01-16 23:08:36 +00007880 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007881}
7882
7883static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007884vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007885{
David Blaikie3302f2b2013-01-16 23:08:36 +00007886 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007887}
7888
7889static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007890vec_stvxl(vector short __a, int __b, vector short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007891{
David Blaikie3302f2b2013-01-16 23:08:36 +00007892 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007893}
7894
7895static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007896vec_stvxl(vector short __a, int __b, short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007897{
David Blaikie3302f2b2013-01-16 23:08:36 +00007898 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007899}
7900
7901static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007902vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007903{
David Blaikie3302f2b2013-01-16 23:08:36 +00007904 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007905}
7906
7907static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007908vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007909{
David Blaikie3302f2b2013-01-16 23:08:36 +00007910 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007911}
7912
7913static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007914vec_stvxl(vector bool short __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007915{
David Blaikie3302f2b2013-01-16 23:08:36 +00007916 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007917}
7918
7919static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007920vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007921{
David Blaikie3302f2b2013-01-16 23:08:36 +00007922 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007923}
7924
7925static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007926vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007927{
David Blaikie3302f2b2013-01-16 23:08:36 +00007928 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007929}
7930
7931static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007932vec_stvxl(vector pixel __a, int __b, short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007933{
David Blaikie3302f2b2013-01-16 23:08:36 +00007934 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007935}
7936
7937static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007938vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007939{
David Blaikie3302f2b2013-01-16 23:08:36 +00007940 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007941}
7942
7943static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007944vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007945{
David Blaikie3302f2b2013-01-16 23:08:36 +00007946 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007947}
7948
7949static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007950vec_stvxl(vector int __a, int __b, vector int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007951{
David Blaikie3302f2b2013-01-16 23:08:36 +00007952 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007953}
7954
7955static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007956vec_stvxl(vector int __a, int __b, int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007957{
David Blaikie3302f2b2013-01-16 23:08:36 +00007958 __builtin_altivec_stvxl(__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007959}
7960
7961static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007962vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007963{
David Blaikie3302f2b2013-01-16 23:08:36 +00007964 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007965}
7966
7967static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007968vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007969{
David Blaikie3302f2b2013-01-16 23:08:36 +00007970 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007971}
7972
7973static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007974vec_stvxl(vector bool int __a, int __b, int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007975{
David Blaikie3302f2b2013-01-16 23:08:36 +00007976 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007977}
7978
7979static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007980vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007981{
David Blaikie3302f2b2013-01-16 23:08:36 +00007982 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007983}
7984
7985static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007986vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsevfc83c602010-08-19 03:21:36 +00007987{
David Blaikie3302f2b2013-01-16 23:08:36 +00007988 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Yartsevfc83c602010-08-19 03:21:36 +00007989}
7990
7991static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007992vec_stvxl(vector float __a, int __b, vector float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007993{
David Blaikie3302f2b2013-01-16 23:08:36 +00007994 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007995}
7996
7997static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00007998vec_stvxl(vector float __a, int __b, float *__c)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00007999{
David Blaikie3302f2b2013-01-16 23:08:36 +00008000 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008001}
8002
8003/* vec_sub */
8004
8005static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008006vec_sub(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008007{
David Blaikie3302f2b2013-01-16 23:08:36 +00008008 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008009}
8010
Anton Yartsevfc83c602010-08-19 03:21:36 +00008011static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008012vec_sub(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008013{
David Blaikie3302f2b2013-01-16 23:08:36 +00008014 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008015}
8016
8017static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008018vec_sub(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008019{
David Blaikie3302f2b2013-01-16 23:08:36 +00008020 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008021}
8022
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008023static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008024vec_sub(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008025{
David Blaikie3302f2b2013-01-16 23:08:36 +00008026 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008027}
8028
Anton Yartsevfc83c602010-08-19 03:21:36 +00008029static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008030vec_sub(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008031{
David Blaikie3302f2b2013-01-16 23:08:36 +00008032 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008033}
8034
8035static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008036vec_sub(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008037{
David Blaikie3302f2b2013-01-16 23:08:36 +00008038 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008039}
8040
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008041static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008042vec_sub(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008043{
David Blaikie3302f2b2013-01-16 23:08:36 +00008044 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008045}
8046
Anton Yartsevfc83c602010-08-19 03:21:36 +00008047static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008048vec_sub(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008049{
David Blaikie3302f2b2013-01-16 23:08:36 +00008050 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008051}
8052
8053static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008054vec_sub(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008055{
David Blaikie3302f2b2013-01-16 23:08:36 +00008056 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008057}
8058
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008059static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008060vec_sub(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008061{
David Blaikie3302f2b2013-01-16 23:08:36 +00008062 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008063}
8064
Anton Yartsevfc83c602010-08-19 03:21:36 +00008065static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008066vec_sub(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008067{
David Blaikie3302f2b2013-01-16 23:08:36 +00008068 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008069}
8070
8071static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008072vec_sub(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008073{
David Blaikie3302f2b2013-01-16 23:08:36 +00008074 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008075}
8076
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008077static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008078vec_sub(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008079{
David Blaikie3302f2b2013-01-16 23:08:36 +00008080 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008081}
8082
Anton Yartsevfc83c602010-08-19 03:21:36 +00008083static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008084vec_sub(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008085{
David Blaikie3302f2b2013-01-16 23:08:36 +00008086 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008087}
8088
8089static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008090vec_sub(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008091{
David Blaikie3302f2b2013-01-16 23:08:36 +00008092 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008093}
8094
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008095static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008096vec_sub(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008097{
David Blaikie3302f2b2013-01-16 23:08:36 +00008098 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008099}
8100
Anton Yartsevfc83c602010-08-19 03:21:36 +00008101static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008102vec_sub(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008103{
David Blaikie3302f2b2013-01-16 23:08:36 +00008104 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008105}
8106
8107static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008108vec_sub(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008109{
David Blaikie3302f2b2013-01-16 23:08:36 +00008110 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008111}
8112
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008113static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008114vec_sub(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008115{
David Blaikie3302f2b2013-01-16 23:08:36 +00008116 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008117}
8118
8119/* vec_vsububm */
8120
8121#define __builtin_altivec_vsububm vec_vsububm
8122
8123static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008124vec_vsububm(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008125{
David Blaikie3302f2b2013-01-16 23:08:36 +00008126 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008127}
8128
Anton Yartsevfc83c602010-08-19 03:21:36 +00008129static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008130vec_vsububm(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008131{
David Blaikie3302f2b2013-01-16 23:08:36 +00008132 return (vector signed char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008133}
8134
8135static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008136vec_vsububm(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008137{
David Blaikie3302f2b2013-01-16 23:08:36 +00008138 return __a - (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008139}
8140
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008141static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008142vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008143{
David Blaikie3302f2b2013-01-16 23:08:36 +00008144 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008145}
8146
Anton Yartsevfc83c602010-08-19 03:21:36 +00008147static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008148vec_vsububm(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008149{
David Blaikie3302f2b2013-01-16 23:08:36 +00008150 return (vector unsigned char)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008151}
8152
8153static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008154vec_vsububm(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008155{
David Blaikie3302f2b2013-01-16 23:08:36 +00008156 return __a - (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008157}
8158
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008159/* vec_vsubuhm */
8160
8161#define __builtin_altivec_vsubuhm vec_vsubuhm
8162
8163static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008164vec_vsubuhm(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008165{
David Blaikie3302f2b2013-01-16 23:08:36 +00008166 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008167}
8168
Anton Yartsevfc83c602010-08-19 03:21:36 +00008169static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008170vec_vsubuhm(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008171{
David Blaikie3302f2b2013-01-16 23:08:36 +00008172 return (vector short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008173}
8174
8175static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008176vec_vsubuhm(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008177{
David Blaikie3302f2b2013-01-16 23:08:36 +00008178 return __a - (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008179}
8180
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008181static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008182vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008183{
David Blaikie3302f2b2013-01-16 23:08:36 +00008184 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008185}
8186
Anton Yartsevfc83c602010-08-19 03:21:36 +00008187static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008188vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008189{
David Blaikie3302f2b2013-01-16 23:08:36 +00008190 return (vector unsigned short)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008191}
8192
8193static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008194vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008195{
David Blaikie3302f2b2013-01-16 23:08:36 +00008196 return __a - (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008197}
8198
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008199/* vec_vsubuwm */
8200
8201#define __builtin_altivec_vsubuwm vec_vsubuwm
8202
8203static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008204vec_vsubuwm(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008205{
David Blaikie3302f2b2013-01-16 23:08:36 +00008206 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008207}
8208
Anton Yartsevfc83c602010-08-19 03:21:36 +00008209static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008210vec_vsubuwm(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008211{
David Blaikie3302f2b2013-01-16 23:08:36 +00008212 return (vector int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008213}
8214
8215static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008216vec_vsubuwm(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008217{
David Blaikie3302f2b2013-01-16 23:08:36 +00008218 return __a - (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008219}
8220
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008221static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008222vec_vsubuwm(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008223{
David Blaikie3302f2b2013-01-16 23:08:36 +00008224 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008225}
8226
Anton Yartsevfc83c602010-08-19 03:21:36 +00008227static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008228vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008229{
David Blaikie3302f2b2013-01-16 23:08:36 +00008230 return (vector unsigned int)__a - __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008231}
8232
8233static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008234vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008235{
David Blaikie3302f2b2013-01-16 23:08:36 +00008236 return __a - (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008237}
8238
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008239/* vec_vsubfp */
8240
8241#define __builtin_altivec_vsubfp vec_vsubfp
8242
8243static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008244vec_vsubfp(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008245{
David Blaikie3302f2b2013-01-16 23:08:36 +00008246 return __a - __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008247}
8248
8249/* vec_subc */
8250
8251static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008252vec_subc(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008253{
David Blaikie3302f2b2013-01-16 23:08:36 +00008254 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008255}
8256
8257/* vec_vsubcuw */
8258
8259static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008260vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008261{
David Blaikie3302f2b2013-01-16 23:08:36 +00008262 return __builtin_altivec_vsubcuw(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008263}
8264
8265/* vec_subs */
8266
8267static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008268vec_subs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008269{
David Blaikie3302f2b2013-01-16 23:08:36 +00008270 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008271}
8272
Anton Yartsevfc83c602010-08-19 03:21:36 +00008273static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008274vec_subs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008275{
David Blaikie3302f2b2013-01-16 23:08:36 +00008276 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008277}
8278
8279static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008280vec_subs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008281{
David Blaikie3302f2b2013-01-16 23:08:36 +00008282 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008283}
8284
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008285static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008286vec_subs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008287{
David Blaikie3302f2b2013-01-16 23:08:36 +00008288 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008289}
8290
Anton Yartsevfc83c602010-08-19 03:21:36 +00008291static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008292vec_subs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008293{
David Blaikie3302f2b2013-01-16 23:08:36 +00008294 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008295}
8296
8297static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008298vec_subs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008299{
David Blaikie3302f2b2013-01-16 23:08:36 +00008300 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008301}
8302
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008303static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008304vec_subs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008305{
David Blaikie3302f2b2013-01-16 23:08:36 +00008306 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008307}
8308
Anton Yartsevfc83c602010-08-19 03:21:36 +00008309static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008310vec_subs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008311{
David Blaikie3302f2b2013-01-16 23:08:36 +00008312 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008313}
8314
8315static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008316vec_subs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008317{
David Blaikie3302f2b2013-01-16 23:08:36 +00008318 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008319}
8320
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008321static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008322vec_subs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008323{
David Blaikie3302f2b2013-01-16 23:08:36 +00008324 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008325}
8326
Anton Yartsevfc83c602010-08-19 03:21:36 +00008327static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008328vec_subs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008329{
David Blaikie3302f2b2013-01-16 23:08:36 +00008330 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008331}
8332
8333static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008334vec_subs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008335{
David Blaikie3302f2b2013-01-16 23:08:36 +00008336 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008337}
8338
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008339static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008340vec_subs(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008341{
David Blaikie3302f2b2013-01-16 23:08:36 +00008342 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008343}
8344
Anton Yartsevfc83c602010-08-19 03:21:36 +00008345static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008346vec_subs(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008347{
David Blaikie3302f2b2013-01-16 23:08:36 +00008348 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008349}
8350
8351static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008352vec_subs(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008353{
David Blaikie3302f2b2013-01-16 23:08:36 +00008354 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008355}
8356
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008357static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008358vec_subs(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008359{
David Blaikie3302f2b2013-01-16 23:08:36 +00008360 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008361}
8362
Anton Yartsevfc83c602010-08-19 03:21:36 +00008363static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008364vec_subs(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008365{
David Blaikie3302f2b2013-01-16 23:08:36 +00008366 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008367}
8368
8369static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008370vec_subs(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008371{
David Blaikie3302f2b2013-01-16 23:08:36 +00008372 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008373}
8374
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008375/* vec_vsubsbs */
8376
Anton Yartsevfc83c602010-08-19 03:21:36 +00008377static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008378vec_vsubsbs(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008379{
David Blaikie3302f2b2013-01-16 23:08:36 +00008380 return __builtin_altivec_vsubsbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008381}
8382
Anton Yartsevfc83c602010-08-19 03:21:36 +00008383static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008384vec_vsubsbs(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008385{
David Blaikie3302f2b2013-01-16 23:08:36 +00008386 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008387}
8388
8389static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008390vec_vsubsbs(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008391{
David Blaikie3302f2b2013-01-16 23:08:36 +00008392 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008393}
8394
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008395/* vec_vsububs */
8396
Anton Yartsevfc83c602010-08-19 03:21:36 +00008397static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008398vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008399{
David Blaikie3302f2b2013-01-16 23:08:36 +00008400 return __builtin_altivec_vsububs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008401}
8402
Anton Yartsevfc83c602010-08-19 03:21:36 +00008403static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008404vec_vsububs(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008405{
David Blaikie3302f2b2013-01-16 23:08:36 +00008406 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008407}
8408
8409static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008410vec_vsububs(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008411{
David Blaikie3302f2b2013-01-16 23:08:36 +00008412 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008413}
8414
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008415/* vec_vsubshs */
8416
Anton Yartsevfc83c602010-08-19 03:21:36 +00008417static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008418vec_vsubshs(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008419{
David Blaikie3302f2b2013-01-16 23:08:36 +00008420 return __builtin_altivec_vsubshs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008421}
8422
Anton Yartsevfc83c602010-08-19 03:21:36 +00008423static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008424vec_vsubshs(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008425{
David Blaikie3302f2b2013-01-16 23:08:36 +00008426 return __builtin_altivec_vsubshs((vector short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008427}
8428
8429static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008430vec_vsubshs(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008431{
David Blaikie3302f2b2013-01-16 23:08:36 +00008432 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008433}
8434
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008435/* vec_vsubuhs */
8436
Anton Yartsevfc83c602010-08-19 03:21:36 +00008437static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008438vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008439{
David Blaikie3302f2b2013-01-16 23:08:36 +00008440 return __builtin_altivec_vsubuhs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008441}
8442
Anton Yartsevfc83c602010-08-19 03:21:36 +00008443static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008444vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008445{
David Blaikie3302f2b2013-01-16 23:08:36 +00008446 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008447}
8448
8449static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008450vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008451{
David Blaikie3302f2b2013-01-16 23:08:36 +00008452 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008453}
8454
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008455/* vec_vsubsws */
8456
Anton Yartsevfc83c602010-08-19 03:21:36 +00008457static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008458vec_vsubsws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008459{
David Blaikie3302f2b2013-01-16 23:08:36 +00008460 return __builtin_altivec_vsubsws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008461}
8462
Anton Yartsevfc83c602010-08-19 03:21:36 +00008463static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008464vec_vsubsws(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008465{
David Blaikie3302f2b2013-01-16 23:08:36 +00008466 return __builtin_altivec_vsubsws((vector int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008467}
8468
8469static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008470vec_vsubsws(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008471{
David Blaikie3302f2b2013-01-16 23:08:36 +00008472 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008473}
8474
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008475/* vec_vsubuws */
8476
Anton Yartsevfc83c602010-08-19 03:21:36 +00008477static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008478vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008479{
David Blaikie3302f2b2013-01-16 23:08:36 +00008480 return __builtin_altivec_vsubuws(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008481}
8482
Anton Yartsevfc83c602010-08-19 03:21:36 +00008483static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008484vec_vsubuws(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008485{
David Blaikie3302f2b2013-01-16 23:08:36 +00008486 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008487}
8488
8489static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008490vec_vsubuws(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008491{
David Blaikie3302f2b2013-01-16 23:08:36 +00008492 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Anton Yartsevfc83c602010-08-19 03:21:36 +00008493}
8494
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008495/* vec_sum4s */
8496
8497static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008498vec_sum4s(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008499{
David Blaikie3302f2b2013-01-16 23:08:36 +00008500 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008501}
8502
8503static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008504vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008505{
David Blaikie3302f2b2013-01-16 23:08:36 +00008506 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008507}
8508
8509static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008510vec_sum4s(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008511{
David Blaikie3302f2b2013-01-16 23:08:36 +00008512 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008513}
8514
8515/* vec_vsum4sbs */
8516
8517static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008518vec_vsum4sbs(vector signed char __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008519{
David Blaikie3302f2b2013-01-16 23:08:36 +00008520 return __builtin_altivec_vsum4sbs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008521}
8522
8523/* vec_vsum4ubs */
8524
8525static vector unsigned int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008526vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008527{
David Blaikie3302f2b2013-01-16 23:08:36 +00008528 return __builtin_altivec_vsum4ubs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008529}
8530
8531/* vec_vsum4shs */
8532
8533static vector int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008534vec_vsum4shs(vector signed short __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008535{
David Blaikie3302f2b2013-01-16 23:08:36 +00008536 return __builtin_altivec_vsum4shs(__a, __b);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008537}
8538
8539/* vec_sum2s */
8540
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008541/* The vsum2sws instruction has a big-endian bias, so that the second
8542 input vector and the result always reference big-endian elements
8543 1 and 3 (little-endian element 0 and 2). For ease of porting the
8544 programmer wants elements 1 and 3 in both cases, so for little
8545 endian we must perform some permutes. */
8546
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008547static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008548vec_sum2s(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008549{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008550#ifdef __LITTLE_ENDIAN__
8551 vector int __c = (vector signed int)
8552 vec_perm(__b, __b, (vector unsigned char)
8553 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8554 __c = __builtin_altivec_vsum2sws(__a, __c);
8555 return (vector signed int)
8556 vec_perm(__c, __c, (vector unsigned char)
8557 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8558#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008559 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008560#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008561}
8562
8563/* vec_vsum2sws */
8564
8565static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008566vec_vsum2sws(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008567{
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008568#ifdef __LITTLE_ENDIAN__
8569 vector int __c = (vector signed int)
8570 vec_perm(__b, __b, (vector unsigned char)
8571 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8572 __c = __builtin_altivec_vsum2sws(__a, __c);
8573 return (vector signed int)
8574 vec_perm(__c, __c, (vector unsigned char)
8575 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
8576#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008577 return __builtin_altivec_vsum2sws(__a, __b);
Bill Schmidt7f0a5c52014-06-06 23:12:00 +00008578#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008579}
8580
8581/* vec_sums */
8582
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008583/* The vsumsws instruction has a big-endian bias, so that the second
8584 input vector and the result always reference big-endian element 3
8585 (little-endian element 0). For ease of porting the programmer
8586 wants element 3 in both cases, so for little endian we must perform
8587 some permutes. */
8588
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008589static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008590vec_sums(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008591{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008592#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008593 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008594 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008595 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008596#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008597 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008598#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008599}
8600
8601/* vec_vsumsws */
8602
8603static vector signed int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008604vec_vsumsws(vector signed int __a, vector signed int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008605{
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008606#ifdef __LITTLE_ENDIAN__
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008607 __b = (vector signed int)vec_splat(__b, 3);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008608 __b = __builtin_altivec_vsumsws(__a, __b);
Bill Schmidtccbe0a82014-08-04 23:21:26 +00008609 return (vector signed int)(0, 0, 0, __b[0]);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008610#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008611 return __builtin_altivec_vsumsws(__a, __b);
Bill Schmidt7f6596bb2014-06-09 03:31:47 +00008612#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008613}
8614
8615/* vec_trunc */
8616
8617static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008618vec_trunc(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008619{
David Blaikie3302f2b2013-01-16 23:08:36 +00008620 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008621}
8622
8623/* vec_vrfiz */
8624
8625static vector float __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +00008626vec_vrfiz(vector float __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008627{
David Blaikie3302f2b2013-01-16 23:08:36 +00008628 return __builtin_altivec_vrfiz(__a);
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008629}
8630
8631/* vec_unpackh */
8632
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008633/* The vector unpack instructions all have a big-endian bias, so for
8634 little endian we must reverse the meanings of "high" and "low." */
8635
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008636static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008637vec_unpackh(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008638{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008639#ifdef __LITTLE_ENDIAN__
8640 return __builtin_altivec_vupklsb((vector char)__a);
8641#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008642 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008643#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008644}
8645
Anton Yartsevfc83c602010-08-19 03:21:36 +00008646static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008647vec_unpackh(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008648{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008649#ifdef __LITTLE_ENDIAN__
8650 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8651#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008652 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008653#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008654}
8655
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008656static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008657vec_unpackh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008658{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008659#ifdef __LITTLE_ENDIAN__
8660 return __builtin_altivec_vupklsh(__a);
8661#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008662 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008663#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008664}
8665
Anton Yartsevfc83c602010-08-19 03:21:36 +00008666static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008667vec_unpackh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008668{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008669#ifdef __LITTLE_ENDIAN__
8670 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8671#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008672 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008673#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008674}
8675
8676static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008677vec_unpackh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008678{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008679#ifdef __LITTLE_ENDIAN__
8680 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8681#else
8682 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8683#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008684}
8685
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008686/* vec_vupkhsb */
8687
Anton Yartsevfc83c602010-08-19 03:21:36 +00008688static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008689vec_vupkhsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008690{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008691#ifdef __LITTLE_ENDIAN__
8692 return __builtin_altivec_vupklsb((vector char)__a);
8693#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008694 return __builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008695#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008696}
8697
Anton Yartsevfc83c602010-08-19 03:21:36 +00008698static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008699vec_vupkhsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008700{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008701#ifdef __LITTLE_ENDIAN__
8702 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8703#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008704 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008705#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008706}
8707
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008708/* vec_vupkhsh */
8709
Anton Yartsevfc83c602010-08-19 03:21:36 +00008710static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008711vec_vupkhsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008712{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008713#ifdef __LITTLE_ENDIAN__
8714 return __builtin_altivec_vupklsh(__a);
8715#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008716 return __builtin_altivec_vupkhsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008717#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008718}
8719
Anton Yartsevfc83c602010-08-19 03:21:36 +00008720static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008721vec_vupkhsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008722{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008723#ifdef __LITTLE_ENDIAN__
8724 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8725#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008726 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008727#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008728}
8729
8730static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008731vec_vupkhsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008732{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008733#ifdef __LITTLE_ENDIAN__
8734 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8735#else
8736 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8737#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008738}
8739
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008740/* vec_unpackl */
8741
8742static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008743vec_unpackl(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008744{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008745#ifdef __LITTLE_ENDIAN__
8746 return __builtin_altivec_vupkhsb((vector char)__a);
8747#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008748 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008749#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008750}
8751
Anton Yartsevfc83c602010-08-19 03:21:36 +00008752static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008753vec_unpackl(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008754{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008755#ifdef __LITTLE_ENDIAN__
8756 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8757#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008758 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008759#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008760}
8761
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008762static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008763vec_unpackl(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008764{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008765#ifdef __LITTLE_ENDIAN__
8766 return __builtin_altivec_vupkhsh(__a);
8767#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008768 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008769#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008770}
8771
Anton Yartsevfc83c602010-08-19 03:21:36 +00008772static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008773vec_unpackl(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008774{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008775#ifdef __LITTLE_ENDIAN__
8776 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8777#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008778 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008779#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008780}
8781
8782static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008783vec_unpackl(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008784{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008785#ifdef __LITTLE_ENDIAN__
8786 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8787#else
8788 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8789#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008790}
8791
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008792/* vec_vupklsb */
8793
Anton Yartsevfc83c602010-08-19 03:21:36 +00008794static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008795vec_vupklsb(vector signed char __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008796{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008797#ifdef __LITTLE_ENDIAN__
8798 return __builtin_altivec_vupkhsb((vector char)__a);
8799#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008800 return __builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008801#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008802}
8803
Anton Yartsevfc83c602010-08-19 03:21:36 +00008804static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008805vec_vupklsb(vector bool char __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008806{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008807#ifdef __LITTLE_ENDIAN__
8808 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
8809#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008810 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008811#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008812}
8813
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008814/* vec_vupklsh */
8815
Anton Yartsevfc83c602010-08-19 03:21:36 +00008816static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008817vec_vupklsh(vector short __a)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008818{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008819#ifdef __LITTLE_ENDIAN__
8820 return __builtin_altivec_vupkhsh(__a);
8821#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008822 return __builtin_altivec_vupklsh(__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008823#endif
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008824}
8825
Anton Yartsevfc83c602010-08-19 03:21:36 +00008826static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008827vec_vupklsh(vector bool short __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008828{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008829#ifdef __LITTLE_ENDIAN__
8830 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
8831#else
David Blaikie3302f2b2013-01-16 23:08:36 +00008832 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008833#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008834}
8835
8836static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008837vec_vupklsh(vector pixel __a)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008838{
Bill Schmidtd7c53a92014-06-07 02:20:52 +00008839#ifdef __LITTLE_ENDIAN__
8840 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8841#else
8842 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8843#endif
Anton Yartsevfc83c602010-08-19 03:21:36 +00008844}
8845
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008846/* vec_xor */
8847
8848#define __builtin_altivec_vxor vec_xor
8849
8850static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008851vec_xor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008852{
David Blaikie3302f2b2013-01-16 23:08:36 +00008853 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008854}
8855
Anton Yartsevfc83c602010-08-19 03:21:36 +00008856static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008857vec_xor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008858{
David Blaikie3302f2b2013-01-16 23:08:36 +00008859 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008860}
8861
8862static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008863vec_xor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008864{
David Blaikie3302f2b2013-01-16 23:08:36 +00008865 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008866}
8867
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008868static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008869vec_xor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008870{
David Blaikie3302f2b2013-01-16 23:08:36 +00008871 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008872}
8873
Anton Yartsevfc83c602010-08-19 03:21:36 +00008874static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008875vec_xor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008876{
David Blaikie3302f2b2013-01-16 23:08:36 +00008877 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008878}
8879
8880static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008881vec_xor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008882{
David Blaikie3302f2b2013-01-16 23:08:36 +00008883 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008884}
8885
8886static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008887vec_xor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008888{
David Blaikie3302f2b2013-01-16 23:08:36 +00008889 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008890}
8891
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008892static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008893vec_xor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008894{
David Blaikie3302f2b2013-01-16 23:08:36 +00008895 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008896}
8897
Anton Yartsevfc83c602010-08-19 03:21:36 +00008898static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008899vec_xor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008900{
David Blaikie3302f2b2013-01-16 23:08:36 +00008901 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008902}
8903
8904static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008905vec_xor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008906{
David Blaikie3302f2b2013-01-16 23:08:36 +00008907 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008908}
8909
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008910static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008911vec_xor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008912{
David Blaikie3302f2b2013-01-16 23:08:36 +00008913 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008914}
8915
Anton Yartsevfc83c602010-08-19 03:21:36 +00008916static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008917vec_xor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008918{
David Blaikie3302f2b2013-01-16 23:08:36 +00008919 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008920}
8921
8922static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008923vec_xor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008924{
David Blaikie3302f2b2013-01-16 23:08:36 +00008925 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008926}
8927
8928static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008929vec_xor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008930{
David Blaikie3302f2b2013-01-16 23:08:36 +00008931 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008932}
8933
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008934static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008935vec_xor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008936{
David Blaikie3302f2b2013-01-16 23:08:36 +00008937 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008938}
8939
Anton Yartsevfc83c602010-08-19 03:21:36 +00008940static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008941vec_xor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008942{
David Blaikie3302f2b2013-01-16 23:08:36 +00008943 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008944}
8945
8946static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008947vec_xor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008948{
David Blaikie3302f2b2013-01-16 23:08:36 +00008949 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008950}
8951
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008952static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008953vec_xor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008954{
David Blaikie3302f2b2013-01-16 23:08:36 +00008955 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008956}
8957
Anton Yartsevfc83c602010-08-19 03:21:36 +00008958static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008959vec_xor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008960{
David Blaikie3302f2b2013-01-16 23:08:36 +00008961 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008962}
8963
8964static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008965vec_xor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008966{
David Blaikie3302f2b2013-01-16 23:08:36 +00008967 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008968}
8969
8970static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008971vec_xor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008972{
David Blaikie3302f2b2013-01-16 23:08:36 +00008973 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008974}
8975
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008976static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008977vec_xor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008978{
David Blaikie3302f2b2013-01-16 23:08:36 +00008979 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8980 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008981}
8982
Anton Yartsevfc83c602010-08-19 03:21:36 +00008983static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008984vec_xor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008985{
David Blaikie3302f2b2013-01-16 23:08:36 +00008986 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8987 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008988}
8989
8990static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00008991vec_xor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00008992{
David Blaikie3302f2b2013-01-16 23:08:36 +00008993 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
8994 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00008995}
8996
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00008997/* vec_vxor */
8998
8999static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009000vec_vxor(vector signed char __a, vector signed char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009001{
David Blaikie3302f2b2013-01-16 23:08:36 +00009002 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009003}
9004
Anton Yartsevfc83c602010-08-19 03:21:36 +00009005static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009006vec_vxor(vector bool char __a, vector signed char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009007{
David Blaikie3302f2b2013-01-16 23:08:36 +00009008 return (vector signed char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009009}
9010
9011static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009012vec_vxor(vector signed char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009013{
David Blaikie3302f2b2013-01-16 23:08:36 +00009014 return __a ^ (vector signed char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009015}
9016
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009017static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009018vec_vxor(vector unsigned char __a, vector unsigned char __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009019{
David Blaikie3302f2b2013-01-16 23:08:36 +00009020 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009021}
9022
Anton Yartsevfc83c602010-08-19 03:21:36 +00009023static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009024vec_vxor(vector bool char __a, vector unsigned char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009025{
David Blaikie3302f2b2013-01-16 23:08:36 +00009026 return (vector unsigned char)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009027}
9028
9029static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009030vec_vxor(vector unsigned char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009031{
David Blaikie3302f2b2013-01-16 23:08:36 +00009032 return __a ^ (vector unsigned char)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009033}
9034
9035static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009036vec_vxor(vector bool char __a, vector bool char __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009037{
David Blaikie3302f2b2013-01-16 23:08:36 +00009038 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009039}
9040
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009041static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009042vec_vxor(vector short __a, vector short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009043{
David Blaikie3302f2b2013-01-16 23:08:36 +00009044 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009045}
9046
Anton Yartsevfc83c602010-08-19 03:21:36 +00009047static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009048vec_vxor(vector bool short __a, vector short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009049{
David Blaikie3302f2b2013-01-16 23:08:36 +00009050 return (vector short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009051}
9052
9053static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009054vec_vxor(vector short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009055{
David Blaikie3302f2b2013-01-16 23:08:36 +00009056 return __a ^ (vector short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009057}
9058
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009059static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009060vec_vxor(vector unsigned short __a, vector unsigned short __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009061{
David Blaikie3302f2b2013-01-16 23:08:36 +00009062 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009063}
9064
Anton Yartsevfc83c602010-08-19 03:21:36 +00009065static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009066vec_vxor(vector bool short __a, vector unsigned short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009067{
David Blaikie3302f2b2013-01-16 23:08:36 +00009068 return (vector unsigned short)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009069}
9070
9071static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009072vec_vxor(vector unsigned short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009073{
David Blaikie3302f2b2013-01-16 23:08:36 +00009074 return __a ^ (vector unsigned short)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009075}
9076
9077static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009078vec_vxor(vector bool short __a, vector bool short __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009079{
David Blaikie3302f2b2013-01-16 23:08:36 +00009080 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009081}
9082
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009083static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009084vec_vxor(vector int __a, vector int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009085{
David Blaikie3302f2b2013-01-16 23:08:36 +00009086 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009087}
9088
Anton Yartsevfc83c602010-08-19 03:21:36 +00009089static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009090vec_vxor(vector bool int __a, vector int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009091{
David Blaikie3302f2b2013-01-16 23:08:36 +00009092 return (vector int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009093}
9094
9095static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009096vec_vxor(vector int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009097{
David Blaikie3302f2b2013-01-16 23:08:36 +00009098 return __a ^ (vector int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009099}
9100
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009101static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009102vec_vxor(vector unsigned int __a, vector unsigned int __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009103{
David Blaikie3302f2b2013-01-16 23:08:36 +00009104 return __a ^ __b;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009105}
9106
Anton Yartsevfc83c602010-08-19 03:21:36 +00009107static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009108vec_vxor(vector bool int __a, vector unsigned int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009109{
David Blaikie3302f2b2013-01-16 23:08:36 +00009110 return (vector unsigned int)__a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009111}
9112
9113static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009114vec_vxor(vector unsigned int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009115{
David Blaikie3302f2b2013-01-16 23:08:36 +00009116 return __a ^ (vector unsigned int)__b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009117}
9118
9119static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009120vec_vxor(vector bool int __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009121{
David Blaikie3302f2b2013-01-16 23:08:36 +00009122 return __a ^ __b;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009123}
9124
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009125static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009126vec_vxor(vector float __a, vector float __b)
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009127{
David Blaikie3302f2b2013-01-16 23:08:36 +00009128 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9129 return (vector float)__res;
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +00009130}
Chris Lattnerdad40622010-04-14 03:54:58 +00009131
Anton Yartsevfc83c602010-08-19 03:21:36 +00009132static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009133vec_vxor(vector bool int __a, vector float __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009134{
David Blaikie3302f2b2013-01-16 23:08:36 +00009135 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9136 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009137}
9138
9139static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009140vec_vxor(vector float __a, vector bool int __b)
Anton Yartsevfc83c602010-08-19 03:21:36 +00009141{
David Blaikie3302f2b2013-01-16 23:08:36 +00009142 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9143 return (vector float)__res;
Anton Yartsevfc83c602010-08-19 03:21:36 +00009144}
9145
Anton Yartsev79d6af32010-09-18 00:39:16 +00009146/* ------------------------ extensions for CBEA ----------------------------- */
Anton Yartsev73d40232010-10-14 14:37:46 +00009147
9148/* vec_extract */
9149
9150static signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009151vec_extract(vector signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009152{
David Blaikie3302f2b2013-01-16 23:08:36 +00009153 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009154}
9155
9156static unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009157vec_extract(vector unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009158{
David Blaikie3302f2b2013-01-16 23:08:36 +00009159 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009160}
9161
9162static short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009163vec_extract(vector short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009164{
David Blaikie3302f2b2013-01-16 23:08:36 +00009165 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009166}
9167
9168static unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009169vec_extract(vector unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009170{
David Blaikie3302f2b2013-01-16 23:08:36 +00009171 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009172}
9173
9174static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009175vec_extract(vector int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009176{
David Blaikie3302f2b2013-01-16 23:08:36 +00009177 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009178}
9179
9180static unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009181vec_extract(vector unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009182{
David Blaikie3302f2b2013-01-16 23:08:36 +00009183 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009184}
9185
9186static float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009187vec_extract(vector float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009188{
David Blaikie3302f2b2013-01-16 23:08:36 +00009189 return __a[__b];
Anton Yartsev73d40232010-10-14 14:37:46 +00009190}
9191
9192/* vec_insert */
9193
9194static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009195vec_insert(signed char __a, vector signed char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009196{
David Blaikie3302f2b2013-01-16 23:08:36 +00009197 __b[__c] = __a;
9198 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009199}
9200
9201static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009202vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009203{
David Blaikie3302f2b2013-01-16 23:08:36 +00009204 __b[__c] = __a;
9205 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009206}
9207
9208static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009209vec_insert(short __a, vector short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009210{
David Blaikie3302f2b2013-01-16 23:08:36 +00009211 __b[__c] = __a;
9212 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009213}
9214
9215static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009216vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009217{
David Blaikie3302f2b2013-01-16 23:08:36 +00009218 __b[__c] = __a;
9219 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009220}
9221
9222static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009223vec_insert(int __a, vector int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009224{
David Blaikie3302f2b2013-01-16 23:08:36 +00009225 __b[__c] = __a;
9226 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009227}
9228
9229static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009230vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009231{
David Blaikie3302f2b2013-01-16 23:08:36 +00009232 __b[__c] = __a;
9233 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009234}
9235
9236static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009237vec_insert(float __a, vector float __b, int __c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009238{
David Blaikie3302f2b2013-01-16 23:08:36 +00009239 __b[__c] = __a;
9240 return __b;
Anton Yartsev73d40232010-10-14 14:37:46 +00009241}
9242
9243/* vec_lvlx */
9244
9245static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009246vec_lvlx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009247{
David Blaikie3302f2b2013-01-16 23:08:36 +00009248 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009249 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009250 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009251}
9252
9253static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009254vec_lvlx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009255{
David Blaikie3302f2b2013-01-16 23:08:36 +00009256 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009257 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009258 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009259}
9260
9261static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009262vec_lvlx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009263{
David Blaikie3302f2b2013-01-16 23:08:36 +00009264 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009265 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009266 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009267}
9268
9269static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009270vec_lvlx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009271{
David Blaikie3302f2b2013-01-16 23:08:36 +00009272 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009273 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009274 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009275}
9276
9277static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009278vec_lvlx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009279{
David Blaikie3302f2b2013-01-16 23:08:36 +00009280 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009281 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009282 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009283}
9284
9285static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009286vec_lvlx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009287{
David Blaikie3302f2b2013-01-16 23:08:36 +00009288 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009289 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009290 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009291}
9292
9293static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009294vec_lvlx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009295{
David Blaikie3302f2b2013-01-16 23:08:36 +00009296 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009297 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009298 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009299}
9300
9301static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009302vec_lvlx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009303{
David Blaikie3302f2b2013-01-16 23:08:36 +00009304 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009305 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009306 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009307}
9308
9309static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009310vec_lvlx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009311{
David Blaikie3302f2b2013-01-16 23:08:36 +00009312 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009313 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009314 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009315}
9316
9317static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009318vec_lvlx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009319{
David Blaikie3302f2b2013-01-16 23:08:36 +00009320 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009321 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009322 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009323}
9324
9325static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009326vec_lvlx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009327{
David Blaikie3302f2b2013-01-16 23:08:36 +00009328 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009329 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009330 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009331}
9332
9333static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009334vec_lvlx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009335{
David Blaikie3302f2b2013-01-16 23:08:36 +00009336 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009337 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009338 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009339}
9340
9341static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009342vec_lvlx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009343{
David Blaikie3302f2b2013-01-16 23:08:36 +00009344 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009345 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009346 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009347}
9348
9349static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009350vec_lvlx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009351{
David Blaikie3302f2b2013-01-16 23:08:36 +00009352 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009353 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009354 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009355}
9356
9357static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009358vec_lvlx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009359{
David Blaikie3302f2b2013-01-16 23:08:36 +00009360 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009361 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009362 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009363}
9364
9365static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009366vec_lvlx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009367{
David Blaikie3302f2b2013-01-16 23:08:36 +00009368 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009369 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009370 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009371}
9372
9373static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009374vec_lvlx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009375{
David Blaikie3302f2b2013-01-16 23:08:36 +00009376 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009377 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009378 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009379}
9380
9381static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009382vec_lvlx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009383{
David Blaikie3302f2b2013-01-16 23:08:36 +00009384 return vec_perm(vec_ld(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009385 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009386 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009387}
9388
9389/* vec_lvlxl */
9390
9391static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009392vec_lvlxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009393{
David Blaikie3302f2b2013-01-16 23:08:36 +00009394 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009395 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009396 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009397}
9398
9399static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009400vec_lvlxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009401{
David Blaikie3302f2b2013-01-16 23:08:36 +00009402 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009403 (vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009404 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009405}
9406
9407static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009408vec_lvlxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009409{
David Blaikie3302f2b2013-01-16 23:08:36 +00009410 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009411 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009412 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009413}
9414
9415static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009416vec_lvlxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009417{
David Blaikie3302f2b2013-01-16 23:08:36 +00009418 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009419 (vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009420 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009421}
9422
9423static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009424vec_lvlxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009425{
David Blaikie3302f2b2013-01-16 23:08:36 +00009426 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009427 (vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009428 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009429}
9430
9431static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009432vec_lvlxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009433{
David Blaikie3302f2b2013-01-16 23:08:36 +00009434 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009435 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009436 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009437}
9438
9439static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009440vec_lvlxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009441{
David Blaikie3302f2b2013-01-16 23:08:36 +00009442 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009443 (vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009444 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009445}
9446
9447static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009448vec_lvlxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009449{
David Blaikie3302f2b2013-01-16 23:08:36 +00009450 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009451 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009452 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009453}
9454
9455static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009456vec_lvlxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009457{
David Blaikie3302f2b2013-01-16 23:08:36 +00009458 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009459 (vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009460 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009461}
9462
9463static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009464vec_lvlxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009465{
David Blaikie3302f2b2013-01-16 23:08:36 +00009466 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009467 (vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009468 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009469}
9470
9471static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009472vec_lvlxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009473{
David Blaikie3302f2b2013-01-16 23:08:36 +00009474 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009475 (vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009476 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009477}
9478
9479static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009480vec_lvlxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009481{
David Blaikie3302f2b2013-01-16 23:08:36 +00009482 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009483 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009484 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009485}
9486
9487static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009488vec_lvlxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009489{
David Blaikie3302f2b2013-01-16 23:08:36 +00009490 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009491 (vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009492 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009493}
9494
9495static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009496vec_lvlxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009497{
David Blaikie3302f2b2013-01-16 23:08:36 +00009498 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009499 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009500 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009501}
9502
9503static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009504vec_lvlxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009505{
David Blaikie3302f2b2013-01-16 23:08:36 +00009506 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009507 (vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009508 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009509}
9510
9511static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009512vec_lvlxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009513{
David Blaikie3302f2b2013-01-16 23:08:36 +00009514 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009515 (vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009516 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009517}
9518
9519static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009520vec_lvlxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009521{
David Blaikie3302f2b2013-01-16 23:08:36 +00009522 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009523 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009524 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009525}
9526
9527static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009528vec_lvlxl(int __a, vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009529{
David Blaikie3302f2b2013-01-16 23:08:36 +00009530 return vec_perm(vec_ldl(__a, __b),
Anton Yartsev73d40232010-10-14 14:37:46 +00009531 (vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009532 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009533}
9534
9535/* vec_lvrx */
9536
9537static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009538vec_lvrx(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009539{
9540 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009541 vec_ld(__a, __b),
9542 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009543}
9544
9545static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009546vec_lvrx(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009547{
9548 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009549 vec_ld(__a, __b),
9550 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009551}
9552
9553static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009554vec_lvrx(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009555{
9556 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009557 vec_ld(__a, __b),
9558 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009559}
9560
9561static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009562vec_lvrx(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009563{
9564 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009565 vec_ld(__a, __b),
9566 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009567}
9568
9569static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009570vec_lvrx(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009571{
9572 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009573 vec_ld(__a, __b),
9574 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009575}
9576
9577static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009578vec_lvrx(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009579{
9580 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009581 vec_ld(__a, __b),
9582 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009583}
9584
9585static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009586vec_lvrx(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009587{
9588 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009589 vec_ld(__a, __b),
9590 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009591}
9592
9593static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009594vec_lvrx(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009595{
9596 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009597 vec_ld(__a, __b),
9598 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009599}
9600
9601static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009602vec_lvrx(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009603{
9604 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009605 vec_ld(__a, __b),
9606 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009607}
9608
9609static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009610vec_lvrx(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009611{
9612 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009613 vec_ld(__a, __b),
9614 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009615}
9616
9617static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009618vec_lvrx(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009619{
9620 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009621 vec_ld(__a, __b),
9622 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009623}
9624
9625static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009626vec_lvrx(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009627{
9628 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009629 vec_ld(__a, __b),
9630 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009631}
9632
9633static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009634vec_lvrx(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009635{
9636 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009637 vec_ld(__a, __b),
9638 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009639}
9640
9641static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009642vec_lvrx(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009643{
9644 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009645 vec_ld(__a, __b),
9646 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009647}
9648
9649static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009650vec_lvrx(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009651{
9652 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009653 vec_ld(__a, __b),
9654 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009655}
9656
9657static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009658vec_lvrx(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009659{
9660 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009661 vec_ld(__a, __b),
9662 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009663}
9664
9665static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009666vec_lvrx(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009667{
9668 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009669 vec_ld(__a, __b),
9670 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009671}
9672
9673static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009674vec_lvrx(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009675{
9676 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009677 vec_ld(__a, __b),
9678 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009679}
9680
9681/* vec_lvrxl */
9682
9683static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009684vec_lvrxl(int __a, const signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009685{
9686 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009687 vec_ldl(__a, __b),
9688 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009689}
9690
9691static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009692vec_lvrxl(int __a, const vector signed char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009693{
9694 return vec_perm((vector signed char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009695 vec_ldl(__a, __b),
9696 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009697}
9698
9699static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009700vec_lvrxl(int __a, const unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009701{
9702 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009703 vec_ldl(__a, __b),
9704 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009705}
9706
9707static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009708vec_lvrxl(int __a, const vector unsigned char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009709{
9710 return vec_perm((vector unsigned char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009711 vec_ldl(__a, __b),
9712 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009713}
9714
9715static vector bool char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009716vec_lvrxl(int __a, const vector bool char *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009717{
9718 return vec_perm((vector bool char)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009719 vec_ldl(__a, __b),
9720 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009721}
9722
9723static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009724vec_lvrxl(int __a, const short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009725{
9726 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009727 vec_ldl(__a, __b),
9728 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009729}
9730
9731static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009732vec_lvrxl(int __a, const vector short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009733{
9734 return vec_perm((vector short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009735 vec_ldl(__a, __b),
9736 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009737}
9738
9739static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009740vec_lvrxl(int __a, const unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009741{
9742 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009743 vec_ldl(__a, __b),
9744 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009745}
9746
9747static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009748vec_lvrxl(int __a, const vector unsigned short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009749{
9750 return vec_perm((vector unsigned short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009751 vec_ldl(__a, __b),
9752 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009753}
9754
9755static vector bool short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009756vec_lvrxl(int __a, const vector bool short *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009757{
9758 return vec_perm((vector bool short)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009759 vec_ldl(__a, __b),
9760 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009761}
9762
9763static vector pixel __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009764vec_lvrxl(int __a, const vector pixel *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009765{
9766 return vec_perm((vector pixel)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009767 vec_ldl(__a, __b),
9768 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009769}
9770
9771static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009772vec_lvrxl(int __a, const int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009773{
9774 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009775 vec_ldl(__a, __b),
9776 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009777}
9778
9779static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009780vec_lvrxl(int __a, const vector int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009781{
9782 return vec_perm((vector int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009783 vec_ldl(__a, __b),
9784 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009785}
9786
9787static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009788vec_lvrxl(int __a, const unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009789{
9790 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009791 vec_ldl(__a, __b),
9792 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009793}
9794
9795static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009796vec_lvrxl(int __a, const vector unsigned int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009797{
9798 return vec_perm((vector unsigned int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009799 vec_ldl(__a, __b),
9800 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009801}
9802
9803static vector bool int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009804vec_lvrxl(int __a, const vector bool int *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009805{
9806 return vec_perm((vector bool int)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009807 vec_ldl(__a, __b),
9808 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009809}
9810
9811static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009812vec_lvrxl(int __a, const float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009813{
9814 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009815 vec_ldl(__a, __b),
9816 vec_lvsl(__a, __b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009817}
9818
9819static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009820vec_lvrxl(int __a, const vector float *__b)
Anton Yartsev73d40232010-10-14 14:37:46 +00009821{
9822 return vec_perm((vector float)(0),
David Blaikie3302f2b2013-01-16 23:08:36 +00009823 vec_ldl(__a, __b),
9824 vec_lvsl(__a, (unsigned char *)__b));
Anton Yartsev73d40232010-10-14 14:37:46 +00009825}
9826
9827/* vec_stvlx */
9828
9829static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009830vec_stvlx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009831{
David Blaikie3302f2b2013-01-16 23:08:36 +00009832 return vec_st(vec_perm(vec_lvrx(__b, __c),
9833 __a,
9834 vec_lvsr(__b, __c)),
9835 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009836}
9837
9838static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009839vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009840{
David Blaikie3302f2b2013-01-16 23:08:36 +00009841 return vec_st(vec_perm(vec_lvrx(__b, __c),
9842 __a,
9843 vec_lvsr(__b, (unsigned char *)__c)),
9844 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009845}
9846
9847static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009848vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009849{
David Blaikie3302f2b2013-01-16 23:08:36 +00009850 return vec_st(vec_perm(vec_lvrx(__b, __c),
9851 __a,
9852 vec_lvsr(__b, __c)),
9853 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009854}
9855
9856static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009857vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009858{
David Blaikie3302f2b2013-01-16 23:08:36 +00009859 return vec_st(vec_perm(vec_lvrx(__b, __c),
9860 __a,
9861 vec_lvsr(__b, (unsigned char *)__c)),
9862 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009863}
9864
9865static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009866vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009867{
David Blaikie3302f2b2013-01-16 23:08:36 +00009868 return vec_st(vec_perm(vec_lvrx(__b, __c),
9869 __a,
9870 vec_lvsr(__b, (unsigned char *)__c)),
9871 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009872}
9873
9874static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009875vec_stvlx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009876{
David Blaikie3302f2b2013-01-16 23:08:36 +00009877 return vec_st(vec_perm(vec_lvrx(__b, __c),
9878 __a,
9879 vec_lvsr(__b, __c)),
9880 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009881}
9882
9883static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009884vec_stvlx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009885{
David Blaikie3302f2b2013-01-16 23:08:36 +00009886 return vec_st(vec_perm(vec_lvrx(__b, __c),
9887 __a,
9888 vec_lvsr(__b, (unsigned char *)__c)),
9889 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009890}
9891
9892static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009893vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009894{
David Blaikie3302f2b2013-01-16 23:08:36 +00009895 return vec_st(vec_perm(vec_lvrx(__b, __c),
9896 __a,
9897 vec_lvsr(__b, __c)),
9898 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009899}
9900
9901static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009902vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009903{
David Blaikie3302f2b2013-01-16 23:08:36 +00009904 return vec_st(vec_perm(vec_lvrx(__b, __c),
9905 __a,
9906 vec_lvsr(__b, (unsigned char *)__c)),
9907 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009908}
9909
9910static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009911vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009912{
David Blaikie3302f2b2013-01-16 23:08:36 +00009913 return vec_st(vec_perm(vec_lvrx(__b, __c),
9914 __a,
9915 vec_lvsr(__b, (unsigned char *)__c)),
9916 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009917}
9918
9919static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009920vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009921{
David Blaikie3302f2b2013-01-16 23:08:36 +00009922 return vec_st(vec_perm(vec_lvrx(__b, __c),
9923 __a,
9924 vec_lvsr(__b, (unsigned char *)__c)),
9925 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009926}
9927
9928static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009929vec_stvlx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009930{
David Blaikie3302f2b2013-01-16 23:08:36 +00009931 return vec_st(vec_perm(vec_lvrx(__b, __c),
9932 __a,
9933 vec_lvsr(__b, __c)),
9934 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009935}
9936
9937static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009938vec_stvlx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009939{
David Blaikie3302f2b2013-01-16 23:08:36 +00009940 return vec_st(vec_perm(vec_lvrx(__b, __c),
9941 __a,
9942 vec_lvsr(__b, (unsigned char *)__c)),
9943 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009944}
9945
9946static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009947vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009948{
David Blaikie3302f2b2013-01-16 23:08:36 +00009949 return vec_st(vec_perm(vec_lvrx(__b, __c),
9950 __a,
9951 vec_lvsr(__b, __c)),
9952 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009953}
9954
9955static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009956vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009957{
David Blaikie3302f2b2013-01-16 23:08:36 +00009958 return vec_st(vec_perm(vec_lvrx(__b, __c),
9959 __a,
9960 vec_lvsr(__b, (unsigned char *)__c)),
9961 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009962}
9963
9964static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009965vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009966{
David Blaikie3302f2b2013-01-16 23:08:36 +00009967 return vec_st(vec_perm(vec_lvrx(__b, __c),
9968 __a,
9969 vec_lvsr(__b, (unsigned char *)__c)),
9970 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009971}
9972
9973static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009974vec_stvlx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009975{
David Blaikie3302f2b2013-01-16 23:08:36 +00009976 return vec_st(vec_perm(vec_lvrx(__b, __c),
9977 __a,
9978 vec_lvsr(__b, (unsigned char *)__c)),
9979 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009980}
9981
9982/* vec_stvlxl */
9983
9984static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009985vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009986{
David Blaikie3302f2b2013-01-16 23:08:36 +00009987 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9988 __a,
9989 vec_lvsr(__b, __c)),
9990 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +00009991}
9992
9993static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +00009994vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +00009995{
David Blaikie3302f2b2013-01-16 23:08:36 +00009996 return vec_stl(vec_perm(vec_lvrx(__b, __c),
9997 __a,
9998 vec_lvsr(__b, (unsigned char *)__c)),
9999 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010000}
10001
10002static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010003vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010004{
David Blaikie3302f2b2013-01-16 23:08:36 +000010005 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10006 __a,
10007 vec_lvsr(__b, __c)),
10008 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010009}
10010
10011static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010012vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010013{
David Blaikie3302f2b2013-01-16 23:08:36 +000010014 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10015 __a,
10016 vec_lvsr(__b, (unsigned char *)__c)),
10017 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010018}
10019
10020static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010021vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010022{
David Blaikie3302f2b2013-01-16 23:08:36 +000010023 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10024 __a,
10025 vec_lvsr(__b, (unsigned char *)__c)),
10026 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010027}
10028
10029static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010030vec_stvlxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010031{
David Blaikie3302f2b2013-01-16 23:08:36 +000010032 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10033 __a,
10034 vec_lvsr(__b, __c)),
10035 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010036}
10037
10038static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010039vec_stvlxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010040{
David Blaikie3302f2b2013-01-16 23:08:36 +000010041 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10042 __a,
10043 vec_lvsr(__b, (unsigned char *)__c)),
10044 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010045}
10046
10047static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010048vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010049{
David Blaikie3302f2b2013-01-16 23:08:36 +000010050 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10051 __a,
10052 vec_lvsr(__b, __c)),
10053 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010054}
10055
10056static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010057vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010058{
David Blaikie3302f2b2013-01-16 23:08:36 +000010059 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10060 __a,
10061 vec_lvsr(__b, (unsigned char *)__c)),
10062 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010063}
10064
10065static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010066vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010067{
David Blaikie3302f2b2013-01-16 23:08:36 +000010068 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10069 __a,
10070 vec_lvsr(__b, (unsigned char *)__c)),
10071 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010072}
10073
10074static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010075vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010076{
David Blaikie3302f2b2013-01-16 23:08:36 +000010077 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10078 __a,
10079 vec_lvsr(__b, (unsigned char *)__c)),
10080 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010081}
10082
10083static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010084vec_stvlxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010085{
David Blaikie3302f2b2013-01-16 23:08:36 +000010086 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10087 __a,
10088 vec_lvsr(__b, __c)),
10089 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010090}
10091
10092static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010093vec_stvlxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010094{
David Blaikie3302f2b2013-01-16 23:08:36 +000010095 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10096 __a,
10097 vec_lvsr(__b, (unsigned char *)__c)),
10098 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010099}
10100
10101static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010102vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010103{
David Blaikie3302f2b2013-01-16 23:08:36 +000010104 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10105 __a,
10106 vec_lvsr(__b, __c)),
10107 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010108}
10109
10110static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010111vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010112{
David Blaikie3302f2b2013-01-16 23:08:36 +000010113 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10114 __a,
10115 vec_lvsr(__b, (unsigned char *)__c)),
10116 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010117}
10118
10119static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010120vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010121{
David Blaikie3302f2b2013-01-16 23:08:36 +000010122 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10123 __a,
10124 vec_lvsr(__b, (unsigned char *)__c)),
10125 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010126}
10127
10128static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010129vec_stvlxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010130{
David Blaikie3302f2b2013-01-16 23:08:36 +000010131 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10132 __a,
10133 vec_lvsr(__b, (unsigned char *)__c)),
10134 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010135}
10136
10137/* vec_stvrx */
10138
10139static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010140vec_stvrx(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010141{
David Blaikie3302f2b2013-01-16 23:08:36 +000010142 return vec_st(vec_perm(__a,
10143 vec_lvlx(__b, __c),
10144 vec_lvsr(__b, __c)),
10145 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010146}
10147
10148static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010149vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010150{
David Blaikie3302f2b2013-01-16 23:08:36 +000010151 return vec_st(vec_perm(__a,
10152 vec_lvlx(__b, __c),
10153 vec_lvsr(__b, (unsigned char *)__c)),
10154 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010155}
10156
10157static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010158vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010159{
David Blaikie3302f2b2013-01-16 23:08:36 +000010160 return vec_st(vec_perm(__a,
10161 vec_lvlx(__b, __c),
10162 vec_lvsr(__b, __c)),
10163 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010164}
10165
10166static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010167vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010168{
David Blaikie3302f2b2013-01-16 23:08:36 +000010169 return vec_st(vec_perm(__a,
10170 vec_lvlx(__b, __c),
10171 vec_lvsr(__b, (unsigned char *)__c)),
10172 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010173}
10174
10175static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010176vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010177{
David Blaikie3302f2b2013-01-16 23:08:36 +000010178 return vec_st(vec_perm(__a,
10179 vec_lvlx(__b, __c),
10180 vec_lvsr(__b, (unsigned char *)__c)),
10181 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010182}
10183
10184static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010185vec_stvrx(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010186{
David Blaikie3302f2b2013-01-16 23:08:36 +000010187 return vec_st(vec_perm(__a,
10188 vec_lvlx(__b, __c),
10189 vec_lvsr(__b, __c)),
10190 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010191}
10192
10193static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010194vec_stvrx(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010195{
David Blaikie3302f2b2013-01-16 23:08:36 +000010196 return vec_st(vec_perm(__a,
10197 vec_lvlx(__b, __c),
10198 vec_lvsr(__b, (unsigned char *)__c)),
10199 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010200}
10201
10202static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010203vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010204{
David Blaikie3302f2b2013-01-16 23:08:36 +000010205 return vec_st(vec_perm(__a,
10206 vec_lvlx(__b, __c),
10207 vec_lvsr(__b, __c)),
10208 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010209}
10210
10211static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010212vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010213{
David Blaikie3302f2b2013-01-16 23:08:36 +000010214 return vec_st(vec_perm(__a,
10215 vec_lvlx(__b, __c),
10216 vec_lvsr(__b, (unsigned char *)__c)),
10217 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010218}
10219
10220static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010221vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010222{
David Blaikie3302f2b2013-01-16 23:08:36 +000010223 return vec_st(vec_perm(__a,
10224 vec_lvlx(__b, __c),
10225 vec_lvsr(__b, (unsigned char *)__c)),
10226 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010227}
10228
10229static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010230vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010231{
David Blaikie3302f2b2013-01-16 23:08:36 +000010232 return vec_st(vec_perm(__a,
10233 vec_lvlx(__b, __c),
10234 vec_lvsr(__b, (unsigned char *)__c)),
10235 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010236}
10237
10238static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010239vec_stvrx(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010240{
David Blaikie3302f2b2013-01-16 23:08:36 +000010241 return vec_st(vec_perm(__a,
10242 vec_lvlx(__b, __c),
10243 vec_lvsr(__b, __c)),
10244 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010245}
10246
10247static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010248vec_stvrx(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010249{
David Blaikie3302f2b2013-01-16 23:08:36 +000010250 return vec_st(vec_perm(__a,
10251 vec_lvlx(__b, __c),
10252 vec_lvsr(__b, (unsigned char *)__c)),
10253 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010254}
10255
10256static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010257vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010258{
David Blaikie3302f2b2013-01-16 23:08:36 +000010259 return vec_st(vec_perm(__a,
10260 vec_lvlx(__b, __c),
10261 vec_lvsr(__b, __c)),
10262 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010263}
10264
10265static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010266vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010267{
David Blaikie3302f2b2013-01-16 23:08:36 +000010268 return vec_st(vec_perm(__a,
10269 vec_lvlx(__b, __c),
10270 vec_lvsr(__b, (unsigned char *)__c)),
10271 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010272}
10273
10274static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010275vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010276{
David Blaikie3302f2b2013-01-16 23:08:36 +000010277 return vec_st(vec_perm(__a,
10278 vec_lvlx(__b, __c),
10279 vec_lvsr(__b, (unsigned char *)__c)),
10280 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010281}
10282
10283static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010284vec_stvrx(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010285{
David Blaikie3302f2b2013-01-16 23:08:36 +000010286 return vec_st(vec_perm(__a,
10287 vec_lvlx(__b, __c),
10288 vec_lvsr(__b, (unsigned char *)__c)),
10289 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010290}
10291
10292/* vec_stvrxl */
10293
10294static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010295vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010296{
David Blaikie3302f2b2013-01-16 23:08:36 +000010297 return vec_stl(vec_perm(__a,
10298 vec_lvlx(__b, __c),
10299 vec_lvsr(__b, __c)),
10300 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010301}
10302
10303static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010304vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010305{
David Blaikie3302f2b2013-01-16 23:08:36 +000010306 return vec_stl(vec_perm(__a,
10307 vec_lvlx(__b, __c),
10308 vec_lvsr(__b, (unsigned char *)__c)),
10309 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010310}
10311
10312static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010313vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010314{
David Blaikie3302f2b2013-01-16 23:08:36 +000010315 return vec_stl(vec_perm(__a,
10316 vec_lvlx(__b, __c),
10317 vec_lvsr(__b, __c)),
10318 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010319}
10320
10321static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010322vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010323{
David Blaikie3302f2b2013-01-16 23:08:36 +000010324 return vec_stl(vec_perm(__a,
10325 vec_lvlx(__b, __c),
10326 vec_lvsr(__b, (unsigned char *)__c)),
10327 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010328}
10329
10330static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010331vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010332{
David Blaikie3302f2b2013-01-16 23:08:36 +000010333 return vec_stl(vec_perm(__a,
10334 vec_lvlx(__b, __c),
10335 vec_lvsr(__b, (unsigned char *)__c)),
10336 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010337}
10338
10339static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010340vec_stvrxl(vector short __a, int __b, short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010341{
David Blaikie3302f2b2013-01-16 23:08:36 +000010342 return vec_stl(vec_perm(__a,
10343 vec_lvlx(__b, __c),
10344 vec_lvsr(__b, __c)),
10345 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010346}
10347
10348static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010349vec_stvrxl(vector short __a, int __b, vector short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010350{
David Blaikie3302f2b2013-01-16 23:08:36 +000010351 return vec_stl(vec_perm(__a,
10352 vec_lvlx(__b, __c),
10353 vec_lvsr(__b, (unsigned char *)__c)),
10354 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010355}
10356
10357static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010358vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010359{
David Blaikie3302f2b2013-01-16 23:08:36 +000010360 return vec_stl(vec_perm(__a,
10361 vec_lvlx(__b, __c),
10362 vec_lvsr(__b, __c)),
10363 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010364}
10365
10366static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010367vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010368{
David Blaikie3302f2b2013-01-16 23:08:36 +000010369 return vec_stl(vec_perm(__a,
10370 vec_lvlx(__b, __c),
10371 vec_lvsr(__b, (unsigned char *)__c)),
10372 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010373}
10374
10375static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010376vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010377{
David Blaikie3302f2b2013-01-16 23:08:36 +000010378 return vec_stl(vec_perm(__a,
10379 vec_lvlx(__b, __c),
10380 vec_lvsr(__b, (unsigned char *)__c)),
10381 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010382}
10383
10384static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010385vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010386{
David Blaikie3302f2b2013-01-16 23:08:36 +000010387 return vec_stl(vec_perm(__a,
10388 vec_lvlx(__b, __c),
10389 vec_lvsr(__b, (unsigned char *)__c)),
10390 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010391}
10392
10393static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010394vec_stvrxl(vector int __a, int __b, int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010395{
David Blaikie3302f2b2013-01-16 23:08:36 +000010396 return vec_stl(vec_perm(__a,
10397 vec_lvlx(__b, __c),
10398 vec_lvsr(__b, __c)),
10399 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010400}
10401
10402static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010403vec_stvrxl(vector int __a, int __b, vector int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010404{
David Blaikie3302f2b2013-01-16 23:08:36 +000010405 return vec_stl(vec_perm(__a,
10406 vec_lvlx(__b, __c),
10407 vec_lvsr(__b, (unsigned char *)__c)),
10408 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010409}
10410
10411static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010412vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010413{
David Blaikie3302f2b2013-01-16 23:08:36 +000010414 return vec_stl(vec_perm(__a,
10415 vec_lvlx(__b, __c),
10416 vec_lvsr(__b, __c)),
10417 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010418}
10419
10420static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010421vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010422{
David Blaikie3302f2b2013-01-16 23:08:36 +000010423 return vec_stl(vec_perm(__a,
10424 vec_lvlx(__b, __c),
10425 vec_lvsr(__b, (unsigned char *)__c)),
10426 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010427}
10428
10429static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010430vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010431{
David Blaikie3302f2b2013-01-16 23:08:36 +000010432 return vec_stl(vec_perm(__a,
10433 vec_lvlx(__b, __c),
10434 vec_lvsr(__b, (unsigned char *)__c)),
10435 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010436}
10437
10438static void __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010439vec_stvrxl(vector float __a, int __b, vector float *__c)
Anton Yartsev73d40232010-10-14 14:37:46 +000010440{
David Blaikie3302f2b2013-01-16 23:08:36 +000010441 return vec_stl(vec_perm(__a,
10442 vec_lvlx(__b, __c),
10443 vec_lvsr(__b, (unsigned char *)__c)),
10444 __b, __c);
Anton Yartsev73d40232010-10-14 14:37:46 +000010445}
10446
10447/* vec_promote */
10448
10449static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010450vec_promote(signed char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010451{
David Blaikie3302f2b2013-01-16 23:08:36 +000010452 vector signed char __res = (vector signed char)(0);
10453 __res[__b] = __a;
10454 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010455}
10456
10457static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010458vec_promote(unsigned char __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010459{
David Blaikie3302f2b2013-01-16 23:08:36 +000010460 vector unsigned char __res = (vector unsigned char)(0);
10461 __res[__b] = __a;
10462 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010463}
10464
10465static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010466vec_promote(short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010467{
David Blaikie3302f2b2013-01-16 23:08:36 +000010468 vector short __res = (vector short)(0);
10469 __res[__b] = __a;
10470 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010471}
10472
10473static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010474vec_promote(unsigned short __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010475{
David Blaikie3302f2b2013-01-16 23:08:36 +000010476 vector unsigned short __res = (vector unsigned short)(0);
10477 __res[__b] = __a;
10478 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010479}
10480
10481static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010482vec_promote(int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010483{
David Blaikie3302f2b2013-01-16 23:08:36 +000010484 vector int __res = (vector int)(0);
10485 __res[__b] = __a;
10486 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010487}
10488
10489static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010490vec_promote(unsigned int __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010491{
David Blaikie3302f2b2013-01-16 23:08:36 +000010492 vector unsigned int __res = (vector unsigned int)(0);
10493 __res[__b] = __a;
10494 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010495}
10496
10497static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010498vec_promote(float __a, int __b)
Anton Yartsev73d40232010-10-14 14:37:46 +000010499{
David Blaikie3302f2b2013-01-16 23:08:36 +000010500 vector float __res = (vector float)(0);
10501 __res[__b] = __a;
10502 return __res;
Anton Yartsev73d40232010-10-14 14:37:46 +000010503}
10504
10505/* vec_splats */
10506
10507static vector signed char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010508vec_splats(signed char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010509{
David Blaikie3302f2b2013-01-16 23:08:36 +000010510 return (vector signed char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010511}
10512
10513static vector unsigned char __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010514vec_splats(unsigned char __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010515{
David Blaikie3302f2b2013-01-16 23:08:36 +000010516 return (vector unsigned char)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010517}
10518
10519static vector short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010520vec_splats(short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010521{
David Blaikie3302f2b2013-01-16 23:08:36 +000010522 return (vector short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010523}
10524
10525static vector unsigned short __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010526vec_splats(unsigned short __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010527{
David Blaikie3302f2b2013-01-16 23:08:36 +000010528 return (vector unsigned short)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010529}
10530
10531static vector int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010532vec_splats(int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010533{
David Blaikie3302f2b2013-01-16 23:08:36 +000010534 return (vector int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010535}
10536
10537static vector unsigned int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010538vec_splats(unsigned int __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010539{
David Blaikie3302f2b2013-01-16 23:08:36 +000010540 return (vector unsigned int)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010541}
10542
10543static vector float __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010544vec_splats(float __a)
Anton Yartsev73d40232010-10-14 14:37:46 +000010545{
David Blaikie3302f2b2013-01-16 23:08:36 +000010546 return (vector float)(__a);
Anton Yartsev73d40232010-10-14 14:37:46 +000010547}
10548
Anton Yartsev79d6af32010-09-18 00:39:16 +000010549/* ----------------------------- predicates --------------------------------- */
Chris Lattnerdad40622010-04-14 03:54:58 +000010550
Chris Lattnerdad40622010-04-14 03:54:58 +000010551/* vec_all_eq */
10552
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010553static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010554vec_all_eq(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010555{
David Blaikie3302f2b2013-01-16 23:08:36 +000010556 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010557}
10558
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010559static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010560vec_all_eq(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010561{
David Blaikie3302f2b2013-01-16 23:08:36 +000010562 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010563}
10564
10565static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010566vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010567{
David Blaikie3302f2b2013-01-16 23:08:36 +000010568 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010569}
10570
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010571static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010572vec_all_eq(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010573{
David Blaikie3302f2b2013-01-16 23:08:36 +000010574 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010575}
10576
10577static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010578vec_all_eq(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010579{
David Blaikie3302f2b2013-01-16 23:08:36 +000010580 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010581}
10582
10583static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010584vec_all_eq(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010585{
David Blaikie3302f2b2013-01-16 23:08:36 +000010586 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010587}
10588
10589static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010590vec_all_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010591{
David Blaikie3302f2b2013-01-16 23:08:36 +000010592 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010593}
10594
10595static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010596vec_all_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010597{
David Blaikie3302f2b2013-01-16 23:08:36 +000010598 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010599}
10600
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010601static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010602vec_all_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010603{
David Blaikie3302f2b2013-01-16 23:08:36 +000010604 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010605}
10606
10607static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010608vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010609{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010610 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010611 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010612}
10613
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010614static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010615vec_all_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010616{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010617 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010618 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010619}
10620
10621static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010622vec_all_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010623{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010624 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010625 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010626}
10627
10628static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010629vec_all_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010630{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010631 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010632 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010633}
10634
10635static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010636vec_all_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010637{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010638 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010639 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010640}
10641
10642static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010643vec_all_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010644{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010645 return
David Blaikie3302f2b2013-01-16 23:08:36 +000010646 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010647}
10648
10649static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010650vec_all_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010651{
David Blaikie3302f2b2013-01-16 23:08:36 +000010652 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010653}
10654
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010655static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010656vec_all_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010657{
David Blaikie3302f2b2013-01-16 23:08:36 +000010658 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010659}
10660
10661static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010662vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010663{
David Blaikie3302f2b2013-01-16 23:08:36 +000010664 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010665}
10666
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010667static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010668vec_all_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010669{
David Blaikie3302f2b2013-01-16 23:08:36 +000010670 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010671}
10672
10673static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010674vec_all_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010675{
David Blaikie3302f2b2013-01-16 23:08:36 +000010676 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010677}
10678
10679static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010680vec_all_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010681{
David Blaikie3302f2b2013-01-16 23:08:36 +000010682 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010683}
10684
10685static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010686vec_all_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010687{
David Blaikie3302f2b2013-01-16 23:08:36 +000010688 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010689}
10690
10691static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010692vec_all_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010693{
David Blaikie3302f2b2013-01-16 23:08:36 +000010694 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010695}
10696
10697/* vec_all_ge */
10698
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010699static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010700vec_all_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010701{
David Blaikie3302f2b2013-01-16 23:08:36 +000010702 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010703}
10704
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010705static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010706vec_all_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010707{
David Blaikie3302f2b2013-01-16 23:08:36 +000010708 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010709}
10710
10711static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010712vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010713{
David Blaikie3302f2b2013-01-16 23:08:36 +000010714 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010715}
10716
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010717static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010718vec_all_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010719{
David Blaikie3302f2b2013-01-16 23:08:36 +000010720 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010721}
10722
10723static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010724vec_all_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010725{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010726 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010727 (vector unsigned char)__b,
10728 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010729}
10730
10731static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010732vec_all_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010733{
David Blaikie3302f2b2013-01-16 23:08:36 +000010734 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010735}
10736
10737static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010738vec_all_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010739{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010740 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010741 (vector unsigned char)__b,
10742 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010743}
10744
10745static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010746vec_all_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010747{
David Blaikie3302f2b2013-01-16 23:08:36 +000010748 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010749}
10750
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010751static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010752vec_all_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010753{
David Blaikie3302f2b2013-01-16 23:08:36 +000010754 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010755}
10756
10757static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010758vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010759{
David Blaikie3302f2b2013-01-16 23:08:36 +000010760 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010761}
10762
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010763static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010764vec_all_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010765{
David Blaikie3302f2b2013-01-16 23:08:36 +000010766 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010767}
10768
10769static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010770vec_all_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010771{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010772 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010773 (vector unsigned short)__b,
10774 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010775}
10776
10777static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010778vec_all_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010779{
David Blaikie3302f2b2013-01-16 23:08:36 +000010780 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010781}
10782
10783static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010784vec_all_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010785{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010786 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010787 (vector unsigned short)__b,
10788 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010789}
10790
10791static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010792vec_all_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010793{
David Blaikie3302f2b2013-01-16 23:08:36 +000010794 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010795}
10796
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010797static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010798vec_all_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010799{
David Blaikie3302f2b2013-01-16 23:08:36 +000010800 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010801}
10802
10803static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010804vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010805{
David Blaikie3302f2b2013-01-16 23:08:36 +000010806 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000010807}
10808
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010809static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010810vec_all_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010811{
David Blaikie3302f2b2013-01-16 23:08:36 +000010812 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010813}
10814
10815static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010816vec_all_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010817{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010818 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010819 (vector unsigned int)__b,
10820 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010821}
10822
10823static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010824vec_all_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010825{
David Blaikie3302f2b2013-01-16 23:08:36 +000010826 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010827}
10828
10829static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010830vec_all_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010831{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010832 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000010833 (vector unsigned int)__b,
10834 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010835}
10836
10837static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010838vec_all_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010839{
David Blaikie3302f2b2013-01-16 23:08:36 +000010840 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010841}
10842
10843/* vec_all_gt */
10844
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010845static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010846vec_all_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010847{
David Blaikie3302f2b2013-01-16 23:08:36 +000010848 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010849}
10850
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010851static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010852vec_all_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010853{
David Blaikie3302f2b2013-01-16 23:08:36 +000010854 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010855}
10856
10857static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010858vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010859{
David Blaikie3302f2b2013-01-16 23:08:36 +000010860 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010861}
10862
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010863static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010864vec_all_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010865{
David Blaikie3302f2b2013-01-16 23:08:36 +000010866 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010867}
10868
10869static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010870vec_all_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010871{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010872 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010873 (vector unsigned char)__a,
10874 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010875}
10876
10877static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010878vec_all_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010879{
David Blaikie3302f2b2013-01-16 23:08:36 +000010880 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010881}
10882
10883static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010884vec_all_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010885{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010886 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010887 (vector unsigned char)__a,
10888 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010889}
10890
10891static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010892vec_all_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010893{
David Blaikie3302f2b2013-01-16 23:08:36 +000010894 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010895}
10896
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010897static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010898vec_all_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010899{
David Blaikie3302f2b2013-01-16 23:08:36 +000010900 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010901}
10902
10903static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010904vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010905{
David Blaikie3302f2b2013-01-16 23:08:36 +000010906 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010907}
10908
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010909static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010910vec_all_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010911{
David Blaikie3302f2b2013-01-16 23:08:36 +000010912 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010913}
10914
10915static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010916vec_all_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010917{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010918 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010919 (vector unsigned short)__a,
10920 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010921}
10922
10923static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010924vec_all_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010925{
David Blaikie3302f2b2013-01-16 23:08:36 +000010926 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010927}
10928
10929static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010930vec_all_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010931{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010932 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010933 (vector unsigned short)__a,
10934 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010935}
10936
10937static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010938vec_all_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010939{
David Blaikie3302f2b2013-01-16 23:08:36 +000010940 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010941}
10942
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010943static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010944vec_all_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010945{
David Blaikie3302f2b2013-01-16 23:08:36 +000010946 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010947}
10948
10949static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010950vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010951{
David Blaikie3302f2b2013-01-16 23:08:36 +000010952 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010953}
10954
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010955static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010956vec_all_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010957{
David Blaikie3302f2b2013-01-16 23:08:36 +000010958 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010959}
10960
10961static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010962vec_all_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010963{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010964 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010965 (vector unsigned int)__a,
10966 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010967}
10968
10969static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010970vec_all_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010971{
David Blaikie3302f2b2013-01-16 23:08:36 +000010972 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010973}
10974
10975static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010976vec_all_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010977{
Anton Yartsev79d6af32010-09-18 00:39:16 +000010978 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000010979 (vector unsigned int)__a,
10980 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000010981}
10982
10983static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000010984vec_all_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010985{
David Blaikie3302f2b2013-01-16 23:08:36 +000010986 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010987}
10988
10989/* vec_all_in */
10990
10991static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000010992vec_all_in(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000010993{
David Blaikie3302f2b2013-01-16 23:08:36 +000010994 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000010995}
10996
10997/* vec_all_le */
10998
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000010999static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011000vec_all_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011001{
David Blaikie3302f2b2013-01-16 23:08:36 +000011002 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011003}
11004
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011005static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011006vec_all_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011007{
David Blaikie3302f2b2013-01-16 23:08:36 +000011008 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011009}
11010
11011static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011012vec_all_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011013{
David Blaikie3302f2b2013-01-16 23:08:36 +000011014 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011015}
11016
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011017static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011018vec_all_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011019{
David Blaikie3302f2b2013-01-16 23:08:36 +000011020 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (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_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011025{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011026 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011027 (vector unsigned char)__a,
11028 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011029}
11030
11031static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011032vec_all_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011033{
David Blaikie3302f2b2013-01-16 23:08:36 +000011034 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011035}
11036
11037static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011038vec_all_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011039{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011040 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011041 (vector unsigned char)__a,
11042 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011043}
11044
11045static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011046vec_all_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011047{
David Blaikie3302f2b2013-01-16 23:08:36 +000011048 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011049}
11050
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011051static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011052vec_all_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011053{
David Blaikie3302f2b2013-01-16 23:08:36 +000011054 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011055}
11056
11057static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011058vec_all_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011059{
David Blaikie3302f2b2013-01-16 23:08:36 +000011060 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011061}
11062
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011063static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011064vec_all_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011065{
David Blaikie3302f2b2013-01-16 23:08:36 +000011066 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (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_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011071{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011072 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011073 (vector unsigned short)__a,
11074 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011075}
11076
11077static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011078vec_all_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011079{
David Blaikie3302f2b2013-01-16 23:08:36 +000011080 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011081}
11082
11083static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011084vec_all_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011085{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011086 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011087 (vector unsigned short)__a,
11088 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011089}
11090
11091static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011092vec_all_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011093{
David Blaikie3302f2b2013-01-16 23:08:36 +000011094 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011095}
11096
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011097static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011098vec_all_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011099{
David Blaikie3302f2b2013-01-16 23:08:36 +000011100 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011101}
11102
11103static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011104vec_all_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011105{
David Blaikie3302f2b2013-01-16 23:08:36 +000011106 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011107}
11108
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011109static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011110vec_all_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011111{
David Blaikie3302f2b2013-01-16 23:08:36 +000011112 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (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_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011117{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011118 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011119 (vector unsigned int)__a,
11120 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011121}
11122
11123static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011124vec_all_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011125{
David Blaikie3302f2b2013-01-16 23:08:36 +000011126 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011127}
11128
11129static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011130vec_all_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011131{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011132 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
David Blaikie3302f2b2013-01-16 23:08:36 +000011133 (vector unsigned int)__a,
11134 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011135}
11136
11137static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011138vec_all_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011139{
David Blaikie3302f2b2013-01-16 23:08:36 +000011140 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011141}
11142
11143/* vec_all_lt */
11144
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011145static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011146vec_all_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011147{
David Blaikie3302f2b2013-01-16 23:08:36 +000011148 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011149}
11150
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011151static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011152vec_all_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011153{
David Blaikie3302f2b2013-01-16 23:08:36 +000011154 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011155}
11156
11157static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011158vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011159{
David Blaikie3302f2b2013-01-16 23:08:36 +000011160 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011161}
11162
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011163static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011164vec_all_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011165{
David Blaikie3302f2b2013-01-16 23:08:36 +000011166 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011167}
11168
11169static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011170vec_all_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011171{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011172 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011173 (vector unsigned char)__b,
11174 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011175}
11176
11177static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011178vec_all_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011179{
David Blaikie3302f2b2013-01-16 23:08:36 +000011180 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011181}
11182
11183static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011184vec_all_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011185{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011186 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011187 (vector unsigned char)__b,
11188 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011189}
11190
11191static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011192vec_all_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011193{
David Blaikie3302f2b2013-01-16 23:08:36 +000011194 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011195}
11196
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011197static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011198vec_all_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011199{
David Blaikie3302f2b2013-01-16 23:08:36 +000011200 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011201}
11202
11203static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011204vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011205{
David Blaikie3302f2b2013-01-16 23:08:36 +000011206 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011207}
11208
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011209static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011210vec_all_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011211{
David Blaikie3302f2b2013-01-16 23:08:36 +000011212 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011213}
11214
11215static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011216vec_all_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011217{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011218 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011219 (vector unsigned short)__b,
11220 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011221}
11222
11223static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011224vec_all_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011225{
David Blaikie3302f2b2013-01-16 23:08:36 +000011226 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011227}
11228
11229static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011230vec_all_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011231{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011232 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011233 (vector unsigned short)__b,
11234 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011235}
11236
11237static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011238vec_all_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011239{
David Blaikie3302f2b2013-01-16 23:08:36 +000011240 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011241}
11242
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011243static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011244vec_all_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011245{
David Blaikie3302f2b2013-01-16 23:08:36 +000011246 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011247}
11248
11249static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011250vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011251{
David Blaikie3302f2b2013-01-16 23:08:36 +000011252 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011253}
11254
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011255static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011256vec_all_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011257{
David Blaikie3302f2b2013-01-16 23:08:36 +000011258 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011259}
11260
11261static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011262vec_all_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011263{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011264 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011265 (vector unsigned int)__b,
11266 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011267}
11268
11269static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011270vec_all_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011271{
David Blaikie3302f2b2013-01-16 23:08:36 +000011272 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011273}
11274
11275static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011276vec_all_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011277{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011278 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
David Blaikie3302f2b2013-01-16 23:08:36 +000011279 (vector unsigned int)__b,
11280 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011281}
11282
11283static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011284vec_all_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011285{
David Blaikie3302f2b2013-01-16 23:08:36 +000011286 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011287}
11288
11289/* vec_all_nan */
11290
11291static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011292vec_all_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011293{
David Blaikie3302f2b2013-01-16 23:08:36 +000011294 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011295}
11296
11297/* vec_all_ne */
11298
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011299static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011300vec_all_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011301{
David Blaikie3302f2b2013-01-16 23:08:36 +000011302 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011303}
11304
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011305static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011306vec_all_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011307{
David Blaikie3302f2b2013-01-16 23:08:36 +000011308 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011309}
11310
11311static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011312vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011313{
David Blaikie3302f2b2013-01-16 23:08:36 +000011314 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011315}
11316
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011317static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011318vec_all_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011319{
David Blaikie3302f2b2013-01-16 23:08:36 +000011320 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011321}
11322
11323static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011324vec_all_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011325{
David Blaikie3302f2b2013-01-16 23:08:36 +000011326 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011327}
11328
11329static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011330vec_all_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011331{
David Blaikie3302f2b2013-01-16 23:08:36 +000011332 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011333}
11334
11335static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011336vec_all_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011337{
David Blaikie3302f2b2013-01-16 23:08:36 +000011338 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011339}
11340
11341static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011342vec_all_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011343{
David Blaikie3302f2b2013-01-16 23:08:36 +000011344 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011345}
11346
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011347static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011348vec_all_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011349{
David Blaikie3302f2b2013-01-16 23:08:36 +000011350 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011351}
11352
11353static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011354vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011355{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011356 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011357 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011358}
11359
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011360static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011361vec_all_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011362{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011363 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011364 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011365}
11366
11367static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011368vec_all_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011369{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011370 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011371 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011372}
11373
11374static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011375vec_all_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011376{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011377 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011378 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011379}
11380
11381static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011382vec_all_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011383{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011384 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011385 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011386}
11387
11388static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011389vec_all_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011390{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011391 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011392 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011393}
11394
11395static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011396vec_all_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011397{
David Blaikie3302f2b2013-01-16 23:08:36 +000011398 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011399}
11400
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011401static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011402vec_all_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011403{
David Blaikie3302f2b2013-01-16 23:08:36 +000011404 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011405}
11406
11407static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011408vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011409{
David Blaikie3302f2b2013-01-16 23:08:36 +000011410 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011411}
11412
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011413static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011414vec_all_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011415{
David Blaikie3302f2b2013-01-16 23:08:36 +000011416 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011417}
11418
11419static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011420vec_all_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011421{
David Blaikie3302f2b2013-01-16 23:08:36 +000011422 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011423}
11424
11425static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011426vec_all_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011427{
David Blaikie3302f2b2013-01-16 23:08:36 +000011428 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011429}
11430
11431static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011432vec_all_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011433{
David Blaikie3302f2b2013-01-16 23:08:36 +000011434 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011435}
11436
11437static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011438vec_all_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011439{
David Blaikie3302f2b2013-01-16 23:08:36 +000011440 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011441}
11442
11443/* vec_all_nge */
11444
11445static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011446vec_all_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011447{
David Blaikie3302f2b2013-01-16 23:08:36 +000011448 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011449}
11450
11451/* vec_all_ngt */
11452
11453static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011454vec_all_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011455{
David Blaikie3302f2b2013-01-16 23:08:36 +000011456 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011457}
11458
11459/* vec_all_nle */
11460
11461static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011462vec_all_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011463{
David Blaikie3302f2b2013-01-16 23:08:36 +000011464 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011465}
11466
11467/* vec_all_nlt */
11468
11469static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011470vec_all_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011471{
David Blaikie3302f2b2013-01-16 23:08:36 +000011472 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011473}
11474
11475/* vec_all_numeric */
11476
11477static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000011478vec_all_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000011479{
David Blaikie3302f2b2013-01-16 23:08:36 +000011480 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011481}
11482
11483/* vec_any_eq */
11484
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011485static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011486vec_any_eq(vector signed char __a, vector signed char __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_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__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_any_eq(vector signed char __a, vector bool char __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_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011497}
11498
11499static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011500vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011501{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011502 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011503 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011504}
11505
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011506static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011507vec_any_eq(vector unsigned char __a, vector bool char __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_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011511}
11512
11513static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011514vec_any_eq(vector bool char __a, vector signed char __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_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011518}
11519
11520static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011521vec_any_eq(vector bool char __a, vector unsigned char __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_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011525}
11526
11527static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011528vec_any_eq(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011529{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011530 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011531 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011532}
11533
11534static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011535vec_any_eq(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011536{
David Blaikie3302f2b2013-01-16 23:08:36 +000011537 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011538}
11539
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011540static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011541vec_any_eq(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011542{
David Blaikie3302f2b2013-01-16 23:08:36 +000011543 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011544}
11545
11546static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011547vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011548{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011549 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011550 (vector short)__a,
11551 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011552}
11553
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011554static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011555vec_any_eq(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011556{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011557 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011558 (vector short)__a,
11559 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011560}
11561
11562static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011563vec_any_eq(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011564{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011565 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011566 (vector short)__a,
11567 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011568}
11569
11570static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011571vec_any_eq(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011572{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011573 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011574 (vector short)__a,
11575 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011576}
11577
11578static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011579vec_any_eq(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011580{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011581 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011582 (vector short)__a,
11583 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011584}
11585
11586static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011587vec_any_eq(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011588{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011589 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011590 (vector short)__a,
11591 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011592}
11593
11594static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011595vec_any_eq(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011596{
David Blaikie3302f2b2013-01-16 23:08:36 +000011597 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011598}
11599
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011600static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011601vec_any_eq(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011602{
David Blaikie3302f2b2013-01-16 23:08:36 +000011603 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011604}
11605
11606static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011607vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011608{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011609 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011610 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011611}
11612
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011613static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011614vec_any_eq(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011615{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011616 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011617 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011618}
11619
11620static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011621vec_any_eq(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011622{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011623 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011624 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011625}
11626
11627static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011628vec_any_eq(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011629{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011630 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011631 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011632}
11633
11634static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011635vec_any_eq(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011636{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011637 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011638 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011639}
11640
11641static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011642vec_any_eq(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011643{
David Blaikie3302f2b2013-01-16 23:08:36 +000011644 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011645}
11646
11647/* vec_any_ge */
11648
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011649static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011650vec_any_ge(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011651{
David Blaikie3302f2b2013-01-16 23:08:36 +000011652 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011653}
11654
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011655static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011656vec_any_ge(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011657{
David Blaikie3302f2b2013-01-16 23:08:36 +000011658 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011659}
11660
11661static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011662vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011663{
David Blaikie3302f2b2013-01-16 23:08:36 +000011664 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011665}
11666
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011667static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011668vec_any_ge(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011669{
David Blaikie3302f2b2013-01-16 23:08:36 +000011670 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011671}
11672
11673static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011674vec_any_ge(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011675{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011676 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011677 (vector unsigned char)__b,
11678 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011679}
11680
11681static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011682vec_any_ge(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011683{
David Blaikie3302f2b2013-01-16 23:08:36 +000011684 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011685}
11686
11687static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011688vec_any_ge(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011689{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011690 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011691 (vector unsigned char)__b,
11692 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011693}
11694
11695static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011696vec_any_ge(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011697{
David Blaikie3302f2b2013-01-16 23:08:36 +000011698 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011699}
11700
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011701static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011702vec_any_ge(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011703{
David Blaikie3302f2b2013-01-16 23:08:36 +000011704 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011705}
11706
11707static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011708vec_any_ge(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011709{
David Blaikie3302f2b2013-01-16 23:08:36 +000011710 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011711}
11712
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011713static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011714vec_any_ge(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011715{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011716 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011717 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011718}
11719
11720static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011721vec_any_ge(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011722{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011723 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011724 (vector unsigned short)__b,
11725 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011726}
11727
11728static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011729vec_any_ge(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011730{
11731 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011732 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011733}
11734
11735static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011736vec_any_ge(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011737{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011738 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011739 (vector unsigned short)__b,
11740 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011741}
11742
11743static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011744vec_any_ge(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011745{
David Blaikie3302f2b2013-01-16 23:08:36 +000011746 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011747}
11748
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011749static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011750vec_any_ge(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011751{
David Blaikie3302f2b2013-01-16 23:08:36 +000011752 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011753}
11754
11755static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011756vec_any_ge(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011757{
David Blaikie3302f2b2013-01-16 23:08:36 +000011758 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000011759}
11760
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011761static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011762vec_any_ge(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011763{
David Blaikie3302f2b2013-01-16 23:08:36 +000011764 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011765}
11766
11767static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011768vec_any_ge(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011769{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011770 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011771 (vector unsigned int)__b,
11772 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011773}
11774
11775static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011776vec_any_ge(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011777{
David Blaikie3302f2b2013-01-16 23:08:36 +000011778 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011779}
11780
11781static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011782vec_any_ge(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011783{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011784 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011785 (vector unsigned int)__b,
11786 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011787}
11788
11789static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011790vec_any_ge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011791{
David Blaikie3302f2b2013-01-16 23:08:36 +000011792 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011793}
11794
11795/* vec_any_gt */
11796
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011797static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011798vec_any_gt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011799{
David Blaikie3302f2b2013-01-16 23:08:36 +000011800 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011801}
11802
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011803static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011804vec_any_gt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011805{
David Blaikie3302f2b2013-01-16 23:08:36 +000011806 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011807}
11808
11809static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011810vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011811{
David Blaikie3302f2b2013-01-16 23:08:36 +000011812 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011813}
11814
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011815static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011816vec_any_gt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011817{
11818 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011819 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011820}
11821
11822static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011823vec_any_gt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011824{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011825 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011826 (vector unsigned char)__a,
11827 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011828}
11829
11830static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011831vec_any_gt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011832{
11833 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011834 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011835}
11836
11837static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011838vec_any_gt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011839{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011840 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011841 (vector unsigned char)__a,
11842 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011843}
11844
11845static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011846vec_any_gt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011847{
David Blaikie3302f2b2013-01-16 23:08:36 +000011848 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011849}
11850
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011851static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011852vec_any_gt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011853{
David Blaikie3302f2b2013-01-16 23:08:36 +000011854 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011855}
11856
11857static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011858vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011859{
David Blaikie3302f2b2013-01-16 23:08:36 +000011860 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011861}
11862
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011863static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011864vec_any_gt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011865{
11866 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011867 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011868}
11869
11870static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011871vec_any_gt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011872{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011873 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011874 (vector unsigned short)__a,
11875 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011876}
11877
11878static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011879vec_any_gt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011880{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011881 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011882 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011883}
11884
11885static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011886vec_any_gt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011887{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011888 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011889 (vector unsigned short)__a,
11890 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011891}
11892
11893static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011894vec_any_gt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011895{
David Blaikie3302f2b2013-01-16 23:08:36 +000011896 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011897}
11898
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011899static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011900vec_any_gt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011901{
David Blaikie3302f2b2013-01-16 23:08:36 +000011902 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011903}
11904
11905static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011906vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011907{
David Blaikie3302f2b2013-01-16 23:08:36 +000011908 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011909}
11910
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011911static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011912vec_any_gt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011913{
David Blaikie3302f2b2013-01-16 23:08:36 +000011914 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011915}
11916
11917static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011918vec_any_gt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011919{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011920 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011921 (vector unsigned int)__a,
11922 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011923}
11924
11925static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011926vec_any_gt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011927{
David Blaikie3302f2b2013-01-16 23:08:36 +000011928 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011929}
11930
11931static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011932vec_any_gt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011933{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011934 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011935 (vector unsigned int)__a,
11936 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011937}
11938
11939static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011940vec_any_gt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011941{
David Blaikie3302f2b2013-01-16 23:08:36 +000011942 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011943}
11944
11945/* vec_any_le */
11946
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011947static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011948vec_any_le(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011949{
David Blaikie3302f2b2013-01-16 23:08:36 +000011950 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011951}
11952
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011953static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011954vec_any_le(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011955{
David Blaikie3302f2b2013-01-16 23:08:36 +000011956 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011957}
11958
11959static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011960vec_any_le(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011961{
David Blaikie3302f2b2013-01-16 23:08:36 +000011962 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011963}
11964
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000011965static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011966vec_any_le(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011967{
11968 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011969 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011970}
11971
11972static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011973vec_any_le(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011974{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011975 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011976 (vector unsigned char)__a,
11977 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011978}
11979
11980static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011981vec_any_le(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011982{
11983 return
David Blaikie3302f2b2013-01-16 23:08:36 +000011984 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011985}
11986
11987static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011988vec_any_le(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011989{
Anton Yartsev79d6af32010-09-18 00:39:16 +000011990 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000011991 (vector unsigned char)__a,
11992 (vector unsigned char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000011993}
11994
11995static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000011996vec_any_le(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000011997{
David Blaikie3302f2b2013-01-16 23:08:36 +000011998 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000011999}
12000
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012001static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012002vec_any_le(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012003{
David Blaikie3302f2b2013-01-16 23:08:36 +000012004 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012005}
12006
12007static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012008vec_any_le(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012009{
David Blaikie3302f2b2013-01-16 23:08:36 +000012010 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012011}
12012
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012013static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012014vec_any_le(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012015{
12016 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012017 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012018}
12019
12020static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012021vec_any_le(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012022{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012023 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012024 (vector unsigned short)__a,
12025 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012026}
12027
12028static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012029vec_any_le(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012030{
12031 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012032 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012033}
12034
12035static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012036vec_any_le(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012037{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012038 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012039 (vector unsigned short)__a,
12040 (vector unsigned short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012041}
12042
12043static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012044vec_any_le(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012045{
David Blaikie3302f2b2013-01-16 23:08:36 +000012046 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012047}
12048
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012049static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012050vec_any_le(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012051{
David Blaikie3302f2b2013-01-16 23:08:36 +000012052 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012053}
12054
12055static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012056vec_any_le(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012057{
David Blaikie3302f2b2013-01-16 23:08:36 +000012058 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012059}
12060
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012061static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012062vec_any_le(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012063{
David Blaikie3302f2b2013-01-16 23:08:36 +000012064 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012065}
12066
12067static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012068vec_any_le(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012069{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012070 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012071 (vector unsigned int)__a,
12072 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012073}
12074
12075static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012076vec_any_le(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012077{
David Blaikie3302f2b2013-01-16 23:08:36 +000012078 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012079}
12080
12081static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012082vec_any_le(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012083{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012084 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012085 (vector unsigned int)__a,
12086 (vector unsigned int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012087}
12088
12089static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012090vec_any_le(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012091{
David Blaikie3302f2b2013-01-16 23:08:36 +000012092 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012093}
12094
12095/* vec_any_lt */
12096
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012097static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012098vec_any_lt(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012099{
David Blaikie3302f2b2013-01-16 23:08:36 +000012100 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012101}
12102
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012103static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012104vec_any_lt(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012105{
David Blaikie3302f2b2013-01-16 23:08:36 +000012106 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012107}
12108
12109static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012110vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012111{
David Blaikie3302f2b2013-01-16 23:08:36 +000012112 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012113}
12114
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012115static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012116vec_any_lt(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012117{
12118 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012119 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012120}
12121
12122static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012123vec_any_lt(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012124{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012125 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012126 (vector unsigned char)__b,
12127 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012128}
12129
12130static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012131vec_any_lt(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012132{
12133 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012134 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012135}
12136
12137static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012138vec_any_lt(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012139{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012140 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012141 (vector unsigned char)__b,
12142 (vector unsigned char)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012143}
12144
12145static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012146vec_any_lt(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012147{
David Blaikie3302f2b2013-01-16 23:08:36 +000012148 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012149}
12150
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012151static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012152vec_any_lt(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012153{
David Blaikie3302f2b2013-01-16 23:08:36 +000012154 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012155}
12156
12157static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012158vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012159{
David Blaikie3302f2b2013-01-16 23:08:36 +000012160 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012161}
12162
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012163static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012164vec_any_lt(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012165{
12166 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012167 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012168}
12169
12170static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012171vec_any_lt(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012172{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012173 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012174 (vector unsigned short)__b,
12175 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012176}
12177
12178static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012179vec_any_lt(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012180{
12181 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012182 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012183}
12184
12185static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012186vec_any_lt(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012187{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012188 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012189 (vector unsigned short)__b,
12190 (vector unsigned short)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012191}
12192
12193static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012194vec_any_lt(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012195{
David Blaikie3302f2b2013-01-16 23:08:36 +000012196 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012197}
12198
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012199static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012200vec_any_lt(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012201{
David Blaikie3302f2b2013-01-16 23:08:36 +000012202 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012203}
12204
12205static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012206vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012207{
David Blaikie3302f2b2013-01-16 23:08:36 +000012208 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012209}
12210
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012211static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012212vec_any_lt(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012213{
David Blaikie3302f2b2013-01-16 23:08:36 +000012214 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012215}
12216
12217static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012218vec_any_lt(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012219{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012220 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012221 (vector unsigned int)__b,
12222 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012223}
12224
12225static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012226vec_any_lt(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012227{
David Blaikie3302f2b2013-01-16 23:08:36 +000012228 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012229}
12230
12231static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012232vec_any_lt(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012233{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012234 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012235 (vector unsigned int)__b,
12236 (vector unsigned int)__a);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012237}
12238
12239static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012240vec_any_lt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012241{
David Blaikie3302f2b2013-01-16 23:08:36 +000012242 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012243}
12244
12245/* vec_any_nan */
12246
12247static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012248vec_any_nan(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012249{
David Blaikie3302f2b2013-01-16 23:08:36 +000012250 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012251}
12252
12253/* vec_any_ne */
12254
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012255static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012256vec_any_ne(vector signed char __a, vector signed char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012257{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012258 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012259 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012260}
12261
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012262static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012263vec_any_ne(vector signed char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012264{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012265 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012266 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012267}
12268
12269static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012270vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012271{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012272 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012273 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012274}
12275
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012276static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012277vec_any_ne(vector unsigned char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012278{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012279 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012280 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012281}
12282
12283static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012284vec_any_ne(vector bool char __a, vector signed char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012285{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012286 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012287 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012288}
12289
12290static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012291vec_any_ne(vector bool char __a, vector unsigned char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012292{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012293 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012294 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012295}
12296
12297static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012298vec_any_ne(vector bool char __a, vector bool char __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012299{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012300 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012301 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012302}
12303
12304static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012305vec_any_ne(vector short __a, vector short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012306{
David Blaikie3302f2b2013-01-16 23:08:36 +000012307 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012308}
12309
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012310static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012311vec_any_ne(vector short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012312{
David Blaikie3302f2b2013-01-16 23:08:36 +000012313 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012314}
12315
12316static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012317vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012318{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012319 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012320 (vector short)__a,
12321 (vector short)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012322}
12323
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012324static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012325vec_any_ne(vector unsigned short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012326{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012327 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012328 (vector short)__a,
12329 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012330}
12331
12332static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012333vec_any_ne(vector bool short __a, vector short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012334{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012335 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012336 (vector short)__a,
12337 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012338}
12339
12340static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012341vec_any_ne(vector bool short __a, vector unsigned short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012342{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012343 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012344 (vector short)__a,
12345 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012346}
12347
12348static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012349vec_any_ne(vector bool short __a, vector bool short __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012350{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012351 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012352 (vector short)__a,
12353 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012354}
12355
12356static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012357vec_any_ne(vector pixel __a, vector pixel __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012358{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012359 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
David Blaikie3302f2b2013-01-16 23:08:36 +000012360 (vector short)__a,
12361 (vector short)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012362}
12363
12364static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012365vec_any_ne(vector int __a, vector int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012366{
David Blaikie3302f2b2013-01-16 23:08:36 +000012367 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012368}
12369
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012370static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012371vec_any_ne(vector int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012372{
David Blaikie3302f2b2013-01-16 23:08:36 +000012373 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012374}
12375
12376static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012377vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012378{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012379 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012380 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012381}
12382
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012383static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012384vec_any_ne(vector unsigned int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012385{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012386 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012387 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012388}
12389
12390static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012391vec_any_ne(vector bool int __a, vector int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012392{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012393 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012394 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012395}
12396
12397static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012398vec_any_ne(vector bool int __a, vector unsigned int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012399{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012400 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012401 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012402}
12403
12404static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012405vec_any_ne(vector bool int __a, vector bool int __b)
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012406{
Anton Yartsev79d6af32010-09-18 00:39:16 +000012407 return
David Blaikie3302f2b2013-01-16 23:08:36 +000012408 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Anton Yartsev583a1cf2010-08-19 11:57:49 +000012409}
12410
12411static int __ATTRS_o_ai
David Blaikie3302f2b2013-01-16 23:08:36 +000012412vec_any_ne(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012413{
David Blaikie3302f2b2013-01-16 23:08:36 +000012414 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012415}
12416
12417/* vec_any_nge */
12418
12419static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012420vec_any_nge(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012421{
David Blaikie3302f2b2013-01-16 23:08:36 +000012422 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012423}
12424
12425/* vec_any_ngt */
12426
12427static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012428vec_any_ngt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012429{
David Blaikie3302f2b2013-01-16 23:08:36 +000012430 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012431}
12432
12433/* vec_any_nle */
12434
12435static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012436vec_any_nle(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012437{
David Blaikie3302f2b2013-01-16 23:08:36 +000012438 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012439}
12440
12441/* vec_any_nlt */
12442
12443static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012444vec_any_nlt(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012445{
David Blaikie3302f2b2013-01-16 23:08:36 +000012446 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012447}
12448
12449/* vec_any_numeric */
12450
12451static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012452vec_any_numeric(vector float __a)
Chris Lattnerdad40622010-04-14 03:54:58 +000012453{
David Blaikie3302f2b2013-01-16 23:08:36 +000012454 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Chris Lattnerdad40622010-04-14 03:54:58 +000012455}
12456
12457/* vec_any_out */
12458
12459static int __attribute__((__always_inline__))
David Blaikie3302f2b2013-01-16 23:08:36 +000012460vec_any_out(vector float __a, vector float __b)
Chris Lattnerdad40622010-04-14 03:54:58 +000012461{
David Blaikie3302f2b2013-01-16 23:08:36 +000012462 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Chris Lattnerdad40622010-04-14 03:54:58 +000012463}
12464
Anton Korobeynikovcc50b7d2010-06-19 09:47:18 +000012465#undef __ATTRS_o_ai
Chris Lattnerdad40622010-04-14 03:54:58 +000012466
12467#endif /* __ALTIVEC_H */