blob: 252bf36c925bac513bbacbe47fc3d0f96d4d46d1 [file] [log] [blame]
Ying Wangb335bb02011-11-29 10:23:55 -08001/*===---- 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
37#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
38
39static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070040vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080041
42static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070043vec_perm(vector unsigned char __a,
44 vector unsigned char __b,
45 vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080046
47static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070048vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080049
50static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070051vec_perm(vector short __a, vector short __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080052
53static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070054vec_perm(vector unsigned short __a,
55 vector unsigned short __b,
56 vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080057
58static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070059vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080060
61static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070062vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080063
64static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070065vec_perm(vector int __a, vector int __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080066
67static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070068vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080069
70static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070071vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080072
73static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070074vec_perm(vector float __a, vector float __b, vector unsigned char __c);
Ying Wangb335bb02011-11-29 10:23:55 -080075
Stephen Hines990d2fc2014-07-23 10:40:48 -070076static vector unsigned char __ATTRS_o_ai
77vec_xor(vector unsigned char __a, vector unsigned char __b);
78
Ying Wangb335bb02011-11-29 10:23:55 -080079/* vec_abs */
80
81#define __builtin_altivec_abs_v16qi vec_abs
82#define __builtin_altivec_abs_v8hi vec_abs
83#define __builtin_altivec_abs_v4si vec_abs
84
85static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070086vec_abs(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -080087{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070088 return __builtin_altivec_vmaxsb(__a, -__a);
Ying Wangb335bb02011-11-29 10:23:55 -080089}
90
91static vector signed short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070092vec_abs(vector signed short __a)
Ying Wangb335bb02011-11-29 10:23:55 -080093{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070094 return __builtin_altivec_vmaxsh(__a, -__a);
Ying Wangb335bb02011-11-29 10:23:55 -080095}
96
97static vector signed int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070098vec_abs(vector signed int __a)
Ying Wangb335bb02011-11-29 10:23:55 -080099{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700100 return __builtin_altivec_vmaxsw(__a, -__a);
Ying Wangb335bb02011-11-29 10:23:55 -0800101}
102
103static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700104vec_abs(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -0800105{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700106 vector unsigned int __res = (vector unsigned int)__a
Ying Wangb335bb02011-11-29 10:23:55 -0800107 & (vector unsigned int)(0x7FFFFFFF);
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700108 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800109}
110
111/* vec_abss */
112
113#define __builtin_altivec_abss_v16qi vec_abss
114#define __builtin_altivec_abss_v8hi vec_abss
115#define __builtin_altivec_abss_v4si vec_abss
116
117static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700118vec_abss(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -0800119{
120 return __builtin_altivec_vmaxsb
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700121 (__a, __builtin_altivec_vsubsbs((vector signed char)(0), __a));
Ying Wangb335bb02011-11-29 10:23:55 -0800122}
123
124static vector signed short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700125vec_abss(vector signed short __a)
Ying Wangb335bb02011-11-29 10:23:55 -0800126{
127 return __builtin_altivec_vmaxsh
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700128 (__a, __builtin_altivec_vsubshs((vector signed short)(0), __a));
Ying Wangb335bb02011-11-29 10:23:55 -0800129}
130
131static vector signed int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700132vec_abss(vector signed int __a)
Ying Wangb335bb02011-11-29 10:23:55 -0800133{
134 return __builtin_altivec_vmaxsw
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700135 (__a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
Ying Wangb335bb02011-11-29 10:23:55 -0800136}
137
138/* vec_add */
139
140static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700141vec_add(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800142{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700143 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800144}
145
146static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700147vec_add(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800148{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700149 return (vector signed char)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800150}
151
152static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700153vec_add(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800154{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700155 return __a + (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800156}
157
158static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700159vec_add(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800160{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700161 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800162}
163
164static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700165vec_add(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800166{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700167 return (vector unsigned char)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800168}
169
170static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700171vec_add(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800172{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700173 return __a + (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800174}
175
176static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700177vec_add(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800178{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700179 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800180}
181
182static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700183vec_add(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800184{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700185 return (vector short)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800186}
187
188static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700189vec_add(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800190{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700191 return __a + (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800192}
193
194static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700195vec_add(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800196{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700197 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800198}
199
200static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700201vec_add(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800202{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700203 return (vector unsigned short)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800204}
205
206static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700207vec_add(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800208{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700209 return __a + (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800210}
211
212static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700213vec_add(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800214{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700215 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800216}
217
218static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700219vec_add(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800220{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700221 return (vector int)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800222}
223
224static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700225vec_add(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800226{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700227 return __a + (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800228}
229
230static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700231vec_add(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800232{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700233 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800234}
235
236static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700237vec_add(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800238{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700239 return (vector unsigned int)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800240}
241
242static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700243vec_add(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800244{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700245 return __a + (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800246}
247
248static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700249vec_add(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800250{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700251 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800252}
253
254/* vec_vaddubm */
255
256#define __builtin_altivec_vaddubm vec_vaddubm
257
258static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700259vec_vaddubm(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800260{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700261 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800262}
263
264static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700265vec_vaddubm(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800266{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700267 return (vector signed char)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800268}
269
270static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700271vec_vaddubm(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800272{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700273 return __a + (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800274}
275
276static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700277vec_vaddubm(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800278{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700279 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800280}
281
282static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700283vec_vaddubm(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800284{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700285 return (vector unsigned char)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800286}
287
288static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700289vec_vaddubm(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800290{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700291 return __a + (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800292}
293
294/* vec_vadduhm */
295
296#define __builtin_altivec_vadduhm vec_vadduhm
297
298static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700299vec_vadduhm(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800300{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700301 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800302}
303
304static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700305vec_vadduhm(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800306{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700307 return (vector short)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800308}
309
310static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700311vec_vadduhm(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800312{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700313 return __a + (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800314}
315
316static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700317vec_vadduhm(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800318{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700319 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800320}
321
322static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700323vec_vadduhm(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800324{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700325 return (vector unsigned short)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800326}
327
328static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700329vec_vadduhm(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800330{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700331 return __a + (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800332}
333
334/* vec_vadduwm */
335
336#define __builtin_altivec_vadduwm vec_vadduwm
337
338static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700339vec_vadduwm(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800340{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700341 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800342}
343
344static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700345vec_vadduwm(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800346{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700347 return (vector int)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800348}
349
350static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700351vec_vadduwm(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800352{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700353 return __a + (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800354}
355
356static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700357vec_vadduwm(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800358{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700359 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800360}
361
362static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700363vec_vadduwm(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800364{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700365 return (vector unsigned int)__a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800366}
367
368static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700369vec_vadduwm(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800370{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700371 return __a + (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800372}
373
374/* vec_vaddfp */
375
376#define __builtin_altivec_vaddfp vec_vaddfp
377
378static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700379vec_vaddfp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800380{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700381 return __a + __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800382}
383
384/* vec_addc */
385
386static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700387vec_addc(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800388{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700389 return __builtin_altivec_vaddcuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800390}
391
392/* vec_vaddcuw */
393
394static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700395vec_vaddcuw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800396{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700397 return __builtin_altivec_vaddcuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800398}
399
400/* vec_adds */
401
402static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700403vec_adds(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800404{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700405 return __builtin_altivec_vaddsbs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800406}
407
408static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700409vec_adds(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800410{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700411 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800412}
413
414static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700415vec_adds(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800416{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700417 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800418}
419
420static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700421vec_adds(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800422{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700423 return __builtin_altivec_vaddubs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800424}
425
426static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700427vec_adds(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800428{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700429 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800430}
431
432static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700433vec_adds(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800434{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700435 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800436}
437
438static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700439vec_adds(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800440{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700441 return __builtin_altivec_vaddshs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800442}
443
444static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700445vec_adds(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800446{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700447 return __builtin_altivec_vaddshs((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800448}
449
450static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700451vec_adds(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800452{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700453 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800454}
455
456static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700457vec_adds(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800458{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700459 return __builtin_altivec_vadduhs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800460}
461
462static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700463vec_adds(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800464{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700465 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800466}
467
468static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700469vec_adds(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800470{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700471 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800472}
473
474static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700475vec_adds(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800476{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700477 return __builtin_altivec_vaddsws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800478}
479
480static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700481vec_adds(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800482{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700483 return __builtin_altivec_vaddsws((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800484}
485
486static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700487vec_adds(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800488{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700489 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800490}
491
492static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700493vec_adds(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800494{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700495 return __builtin_altivec_vadduws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800496}
497
498static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700499vec_adds(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800500{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700501 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800502}
503
504static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700505vec_adds(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800506{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700507 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800508}
509
510/* vec_vaddsbs */
511
512static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700513vec_vaddsbs(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800514{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700515 return __builtin_altivec_vaddsbs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800516}
517
518static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700519vec_vaddsbs(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800520{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700521 return __builtin_altivec_vaddsbs((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800522}
523
524static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700525vec_vaddsbs(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800526{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700527 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800528}
529
530/* vec_vaddubs */
531
532static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700533vec_vaddubs(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800534{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700535 return __builtin_altivec_vaddubs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800536}
537
538static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700539vec_vaddubs(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800540{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700541 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800542}
543
544static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700545vec_vaddubs(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800546{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700547 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800548}
549
550/* vec_vaddshs */
551
552static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700553vec_vaddshs(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800554{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700555 return __builtin_altivec_vaddshs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800556}
557
558static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700559vec_vaddshs(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800560{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700561 return __builtin_altivec_vaddshs((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800562}
563
564static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700565vec_vaddshs(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800566{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700567 return __builtin_altivec_vaddshs(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800568}
569
570/* vec_vadduhs */
571
572static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700573vec_vadduhs(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800574{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700575 return __builtin_altivec_vadduhs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800576}
577
578static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700579vec_vadduhs(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800580{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700581 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800582}
583
584static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700585vec_vadduhs(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800586{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700587 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800588}
589
590/* vec_vaddsws */
591
592static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700593vec_vaddsws(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800594{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700595 return __builtin_altivec_vaddsws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800596}
597
598static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700599vec_vaddsws(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800600{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700601 return __builtin_altivec_vaddsws((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800602}
603
604static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700605vec_vaddsws(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800606{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700607 return __builtin_altivec_vaddsws(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800608}
609
610/* vec_vadduws */
611
612static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700613vec_vadduws(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800614{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700615 return __builtin_altivec_vadduws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800616}
617
618static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700619vec_vadduws(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800620{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700621 return __builtin_altivec_vadduws((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -0800622}
623
624static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700625vec_vadduws(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800626{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700627 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -0800628}
629
630/* vec_and */
631
632#define __builtin_altivec_vand vec_and
633
634static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700635vec_and(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800636{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700637 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800638}
639
640static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700641vec_and(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800642{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700643 return (vector signed char)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800644}
645
646static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700647vec_and(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800648{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700649 return __a & (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800650}
651
652static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700653vec_and(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800654{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700655 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800656}
657
658static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700659vec_and(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800660{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700661 return (vector unsigned char)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800662}
663
664static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700665vec_and(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800666{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700667 return __a & (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800668}
669
670static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700671vec_and(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800672{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700673 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800674}
675
676static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700677vec_and(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800678{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700679 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800680}
681
682static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700683vec_and(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800684{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700685 return (vector short)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800686}
687
688static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700689vec_and(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800690{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700691 return __a & (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800692}
693
694static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700695vec_and(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800696{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700697 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800698}
699
700static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700701vec_and(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800702{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700703 return (vector unsigned short)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800704}
705
706static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700707vec_and(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800708{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700709 return __a & (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800710}
711
712static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700713vec_and(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800714{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700715 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800716}
717
718static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700719vec_and(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800720{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700721 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800722}
723
724static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700725vec_and(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800726{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700727 return (vector int)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800728}
729
730static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700731vec_and(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800732{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700733 return __a & (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800734}
735
736static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700737vec_and(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800738{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700739 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800740}
741
742static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700743vec_and(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800744{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700745 return (vector unsigned int)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800746}
747
748static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700749vec_and(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800750{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700751 return __a & (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800752}
753
754static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700755vec_and(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800756{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700757 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800758}
759
760static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700761vec_and(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800762{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700763 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
764 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800765}
766
767static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700768vec_and(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800769{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700770 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
771 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800772}
773
774static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700775vec_and(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800776{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700777 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
778 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800779}
780
781/* vec_vand */
782
783static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700784vec_vand(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800785{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700786 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800787}
788
789static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700790vec_vand(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800791{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700792 return (vector signed char)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800793}
794
795static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700796vec_vand(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800797{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700798 return __a & (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800799}
800
801static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700802vec_vand(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800803{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700804 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800805}
806
807static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700808vec_vand(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800809{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700810 return (vector unsigned char)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800811}
812
813static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700814vec_vand(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800815{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700816 return __a & (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800817}
818
819static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700820vec_vand(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800821{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700822 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800823}
824
825static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700826vec_vand(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800827{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700828 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800829}
830
831static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700832vec_vand(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800833{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700834 return (vector short)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800835}
836
837static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700838vec_vand(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800839{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700840 return __a & (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800841}
842
843static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700844vec_vand(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800845{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700846 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800847}
848
849static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700850vec_vand(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800851{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700852 return (vector unsigned short)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800853}
854
855static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700856vec_vand(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800857{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700858 return __a & (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800859}
860
861static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700862vec_vand(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800863{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700864 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800865}
866
867static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700868vec_vand(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800869{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700870 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800871}
872
873static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700874vec_vand(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800875{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700876 return (vector int)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800877}
878
879static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700880vec_vand(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800881{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700882 return __a & (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800883}
884
885static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700886vec_vand(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800887{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700888 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800889}
890
891static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700892vec_vand(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800893{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700894 return (vector unsigned int)__a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800895}
896
897static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700898vec_vand(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800899{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700900 return __a & (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800901}
902
903static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700904vec_vand(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800905{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700906 return __a & __b;
Ying Wangb335bb02011-11-29 10:23:55 -0800907}
908
909static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700910vec_vand(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800911{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700912 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
913 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800914}
915
916static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700917vec_vand(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800918{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700919 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
920 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800921}
922
923static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700924vec_vand(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800925{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700926 vector unsigned int __res = (vector unsigned int)__a & (vector unsigned int)__b;
927 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -0800928}
929
930/* vec_andc */
931
932#define __builtin_altivec_vandc vec_andc
933
934static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700935vec_andc(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800936{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700937 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800938}
939
940static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700941vec_andc(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800942{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700943 return (vector signed char)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800944}
945
946static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700947vec_andc(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800948{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700949 return __a & ~(vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800950}
951
952static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700953vec_andc(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800954{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700955 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800956}
957
958static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700959vec_andc(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800960{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700961 return (vector unsigned char)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800962}
963
964static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700965vec_andc(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800966{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700967 return __a & ~(vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800968}
969
970static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700971vec_andc(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800972{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700973 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800974}
975
976static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700977vec_andc(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800978{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700979 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800980}
981
982static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700983vec_andc(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800984{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700985 return (vector short)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800986}
987
988static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700989vec_andc(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800990{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700991 return __a & ~(vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800992}
993
994static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700995vec_andc(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -0800996{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -0700997 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -0800998}
999
1000static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001001vec_andc(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001002{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001003 return (vector unsigned short)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001004}
1005
1006static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001007vec_andc(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001008{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001009 return __a & ~(vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001010}
1011
1012static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001013vec_andc(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001014{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001015 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001016}
1017
1018static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001019vec_andc(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001020{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001021 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001022}
1023
1024static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001025vec_andc(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001026{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001027 return (vector int)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001028}
1029
1030static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001031vec_andc(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001032{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001033 return __a & ~(vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001034}
1035
1036static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001037vec_andc(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001038{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001039 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001040}
1041
1042static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001043vec_andc(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001044{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001045 return (vector unsigned int)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001046}
1047
1048static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001049vec_andc(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001050{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001051 return __a & ~(vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001052}
1053
1054static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001055vec_andc(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001056{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001057 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001058}
1059
1060static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001061vec_andc(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001062{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001063 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1064 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08001065}
1066
1067static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001068vec_andc(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001069{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001070 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1071 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08001072}
1073
1074static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001075vec_andc(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001076{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001077 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1078 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08001079}
1080
1081/* vec_vandc */
1082
1083static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001084vec_vandc(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001085{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001086 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001087}
1088
1089static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001090vec_vandc(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001091{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001092 return (vector signed char)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001093}
1094
1095static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001096vec_vandc(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001097{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001098 return __a & ~(vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001099}
1100
1101static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001102vec_vandc(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001103{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001104 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001105}
1106
1107static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001108vec_vandc(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001109{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001110 return (vector unsigned char)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001111}
1112
1113static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001114vec_vandc(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001115{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001116 return __a & ~(vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001117}
1118
1119static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001120vec_vandc(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001121{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001122 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001123}
1124
1125static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001126vec_vandc(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001127{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001128 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001129}
1130
1131static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001132vec_vandc(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001133{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001134 return (vector short)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001135}
1136
1137static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001138vec_vandc(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001139{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001140 return __a & ~(vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001141}
1142
1143static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001144vec_vandc(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001145{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001146 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001147}
1148
1149static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001150vec_vandc(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001151{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001152 return (vector unsigned short)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001153}
1154
1155static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001156vec_vandc(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001157{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001158 return __a & ~(vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001159}
1160
1161static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001162vec_vandc(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001163{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001164 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001165}
1166
1167static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001168vec_vandc(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001169{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001170 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001171}
1172
1173static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001174vec_vandc(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001175{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001176 return (vector int)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001177}
1178
1179static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001180vec_vandc(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001181{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001182 return __a & ~(vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001183}
1184
1185static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001186vec_vandc(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001187{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001188 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001189}
1190
1191static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001192vec_vandc(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001193{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001194 return (vector unsigned int)__a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001195}
1196
1197static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001198vec_vandc(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001199{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001200 return __a & ~(vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001201}
1202
1203static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001204vec_vandc(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001205{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001206 return __a & ~__b;
Ying Wangb335bb02011-11-29 10:23:55 -08001207}
1208
1209static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001210vec_vandc(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001211{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001212 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1213 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08001214}
1215
1216static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001217vec_vandc(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001218{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001219 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1220 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08001221}
1222
1223static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001224vec_vandc(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001225{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001226 vector unsigned int __res = (vector unsigned int)__a & ~(vector unsigned int)__b;
1227 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08001228}
1229
1230/* vec_avg */
1231
1232static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001233vec_avg(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001234{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001235 return __builtin_altivec_vavgsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001236}
1237
1238static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001239vec_avg(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001240{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001241 return __builtin_altivec_vavgub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001242}
1243
1244static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001245vec_avg(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001246{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001247 return __builtin_altivec_vavgsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001248}
1249
1250static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001251vec_avg(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001252{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001253 return __builtin_altivec_vavguh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001254}
1255
1256static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001257vec_avg(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001258{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001259 return __builtin_altivec_vavgsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001260}
1261
1262static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001263vec_avg(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001264{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001265 return __builtin_altivec_vavguw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001266}
1267
1268/* vec_vavgsb */
1269
1270static vector signed char __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001271vec_vavgsb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001272{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001273 return __builtin_altivec_vavgsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001274}
1275
1276/* vec_vavgub */
1277
1278static vector unsigned char __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001279vec_vavgub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001280{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001281 return __builtin_altivec_vavgub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001282}
1283
1284/* vec_vavgsh */
1285
1286static vector short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001287vec_vavgsh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001288{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001289 return __builtin_altivec_vavgsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001290}
1291
1292/* vec_vavguh */
1293
1294static vector unsigned short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001295vec_vavguh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001296{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001297 return __builtin_altivec_vavguh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001298}
1299
1300/* vec_vavgsw */
1301
1302static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001303vec_vavgsw(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001304{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001305 return __builtin_altivec_vavgsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001306}
1307
1308/* vec_vavguw */
1309
1310static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001311vec_vavguw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001312{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001313 return __builtin_altivec_vavguw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001314}
1315
1316/* vec_ceil */
1317
1318static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001319vec_ceil(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001320{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001321 return __builtin_altivec_vrfip(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001322}
1323
1324/* vec_vrfip */
1325
1326static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001327vec_vrfip(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001328{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001329 return __builtin_altivec_vrfip(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001330}
1331
1332/* vec_cmpb */
1333
1334static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001335vec_cmpb(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001336{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001337 return __builtin_altivec_vcmpbfp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001338}
1339
1340/* vec_vcmpbfp */
1341
1342static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001343vec_vcmpbfp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001344{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001345 return __builtin_altivec_vcmpbfp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001346}
1347
1348/* vec_cmpeq */
1349
1350static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001351vec_cmpeq(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001352{
1353 return (vector bool char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001354 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08001355}
1356
1357static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001358vec_cmpeq(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001359{
1360 return (vector bool char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001361 __builtin_altivec_vcmpequb((vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08001362}
1363
1364static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001365vec_cmpeq(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001366{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001367 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001368}
1369
1370static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001371vec_cmpeq(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001372{
1373 return (vector bool short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001374 __builtin_altivec_vcmpequh((vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08001375}
1376
1377static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001378vec_cmpeq(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001379{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001380 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001381}
1382
1383static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001384vec_cmpeq(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001385{
1386 return (vector bool int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001387 __builtin_altivec_vcmpequw((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08001388}
1389
Stephen Hines3f868232015-04-10 09:22:19 -07001390#ifdef __POWER8_VECTOR__
1391static vector bool long long __ATTRS_o_ai
1392vec_cmpeq(vector signed long long __a, vector signed long long __b)
1393{
1394 return (vector bool long long) __builtin_altivec_vcmpequd(__a, __b);
1395}
1396
1397static vector bool long long __ATTRS_o_ai
1398vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b)
1399{
1400 return (vector bool long long)
1401 __builtin_altivec_vcmpequd((vector long long)__a, (vector long long) __b);
1402}
1403#endif
1404
Ying Wangb335bb02011-11-29 10:23:55 -08001405static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001406vec_cmpeq(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001407{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001408 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001409}
1410
1411/* vec_cmpge */
1412
1413static vector bool int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001414vec_cmpge(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001415{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001416 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001417}
1418
1419/* vec_vcmpgefp */
1420
1421static vector bool int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001422vec_vcmpgefp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001423{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001424 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001425}
1426
1427/* vec_cmpgt */
1428
1429static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001430vec_cmpgt(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001431{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001432 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001433}
1434
1435static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001436vec_cmpgt(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001437{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001438 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001439}
1440
1441static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001442vec_cmpgt(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001443{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001444 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001445}
1446
1447static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001448vec_cmpgt(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001449{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001450 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001451}
1452
1453static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001454vec_cmpgt(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001455{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001456 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001457}
1458
1459static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001460vec_cmpgt(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001461{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001462 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001463}
1464
Stephen Hines3f868232015-04-10 09:22:19 -07001465#ifdef __POWER8_VECTOR__
1466static vector bool long long __ATTRS_o_ai
1467vec_cmpgt(vector signed long long __a, vector signed long long __b)
1468{
1469 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b);
1470}
1471
1472static vector bool long long __ATTRS_o_ai
1473vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b)
1474{
1475 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b);
1476}
1477#endif
1478
Ying Wangb335bb02011-11-29 10:23:55 -08001479static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001480vec_cmpgt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001481{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001482 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001483}
1484
1485/* vec_vcmpgtsb */
1486
1487static vector bool char __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001488vec_vcmpgtsb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001489{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001490 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001491}
1492
1493/* vec_vcmpgtub */
1494
1495static vector bool char __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001496vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001497{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001498 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001499}
1500
1501/* vec_vcmpgtsh */
1502
1503static vector bool short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001504vec_vcmpgtsh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001505{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001506 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001507}
1508
1509/* vec_vcmpgtuh */
1510
1511static vector bool short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001512vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001513{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001514 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001515}
1516
1517/* vec_vcmpgtsw */
1518
1519static vector bool int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001520vec_vcmpgtsw(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001521{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001522 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001523}
1524
1525/* vec_vcmpgtuw */
1526
1527static vector bool int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001528vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001529{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001530 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001531}
1532
1533/* vec_vcmpgtfp */
1534
1535static vector bool int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001536vec_vcmpgtfp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001537{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001538 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001539}
1540
1541/* vec_cmple */
1542
1543static vector bool int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001544vec_cmple(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001545{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001546 return (vector bool int)__builtin_altivec_vcmpgefp(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001547}
1548
1549/* vec_cmplt */
1550
1551static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001552vec_cmplt(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001553{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001554 return (vector bool char)__builtin_altivec_vcmpgtsb(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001555}
1556
1557static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001558vec_cmplt(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001559{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001560 return (vector bool char)__builtin_altivec_vcmpgtub(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001561}
1562
1563static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001564vec_cmplt(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001565{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001566 return (vector bool short)__builtin_altivec_vcmpgtsh(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001567}
1568
1569static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001570vec_cmplt(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001571{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001572 return (vector bool short)__builtin_altivec_vcmpgtuh(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001573}
1574
1575static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001576vec_cmplt(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001577{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001578 return (vector bool int)__builtin_altivec_vcmpgtsw(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001579}
1580
1581static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001582vec_cmplt(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001583{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001584 return (vector bool int)__builtin_altivec_vcmpgtuw(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001585}
1586
1587static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001588vec_cmplt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001589{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001590 return (vector bool int)__builtin_altivec_vcmpgtfp(__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -08001591}
1592
1593/* vec_ctf */
1594
1595static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001596vec_ctf(vector int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001597{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001598 return __builtin_altivec_vcfsx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001599}
1600
1601static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001602vec_ctf(vector unsigned int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001603{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001604 return __builtin_altivec_vcfux((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001605}
1606
1607/* vec_vcfsx */
1608
1609static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001610vec_vcfsx(vector int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001611{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001612 return __builtin_altivec_vcfsx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001613}
1614
1615/* vec_vcfux */
1616
1617static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001618vec_vcfux(vector unsigned int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001619{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001620 return __builtin_altivec_vcfux((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001621}
1622
1623/* vec_cts */
1624
1625static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001626vec_cts(vector float __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001627{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001628 return __builtin_altivec_vctsxs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001629}
1630
1631/* vec_vctsxs */
1632
1633static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001634vec_vctsxs(vector float __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001635{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001636 return __builtin_altivec_vctsxs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001637}
1638
1639/* vec_ctu */
1640
1641static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001642vec_ctu(vector float __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001643{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001644 return __builtin_altivec_vctuxs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001645}
1646
1647/* vec_vctuxs */
1648
1649static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001650vec_vctuxs(vector float __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08001651{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001652 return __builtin_altivec_vctuxs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001653}
1654
Stephen Hinesee4ca282014-12-02 17:05:12 -08001655/* vec_div */
1656#ifdef __VSX__
1657static vector float __ATTRS_o_ai
1658vec_div(vector float __a, vector float __b)
1659{
1660 return __builtin_vsx_xvdivsp(__a, __b);
1661}
1662
1663static vector double __ATTRS_o_ai
1664vec_div(vector double __a, vector double __b)
1665{
1666 return __builtin_vsx_xvdivdp(__a, __b);
1667}
1668#endif
1669
Ying Wangb335bb02011-11-29 10:23:55 -08001670/* vec_dss */
1671
1672static void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001673vec_dss(int __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001674{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001675 __builtin_altivec_dss(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001676}
1677
1678/* vec_dssall */
1679
1680static void __attribute__((__always_inline__))
1681vec_dssall(void)
1682{
1683 __builtin_altivec_dssall();
1684}
1685
1686/* vec_dst */
1687
1688static void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001689vec_dst(const void *__a, int __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08001690{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001691 __builtin_altivec_dst(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08001692}
1693
1694/* vec_dstst */
1695
1696static void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001697vec_dstst(const void *__a, int __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08001698{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001699 __builtin_altivec_dstst(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08001700}
1701
1702/* vec_dststt */
1703
1704static void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001705vec_dststt(const void *__a, int __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08001706{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001707 __builtin_altivec_dststt(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08001708}
1709
1710/* vec_dstt */
1711
1712static void __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001713vec_dstt(const void *__a, int __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08001714{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001715 __builtin_altivec_dstt(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08001716}
1717
1718/* vec_expte */
1719
1720static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001721vec_expte(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001722{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001723 return __builtin_altivec_vexptefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001724}
1725
1726/* vec_vexptefp */
1727
1728static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001729vec_vexptefp(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001730{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001731 return __builtin_altivec_vexptefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001732}
1733
1734/* vec_floor */
1735
1736static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001737vec_floor(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001738{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001739 return __builtin_altivec_vrfim(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001740}
1741
1742/* vec_vrfim */
1743
1744static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001745vec_vrfim(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08001746{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001747 return __builtin_altivec_vrfim(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08001748}
1749
1750/* vec_ld */
1751
1752static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001753vec_ld(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001754{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001755 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001756}
1757
1758static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001759vec_ld(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001760{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001761 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001762}
1763
1764static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001765vec_ld(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001766{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001767 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001768}
1769
1770static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001771vec_ld(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001772{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001773 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001774}
1775
1776static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001777vec_ld(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001778{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001779 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001780}
1781
1782static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001783vec_ld(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001784{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001785 return (vector short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001786}
1787
1788static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001789vec_ld(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001790{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001791 return (vector short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001792}
1793
1794static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001795vec_ld(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001796{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001797 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001798}
1799
1800static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001801vec_ld(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001802{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001803 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001804}
1805
1806static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001807vec_ld(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001808{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001809 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001810}
1811
1812static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001813vec_ld(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001814{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001815 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001816}
1817
1818static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001819vec_ld(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001820{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001821 return (vector int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001822}
1823
1824static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001825vec_ld(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001826{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001827 return (vector int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001828}
1829
1830static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001831vec_ld(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001832{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001833 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001834}
1835
1836static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001837vec_ld(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001838{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001839 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001840}
1841
1842static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001843vec_ld(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001844{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001845 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001846}
1847
1848static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001849vec_ld(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001850{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001851 return (vector float)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001852}
1853
1854static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001855vec_ld(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001856{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001857 return (vector float)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001858}
1859
1860/* vec_lvx */
1861
1862static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001863vec_lvx(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001864{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001865 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001866}
1867
1868static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001869vec_lvx(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001870{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001871 return (vector signed char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001872}
1873
1874static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001875vec_lvx(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001876{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001877 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001878}
1879
1880static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001881vec_lvx(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001882{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001883 return (vector unsigned char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001884}
1885
1886static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001887vec_lvx(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001888{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001889 return (vector bool char)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001890}
1891
1892static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001893vec_lvx(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001894{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001895 return (vector short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001896}
1897
1898static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001899vec_lvx(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001900{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001901 return (vector short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001902}
1903
1904static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001905vec_lvx(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001906{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001907 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001908}
1909
1910static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001911vec_lvx(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001912{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001913 return (vector unsigned short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001914}
1915
1916static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001917vec_lvx(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001918{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001919 return (vector bool short)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001920}
1921
1922static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001923vec_lvx(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001924{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001925 return (vector pixel)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001926}
1927
1928static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001929vec_lvx(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001930{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001931 return (vector int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001932}
1933
1934static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001935vec_lvx(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001936{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001937 return (vector int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001938}
1939
1940static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001941vec_lvx(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001942{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001943 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001944}
1945
1946static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001947vec_lvx(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001948{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001949 return (vector unsigned int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001950}
1951
1952static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001953vec_lvx(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001954{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001955 return (vector bool int)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001956}
1957
1958static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001959vec_lvx(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001960{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001961 return (vector float)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001962}
1963
1964static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001965vec_lvx(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001966{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001967 return (vector float)__builtin_altivec_lvx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001968}
1969
1970/* vec_lde */
1971
1972static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001973vec_lde(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001974{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001975 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001976}
1977
1978static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001979vec_lde(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001980{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001981 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001982}
1983
1984static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001985vec_lde(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001986{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001987 return (vector short)__builtin_altivec_lvehx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001988}
1989
1990static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001991vec_lde(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001992{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001993 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08001994}
1995
1996static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001997vec_lde(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08001998{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07001999 return (vector int)__builtin_altivec_lvewx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002000}
2001
2002static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002003vec_lde(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002004{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002005 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002006}
2007
2008static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002009vec_lde(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002010{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002011 return (vector float)__builtin_altivec_lvewx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002012}
2013
2014/* vec_lvebx */
2015
2016static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002017vec_lvebx(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002018{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002019 return (vector signed char)__builtin_altivec_lvebx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002020}
2021
2022static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002023vec_lvebx(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002024{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002025 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002026}
2027
2028/* vec_lvehx */
2029
2030static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002031vec_lvehx(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002032{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002033 return (vector short)__builtin_altivec_lvehx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002034}
2035
2036static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002037vec_lvehx(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002038{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002039 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002040}
2041
2042/* vec_lvewx */
2043
2044static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002045vec_lvewx(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002046{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002047 return (vector int)__builtin_altivec_lvewx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002048}
2049
2050static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002051vec_lvewx(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002052{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002053 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002054}
2055
2056static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002057vec_lvewx(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002058{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002059 return (vector float)__builtin_altivec_lvewx(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002060}
2061
2062/* vec_ldl */
2063
2064static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002065vec_ldl(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002066{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002067 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002068}
2069
2070static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002071vec_ldl(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002072{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002073 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002074}
2075
2076static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002077vec_ldl(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002078{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002079 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002080}
2081
2082static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002083vec_ldl(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002084{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002085 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002086}
2087
2088static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002089vec_ldl(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002090{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002091 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002092}
2093
2094static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002095vec_ldl(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002096{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002097 return (vector short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002098}
2099
2100static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002101vec_ldl(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002102{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002103 return (vector short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002104}
2105
2106static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002107vec_ldl(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002108{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002109 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002110}
2111
2112static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002113vec_ldl(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002114{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002115 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002116}
2117
2118static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002119vec_ldl(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002120{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002121 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002122}
2123
2124static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002125vec_ldl(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002126{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002127 return (vector pixel short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002128}
2129
2130static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002131vec_ldl(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002132{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002133 return (vector int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002134}
2135
2136static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002137vec_ldl(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002138{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002139 return (vector int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002140}
2141
2142static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002143vec_ldl(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002144{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002145 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002146}
2147
2148static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002149vec_ldl(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002150{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002151 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002152}
2153
2154static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002155vec_ldl(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002156{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002157 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002158}
2159
2160static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002161vec_ldl(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002162{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002163 return (vector float)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002164}
2165
2166static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002167vec_ldl(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002168{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002169 return (vector float)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002170}
2171
2172/* vec_lvxl */
2173
2174static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002175vec_lvxl(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002176{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002177 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002178}
2179
2180static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002181vec_lvxl(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002182{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002183 return (vector signed char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002184}
2185
2186static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002187vec_lvxl(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002188{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002189 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002190}
2191
2192static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002193vec_lvxl(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002194{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002195 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002196}
2197
2198static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002199vec_lvxl(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002200{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002201 return (vector bool char)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002202}
2203
2204static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002205vec_lvxl(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002206{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002207 return (vector short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002208}
2209
2210static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002211vec_lvxl(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002212{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002213 return (vector short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002214}
2215
2216static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002217vec_lvxl(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002218{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002219 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002220}
2221
2222static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002223vec_lvxl(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002224{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002225 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002226}
2227
2228static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002229vec_lvxl(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002230{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002231 return (vector bool short)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002232}
2233
2234static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002235vec_lvxl(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002236{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002237 return (vector pixel)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002238}
2239
2240static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002241vec_lvxl(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002242{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002243 return (vector int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002244}
2245
2246static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002247vec_lvxl(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002248{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002249 return (vector int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002250}
2251
2252static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002253vec_lvxl(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002254{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002255 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002256}
2257
2258static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002259vec_lvxl(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002260{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002261 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002262}
2263
2264static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002265vec_lvxl(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002266{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002267 return (vector bool int)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002268}
2269
2270static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002271vec_lvxl(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002272{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002273 return (vector float)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002274}
2275
2276static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002277vec_lvxl(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002278{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002279 return (vector float)__builtin_altivec_lvxl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002280}
2281
2282/* vec_loge */
2283
2284static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002285vec_loge(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08002286{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002287 return __builtin_altivec_vlogefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08002288}
2289
2290/* vec_vlogefp */
2291
2292static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002293vec_vlogefp(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08002294{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002295 return __builtin_altivec_vlogefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08002296}
2297
2298/* vec_lvsl */
2299
Stephen Hinesee4ca282014-12-02 17:05:12 -08002300#ifdef __LITTLE_ENDIAN__
2301static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002302__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002303loads/stores")))
2304vec_lvsl(int __a, const signed char *__b)
2305{
2306 vector unsigned char mask =
2307 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2308 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2309 return vec_perm(mask, mask, reverse);
2310}
2311#else
Ying Wangb335bb02011-11-29 10:23:55 -08002312static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002313vec_lvsl(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002314{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002315 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002316}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002317#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002318
Stephen Hinesee4ca282014-12-02 17:05:12 -08002319#ifdef __LITTLE_ENDIAN__
2320static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002321__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002322loads/stores")))
2323vec_lvsl(int __a, const unsigned char *__b)
2324{
2325 vector unsigned char mask =
2326 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2327 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2328 return vec_perm(mask, mask, reverse);
2329}
2330#else
Ying Wangb335bb02011-11-29 10:23:55 -08002331static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002332vec_lvsl(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002333{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002334 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002335}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002336#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002337
Stephen Hinesee4ca282014-12-02 17:05:12 -08002338#ifdef __LITTLE_ENDIAN__
2339static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002340__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002341loads/stores")))
2342vec_lvsl(int __a, const short *__b)
2343{
2344 vector unsigned char mask =
2345 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2346 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2347 return vec_perm(mask, mask, reverse);
2348}
2349#else
Ying Wangb335bb02011-11-29 10:23:55 -08002350static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002351vec_lvsl(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002352{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002353 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002354}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002355#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002356
Stephen Hinesee4ca282014-12-02 17:05:12 -08002357#ifdef __LITTLE_ENDIAN__
2358static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002359__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002360loads/stores")))
2361vec_lvsl(int __a, const unsigned short *__b)
2362{
2363 vector unsigned char mask =
2364 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2365 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2366 return vec_perm(mask, mask, reverse);
2367}
2368#else
Ying Wangb335bb02011-11-29 10:23:55 -08002369static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002370vec_lvsl(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002371{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002372 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002373}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002374#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002375
Stephen Hinesee4ca282014-12-02 17:05:12 -08002376#ifdef __LITTLE_ENDIAN__
2377static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002378__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002379loads/stores")))
2380vec_lvsl(int __a, const int *__b)
2381{
2382 vector unsigned char mask =
2383 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2384 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2385 return vec_perm(mask, mask, reverse);
2386}
2387#else
Ying Wangb335bb02011-11-29 10:23:55 -08002388static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002389vec_lvsl(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002390{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002391 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002392}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002393#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002394
Stephen Hinesee4ca282014-12-02 17:05:12 -08002395#ifdef __LITTLE_ENDIAN__
2396static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002397__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002398loads/stores")))
2399vec_lvsl(int __a, const unsigned int *__b)
2400{
2401 vector unsigned char mask =
2402 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2403 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2404 return vec_perm(mask, mask, reverse);
2405}
2406#else
Ying Wangb335bb02011-11-29 10:23:55 -08002407static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002408vec_lvsl(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002409{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002410 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002411}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002412#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002413
Stephen Hinesee4ca282014-12-02 17:05:12 -08002414#ifdef __LITTLE_ENDIAN__
2415static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002416__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002417loads/stores")))
2418vec_lvsl(int __a, const float *__b)
2419{
2420 vector unsigned char mask =
2421 (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
2422 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2423 return vec_perm(mask, mask, reverse);
2424}
2425#else
Ying Wangb335bb02011-11-29 10:23:55 -08002426static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002427vec_lvsl(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002428{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002429 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002430}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002431#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002432
2433/* vec_lvsr */
2434
Stephen Hinesee4ca282014-12-02 17:05:12 -08002435#ifdef __LITTLE_ENDIAN__
2436static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002437__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002438loads/stores")))
2439vec_lvsr(int __a, const signed char *__b)
2440{
2441 vector unsigned char mask =
2442 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2443 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2444 return vec_perm(mask, mask, reverse);
2445}
2446#else
Ying Wangb335bb02011-11-29 10:23:55 -08002447static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002448vec_lvsr(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002449{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002450 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002451}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002452#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002453
Stephen Hinesee4ca282014-12-02 17:05:12 -08002454#ifdef __LITTLE_ENDIAN__
2455static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002456__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002457loads/stores")))
2458vec_lvsr(int __a, const unsigned char *__b)
2459{
2460 vector unsigned char mask =
2461 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2462 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2463 return vec_perm(mask, mask, reverse);
2464}
2465#else
Ying Wangb335bb02011-11-29 10:23:55 -08002466static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002467vec_lvsr(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002468{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002469 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002470}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002471#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002472
Stephen Hinesee4ca282014-12-02 17:05:12 -08002473#ifdef __LITTLE_ENDIAN__
2474static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002475__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002476loads/stores")))
2477vec_lvsr(int __a, const short *__b)
2478{
2479 vector unsigned char mask =
2480 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2481 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2482 return vec_perm(mask, mask, reverse);
2483}
2484#else
Ying Wangb335bb02011-11-29 10:23:55 -08002485static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002486vec_lvsr(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002487{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002488 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002489}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002490#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002491
Stephen Hinesee4ca282014-12-02 17:05:12 -08002492#ifdef __LITTLE_ENDIAN__
2493static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002494__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002495loads/stores")))
2496vec_lvsr(int __a, const unsigned short *__b)
2497{
2498 vector unsigned char mask =
2499 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2500 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2501 return vec_perm(mask, mask, reverse);
2502}
2503#else
Ying Wangb335bb02011-11-29 10:23:55 -08002504static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002505vec_lvsr(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002506{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002507 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002508}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002509#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002510
Stephen Hinesee4ca282014-12-02 17:05:12 -08002511#ifdef __LITTLE_ENDIAN__
2512static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002513__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002514loads/stores")))
2515vec_lvsr(int __a, const int *__b)
2516{
2517 vector unsigned char mask =
2518 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2519 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2520 return vec_perm(mask, mask, reverse);
2521}
2522#else
Ying Wangb335bb02011-11-29 10:23:55 -08002523static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002524vec_lvsr(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002525{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002526 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002527}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002528#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002529
Stephen Hinesee4ca282014-12-02 17:05:12 -08002530#ifdef __LITTLE_ENDIAN__
2531static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002532__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002533loads/stores")))
2534vec_lvsr(int __a, const unsigned int *__b)
2535{
2536 vector unsigned char mask =
2537 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2538 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2539 return vec_perm(mask, mask, reverse);
2540}
2541#else
Ying Wangb335bb02011-11-29 10:23:55 -08002542static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002543vec_lvsr(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002544{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002545 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002546}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002547#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002548
Stephen Hinesee4ca282014-12-02 17:05:12 -08002549#ifdef __LITTLE_ENDIAN__
2550static vector unsigned char __ATTRS_o_ai
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002551__attribute__((__deprecated__("use assignment for unaligned little endian \
Stephen Hinesee4ca282014-12-02 17:05:12 -08002552loads/stores")))
2553vec_lvsr(int __a, const float *__b)
2554{
2555 vector unsigned char mask =
2556 (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
2557 vector unsigned char reverse = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
2558 return vec_perm(mask, mask, reverse);
2559}
2560#else
Ying Wangb335bb02011-11-29 10:23:55 -08002561static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002562vec_lvsr(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08002563{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002564 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002565}
Stephen Hinesee4ca282014-12-02 17:05:12 -08002566#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002567
2568/* vec_madd */
2569
2570static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002571vec_madd(vector float __a, vector float __b, vector float __c)
Ying Wangb335bb02011-11-29 10:23:55 -08002572{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002573 return __builtin_altivec_vmaddfp(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08002574}
2575
2576/* vec_vmaddfp */
2577
2578static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002579vec_vmaddfp(vector float __a, vector float __b, vector float __c)
Ying Wangb335bb02011-11-29 10:23:55 -08002580{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002581 return __builtin_altivec_vmaddfp(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08002582}
2583
2584/* vec_madds */
2585
2586static vector signed short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002587vec_madds(vector signed short __a, vector signed short __b, vector signed short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08002588{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002589 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08002590}
2591
2592/* vec_vmhaddshs */
2593static vector signed short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002594vec_vmhaddshs(vector signed short __a,
2595 vector signed short __b,
2596 vector signed short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08002597{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002598 return __builtin_altivec_vmhaddshs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08002599}
2600
2601/* vec_max */
2602
2603static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002604vec_max(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002605{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002606 return __builtin_altivec_vmaxsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002607}
2608
2609static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002610vec_max(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002611{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002612 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002613}
2614
2615static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002616vec_max(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002617{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002618 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002619}
2620
2621static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002622vec_max(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002623{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002624 return __builtin_altivec_vmaxub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002625}
2626
2627static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002628vec_max(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002629{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002630 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002631}
2632
2633static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002634vec_max(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002635{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002636 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002637}
2638
2639static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002640vec_max(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002641{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002642 return __builtin_altivec_vmaxsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002643}
2644
2645static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002646vec_max(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002647{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002648 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002649}
2650
2651static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002652vec_max(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002653{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002654 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002655}
2656
2657static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002658vec_max(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002659{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002660 return __builtin_altivec_vmaxuh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002661}
2662
2663static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002664vec_max(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002665{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002666 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002667}
2668
2669static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002670vec_max(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002671{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002672 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002673}
2674
2675static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002676vec_max(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002677{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002678 return __builtin_altivec_vmaxsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002679}
2680
2681static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002682vec_max(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002683{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002684 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002685}
2686
2687static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002688vec_max(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002689{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002690 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002691}
2692
2693static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002694vec_max(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002695{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002696 return __builtin_altivec_vmaxuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002697}
2698
2699static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002700vec_max(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002701{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002702 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002703}
2704
2705static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002706vec_max(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002707{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002708 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002709}
2710
Stephen Hines3f868232015-04-10 09:22:19 -07002711#ifdef __POWER8_VECTOR__
2712static vector signed long long __ATTRS_o_ai
2713vec_max(vector signed long long __a, vector signed long long __b)
2714{
2715 return __builtin_altivec_vmaxsd(__a, __b);
2716}
2717
2718static vector unsigned long long __ATTRS_o_ai
2719vec_max(vector unsigned long long __a, vector unsigned long long __b)
2720{
2721 return __builtin_altivec_vmaxud(__a, __b);
2722}
2723#endif
2724
Ying Wangb335bb02011-11-29 10:23:55 -08002725static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002726vec_max(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002727{
Stephen Hinesee4ca282014-12-02 17:05:12 -08002728#ifdef __VSX__
2729 return __builtin_vsx_xvmaxsp(__a, __b);
2730#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002731 return __builtin_altivec_vmaxfp(__a, __b);
Stephen Hinesee4ca282014-12-02 17:05:12 -08002732#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002733}
2734
Stephen Hinesee4ca282014-12-02 17:05:12 -08002735#ifdef __VSX__
2736static vector double __ATTRS_o_ai
2737vec_max(vector double __a, vector double __b)
2738{
2739 return __builtin_vsx_xvmaxdp(__a, __b);
2740}
2741#endif
2742
Ying Wangb335bb02011-11-29 10:23:55 -08002743/* vec_vmaxsb */
2744
2745static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002746vec_vmaxsb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002747{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002748 return __builtin_altivec_vmaxsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002749}
2750
2751static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002752vec_vmaxsb(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002753{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002754 return __builtin_altivec_vmaxsb((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002755}
2756
2757static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002758vec_vmaxsb(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002759{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002760 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002761}
2762
2763/* vec_vmaxub */
2764
2765static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002766vec_vmaxub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002767{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002768 return __builtin_altivec_vmaxub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002769}
2770
2771static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002772vec_vmaxub(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002773{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002774 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002775}
2776
2777static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002778vec_vmaxub(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002779{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002780 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002781}
2782
2783/* vec_vmaxsh */
2784
2785static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002786vec_vmaxsh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002787{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002788 return __builtin_altivec_vmaxsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002789}
2790
2791static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002792vec_vmaxsh(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002793{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002794 return __builtin_altivec_vmaxsh((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002795}
2796
2797static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002798vec_vmaxsh(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002799{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002800 return __builtin_altivec_vmaxsh(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002801}
2802
2803/* vec_vmaxuh */
2804
2805static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002806vec_vmaxuh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002807{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002808 return __builtin_altivec_vmaxuh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002809}
2810
2811static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002812vec_vmaxuh(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002813{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002814 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002815}
2816
2817static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002818vec_vmaxuh(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002819{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002820 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002821}
2822
2823/* vec_vmaxsw */
2824
2825static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002826vec_vmaxsw(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002827{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002828 return __builtin_altivec_vmaxsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002829}
2830
2831static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002832vec_vmaxsw(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002833{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002834 return __builtin_altivec_vmaxsw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002835}
2836
2837static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002838vec_vmaxsw(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002839{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002840 return __builtin_altivec_vmaxsw(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002841}
2842
2843/* vec_vmaxuw */
2844
2845static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002846vec_vmaxuw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002847{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002848 return __builtin_altivec_vmaxuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002849}
2850
2851static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002852vec_vmaxuw(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002853{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002854 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08002855}
2856
2857static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002858vec_vmaxuw(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002859{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002860 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08002861}
2862
2863/* vec_vmaxfp */
2864
2865static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002866vec_vmaxfp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002867{
Stephen Hinesee4ca282014-12-02 17:05:12 -08002868#ifdef __VSX__
2869 return __builtin_vsx_xvmaxsp(__a, __b);
2870#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002871 return __builtin_altivec_vmaxfp(__a, __b);
Stephen Hinesee4ca282014-12-02 17:05:12 -08002872#endif
Ying Wangb335bb02011-11-29 10:23:55 -08002873}
2874
2875/* vec_mergeh */
2876
2877static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002878vec_mergeh(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002879{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002880 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002881 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2882 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2883}
2884
2885static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002886vec_mergeh(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002887{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002888 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002889 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2890 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2891}
2892
2893static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002894vec_mergeh(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002895{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002896 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002897 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2898 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2899}
2900
2901static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002902vec_mergeh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002903{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002904 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002905 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2906 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2907}
2908
2909static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002910vec_mergeh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002911{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002912 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002913 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2914 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2915}
2916
2917static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002918vec_mergeh(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002919{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002920 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002921 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2922 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2923}
2924
2925static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002926vec_mergeh(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002927{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002928 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002929 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
2930 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
2931}
2932
2933static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002934vec_mergeh(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002935{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002936 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002937 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2938 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2939}
2940
2941static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002942vec_mergeh(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002943{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002944 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002945 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2946 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2947}
2948
2949static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002950vec_mergeh(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002951{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002952 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002953 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2954 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2955}
2956
2957static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002958vec_mergeh(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002959{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002960 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002961 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
2962 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
2963}
2964
2965/* vec_vmrghb */
2966
2967#define __builtin_altivec_vmrghb vec_vmrghb
2968
2969static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002970vec_vmrghb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002971{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002972 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002973 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2974 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2975}
2976
2977static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002978vec_vmrghb(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002979{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002980 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002981 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2982 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2983}
2984
2985static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002986vec_vmrghb(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002987{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002988 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08002989 (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13,
2990 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));
2991}
2992
2993/* vec_vmrghh */
2994
2995#define __builtin_altivec_vmrghh vec_vmrghh
2996
2997static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07002998vec_vmrghh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08002999{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003000 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003001 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3002 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3003}
3004
3005static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003006vec_vmrghh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003007{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003008 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003009 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3010 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3011}
3012
3013static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003014vec_vmrghh(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003015{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003016 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003017 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3018 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3019}
3020
3021static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003022vec_vmrghh(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003023{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003024 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003025 (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,
3026 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));
3027}
3028
3029/* vec_vmrghw */
3030
3031#define __builtin_altivec_vmrghw vec_vmrghw
3032
3033static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003034vec_vmrghw(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003035{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003036 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003037 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3038 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3039}
3040
3041static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003042vec_vmrghw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003043{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003044 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003045 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3046 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3047}
3048
3049static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003050vec_vmrghw(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003051{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003052 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003053 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3054 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3055}
3056
3057static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003058vec_vmrghw(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003059{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003060 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003061 (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,
3062 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));
3063}
3064
3065/* vec_mergel */
3066
3067static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003068vec_mergel(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003069{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003070 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003071 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3072 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3073}
3074
3075static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003076vec_mergel(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003077{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003078 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003079 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3080 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3081}
3082
3083static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003084vec_mergel(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003085{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003086 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003087 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3088 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3089}
3090
3091static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003092vec_mergel(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003093{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003094 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003095 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3096 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3097}
3098
3099static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003100vec_mergel(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003101{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003102 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003103 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3104 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3105}
3106
3107static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003108vec_mergel(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003109{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003110 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003111 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3112 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3113}
3114
3115static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003116vec_mergel(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003117{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003118 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003119 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3120 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3121}
3122
3123static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003124vec_mergel(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003125{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003126 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003127 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3128 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3129}
3130
3131static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003132vec_mergel(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003133{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003134 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003135 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3136 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3137}
3138
3139static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003140vec_mergel(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003141{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003142 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003143 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3144 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3145}
3146
3147static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003148vec_mergel(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003149{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003150 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003151 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3152 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3153}
3154
3155/* vec_vmrglb */
3156
3157#define __builtin_altivec_vmrglb vec_vmrglb
3158
3159static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003160vec_vmrglb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003161{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003162 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003163 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3164 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3165}
3166
3167static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003168vec_vmrglb(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003169{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003170 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003171 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3172 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3173}
3174
3175static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003176vec_vmrglb(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003177{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003178 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003179 (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B,
3180 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));
3181}
3182
3183/* vec_vmrglh */
3184
3185#define __builtin_altivec_vmrglh vec_vmrglh
3186
3187static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003188vec_vmrglh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003189{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003190 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003191 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3192 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3193}
3194
3195static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003196vec_vmrglh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003197{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003198 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003199 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3200 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3201}
3202
3203static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003204vec_vmrglh(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003205{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003206 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003207 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3208 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3209}
3210
3211static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003212vec_vmrglh(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003213{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003214 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003215 (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,
3216 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));
3217}
3218
3219/* vec_vmrglw */
3220
3221#define __builtin_altivec_vmrglw vec_vmrglw
3222
3223static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003224vec_vmrglw(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003225{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003226 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003227 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3228 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3229}
3230
3231static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003232vec_vmrglw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003233{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003234 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003235 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3236 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3237}
3238
3239static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003240vec_vmrglw(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003241{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003242 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003243 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3244 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3245}
3246
3247static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003248vec_vmrglw(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003249{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003250 return vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08003251 (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,
3252 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));
3253}
3254
3255/* vec_mfvscr */
3256
3257static vector unsigned short __attribute__((__always_inline__))
3258vec_mfvscr(void)
3259{
3260 return __builtin_altivec_mfvscr();
3261}
3262
3263/* vec_min */
3264
3265static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003266vec_min(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003267{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003268 return __builtin_altivec_vminsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003269}
3270
3271static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003272vec_min(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003273{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003274 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003275}
3276
3277static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003278vec_min(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003279{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003280 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003281}
3282
3283static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003284vec_min(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003285{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003286 return __builtin_altivec_vminub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003287}
3288
3289static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003290vec_min(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003291{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003292 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003293}
3294
3295static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003296vec_min(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003297{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003298 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003299}
3300
3301static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003302vec_min(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003303{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003304 return __builtin_altivec_vminsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003305}
3306
3307static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003308vec_min(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003309{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003310 return __builtin_altivec_vminsh((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003311}
3312
3313static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003314vec_min(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003315{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003316 return __builtin_altivec_vminsh(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003317}
3318
3319static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003320vec_min(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003321{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003322 return __builtin_altivec_vminuh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003323}
3324
3325static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003326vec_min(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003327{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003328 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003329}
3330
3331static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003332vec_min(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003333{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003334 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003335}
3336
3337static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003338vec_min(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003339{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003340 return __builtin_altivec_vminsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003341}
3342
3343static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003344vec_min(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003345{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003346 return __builtin_altivec_vminsw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003347}
3348
3349static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003350vec_min(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003351{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003352 return __builtin_altivec_vminsw(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003353}
3354
3355static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003356vec_min(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003357{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003358 return __builtin_altivec_vminuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003359}
3360
3361static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003362vec_min(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003363{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003364 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003365}
3366
3367static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003368vec_min(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003369{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003370 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003371}
3372
Stephen Hines3f868232015-04-10 09:22:19 -07003373#ifdef __POWER8_VECTOR__
3374static vector signed long long __ATTRS_o_ai
3375vec_min(vector signed long long __a, vector signed long long __b)
3376{
3377 return __builtin_altivec_vminsd(__a, __b);
3378}
3379
3380static vector unsigned long long __ATTRS_o_ai
3381vec_min(vector unsigned long long __a, vector unsigned long long __b)
3382{
3383 return __builtin_altivec_vminud(__a, __b);
3384}
3385#endif
3386
Ying Wangb335bb02011-11-29 10:23:55 -08003387static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003388vec_min(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003389{
Stephen Hinesee4ca282014-12-02 17:05:12 -08003390#ifdef __VSX__
3391 return __builtin_vsx_xvminsp(__a, __b);
3392#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003393 return __builtin_altivec_vminfp(__a, __b);
Stephen Hinesee4ca282014-12-02 17:05:12 -08003394#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003395}
3396
Stephen Hinesee4ca282014-12-02 17:05:12 -08003397#ifdef __VSX__
3398static vector double __ATTRS_o_ai
3399vec_min(vector double __a, vector double __b)
3400{
3401 return __builtin_vsx_xvmindp(__a, __b);
3402}
3403#endif
3404
Ying Wangb335bb02011-11-29 10:23:55 -08003405/* vec_vminsb */
3406
3407static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003408vec_vminsb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003409{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003410 return __builtin_altivec_vminsb(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003411}
3412
3413static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003414vec_vminsb(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003415{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003416 return __builtin_altivec_vminsb((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003417}
3418
3419static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003420vec_vminsb(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003421{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003422 return __builtin_altivec_vminsb(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003423}
3424
3425/* vec_vminub */
3426
3427static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003428vec_vminub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003429{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003430 return __builtin_altivec_vminub(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003431}
3432
3433static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003434vec_vminub(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003435{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003436 return __builtin_altivec_vminub((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003437}
3438
3439static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003440vec_vminub(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003441{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003442 return __builtin_altivec_vminub(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003443}
3444
3445/* vec_vminsh */
3446
3447static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003448vec_vminsh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003449{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003450 return __builtin_altivec_vminsh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003451}
3452
3453static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003454vec_vminsh(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003455{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003456 return __builtin_altivec_vminsh((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003457}
3458
3459static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003460vec_vminsh(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003461{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003462 return __builtin_altivec_vminsh(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003463}
3464
3465/* vec_vminuh */
3466
3467static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003468vec_vminuh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003469{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003470 return __builtin_altivec_vminuh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003471}
3472
3473static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003474vec_vminuh(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003475{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003476 return __builtin_altivec_vminuh((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003477}
3478
3479static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003480vec_vminuh(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003481{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003482 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003483}
3484
3485/* vec_vminsw */
3486
3487static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003488vec_vminsw(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003489{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003490 return __builtin_altivec_vminsw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003491}
3492
3493static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003494vec_vminsw(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003495{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003496 return __builtin_altivec_vminsw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003497}
3498
3499static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003500vec_vminsw(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003501{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003502 return __builtin_altivec_vminsw(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003503}
3504
3505/* vec_vminuw */
3506
3507static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003508vec_vminuw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003509{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003510 return __builtin_altivec_vminuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003511}
3512
3513static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003514vec_vminuw(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003515{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003516 return __builtin_altivec_vminuw((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08003517}
3518
3519static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003520vec_vminuw(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003521{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003522 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08003523}
3524
3525/* vec_vminfp */
3526
3527static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003528vec_vminfp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003529{
Stephen Hinesee4ca282014-12-02 17:05:12 -08003530#ifdef __VSX__
3531 return __builtin_vsx_xvminsp(__a, __b);
3532#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003533 return __builtin_altivec_vminfp(__a, __b);
Stephen Hinesee4ca282014-12-02 17:05:12 -08003534#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003535}
3536
3537/* vec_mladd */
3538
3539#define __builtin_altivec_vmladduhm vec_mladd
3540
3541static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003542vec_mladd(vector short __a, vector short __b, vector short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003543{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003544 return __a * __b + __c;
Ying Wangb335bb02011-11-29 10:23:55 -08003545}
3546
3547static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003548vec_mladd(vector short __a, vector unsigned short __b, vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003549{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003550 return __a * (vector short)__b + (vector short)__c;
Ying Wangb335bb02011-11-29 10:23:55 -08003551}
3552
3553static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003554vec_mladd(vector unsigned short __a, vector short __b, vector short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003555{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003556 return (vector short)__a * __b + __c;
Ying Wangb335bb02011-11-29 10:23:55 -08003557}
3558
3559static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003560vec_mladd(vector unsigned short __a,
3561 vector unsigned short __b,
3562 vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003563{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003564 return __a * __b + __c;
Ying Wangb335bb02011-11-29 10:23:55 -08003565}
3566
3567/* vec_vmladduhm */
3568
3569static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003570vec_vmladduhm(vector short __a, vector short __b, vector short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003571{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003572 return __a * __b + __c;
Ying Wangb335bb02011-11-29 10:23:55 -08003573}
3574
3575static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003576vec_vmladduhm(vector short __a, vector unsigned short __b, vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003577{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003578 return __a * (vector short)__b + (vector short)__c;
Ying Wangb335bb02011-11-29 10:23:55 -08003579}
3580
3581static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003582vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003583{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003584 return (vector short)__a * __b + __c;
Ying Wangb335bb02011-11-29 10:23:55 -08003585}
3586
3587static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003588vec_vmladduhm(vector unsigned short __a,
3589 vector unsigned short __b,
3590 vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003591{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003592 return __a * __b + __c;
Ying Wangb335bb02011-11-29 10:23:55 -08003593}
3594
3595/* vec_mradds */
3596
3597static vector short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003598vec_mradds(vector short __a, vector short __b, vector short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003599{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003600 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003601}
3602
3603/* vec_vmhraddshs */
3604
3605static vector short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003606vec_vmhraddshs(vector short __a, vector short __b, vector short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003607{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003608 return __builtin_altivec_vmhraddshs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003609}
3610
3611/* vec_msum */
3612
3613static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003614vec_msum(vector signed char __a, vector unsigned char __b, vector int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003615{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003616 return __builtin_altivec_vmsummbm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003617}
3618
3619static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003620vec_msum(vector unsigned char __a, vector unsigned char __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003621{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003622 return __builtin_altivec_vmsumubm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003623}
3624
3625static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003626vec_msum(vector short __a, vector short __b, vector int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003627{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003628 return __builtin_altivec_vmsumshm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003629}
3630
3631static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003632vec_msum(vector unsigned short __a,
3633 vector unsigned short __b,
3634 vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003635{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003636 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003637}
3638
3639/* vec_vmsummbm */
3640
3641static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003642vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003643{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003644 return __builtin_altivec_vmsummbm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003645}
3646
3647/* vec_vmsumubm */
3648
3649static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003650vec_vmsumubm(vector unsigned char __a,
3651 vector unsigned char __b,
3652 vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003653{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003654 return __builtin_altivec_vmsumubm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003655}
3656
3657/* vec_vmsumshm */
3658
3659static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003660vec_vmsumshm(vector short __a, vector short __b, vector int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003661{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003662 return __builtin_altivec_vmsumshm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003663}
3664
3665/* vec_vmsumuhm */
3666
3667static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003668vec_vmsumuhm(vector unsigned short __a,
3669 vector unsigned short __b,
3670 vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003671{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003672 return __builtin_altivec_vmsumuhm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003673}
3674
3675/* vec_msums */
3676
3677static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003678vec_msums(vector short __a, vector short __b, vector int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003679{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003680 return __builtin_altivec_vmsumshs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003681}
3682
3683static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003684vec_msums(vector unsigned short __a,
3685 vector unsigned short __b,
3686 vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003687{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003688 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003689}
3690
3691/* vec_vmsumshs */
3692
3693static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003694vec_vmsumshs(vector short __a, vector short __b, vector int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003695{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003696 return __builtin_altivec_vmsumshs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003697}
3698
3699/* vec_vmsumuhs */
3700
3701static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003702vec_vmsumuhs(vector unsigned short __a,
3703 vector unsigned short __b,
3704 vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08003705{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003706 return __builtin_altivec_vmsumuhs(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08003707}
3708
3709/* vec_mtvscr */
3710
3711static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003712vec_mtvscr(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003713{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003714 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003715}
3716
3717static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003718vec_mtvscr(vector unsigned char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003719{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003720 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003721}
3722
3723static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003724vec_mtvscr(vector bool char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003725{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003726 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003727}
3728
3729static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003730vec_mtvscr(vector short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003731{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003732 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003733}
3734
3735static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003736vec_mtvscr(vector unsigned short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003737{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003738 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003739}
3740
3741static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003742vec_mtvscr(vector bool short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003743{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003744 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003745}
3746
3747static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003748vec_mtvscr(vector pixel __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003749{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003750 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003751}
3752
3753static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003754vec_mtvscr(vector int __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003755{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003756 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003757}
3758
3759static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003760vec_mtvscr(vector unsigned int __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003761{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003762 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003763}
3764
3765static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003766vec_mtvscr(vector bool int __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003767{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003768 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003769}
3770
3771static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003772vec_mtvscr(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08003773{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003774 __builtin_altivec_mtvscr((vector int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -08003775}
3776
Stephen Hines990d2fc2014-07-23 10:40:48 -07003777/* The vmulos* and vmules* instructions have a big endian bias, so
3778 we must reverse the meaning of "even" and "odd" for little endian. */
3779
Ying Wangb335bb02011-11-29 10:23:55 -08003780/* vec_mule */
3781
3782static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003783vec_mule(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003784{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003785#ifdef __LITTLE_ENDIAN__
3786 return __builtin_altivec_vmulosb(__a, __b);
3787#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003788 return __builtin_altivec_vmulesb(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003789#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003790}
3791
3792static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003793vec_mule(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003794{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003795#ifdef __LITTLE_ENDIAN__
3796 return __builtin_altivec_vmuloub(__a, __b);
3797#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003798 return __builtin_altivec_vmuleub(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003799#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003800}
3801
3802static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003803vec_mule(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003804{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003805#ifdef __LITTLE_ENDIAN__
3806 return __builtin_altivec_vmulosh(__a, __b);
3807#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003808 return __builtin_altivec_vmulesh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003809#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003810}
3811
3812static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003813vec_mule(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003814{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003815#ifdef __LITTLE_ENDIAN__
3816 return __builtin_altivec_vmulouh(__a, __b);
3817#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003818 return __builtin_altivec_vmuleuh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003819#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003820}
3821
Stephen Hines3f868232015-04-10 09:22:19 -07003822#ifdef __POWER8_VECTOR__
3823static vector signed long long __ATTRS_o_ai
3824vec_mule(vector signed int __a, vector signed int __b)
3825{
3826#ifdef __LITTLE_ENDIAN__
3827 return __builtin_altivec_vmulosw(__a, __b);
3828#else
3829 return __builtin_altivec_vmulesw(__a, __b);
3830#endif
3831}
3832
3833static vector unsigned long long __ATTRS_o_ai
3834vec_mule(vector unsigned int __a, vector unsigned int __b)
3835{
3836#ifdef __LITTLE_ENDIAN__
3837 return __builtin_altivec_vmulouw(__a, __b);
3838#else
3839 return __builtin_altivec_vmuleuw(__a, __b);
3840#endif
3841}
3842#endif
3843
Ying Wangb335bb02011-11-29 10:23:55 -08003844/* vec_vmulesb */
3845
3846static vector short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003847vec_vmulesb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003848{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003849#ifdef __LITTLE_ENDIAN__
3850 return __builtin_altivec_vmulosb(__a, __b);
3851#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003852 return __builtin_altivec_vmulesb(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003853#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003854}
3855
3856/* vec_vmuleub */
3857
3858static vector unsigned short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003859vec_vmuleub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003860{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003861#ifdef __LITTLE_ENDIAN__
3862 return __builtin_altivec_vmuloub(__a, __b);
3863#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003864 return __builtin_altivec_vmuleub(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003865#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003866}
3867
3868/* vec_vmulesh */
3869
3870static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003871vec_vmulesh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003872{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003873#ifdef __LITTLE_ENDIAN__
3874 return __builtin_altivec_vmulosh(__a, __b);
3875#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003876 return __builtin_altivec_vmulesh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003877#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003878}
3879
3880/* vec_vmuleuh */
3881
3882static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003883vec_vmuleuh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003884{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003885#ifdef __LITTLE_ENDIAN__
3886 return __builtin_altivec_vmulouh(__a, __b);
3887#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003888 return __builtin_altivec_vmuleuh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003889#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003890}
3891
3892/* vec_mulo */
3893
3894static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003895vec_mulo(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003896{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003897#ifdef __LITTLE_ENDIAN__
3898 return __builtin_altivec_vmulesb(__a, __b);
3899#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003900 return __builtin_altivec_vmulosb(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003901#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003902}
3903
3904static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003905vec_mulo(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003906{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003907#ifdef __LITTLE_ENDIAN__
3908 return __builtin_altivec_vmuleub(__a, __b);
3909#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003910 return __builtin_altivec_vmuloub(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003911#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003912}
3913
3914static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003915vec_mulo(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003916{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003917#ifdef __LITTLE_ENDIAN__
3918 return __builtin_altivec_vmulesh(__a, __b);
3919#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003920 return __builtin_altivec_vmulosh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003921#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003922}
3923
3924static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003925vec_mulo(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003926{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003927#ifdef __LITTLE_ENDIAN__
3928 return __builtin_altivec_vmuleuh(__a, __b);
3929#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003930 return __builtin_altivec_vmulouh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003931#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003932}
3933
Stephen Hines3f868232015-04-10 09:22:19 -07003934#ifdef __POWER8_VECTOR__
3935static vector signed long long __ATTRS_o_ai
3936vec_mulo(vector signed int __a, vector signed int __b)
3937{
3938#ifdef __LITTLE_ENDIAN__
3939 return __builtin_altivec_vmulesw(__a, __b);
3940#else
3941 return __builtin_altivec_vmulosw(__a, __b);
3942#endif
3943}
3944
3945static vector unsigned long long __ATTRS_o_ai
3946vec_mulo(vector unsigned int __a, vector unsigned int __b)
3947{
3948#ifdef __LITTLE_ENDIAN__
3949 return __builtin_altivec_vmuleuw(__a, __b);
3950#else
3951 return __builtin_altivec_vmulouw(__a, __b);
3952#endif
3953}
3954#endif
3955
Ying Wangb335bb02011-11-29 10:23:55 -08003956/* vec_vmulosb */
3957
3958static vector short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003959vec_vmulosb(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003960{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003961#ifdef __LITTLE_ENDIAN__
3962 return __builtin_altivec_vmulesb(__a, __b);
3963#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003964 return __builtin_altivec_vmulosb(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003965#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003966}
3967
3968/* vec_vmuloub */
3969
3970static vector unsigned short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003971vec_vmuloub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003972{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003973#ifdef __LITTLE_ENDIAN__
3974 return __builtin_altivec_vmuleub(__a, __b);
3975#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003976 return __builtin_altivec_vmuloub(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003977#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003978}
3979
3980/* vec_vmulosh */
3981
3982static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003983vec_vmulosh(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003984{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003985#ifdef __LITTLE_ENDIAN__
3986 return __builtin_altivec_vmulesh(__a, __b);
3987#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003988 return __builtin_altivec_vmulosh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07003989#endif
Ying Wangb335bb02011-11-29 10:23:55 -08003990}
3991
3992/* vec_vmulouh */
3993
3994static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07003995vec_vmulouh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08003996{
Stephen Hines990d2fc2014-07-23 10:40:48 -07003997#ifdef __LITTLE_ENDIAN__
3998 return __builtin_altivec_vmuleuh(__a, __b);
3999#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004000 return __builtin_altivec_vmulouh(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004001#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004002}
4003
4004/* vec_nmsub */
4005
4006static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004007vec_nmsub(vector float __a, vector float __b, vector float __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004008{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004009 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08004010}
4011
4012/* vec_vnmsubfp */
4013
4014static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004015vec_vnmsubfp(vector float __a, vector float __b, vector float __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004016{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004017 return __builtin_altivec_vnmsubfp(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08004018}
4019
4020/* vec_nor */
4021
4022#define __builtin_altivec_vnor vec_nor
4023
4024static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004025vec_nor(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004026{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004027 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004028}
4029
4030static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004031vec_nor(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004032{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004033 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004034}
4035
4036static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004037vec_nor(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004038{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004039 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004040}
4041
4042static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004043vec_nor(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004044{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004045 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004046}
4047
4048static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004049vec_nor(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004050{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004051 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004052}
4053
4054static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004055vec_nor(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004056{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004057 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004058}
4059
4060static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004061vec_nor(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004062{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004063 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004064}
4065
4066static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004067vec_nor(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004068{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004069 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004070}
4071
4072static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004073vec_nor(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004074{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004075 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004076}
4077
4078static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004079vec_nor(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004080{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004081 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4082 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004083}
4084
4085/* vec_vnor */
4086
4087static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004088vec_vnor(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004089{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004090 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004091}
4092
4093static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004094vec_vnor(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004095{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004096 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004097}
4098
4099static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004100vec_vnor(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004101{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004102 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004103}
4104
4105static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004106vec_vnor(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004107{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004108 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004109}
4110
4111static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004112vec_vnor(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004113{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004114 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004115}
4116
4117static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004118vec_vnor(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004119{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004120 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004121}
4122
4123static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004124vec_vnor(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004125{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004126 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004127}
4128
4129static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004130vec_vnor(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004131{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004132 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004133}
4134
4135static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004136vec_vnor(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004137{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004138 return ~(__a | __b);
Ying Wangb335bb02011-11-29 10:23:55 -08004139}
4140
4141static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004142vec_vnor(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004143{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004144 vector unsigned int __res = ~((vector unsigned int)__a | (vector unsigned int)__b);
4145 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004146}
4147
4148/* vec_or */
4149
4150#define __builtin_altivec_vor vec_or
4151
4152static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004153vec_or(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004154{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004155 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004156}
4157
4158static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004159vec_or(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004160{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004161 return (vector signed char)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004162}
4163
4164static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004165vec_or(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004166{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004167 return __a | (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004168}
4169
4170static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004171vec_or(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004172{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004173 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004174}
4175
4176static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004177vec_or(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004178{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004179 return (vector unsigned char)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004180}
4181
4182static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004183vec_or(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004184{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004185 return __a | (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004186}
4187
4188static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004189vec_or(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004190{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004191 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004192}
4193
4194static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004195vec_or(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004196{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004197 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004198}
4199
4200static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004201vec_or(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004202{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004203 return (vector short)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004204}
4205
4206static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004207vec_or(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004208{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004209 return __a | (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004210}
4211
4212static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004213vec_or(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004214{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004215 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004216}
4217
4218static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004219vec_or(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004220{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004221 return (vector unsigned short)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004222}
4223
4224static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004225vec_or(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004226{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004227 return __a | (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004228}
4229
4230static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004231vec_or(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004232{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004233 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004234}
4235
4236static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004237vec_or(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004238{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004239 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004240}
4241
4242static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004243vec_or(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004244{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004245 return (vector int)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004246}
4247
4248static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004249vec_or(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004250{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004251 return __a | (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004252}
4253
4254static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004255vec_or(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004256{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004257 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004258}
4259
4260static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004261vec_or(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004262{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004263 return (vector unsigned int)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004264}
4265
4266static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004267vec_or(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004268{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004269 return __a | (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004270}
4271
4272static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004273vec_or(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004274{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004275 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004276}
4277
4278static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004279vec_or(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004280{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004281 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4282 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004283}
4284
4285static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004286vec_or(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004287{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004288 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4289 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004290}
4291
4292static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004293vec_or(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004294{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004295 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4296 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004297}
4298
4299/* vec_vor */
4300
4301static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004302vec_vor(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004303{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004304 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004305}
4306
4307static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004308vec_vor(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004309{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004310 return (vector signed char)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004311}
4312
4313static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004314vec_vor(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004315{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004316 return __a | (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004317}
4318
4319static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004320vec_vor(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004321{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004322 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004323}
4324
4325static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004326vec_vor(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004327{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004328 return (vector unsigned char)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004329}
4330
4331static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004332vec_vor(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004333{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004334 return __a | (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004335}
4336
4337static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004338vec_vor(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004339{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004340 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004341}
4342
4343static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004344vec_vor(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004345{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004346 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004347}
4348
4349static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004350vec_vor(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004351{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004352 return (vector short)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004353}
4354
4355static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004356vec_vor(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004357{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004358 return __a | (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004359}
4360
4361static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004362vec_vor(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004363{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004364 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004365}
4366
4367static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004368vec_vor(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004369{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004370 return (vector unsigned short)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004371}
4372
4373static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004374vec_vor(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004375{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004376 return __a | (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004377}
4378
4379static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004380vec_vor(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004381{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004382 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004383}
4384
4385static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004386vec_vor(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004387{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004388 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004389}
4390
4391static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004392vec_vor(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004393{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004394 return (vector int)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004395}
4396
4397static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004398vec_vor(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004399{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004400 return __a | (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004401}
4402
4403static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004404vec_vor(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004405{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004406 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004407}
4408
4409static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004410vec_vor(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004411{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004412 return (vector unsigned int)__a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004413}
4414
4415static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004416vec_vor(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004417{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004418 return __a | (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08004419}
4420
4421static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004422vec_vor(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004423{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004424 return __a | __b;
Ying Wangb335bb02011-11-29 10:23:55 -08004425}
4426
4427static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004428vec_vor(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004429{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004430 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4431 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004432}
4433
4434static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004435vec_vor(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004436{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004437 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4438 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004439}
4440
4441static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004442vec_vor(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004443{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004444 vector unsigned int __res = (vector unsigned int)__a | (vector unsigned int)__b;
4445 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08004446}
4447
4448/* vec_pack */
4449
Stephen Hines990d2fc2014-07-23 10:40:48 -07004450/* The various vector pack instructions have a big-endian bias, so for
4451 little endian we must handle reversed element numbering. */
4452
Ying Wangb335bb02011-11-29 10:23:55 -08004453static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004454vec_pack(vector signed short __a, vector signed short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004455{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004456#ifdef __LITTLE_ENDIAN__
4457 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4458 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4459 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4460#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004461 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004462 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4463 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004464#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004465}
4466
4467static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004468vec_pack(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004469{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004470#ifdef __LITTLE_ENDIAN__
4471 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4472 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4473 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4474#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004475 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004476 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4477 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004478#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004479}
4480
4481static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004482vec_pack(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004483{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004484#ifdef __LITTLE_ENDIAN__
4485 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4486 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4487 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4488#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004489 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004490 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4491 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004492#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004493}
4494
4495static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004496vec_pack(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004497{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004498#ifdef __LITTLE_ENDIAN__
4499 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4500 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4501 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4502#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004503 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004504 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4505 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004506#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004507}
4508
4509static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004510vec_pack(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004511{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004512#ifdef __LITTLE_ENDIAN__
4513 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4514 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4515 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4516#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004517 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004518 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4519 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004520#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004521}
4522
4523static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004524vec_pack(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004525{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004526#ifdef __LITTLE_ENDIAN__
4527 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4528 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4529 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4530#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004531 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004532 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4533 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004534#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004535}
4536
4537/* vec_vpkuhum */
4538
4539#define __builtin_altivec_vpkuhum vec_vpkuhum
4540
4541static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004542vec_vpkuhum(vector signed short __a, vector signed short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004543{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004544#ifdef __LITTLE_ENDIAN__
4545 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
4546 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4547 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4548#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004549 return (vector signed char)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004550 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4551 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004552#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004553}
4554
4555static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004556vec_vpkuhum(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004557{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004558#ifdef __LITTLE_ENDIAN__
4559 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
4560 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4561 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4562#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004563 return (vector unsigned char)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004564 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4565 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004566#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004567}
4568
4569static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004570vec_vpkuhum(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004571{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004572#ifdef __LITTLE_ENDIAN__
4573 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
4574 (0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E,
4575 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E));
4576#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004577 return (vector bool char)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004578 (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
4579 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004580#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004581}
4582
4583/* vec_vpkuwum */
4584
4585#define __builtin_altivec_vpkuwum vec_vpkuwum
4586
4587static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004588vec_vpkuwum(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004589{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004590#ifdef __LITTLE_ENDIAN__
4591 return (vector short)vec_perm(__a, __b, (vector unsigned char)
4592 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4593 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4594#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004595 return (vector short)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004596 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4597 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004598#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004599}
4600
4601static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004602vec_vpkuwum(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004603{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004604#ifdef __LITTLE_ENDIAN__
4605 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
4606 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4607 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4608#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004609 return (vector unsigned short)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004610 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4611 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004612#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004613}
4614
4615static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004616vec_vpkuwum(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004617{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004618#ifdef __LITTLE_ENDIAN__
4619 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
4620 (0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D,
4621 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D));
4622#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004623 return (vector bool short)vec_perm(__a, __b, (vector unsigned char)
Ying Wangb335bb02011-11-29 10:23:55 -08004624 (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,
4625 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));
Stephen Hines990d2fc2014-07-23 10:40:48 -07004626#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004627}
4628
4629/* vec_packpx */
4630
4631static vector pixel __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004632vec_packpx(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004633{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004634#ifdef __LITTLE_ENDIAN__
4635 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4636#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004637 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004638#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004639}
4640
4641/* vec_vpkpx */
4642
4643static vector pixel __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004644vec_vpkpx(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004645{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004646#ifdef __LITTLE_ENDIAN__
4647 return (vector pixel)__builtin_altivec_vpkpx(__b, __a);
4648#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004649 return (vector pixel)__builtin_altivec_vpkpx(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004650#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004651}
4652
4653/* vec_packs */
4654
4655static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004656vec_packs(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004657{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004658#ifdef __LITTLE_ENDIAN__
4659 return __builtin_altivec_vpkshss(__b, __a);
4660#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004661 return __builtin_altivec_vpkshss(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004662#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004663}
4664
4665static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004666vec_packs(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004667{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004668#ifdef __LITTLE_ENDIAN__
4669 return __builtin_altivec_vpkuhus(__b, __a);
4670#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004671 return __builtin_altivec_vpkuhus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004672#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004673}
4674
4675static vector signed short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004676vec_packs(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004677{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004678#ifdef __LITTLE_ENDIAN__
4679 return __builtin_altivec_vpkswss(__b, __a);
4680#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004681 return __builtin_altivec_vpkswss(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004682#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004683}
4684
4685static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004686vec_packs(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004687{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004688#ifdef __LITTLE_ENDIAN__
4689 return __builtin_altivec_vpkuwus(__b, __a);
4690#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004691 return __builtin_altivec_vpkuwus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004692#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004693}
4694
4695/* vec_vpkshss */
4696
4697static vector signed char __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004698vec_vpkshss(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004699{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004700#ifdef __LITTLE_ENDIAN__
4701 return __builtin_altivec_vpkshss(__b, __a);
4702#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004703 return __builtin_altivec_vpkshss(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004704#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004705}
4706
4707/* vec_vpkuhus */
4708
4709static vector unsigned char __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004710vec_vpkuhus(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004711{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004712#ifdef __LITTLE_ENDIAN__
4713 return __builtin_altivec_vpkuhus(__b, __a);
4714#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004715 return __builtin_altivec_vpkuhus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004716#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004717}
4718
4719/* vec_vpkswss */
4720
4721static vector signed short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004722vec_vpkswss(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004723{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004724#ifdef __LITTLE_ENDIAN__
4725 return __builtin_altivec_vpkswss(__b, __a);
4726#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004727 return __builtin_altivec_vpkswss(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004728#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004729}
4730
4731/* vec_vpkuwus */
4732
4733static vector unsigned short __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004734vec_vpkuwus(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004735{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004736#ifdef __LITTLE_ENDIAN__
4737 return __builtin_altivec_vpkuwus(__b, __a);
4738#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004739 return __builtin_altivec_vpkuwus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004740#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004741}
4742
4743/* vec_packsu */
4744
4745static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004746vec_packsu(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004747{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004748#ifdef __LITTLE_ENDIAN__
4749 return __builtin_altivec_vpkshus(__b, __a);
4750#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004751 return __builtin_altivec_vpkshus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004752#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004753}
4754
4755static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004756vec_packsu(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004757{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004758#ifdef __LITTLE_ENDIAN__
4759 return __builtin_altivec_vpkuhus(__b, __a);
4760#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004761 return __builtin_altivec_vpkuhus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004762#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004763}
4764
4765static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004766vec_packsu(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004767{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004768#ifdef __LITTLE_ENDIAN__
4769 return __builtin_altivec_vpkswus(__b, __a);
4770#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004771 return __builtin_altivec_vpkswus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004772#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004773}
4774
4775static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004776vec_packsu(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004777{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004778#ifdef __LITTLE_ENDIAN__
4779 return __builtin_altivec_vpkuwus(__b, __a);
4780#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004781 return __builtin_altivec_vpkuwus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004782#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004783}
4784
4785/* vec_vpkshus */
4786
4787static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004788vec_vpkshus(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004789{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004790#ifdef __LITTLE_ENDIAN__
4791 return __builtin_altivec_vpkshus(__b, __a);
4792#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004793 return __builtin_altivec_vpkshus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004794#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004795}
4796
4797static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004798vec_vpkshus(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004799{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004800#ifdef __LITTLE_ENDIAN__
4801 return __builtin_altivec_vpkuhus(__b, __a);
4802#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004803 return __builtin_altivec_vpkuhus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004804#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004805}
4806
4807/* vec_vpkswus */
4808
4809static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004810vec_vpkswus(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004811{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004812#ifdef __LITTLE_ENDIAN__
4813 return __builtin_altivec_vpkswus(__b, __a);
4814#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004815 return __builtin_altivec_vpkswus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004816#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004817}
4818
4819static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004820vec_vpkswus(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08004821{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004822#ifdef __LITTLE_ENDIAN__
4823 return __builtin_altivec_vpkuwus(__b, __a);
4824#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004825 return __builtin_altivec_vpkuwus(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004826#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004827}
4828
4829/* vec_perm */
4830
Stephen Hines990d2fc2014-07-23 10:40:48 -07004831// The vperm instruction is defined architecturally with a big-endian bias.
4832// For little endian, we swap the input operands and invert the permute
4833// control vector. Only the rightmost 5 bits matter, so we could use
4834// a vector of all 31s instead of all 255s to perform the inversion.
4835// However, when the PCV is not a constant, using 255 has an advantage
4836// in that the vec_xor can be recognized as a vec_nor (and for P8 and
4837// later, possibly a vec_nand).
4838
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004839static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004840vec_perm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004841{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004842#ifdef __LITTLE_ENDIAN__
4843 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4844 255,255,255,255,255,255,255,255};
4845 __d = vec_xor(__c, __d);
4846 return (vector signed char)
4847 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4848#else
Ying Wangb335bb02011-11-29 10:23:55 -08004849 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004850 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004851#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004852}
4853
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004854static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004855vec_perm(vector unsigned char __a,
4856 vector unsigned char __b,
4857 vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004858{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004859#ifdef __LITTLE_ENDIAN__
4860 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4861 255,255,255,255,255,255,255,255};
4862 __d = vec_xor(__c, __d);
4863 return (vector unsigned char)
4864 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4865#else
Ying Wangb335bb02011-11-29 10:23:55 -08004866 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004867 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004868#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004869}
4870
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004871static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004872vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004873{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004874#ifdef __LITTLE_ENDIAN__
4875 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4876 255,255,255,255,255,255,255,255};
4877 __d = vec_xor(__c, __d);
4878 return (vector bool char)
4879 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4880#else
Ying Wangb335bb02011-11-29 10:23:55 -08004881 return (vector bool char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004882 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004883#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004884}
4885
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004886static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004887vec_perm(vector short __a, vector short __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004888{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004889#ifdef __LITTLE_ENDIAN__
4890 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4891 255,255,255,255,255,255,255,255};
4892 __d = vec_xor(__c, __d);
4893 return (vector short)
4894 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4895#else
Ying Wangb335bb02011-11-29 10:23:55 -08004896 return (vector short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004897 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004898#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004899}
4900
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004901static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004902vec_perm(vector unsigned short __a,
4903 vector unsigned short __b,
4904 vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004905{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004906#ifdef __LITTLE_ENDIAN__
4907 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4908 255,255,255,255,255,255,255,255};
4909 __d = vec_xor(__c, __d);
4910 return (vector unsigned short)
4911 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4912#else
Ying Wangb335bb02011-11-29 10:23:55 -08004913 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004914 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004915#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004916}
4917
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004918static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004919vec_perm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004920{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004921#ifdef __LITTLE_ENDIAN__
4922 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4923 255,255,255,255,255,255,255,255};
4924 __d = vec_xor(__c, __d);
4925 return (vector bool short)
4926 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4927#else
Ying Wangb335bb02011-11-29 10:23:55 -08004928 return (vector bool short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004929 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004930#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004931}
4932
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004933static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004934vec_perm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004935{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004936#ifdef __LITTLE_ENDIAN__
4937 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4938 255,255,255,255,255,255,255,255};
4939 __d = vec_xor(__c, __d);
4940 return (vector pixel)
4941 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4942#else
Ying Wangb335bb02011-11-29 10:23:55 -08004943 return (vector pixel)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004944 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004945#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004946}
4947
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004948static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004949vec_perm(vector int __a, vector int __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004950{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004951#ifdef __LITTLE_ENDIAN__
4952 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4953 255,255,255,255,255,255,255,255};
4954 __d = vec_xor(__c, __d);
4955 return (vector int)__builtin_altivec_vperm_4si(__b, __a, __d);
4956#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004957 return (vector int)__builtin_altivec_vperm_4si(__a, __b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004958#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004959}
4960
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004961static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004962vec_perm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004963{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004964#ifdef __LITTLE_ENDIAN__
4965 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4966 255,255,255,255,255,255,255,255};
4967 __d = vec_xor(__c, __d);
4968 return (vector unsigned int)
4969 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4970#else
Ying Wangb335bb02011-11-29 10:23:55 -08004971 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004972 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004973#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004974}
4975
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004976static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004977vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004978{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004979#ifdef __LITTLE_ENDIAN__
4980 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4981 255,255,255,255,255,255,255,255};
4982 __d = vec_xor(__c, __d);
4983 return (vector bool int)
4984 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
4985#else
Ying Wangb335bb02011-11-29 10:23:55 -08004986 return (vector bool int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004987 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07004988#endif
Ying Wangb335bb02011-11-29 10:23:55 -08004989}
4990
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07004991static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07004992vec_perm(vector float __a, vector float __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08004993{
Stephen Hines990d2fc2014-07-23 10:40:48 -07004994#ifdef __LITTLE_ENDIAN__
4995 vector unsigned char __d = {255,255,255,255,255,255,255,255,
4996 255,255,255,255,255,255,255,255};
4997 __d = vec_xor(__c, __d);
4998 return (vector float)
4999 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5000#else
Ying Wangb335bb02011-11-29 10:23:55 -08005001 return (vector float)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005002 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
Stephen Hines990d2fc2014-07-23 10:40:48 -07005003#endif
Ying Wangb335bb02011-11-29 10:23:55 -08005004}
5005
Stephen Hinesee4ca282014-12-02 17:05:12 -08005006#ifdef __VSX__
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07005007static vector long long __ATTRS_o_ai
Stephen Hinesee4ca282014-12-02 17:05:12 -08005008vec_perm(vector long long __a, vector long long __b, vector unsigned char __c)
5009{
5010#ifdef __LITTLE_ENDIAN__
5011 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5012 255,255,255,255,255,255,255,255};
5013 __d = vec_xor(__c, __d);
5014 return (vector long long)__builtin_altivec_vperm_4si(__b, __a, __d);
5015#else
5016 return (vector long long)__builtin_altivec_vperm_4si(__a, __b, __c);
5017#endif
5018}
5019
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07005020static vector unsigned long long __ATTRS_o_ai
Stephen Hinesee4ca282014-12-02 17:05:12 -08005021vec_perm(vector unsigned long long __a, vector unsigned long long __b,
5022 vector unsigned char __c)
5023{
5024#ifdef __LITTLE_ENDIAN__
5025 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5026 255,255,255,255,255,255,255,255};
5027 __d = vec_xor(__c, __d);
5028 return (vector unsigned long long)
5029 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5030#else
5031 return (vector unsigned long long)
5032 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
5033#endif
5034}
5035
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07005036static vector double __ATTRS_o_ai
Stephen Hinesee4ca282014-12-02 17:05:12 -08005037vec_perm(vector double __a, vector double __b, vector unsigned char __c)
5038{
5039#ifdef __LITTLE_ENDIAN__
5040 vector unsigned char __d = {255,255,255,255,255,255,255,255,
5041 255,255,255,255,255,255,255,255};
5042 __d = vec_xor(__c, __d);
5043 return (vector double)
5044 __builtin_altivec_vperm_4si((vector int)__b, (vector int)__a, __d);
5045#else
5046 return (vector double)
5047 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__b, __c);
5048#endif
5049}
5050#endif
5051
Ying Wangb335bb02011-11-29 10:23:55 -08005052/* vec_vperm */
5053
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005054static vector signed char __ATTRS_o_ai
5055vec_vperm(vector signed char __a, vector signed char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005056{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005057 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005058}
5059
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005060static vector unsigned char __ATTRS_o_ai
5061vec_vperm(vector unsigned char __a,
5062 vector unsigned char __b,
5063 vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005064{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005065 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005066}
5067
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005068static vector bool char __ATTRS_o_ai
5069vec_vperm(vector bool char __a, vector bool char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005070{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005071 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005072}
5073
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005074static vector short __ATTRS_o_ai
5075vec_vperm(vector short __a, vector short __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005076{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005077 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005078}
5079
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005080static vector unsigned short __ATTRS_o_ai
5081vec_vperm(vector unsigned short __a,
5082 vector unsigned short __b,
5083 vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005084{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005085 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005086}
5087
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005088static vector bool short __ATTRS_o_ai
5089vec_vperm(vector bool short __a, vector bool short __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005090{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005091 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005092}
5093
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005094static vector pixel __ATTRS_o_ai
5095vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005096{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005097 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005098}
5099
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005100static vector int __ATTRS_o_ai
5101vec_vperm(vector int __a, vector int __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005102{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005103 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005104}
5105
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005106static vector unsigned int __ATTRS_o_ai
5107vec_vperm(vector unsigned int __a, vector unsigned int __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005108{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005109 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005110}
5111
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005112static vector bool int __ATTRS_o_ai
5113vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005114{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005115 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005116}
5117
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005118static vector float __ATTRS_o_ai
5119vec_vperm(vector float __a, vector float __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005120{
Stephen Hines990d2fc2014-07-23 10:40:48 -07005121 return vec_perm(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005122}
5123
Stephen Hinesee4ca282014-12-02 17:05:12 -08005124#ifdef __VSX__
5125static vector long long __ATTRS_o_ai
5126vec_vperm(vector long long __a, vector long long __b, vector unsigned char __c)
5127{
5128 return vec_perm(__a, __b, __c);
5129}
5130
5131static vector unsigned long long __ATTRS_o_ai
5132vec_vperm(vector unsigned long long __a, vector unsigned long long __b,
5133 vector unsigned char __c)
5134{
5135 return vec_perm(__a, __b, __c);
5136}
5137
5138static vector double __ATTRS_o_ai
5139vec_vperm(vector double __a, vector double __b, vector unsigned char __c)
5140{
5141 return vec_perm(__a, __b, __c);
5142}
5143#endif
5144
Ying Wangb335bb02011-11-29 10:23:55 -08005145/* vec_re */
5146
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005147static vector float __attribute__((__always_inline__))
5148vec_re(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08005149{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005150 return __builtin_altivec_vrefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08005151}
5152
5153/* vec_vrefp */
5154
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005155static vector float __attribute__((__always_inline__))
5156vec_vrefp(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08005157{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005158 return __builtin_altivec_vrefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08005159}
5160
5161/* vec_rl */
5162
5163static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005164vec_rl(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005165{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005166 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005167}
5168
5169static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005170vec_rl(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005171{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005172 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005173}
5174
5175static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005176vec_rl(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005177{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005178 return __builtin_altivec_vrlh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005179}
5180
5181static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005182vec_rl(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005183{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005184 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005185}
5186
5187static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005188vec_rl(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005189{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005190 return __builtin_altivec_vrlw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005191}
5192
5193static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005194vec_rl(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005195{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005196 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005197}
5198
Stephen Hines3f868232015-04-10 09:22:19 -07005199#ifdef __POWER8_VECTOR__
5200static vector signed long long __ATTRS_o_ai
5201vec_rl(vector signed long long __a, vector unsigned long long __b)
5202{
5203 return __builtin_altivec_vrld(__a, __b);
5204}
5205
5206static vector unsigned long long __ATTRS_o_ai
5207vec_rl(vector unsigned long long __a, vector unsigned long long __b)
5208{
5209 return __builtin_altivec_vrld(__a, __b);
5210}
5211#endif
5212
Ying Wangb335bb02011-11-29 10:23:55 -08005213/* vec_vrlb */
5214
5215static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005216vec_vrlb(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005217{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005218 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005219}
5220
5221static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005222vec_vrlb(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005223{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005224 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005225}
5226
5227/* vec_vrlh */
5228
5229static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005230vec_vrlh(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005231{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005232 return __builtin_altivec_vrlh(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005233}
5234
5235static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005236vec_vrlh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005237{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005238 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005239}
5240
5241/* vec_vrlw */
5242
5243static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005244vec_vrlw(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005245{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005246 return __builtin_altivec_vrlw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005247}
5248
5249static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005250vec_vrlw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005251{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005252 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005253}
5254
5255/* vec_round */
5256
5257static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005258vec_round(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08005259{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005260 return __builtin_altivec_vrfin(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08005261}
5262
5263/* vec_vrfin */
5264
5265static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005266vec_vrfin(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08005267{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005268 return __builtin_altivec_vrfin(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08005269}
5270
5271/* vec_rsqrte */
5272
5273static __vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005274vec_rsqrte(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08005275{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005276 return __builtin_altivec_vrsqrtefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08005277}
5278
5279/* vec_vrsqrtefp */
5280
5281static __vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005282vec_vrsqrtefp(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08005283{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005284 return __builtin_altivec_vrsqrtefp(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08005285}
5286
5287/* vec_sel */
5288
5289#define __builtin_altivec_vsel_4si vec_sel
5290
5291static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005292vec_sel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005293{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005294 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005295}
5296
5297static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005298vec_sel(vector signed char __a, vector signed char __b, vector bool char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005299{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005300 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005301}
5302
5303static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005304vec_sel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005305{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005306 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005307}
5308
5309static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005310vec_sel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005311{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005312 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005313}
5314
5315static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005316vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005317{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005318 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005319}
5320
5321static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005322vec_sel(vector bool char __a, vector bool char __b, vector bool char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005323{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005324 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005325}
5326
5327static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005328vec_sel(vector short __a, vector short __b, vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005329{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005330 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005331}
5332
5333static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005334vec_sel(vector short __a, vector short __b, vector bool short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005335{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005336 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005337}
5338
5339static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005340vec_sel(vector unsigned short __a,
5341 vector unsigned short __b,
5342 vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005343{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005344 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005345}
5346
5347static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005348vec_sel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005349{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005350 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005351}
5352
5353static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005354vec_sel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005355{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005356 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005357}
5358
5359static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005360vec_sel(vector bool short __a, vector bool short __b, vector bool short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005361{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005362 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005363}
5364
5365static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005366vec_sel(vector int __a, vector int __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005367{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005368 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005369}
5370
5371static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005372vec_sel(vector int __a, vector int __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005373{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005374 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005375}
5376
5377static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005378vec_sel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005379{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005380 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005381}
5382
5383static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005384vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005385{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005386 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005387}
5388
5389static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005390vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005391{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005392 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005393}
5394
5395static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005396vec_sel(vector bool int __a, vector bool int __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005397{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005398 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005399}
5400
5401static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005402vec_sel(vector float __a, vector float __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005403{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005404 vector int __res = ((vector int)__a & ~(vector int)__c)
5405 | ((vector int)__b & (vector int)__c);
5406 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08005407}
5408
5409static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005410vec_sel(vector float __a, vector float __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005411{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005412 vector int __res = ((vector int)__a & ~(vector int)__c)
5413 | ((vector int)__b & (vector int)__c);
5414 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08005415}
5416
5417/* vec_vsel */
5418
5419static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005420vec_vsel(vector signed char __a, vector signed char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005421{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005422 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005423}
5424
5425static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005426vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005427{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005428 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005429}
5430
5431static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005432vec_vsel(vector unsigned char __a, vector unsigned char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005433{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005434 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005435}
5436
5437static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005438vec_vsel(vector unsigned char __a, vector unsigned char __b, vector bool char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005439{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005440 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005441}
5442
5443static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005444vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005445{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005446 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005447}
5448
5449static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005450vec_vsel(vector bool char __a, vector bool char __b, vector bool char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005451{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005452 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005453}
5454
5455static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005456vec_vsel(vector short __a, vector short __b, vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005457{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005458 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005459}
5460
5461static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005462vec_vsel(vector short __a, vector short __b, vector bool short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005463{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005464 return (__a & ~(vector short)__c) | (__b & (vector short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005465}
5466
5467static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005468vec_vsel(vector unsigned short __a,
5469 vector unsigned short __b,
5470 vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005471{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005472 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005473}
5474
5475static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005476vec_vsel(vector unsigned short __a, vector unsigned short __b, vector bool short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005477{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005478 return (__a & ~(vector unsigned short)__c) | (__b & (vector unsigned short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005479}
5480
5481static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005482vec_vsel(vector bool short __a, vector bool short __b, vector unsigned short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005483{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005484 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005485}
5486
5487static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005488vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005489{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005490 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005491}
5492
5493static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005494vec_vsel(vector int __a, vector int __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005495{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005496 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005497}
5498
5499static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005500vec_vsel(vector int __a, vector int __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005501{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005502 return (__a & ~(vector int)__c) | (__b & (vector int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005503}
5504
5505static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005506vec_vsel(vector unsigned int __a, vector unsigned int __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005507{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005508 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005509}
5510
5511static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005512vec_vsel(vector unsigned int __a, vector unsigned int __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005513{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005514 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005515}
5516
5517static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005518vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005519{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005520 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c);
Ying Wangb335bb02011-11-29 10:23:55 -08005521}
5522
5523static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005524vec_vsel(vector bool int __a, vector bool int __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005525{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005526 return (__a & ~__c) | (__b & __c);
Ying Wangb335bb02011-11-29 10:23:55 -08005527}
5528
5529static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005530vec_vsel(vector float __a, vector float __b, vector unsigned int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005531{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005532 vector int __res = ((vector int)__a & ~(vector int)__c)
5533 | ((vector int)__b & (vector int)__c);
5534 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08005535}
5536
5537static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005538vec_vsel(vector float __a, vector float __b, vector bool int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005539{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005540 vector int __res = ((vector int)__a & ~(vector int)__c)
5541 | ((vector int)__b & (vector int)__c);
5542 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08005543}
5544
5545/* vec_sl */
5546
5547static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005548vec_sl(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005549{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005550 return __a << (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08005551}
5552
5553static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005554vec_sl(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005555{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005556 return __a << __b;
Ying Wangb335bb02011-11-29 10:23:55 -08005557}
5558
5559static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005560vec_sl(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005561{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005562 return __a << (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08005563}
5564
5565static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005566vec_sl(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005567{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005568 return __a << __b;
Ying Wangb335bb02011-11-29 10:23:55 -08005569}
5570
5571static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005572vec_sl(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005573{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005574 return __a << (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08005575}
5576
5577static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005578vec_sl(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005579{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005580 return __a << __b;
Ying Wangb335bb02011-11-29 10:23:55 -08005581}
5582
Stephen Hines3f868232015-04-10 09:22:19 -07005583#ifdef __POWER8_VECTOR__
5584static vector signed long long __ATTRS_o_ai
5585vec_sl(vector signed long long __a, vector unsigned long long __b)
5586{
5587 return __a << (vector long long)__b;
5588}
5589
5590static vector unsigned long long __ATTRS_o_ai
5591vec_sl(vector unsigned long long __a, vector unsigned long long __b)
5592{
5593 return __a << __b;
5594}
5595#endif
5596
Ying Wangb335bb02011-11-29 10:23:55 -08005597/* vec_vslb */
5598
5599#define __builtin_altivec_vslb vec_vslb
5600
5601static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005602vec_vslb(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005603{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005604 return vec_sl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005605}
5606
5607static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005608vec_vslb(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005609{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005610 return vec_sl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005611}
5612
5613/* vec_vslh */
5614
5615#define __builtin_altivec_vslh vec_vslh
5616
5617static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005618vec_vslh(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005619{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005620 return vec_sl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005621}
5622
5623static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005624vec_vslh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005625{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005626 return vec_sl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005627}
5628
5629/* vec_vslw */
5630
5631#define __builtin_altivec_vslw vec_vslw
5632
5633static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005634vec_vslw(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005635{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005636 return vec_sl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005637}
5638
5639static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005640vec_vslw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005641{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005642 return vec_sl(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08005643}
5644
5645/* vec_sld */
5646
5647#define __builtin_altivec_vsldoi_4si vec_sld
5648
5649static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005650vec_sld(vector signed char __a, vector signed char __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005651{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005652 return vec_perm(__a, __b, (vector unsigned char)
5653 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5654 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005655}
5656
5657static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005658vec_sld(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005659{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005660 return vec_perm(__a, __b, (vector unsigned char)
5661 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5662 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005663}
5664
5665static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005666vec_sld(vector short __a, vector short __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005667{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005668 return vec_perm(__a, __b, (vector unsigned char)
5669 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5670 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005671}
5672
5673static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005674vec_sld(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005675{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005676 return vec_perm(__a, __b, (vector unsigned char)
5677 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5678 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005679}
5680
5681static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005682vec_sld(vector pixel __a, vector pixel __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005683{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005684 return vec_perm(__a, __b, (vector unsigned char)
5685 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5686 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005687}
5688
5689static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005690vec_sld(vector int __a, vector int __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005691{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005692 return vec_perm(__a, __b, (vector unsigned char)
5693 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5694 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005695}
5696
5697static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005698vec_sld(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005699{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005700 return vec_perm(__a, __b, (vector unsigned char)
5701 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5702 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005703}
5704
5705static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005706vec_sld(vector float __a, vector float __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005707{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005708 return vec_perm(__a, __b, (vector unsigned char)
5709 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5710 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005711}
5712
5713/* vec_vsldoi */
5714
5715static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005716vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005717{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005718 return vec_perm(__a, __b, (vector unsigned char)
5719 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5720 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005721}
5722
5723static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005724vec_vsldoi(vector unsigned char __a, vector unsigned char __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005725{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005726 return vec_perm(__a, __b, (vector unsigned char)
5727 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5728 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005729}
5730
5731static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005732vec_vsldoi(vector short __a, vector short __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005733{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005734 return vec_perm(__a, __b, (vector unsigned char)
5735 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5736 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005737}
5738
5739static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005740vec_vsldoi(vector unsigned short __a, vector unsigned short __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005741{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005742 return vec_perm(__a, __b, (vector unsigned char)
5743 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5744 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005745}
5746
5747static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005748vec_vsldoi(vector pixel __a, vector pixel __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005749{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005750 return vec_perm(__a, __b, (vector unsigned char)
5751 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5752 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005753}
5754
5755static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005756vec_vsldoi(vector int __a, vector int __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005757{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005758 return vec_perm(__a, __b, (vector unsigned char)
5759 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5760 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005761}
5762
5763static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005764vec_vsldoi(vector unsigned int __a, vector unsigned int __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005765{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005766 return vec_perm(__a, __b, (vector unsigned char)
5767 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5768 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005769}
5770
5771static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005772vec_vsldoi(vector float __a, vector float __b, unsigned char __c)
Ying Wangb335bb02011-11-29 10:23:55 -08005773{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005774 return vec_perm(__a, __b, (vector unsigned char)
5775 (__c, __c+1, __c+2, __c+3, __c+4, __c+5, __c+6, __c+7,
5776 __c+8, __c+9, __c+10, __c+11, __c+12, __c+13, __c+14, __c+15));
Ying Wangb335bb02011-11-29 10:23:55 -08005777}
5778
5779/* vec_sll */
5780
5781static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005782vec_sll(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005783{
5784 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005785 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005786}
5787
5788static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005789vec_sll(vector signed char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005790{
5791 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005792 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005793}
5794
5795static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005796vec_sll(vector signed char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005797{
5798 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005799 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005800}
5801
5802static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005803vec_sll(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005804{
5805 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005806 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005807}
5808
5809static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005810vec_sll(vector unsigned char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005811{
5812 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005813 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005814}
5815
5816static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005817vec_sll(vector unsigned char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005818{
5819 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005820 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005821}
5822
5823static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005824vec_sll(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005825{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005826 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005827}
5828
5829static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005830vec_sll(vector bool char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005831{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005832 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005833}
5834
5835static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005836vec_sll(vector bool char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005837{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005838 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005839}
5840
5841static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005842vec_sll(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005843{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005844 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005845}
5846
5847static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005848vec_sll(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005849{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005850 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005851}
5852
5853static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005854vec_sll(vector short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005855{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005856 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005857}
5858
5859static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005860vec_sll(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005861{
5862 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005863 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005864}
5865
5866static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005867vec_sll(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005868{
5869 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005870 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005871}
5872
5873static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005874vec_sll(vector unsigned short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005875{
5876 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005877 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005878}
5879
5880static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005881vec_sll(vector bool short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005882{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005883 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005884}
5885
5886static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005887vec_sll(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005888{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005889 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005890}
5891
5892static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005893vec_sll(vector bool short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005894{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005895 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005896}
5897
5898static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005899vec_sll(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005900{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005901 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005902}
5903
5904static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005905vec_sll(vector pixel __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005906{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005907 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005908}
5909
5910static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005911vec_sll(vector pixel __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005912{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005913 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005914}
5915
5916static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005917vec_sll(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005918{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005919 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005920}
5921
5922static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005923vec_sll(vector int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005924{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005925 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005926}
5927
5928static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005929vec_sll(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005930{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005931 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005932}
5933
5934static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005935vec_sll(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005936{
5937 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005938 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005939}
5940
5941static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005942vec_sll(vector unsigned int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005943{
5944 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005945 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005946}
5947
5948static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005949vec_sll(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005950{
5951 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005952 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005953}
5954
5955static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005956vec_sll(vector bool int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005957{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005958 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005959}
5960
5961static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005962vec_sll(vector bool int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005963{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005964 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005965}
5966
5967static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005968vec_sll(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005969{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005970 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005971}
5972
5973/* vec_vsl */
5974
5975static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005976vec_vsl(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005977{
5978 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005979 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005980}
5981
5982static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005983vec_vsl(vector signed char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005984{
5985 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005986 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005987}
5988
5989static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005990vec_vsl(vector signed char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005991{
5992 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005993 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08005994}
5995
5996static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07005997vec_vsl(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08005998{
5999 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006000 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006001}
6002
6003static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006004vec_vsl(vector unsigned char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006005{
6006 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006007 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006008}
6009
6010static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006011vec_vsl(vector unsigned char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006012{
6013 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006014 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006015}
6016
6017static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006018vec_vsl(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006019{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006020 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006021}
6022
6023static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006024vec_vsl(vector bool char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006025{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006026 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006027}
6028
6029static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006030vec_vsl(vector bool char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006031{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006032 return (vector bool char)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006033}
6034
6035static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006036vec_vsl(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006037{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006038 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006039}
6040
6041static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006042vec_vsl(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006043{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006044 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006045}
6046
6047static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006048vec_vsl(vector short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006049{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006050 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006051}
6052
6053static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006054vec_vsl(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006055{
6056 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006057 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006058}
6059
6060static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006061vec_vsl(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006062{
6063 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006064 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006065}
6066
6067static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006068vec_vsl(vector unsigned short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006069{
6070 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006071 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006072}
6073
6074static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006075vec_vsl(vector bool short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006076{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006077 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006078}
6079
6080static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006081vec_vsl(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006082{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006083 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006084}
6085
6086static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006087vec_vsl(vector bool short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006088{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006089 return (vector bool short)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006090}
6091
6092static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006093vec_vsl(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006094{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006095 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006096}
6097
6098static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006099vec_vsl(vector pixel __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006100{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006101 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006102}
6103
6104static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006105vec_vsl(vector pixel __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006106{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006107 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006108}
6109
6110static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006111vec_vsl(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006112{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006113 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006114}
6115
6116static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006117vec_vsl(vector int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006118{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006119 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006120}
6121
6122static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006123vec_vsl(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006124{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006125 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006126}
6127
6128static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006129vec_vsl(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006130{
6131 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006132 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006133}
6134
6135static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006136vec_vsl(vector unsigned int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006137{
6138 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006139 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006140}
6141
6142static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006143vec_vsl(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006144{
6145 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006146 __builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006147}
6148
6149static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006150vec_vsl(vector bool int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006151{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006152 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006153}
6154
6155static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006156vec_vsl(vector bool int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006157{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006158 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006159}
6160
6161static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006162vec_vsl(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006163{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006164 return (vector bool int)__builtin_altivec_vsl((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006165}
6166
6167/* vec_slo */
6168
6169static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006170vec_slo(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006171{
6172 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006173 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006174}
6175
6176static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006177vec_slo(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006178{
6179 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006180 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006181}
6182
6183static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006184vec_slo(vector unsigned char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006185{
6186 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006187 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006188}
6189
6190static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006191vec_slo(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006192{
6193 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006194 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006195}
6196
6197static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006198vec_slo(vector short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006199{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006200 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006201}
6202
6203static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006204vec_slo(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006205{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006206 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006207}
6208
6209static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006210vec_slo(vector unsigned short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006211{
6212 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006213 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006214}
6215
6216static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006217vec_slo(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006218{
6219 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006220 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006221}
6222
6223static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006224vec_slo(vector pixel __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006225{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006226 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006227}
6228
6229static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006230vec_slo(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006231{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006232 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006233}
6234
6235static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006236vec_slo(vector int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006237{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006238 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006239}
6240
6241static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006242vec_slo(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006243{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006244 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006245}
6246
6247static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006248vec_slo(vector unsigned int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006249{
6250 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006251 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006252}
6253
6254static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006255vec_slo(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006256{
6257 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006258 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006259}
6260
6261static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006262vec_slo(vector float __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006263{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006264 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006265}
6266
6267static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006268vec_slo(vector float __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006269{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006270 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006271}
6272
6273/* vec_vslo */
6274
6275static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006276vec_vslo(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006277{
6278 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006279 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006280}
6281
6282static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006283vec_vslo(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006284{
6285 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006286 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006287}
6288
6289static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006290vec_vslo(vector unsigned char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006291{
6292 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006293 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006294}
6295
6296static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006297vec_vslo(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006298{
6299 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006300 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006301}
6302
6303static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006304vec_vslo(vector short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006305{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006306 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006307}
6308
6309static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006310vec_vslo(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006311{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006312 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006313}
6314
6315static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006316vec_vslo(vector unsigned short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006317{
6318 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006319 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006320}
6321
6322static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006323vec_vslo(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006324{
6325 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006326 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006327}
6328
6329static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006330vec_vslo(vector pixel __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006331{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006332 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006333}
6334
6335static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006336vec_vslo(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006337{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006338 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006339}
6340
6341static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006342vec_vslo(vector int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006343{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006344 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006345}
6346
6347static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006348vec_vslo(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006349{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006350 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006351}
6352
6353static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006354vec_vslo(vector unsigned int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006355{
6356 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006357 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006358}
6359
6360static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006361vec_vslo(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006362{
6363 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006364 __builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006365}
6366
6367static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006368vec_vslo(vector float __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006369{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006370 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006371}
6372
6373static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006374vec_vslo(vector float __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006375{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006376 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006377}
6378
6379/* vec_splat */
6380
6381static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006382vec_splat(vector signed char __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006383{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006384 return vec_perm(__a, __a, (vector unsigned char)(__b));
Ying Wangb335bb02011-11-29 10:23:55 -08006385}
6386
6387static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006388vec_splat(vector unsigned char __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006389{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006390 return vec_perm(__a, __a, (vector unsigned char)(__b));
Ying Wangb335bb02011-11-29 10:23:55 -08006391}
6392
6393static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006394vec_splat(vector bool char __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006395{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006396 return vec_perm(__a, __a, (vector unsigned char)(__b));
Ying Wangb335bb02011-11-29 10:23:55 -08006397}
6398
6399static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006400vec_splat(vector short __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006401{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006402 __b *= 2;
6403 unsigned char b1=__b+1;
6404 return vec_perm(__a, __a, (vector unsigned char)
6405 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006406}
6407
6408static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006409vec_splat(vector unsigned short __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006410{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006411 __b *= 2;
6412 unsigned char b1=__b+1;
6413 return vec_perm(__a, __a, (vector unsigned char)
6414 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006415}
6416
6417static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006418vec_splat(vector bool short __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006419{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006420 __b *= 2;
6421 unsigned char b1=__b+1;
6422 return vec_perm(__a, __a, (vector unsigned char)
6423 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006424}
6425
6426static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006427vec_splat(vector pixel __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006428{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006429 __b *= 2;
6430 unsigned char b1=__b+1;
6431 return vec_perm(__a, __a, (vector unsigned char)
6432 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006433}
6434
6435static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006436vec_splat(vector int __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006437{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006438 __b *= 4;
6439 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6440 return vec_perm(__a, __a, (vector unsigned char)
6441 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006442}
6443
6444static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006445vec_splat(vector unsigned int __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006446{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006447 __b *= 4;
6448 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6449 return vec_perm(__a, __a, (vector unsigned char)
6450 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006451}
6452
6453static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006454vec_splat(vector bool int __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006455{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006456 __b *= 4;
6457 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6458 return vec_perm(__a, __a, (vector unsigned char)
6459 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006460}
6461
6462static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006463vec_splat(vector float __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006464{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006465 __b *= 4;
6466 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6467 return vec_perm(__a, __a, (vector unsigned char)
6468 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006469}
6470
6471/* vec_vspltb */
6472
6473#define __builtin_altivec_vspltb vec_vspltb
6474
6475static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006476vec_vspltb(vector signed char __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006477{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006478 return vec_perm(__a, __a, (vector unsigned char)(__b));
Ying Wangb335bb02011-11-29 10:23:55 -08006479}
6480
6481static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006482vec_vspltb(vector unsigned char __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006483{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006484 return vec_perm(__a, __a, (vector unsigned char)(__b));
Ying Wangb335bb02011-11-29 10:23:55 -08006485}
6486
6487static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006488vec_vspltb(vector bool char __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006489{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006490 return vec_perm(__a, __a, (vector unsigned char)(__b));
Ying Wangb335bb02011-11-29 10:23:55 -08006491}
6492
6493/* vec_vsplth */
6494
6495#define __builtin_altivec_vsplth vec_vsplth
6496
6497static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006498vec_vsplth(vector short __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006499{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006500 __b *= 2;
6501 unsigned char b1=__b+1;
6502 return vec_perm(__a, __a, (vector unsigned char)
6503 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006504}
6505
6506static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006507vec_vsplth(vector unsigned short __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006508{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006509 __b *= 2;
6510 unsigned char b1=__b+1;
6511 return vec_perm(__a, __a, (vector unsigned char)
6512 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006513}
6514
6515static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006516vec_vsplth(vector bool short __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006517{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006518 __b *= 2;
6519 unsigned char b1=__b+1;
6520 return vec_perm(__a, __a, (vector unsigned char)
6521 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006522}
6523
6524static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006525vec_vsplth(vector pixel __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006526{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006527 __b *= 2;
6528 unsigned char b1=__b+1;
6529 return vec_perm(__a, __a, (vector unsigned char)
6530 (__b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1, __b, b1));
Ying Wangb335bb02011-11-29 10:23:55 -08006531}
6532
6533/* vec_vspltw */
6534
6535#define __builtin_altivec_vspltw vec_vspltw
6536
6537static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006538vec_vspltw(vector int __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006539{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006540 __b *= 4;
6541 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6542 return vec_perm(__a, __a, (vector unsigned char)
6543 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006544}
6545
6546static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006547vec_vspltw(vector unsigned int __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006548{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006549 __b *= 4;
6550 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6551 return vec_perm(__a, __a, (vector unsigned char)
6552 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006553}
6554
6555static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006556vec_vspltw(vector bool int __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006557{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006558 __b *= 4;
6559 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6560 return vec_perm(__a, __a, (vector unsigned char)
6561 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006562}
6563
6564static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006565vec_vspltw(vector float __a, unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006566{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006567 __b *= 4;
6568 unsigned char b1=__b+1, b2=__b+2, b3=__b+3;
6569 return vec_perm(__a, __a, (vector unsigned char)
6570 (__b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3, __b, b1, b2, b3));
Ying Wangb335bb02011-11-29 10:23:55 -08006571}
6572
6573/* vec_splat_s8 */
6574
6575#define __builtin_altivec_vspltisb vec_splat_s8
6576
6577// FIXME: parameter should be treated as 5-bit signed literal
6578static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006579vec_splat_s8(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006580{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006581 return (vector signed char)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006582}
6583
6584/* vec_vspltisb */
6585
6586// FIXME: parameter should be treated as 5-bit signed literal
6587static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006588vec_vspltisb(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006589{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006590 return (vector signed char)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006591}
6592
6593/* vec_splat_s16 */
6594
6595#define __builtin_altivec_vspltish vec_splat_s16
6596
6597// FIXME: parameter should be treated as 5-bit signed literal
6598static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006599vec_splat_s16(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006600{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006601 return (vector short)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006602}
6603
6604/* vec_vspltish */
6605
6606// FIXME: parameter should be treated as 5-bit signed literal
6607static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006608vec_vspltish(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006609{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006610 return (vector short)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006611}
6612
6613/* vec_splat_s32 */
6614
6615#define __builtin_altivec_vspltisw vec_splat_s32
6616
6617// FIXME: parameter should be treated as 5-bit signed literal
6618static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006619vec_splat_s32(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006620{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006621 return (vector int)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006622}
6623
6624/* vec_vspltisw */
6625
6626// FIXME: parameter should be treated as 5-bit signed literal
6627static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006628vec_vspltisw(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006629{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006630 return (vector int)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006631}
6632
6633/* vec_splat_u8 */
6634
6635// FIXME: parameter should be treated as 5-bit signed literal
6636static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006637vec_splat_u8(unsigned char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006638{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006639 return (vector unsigned char)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006640}
6641
6642/* vec_splat_u16 */
6643
6644// FIXME: parameter should be treated as 5-bit signed literal
6645static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006646vec_splat_u16(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006647{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006648 return (vector unsigned short)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006649}
6650
6651/* vec_splat_u32 */
6652
6653// FIXME: parameter should be treated as 5-bit signed literal
6654static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006655vec_splat_u32(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08006656{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006657 return (vector unsigned int)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08006658}
6659
6660/* vec_sr */
6661
6662static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006663vec_sr(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006664{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006665 return __a >> (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08006666}
6667
6668static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006669vec_sr(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006670{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006671 return __a >> __b;
Ying Wangb335bb02011-11-29 10:23:55 -08006672}
6673
6674static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006675vec_sr(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006676{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006677 return __a >> (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08006678}
6679
6680static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006681vec_sr(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006682{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006683 return __a >> __b;
Ying Wangb335bb02011-11-29 10:23:55 -08006684}
6685
6686static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006687vec_sr(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006688{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006689 return __a >> (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08006690}
6691
6692static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006693vec_sr(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006694{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006695 return __a >> __b;
Ying Wangb335bb02011-11-29 10:23:55 -08006696}
6697
Stephen Hines3f868232015-04-10 09:22:19 -07006698#ifdef __POWER8_VECTOR__
6699static vector signed long long __ATTRS_o_ai
6700vec_sr(vector signed long long __a, vector unsigned long long __b)
6701{
6702 return __a >> (vector long long)__b;
6703}
6704
6705static vector unsigned long long __ATTRS_o_ai
6706vec_sr(vector unsigned long long __a, vector unsigned long long __b)
6707{
6708 return __a >> __b;
6709}
6710#endif
6711
Ying Wangb335bb02011-11-29 10:23:55 -08006712/* vec_vsrb */
6713
6714#define __builtin_altivec_vsrb vec_vsrb
6715
6716static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006717vec_vsrb(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006718{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006719 return __a >> (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08006720}
6721
6722static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006723vec_vsrb(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006724{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006725 return __a >> __b;
Ying Wangb335bb02011-11-29 10:23:55 -08006726}
6727
6728/* vec_vsrh */
6729
6730#define __builtin_altivec_vsrh vec_vsrh
6731
6732static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006733vec_vsrh(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006734{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006735 return __a >> (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08006736}
6737
6738static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006739vec_vsrh(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006740{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006741 return __a >> __b;
Ying Wangb335bb02011-11-29 10:23:55 -08006742}
6743
6744/* vec_vsrw */
6745
6746#define __builtin_altivec_vsrw vec_vsrw
6747
6748static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006749vec_vsrw(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006750{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006751 return __a >> (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08006752}
6753
6754static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006755vec_vsrw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006756{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006757 return __a >> __b;
Ying Wangb335bb02011-11-29 10:23:55 -08006758}
6759
6760/* vec_sra */
6761
6762static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006763vec_sra(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006764{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006765 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006766}
6767
6768static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006769vec_sra(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006770{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006771 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006772}
6773
6774static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006775vec_sra(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006776{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006777 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006778}
6779
6780static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006781vec_sra(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006782{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006783 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006784}
6785
6786static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006787vec_sra(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006788{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006789 return __builtin_altivec_vsraw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006790}
6791
6792static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006793vec_sra(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006794{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006795 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006796}
6797
Stephen Hines3f868232015-04-10 09:22:19 -07006798#ifdef __POWER8_VECTOR__
6799static vector signed long long __ATTRS_o_ai
6800vec_sra(vector signed long long __a, vector unsigned long long __b)
6801{
6802 return __a >> __b;
6803}
6804
6805static vector unsigned long long __ATTRS_o_ai
6806vec_sra(vector unsigned long long __a, vector unsigned long long __b)
6807{
6808 return (vector unsigned long long) ( (vector signed long long) __a >> __b);
6809}
6810#endif
6811
Ying Wangb335bb02011-11-29 10:23:55 -08006812/* vec_vsrab */
6813
6814static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006815vec_vsrab(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006816{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006817 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006818}
6819
6820static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006821vec_vsrab(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006822{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006823 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006824}
6825
6826/* vec_vsrah */
6827
6828static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006829vec_vsrah(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006830{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006831 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006832}
6833
6834static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006835vec_vsrah(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006836{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006837 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006838}
6839
6840/* vec_vsraw */
6841
6842static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006843vec_vsraw(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006844{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006845 return __builtin_altivec_vsraw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006846}
6847
6848static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006849vec_vsraw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006850{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006851 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08006852}
6853
6854/* vec_srl */
6855
6856static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006857vec_srl(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006858{
6859 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006860 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006861}
6862
6863static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006864vec_srl(vector signed char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006865{
6866 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006867 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006868}
6869
6870static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006871vec_srl(vector signed char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006872{
6873 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006874 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006875}
6876
6877static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006878vec_srl(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006879{
6880 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006881 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006882}
6883
6884static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006885vec_srl(vector unsigned char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006886{
6887 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006888 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006889}
6890
6891static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006892vec_srl(vector unsigned char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006893{
6894 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006895 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006896}
6897
6898static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006899vec_srl(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006900{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006901 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006902}
6903
6904static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006905vec_srl(vector bool char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006906{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006907 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006908}
6909
6910static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006911vec_srl(vector bool char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006912{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006913 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006914}
6915
6916static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006917vec_srl(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006918{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006919 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006920}
6921
6922static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006923vec_srl(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006924{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006925 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006926}
6927
6928static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006929vec_srl(vector short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006930{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006931 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006932}
6933
6934static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006935vec_srl(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006936{
6937 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006938 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006939}
6940
6941static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006942vec_srl(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006943{
6944 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006945 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006946}
6947
6948static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006949vec_srl(vector unsigned short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006950{
6951 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006952 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006953}
6954
6955static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006956vec_srl(vector bool short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006957{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006958 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006959}
6960
6961static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006962vec_srl(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006963{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006964 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006965}
6966
6967static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006968vec_srl(vector bool short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006969{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006970 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006971}
6972
6973static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006974vec_srl(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006975{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006976 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006977}
6978
6979static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006980vec_srl(vector pixel __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006981{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006982 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006983}
6984
6985static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006986vec_srl(vector pixel __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006987{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006988 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006989}
6990
6991static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006992vec_srl(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006993{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006994 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08006995}
6996
6997static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07006998vec_srl(vector int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08006999{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007000 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007001}
7002
7003static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007004vec_srl(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007005{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007006 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007007}
7008
7009static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007010vec_srl(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007011{
7012 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007013 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007014}
7015
7016static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007017vec_srl(vector unsigned int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007018{
7019 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007020 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007021}
7022
7023static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007024vec_srl(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007025{
7026 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007027 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007028}
7029
7030static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007031vec_srl(vector bool int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007032{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007033 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007034}
7035
7036static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007037vec_srl(vector bool int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007038{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007039 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007040}
7041
7042static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007043vec_srl(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007044{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007045 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007046}
7047
7048/* vec_vsr */
7049
7050static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007051vec_vsr(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007052{
7053 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007054 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007055}
7056
7057static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007058vec_vsr(vector signed char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007059{
7060 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007061 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007062}
7063
7064static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007065vec_vsr(vector signed char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007066{
7067 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007068 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007069}
7070
7071static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007072vec_vsr(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007073{
7074 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007075 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007076}
7077
7078static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007079vec_vsr(vector unsigned char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007080{
7081 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007082 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007083}
7084
7085static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007086vec_vsr(vector unsigned char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007087{
7088 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007089 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007090}
7091
7092static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007093vec_vsr(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007094{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007095 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007096}
7097
7098static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007099vec_vsr(vector bool char __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007100{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007101 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007102}
7103
7104static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007105vec_vsr(vector bool char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007106{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007107 return (vector bool char)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007108}
7109
7110static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007111vec_vsr(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007112{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007113 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007114}
7115
7116static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007117vec_vsr(vector short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007118{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007119 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007120}
7121
7122static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007123vec_vsr(vector short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007124{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007125 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007126}
7127
7128static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007129vec_vsr(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007130{
7131 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007132 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007133}
7134
7135static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007136vec_vsr(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007137{
7138 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007139 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007140}
7141
7142static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007143vec_vsr(vector unsigned short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007144{
7145 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007146 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007147}
7148
7149static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007150vec_vsr(vector bool short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007151{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007152 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007153}
7154
7155static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007156vec_vsr(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007157{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007158 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007159}
7160
7161static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007162vec_vsr(vector bool short __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007163{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007164 return (vector bool short)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007165}
7166
7167static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007168vec_vsr(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007169{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007170 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007171}
7172
7173static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007174vec_vsr(vector pixel __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007175{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007176 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007177}
7178
7179static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007180vec_vsr(vector pixel __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007181{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007182 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007183}
7184
7185static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007186vec_vsr(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007187{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007188 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007189}
7190
7191static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007192vec_vsr(vector int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007193{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007194 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007195}
7196
7197static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007198vec_vsr(vector int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007199{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007200 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007201}
7202
7203static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007204vec_vsr(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007205{
7206 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007207 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007208}
7209
7210static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007211vec_vsr(vector unsigned int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007212{
7213 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007214 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007215}
7216
7217static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007218vec_vsr(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007219{
7220 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007221 __builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007222}
7223
7224static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007225vec_vsr(vector bool int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007226{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007227 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007228}
7229
7230static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007231vec_vsr(vector bool int __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007232{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007233 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007234}
7235
7236static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007237vec_vsr(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007238{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007239 return (vector bool int)__builtin_altivec_vsr((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007240}
7241
7242/* vec_sro */
7243
7244static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007245vec_sro(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007246{
7247 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007248 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007249}
7250
7251static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007252vec_sro(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007253{
7254 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007255 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007256}
7257
7258static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007259vec_sro(vector unsigned char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007260{
7261 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007262 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007263}
7264
7265static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007266vec_sro(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007267{
7268 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007269 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007270}
7271
7272static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007273vec_sro(vector short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007274{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007275 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007276}
7277
7278static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007279vec_sro(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007280{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007281 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007282}
7283
7284static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007285vec_sro(vector unsigned short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007286{
7287 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007288 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007289}
7290
7291static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007292vec_sro(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007293{
7294 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007295 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007296}
7297
7298static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007299vec_sro(vector pixel __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007300{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007301 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007302}
7303
7304static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007305vec_sro(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007306{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007307 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007308}
7309
7310static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007311vec_sro(vector int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007312{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007313 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007314}
7315
7316static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007317vec_sro(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007318{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007319 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007320}
7321
7322static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007323vec_sro(vector unsigned int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007324{
7325 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007326 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007327}
7328
7329static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007330vec_sro(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007331{
7332 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007333 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007334}
7335
7336static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007337vec_sro(vector float __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007338{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007339 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007340}
7341
7342static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007343vec_sro(vector float __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007344{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007345 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007346}
7347
7348/* vec_vsro */
7349
7350static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007351vec_vsro(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007352{
7353 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007354 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007355}
7356
7357static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007358vec_vsro(vector signed char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007359{
7360 return (vector signed char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007361 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007362}
7363
7364static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007365vec_vsro(vector unsigned char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007366{
7367 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007368 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007369}
7370
7371static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007372vec_vsro(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007373{
7374 return (vector unsigned char)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007375 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007376}
7377
7378static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007379vec_vsro(vector short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007380{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007381 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007382}
7383
7384static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007385vec_vsro(vector short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007386{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007387 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007388}
7389
7390static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007391vec_vsro(vector unsigned short __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007392{
7393 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007394 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007395}
7396
7397static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007398vec_vsro(vector unsigned short __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007399{
7400 return (vector unsigned short)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007401 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007402}
7403
7404static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007405vec_vsro(vector pixel __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007406{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007407 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007408}
7409
7410static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007411vec_vsro(vector pixel __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007412{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007413 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007414}
7415
7416static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007417vec_vsro(vector int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007418{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007419 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007420}
7421
7422static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007423vec_vsro(vector int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007424{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007425 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007426}
7427
7428static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007429vec_vsro(vector unsigned int __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007430{
7431 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007432 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007433}
7434
7435static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007436vec_vsro(vector unsigned int __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007437{
7438 return (vector unsigned int)
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007439 __builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007440}
7441
7442static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007443vec_vsro(vector float __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007444{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007445 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007446}
7447
7448static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007449vec_vsro(vector float __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08007450{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007451 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08007452}
7453
7454/* vec_st */
7455
7456static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007457vec_st(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007458{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007459 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007460}
7461
7462static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007463vec_st(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007464{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007465 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007466}
7467
7468static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007469vec_st(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007470{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007471 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007472}
7473
7474static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007475vec_st(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007476{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007477 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007478}
7479
7480static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007481vec_st(vector bool char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007482{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007483 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007484}
7485
7486static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007487vec_st(vector bool char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007488{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007489 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007490}
7491
7492static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007493vec_st(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007494{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007495 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007496}
7497
7498static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007499vec_st(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007500{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007501 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007502}
7503
7504static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007505vec_st(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007506{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007507 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007508}
7509
7510static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007511vec_st(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007512{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007513 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007514}
7515
7516static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007517vec_st(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007518{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007519 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007520}
7521
7522static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007523vec_st(vector bool short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007524{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007525 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007526}
7527
7528static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007529vec_st(vector bool short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007530{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007531 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007532}
7533
7534static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007535vec_st(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007536{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007537 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007538}
7539
7540static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007541vec_st(vector pixel __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007542{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007543 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007544}
7545
7546static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007547vec_st(vector pixel __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007548{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007549 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007550}
7551
7552static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007553vec_st(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007554{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007555 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007556}
7557
7558static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007559vec_st(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007560{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007561 __builtin_altivec_stvx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007562}
7563
7564static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007565vec_st(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007566{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007567 __builtin_altivec_stvx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007568}
7569
7570static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007571vec_st(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007572{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007573 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007574}
7575
7576static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007577vec_st(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007578{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007579 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007580}
7581
7582static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007583vec_st(vector bool int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007584{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007585 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007586}
7587
7588static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007589vec_st(vector bool int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007590{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007591 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007592}
7593
7594static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007595vec_st(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007596{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007597 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007598}
7599
7600static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007601vec_st(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007602{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007603 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007604}
7605
7606static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007607vec_st(vector float __a, int __b, float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007608{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007609 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007610}
7611
7612/* vec_stvx */
7613
7614static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007615vec_stvx(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007616{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007617 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007618}
7619
7620static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007621vec_stvx(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007622{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007623 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007624}
7625
7626static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007627vec_stvx(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007628{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007629 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007630}
7631
7632static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007633vec_stvx(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007634{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007635 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007636}
7637
7638static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007639vec_stvx(vector bool char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007640{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007641 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007642}
7643
7644static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007645vec_stvx(vector bool char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007646{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007647 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007648}
7649
7650static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007651vec_stvx(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007652{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007653 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007654}
7655
7656static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007657vec_stvx(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007658{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007659 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007660}
7661
7662static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007663vec_stvx(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007664{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007665 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007666}
7667
7668static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007669vec_stvx(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007670{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007671 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007672}
7673
7674static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007675vec_stvx(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007676{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007677 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007678}
7679
7680static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007681vec_stvx(vector bool short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007682{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007683 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007684}
7685
7686static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007687vec_stvx(vector bool short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007688{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007689 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007690}
7691
7692static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007693vec_stvx(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007694{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007695 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007696}
7697
7698static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007699vec_stvx(vector pixel __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007700{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007701 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007702}
7703
7704static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007705vec_stvx(vector pixel __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007706{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007707 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007708}
7709
7710static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007711vec_stvx(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007712{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007713 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007714}
7715
7716static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007717vec_stvx(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007718{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007719 __builtin_altivec_stvx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007720}
7721
7722static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007723vec_stvx(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007724{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007725 __builtin_altivec_stvx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007726}
7727
7728static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007729vec_stvx(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007730{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007731 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007732}
7733
7734static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007735vec_stvx(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007736{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007737 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007738}
7739
7740static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007741vec_stvx(vector bool int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007742{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007743 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007744}
7745
7746static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007747vec_stvx(vector bool int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007748{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007749 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007750}
7751
7752static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007753vec_stvx(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007754{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007755 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007756}
7757
7758static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007759vec_stvx(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007760{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007761 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007762}
7763
7764static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007765vec_stvx(vector float __a, int __b, float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007766{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007767 __builtin_altivec_stvx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007768}
7769
7770/* vec_ste */
7771
7772static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007773vec_ste(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007774{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007775 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007776}
7777
7778static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007779vec_ste(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007780{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007781 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007782}
7783
7784static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007785vec_ste(vector bool char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007786{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007787 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007788}
7789
7790static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007791vec_ste(vector bool char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007792{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007793 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007794}
7795
7796static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007797vec_ste(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007798{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007799 __builtin_altivec_stvehx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007800}
7801
7802static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007803vec_ste(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007804{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007805 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007806}
7807
7808static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007809vec_ste(vector bool short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007810{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007811 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007812}
7813
7814static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007815vec_ste(vector bool short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007816{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007817 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007818}
7819
7820static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007821vec_ste(vector pixel __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007822{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007823 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007824}
7825
7826static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007827vec_ste(vector pixel __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007828{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007829 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007830}
7831
7832static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007833vec_ste(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007834{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007835 __builtin_altivec_stvewx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007836}
7837
7838static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007839vec_ste(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007840{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007841 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007842}
7843
7844static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007845vec_ste(vector bool int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007846{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007847 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007848}
7849
7850static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007851vec_ste(vector bool int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007852{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007853 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007854}
7855
7856static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007857vec_ste(vector float __a, int __b, float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007858{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007859 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007860}
7861
7862/* vec_stvebx */
7863
7864static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007865vec_stvebx(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007866{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007867 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007868}
7869
7870static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007871vec_stvebx(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007872{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007873 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007874}
7875
7876static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007877vec_stvebx(vector bool char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007878{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007879 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007880}
7881
7882static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007883vec_stvebx(vector bool char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007884{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007885 __builtin_altivec_stvebx((vector char)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007886}
7887
7888/* vec_stvehx */
7889
7890static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007891vec_stvehx(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007892{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007893 __builtin_altivec_stvehx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007894}
7895
7896static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007897vec_stvehx(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007898{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007899 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007900}
7901
7902static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007903vec_stvehx(vector bool short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007904{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007905 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007906}
7907
7908static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007909vec_stvehx(vector bool short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007910{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007911 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007912}
7913
7914static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007915vec_stvehx(vector pixel __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007916{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007917 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007918}
7919
7920static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007921vec_stvehx(vector pixel __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007922{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007923 __builtin_altivec_stvehx((vector short)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007924}
7925
7926/* vec_stvewx */
7927
7928static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007929vec_stvewx(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007930{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007931 __builtin_altivec_stvewx(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007932}
7933
7934static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007935vec_stvewx(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007936{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007937 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007938}
7939
7940static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007941vec_stvewx(vector bool int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007942{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007943 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007944}
7945
7946static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007947vec_stvewx(vector bool int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007948{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007949 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007950}
7951
7952static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007953vec_stvewx(vector float __a, int __b, float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007954{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007955 __builtin_altivec_stvewx((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007956}
7957
7958/* vec_stl */
7959
7960static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007961vec_stl(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007962{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007963 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007964}
7965
7966static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007967vec_stl(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007968{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007969 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007970}
7971
7972static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007973vec_stl(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007974{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007975 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007976}
7977
7978static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007979vec_stl(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007980{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007981 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007982}
7983
7984static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007985vec_stl(vector bool char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007986{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007987 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007988}
7989
7990static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007991vec_stl(vector bool char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007992{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007993 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08007994}
7995
7996static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007997vec_stl(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08007998{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07007999 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008000}
8001
8002static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008003vec_stl(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008004{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008005 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008006}
8007
8008static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008009vec_stl(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008010{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008011 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008012}
8013
8014static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008015vec_stl(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008016{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008017 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008018}
8019
8020static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008021vec_stl(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008022{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008023 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008024}
8025
8026static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008027vec_stl(vector bool short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008028{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008029 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008030}
8031
8032static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008033vec_stl(vector bool short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008034{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008035 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008036}
8037
8038static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008039vec_stl(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008040{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008041 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008042}
8043
8044static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008045vec_stl(vector pixel __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008046{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008047 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008048}
8049
8050static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008051vec_stl(vector pixel __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008052{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008053 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008054}
8055
8056static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008057vec_stl(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008058{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008059 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008060}
8061
8062static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008063vec_stl(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008064{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008065 __builtin_altivec_stvxl(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008066}
8067
8068static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008069vec_stl(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008070{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008071 __builtin_altivec_stvxl(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008072}
8073
8074static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008075vec_stl(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008076{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008077 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008078}
8079
8080static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008081vec_stl(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008082{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008083 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008084}
8085
8086static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008087vec_stl(vector bool int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008088{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008089 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008090}
8091
8092static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008093vec_stl(vector bool int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008094{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008095 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008096}
8097
8098static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008099vec_stl(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008100{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008101 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008102}
8103
8104static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008105vec_stl(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008106{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008107 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008108}
8109
8110static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008111vec_stl(vector float __a, int __b, float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008112{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008113 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008114}
8115
8116/* vec_stvxl */
8117
8118static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008119vec_stvxl(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008120{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008121 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008122}
8123
8124static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008125vec_stvxl(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008126{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008127 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008128}
8129
8130static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008131vec_stvxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008132{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008133 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008134}
8135
8136static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008137vec_stvxl(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008138{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008139 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008140}
8141
8142static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008143vec_stvxl(vector bool char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008144{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008145 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008146}
8147
8148static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008149vec_stvxl(vector bool char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008150{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008151 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008152}
8153
8154static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008155vec_stvxl(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008156{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008157 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008158}
8159
8160static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008161vec_stvxl(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008162{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008163 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008164}
8165
8166static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008167vec_stvxl(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008168{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008169 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008170}
8171
8172static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008173vec_stvxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008174{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008175 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008176}
8177
8178static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008179vec_stvxl(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008180{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008181 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008182}
8183
8184static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008185vec_stvxl(vector bool short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008186{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008187 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008188}
8189
8190static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008191vec_stvxl(vector bool short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008192{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008193 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008194}
8195
8196static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008197vec_stvxl(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008198{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008199 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008200}
8201
8202static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008203vec_stvxl(vector pixel __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008204{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008205 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008206}
8207
8208static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008209vec_stvxl(vector pixel __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008210{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008211 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008212}
8213
8214static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008215vec_stvxl(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008216{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008217 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008218}
8219
8220static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008221vec_stvxl(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008222{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008223 __builtin_altivec_stvxl(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008224}
8225
8226static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008227vec_stvxl(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008228{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008229 __builtin_altivec_stvxl(__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008230}
8231
8232static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008233vec_stvxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008234{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008235 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008236}
8237
8238static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008239vec_stvxl(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008240{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008241 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008242}
8243
8244static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008245vec_stvxl(vector bool int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008246{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008247 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008248}
8249
8250static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008251vec_stvxl(vector bool int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008252{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008253 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008254}
8255
8256static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008257vec_stvxl(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008258{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008259 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008260}
8261
8262static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008263vec_stvxl(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008264{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008265 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008266}
8267
8268static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008269vec_stvxl(vector float __a, int __b, float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -08008270{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008271 __builtin_altivec_stvxl((vector int)__a, __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -08008272}
8273
8274/* vec_sub */
8275
8276static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008277vec_sub(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008278{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008279 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008280}
8281
8282static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008283vec_sub(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008284{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008285 return (vector signed char)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008286}
8287
8288static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008289vec_sub(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008290{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008291 return __a - (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008292}
8293
8294static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008295vec_sub(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008296{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008297 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008298}
8299
8300static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008301vec_sub(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008302{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008303 return (vector unsigned char)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008304}
8305
8306static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008307vec_sub(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008308{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008309 return __a - (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008310}
8311
8312static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008313vec_sub(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008314{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008315 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008316}
8317
8318static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008319vec_sub(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008320{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008321 return (vector short)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008322}
8323
8324static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008325vec_sub(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008326{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008327 return __a - (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008328}
8329
8330static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008331vec_sub(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008332{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008333 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008334}
8335
8336static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008337vec_sub(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008338{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008339 return (vector unsigned short)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008340}
8341
8342static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008343vec_sub(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008344{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008345 return __a - (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008346}
8347
8348static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008349vec_sub(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008350{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008351 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008352}
8353
8354static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008355vec_sub(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008356{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008357 return (vector int)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008358}
8359
8360static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008361vec_sub(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008362{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008363 return __a - (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008364}
8365
8366static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008367vec_sub(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008368{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008369 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008370}
8371
8372static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008373vec_sub(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008374{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008375 return (vector unsigned int)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008376}
8377
8378static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008379vec_sub(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008380{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008381 return __a - (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008382}
8383
8384static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008385vec_sub(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008386{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008387 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008388}
8389
8390/* vec_vsububm */
8391
8392#define __builtin_altivec_vsububm vec_vsububm
8393
8394static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008395vec_vsububm(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008396{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008397 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008398}
8399
8400static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008401vec_vsububm(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008402{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008403 return (vector signed char)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008404}
8405
8406static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008407vec_vsububm(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008408{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008409 return __a - (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008410}
8411
8412static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008413vec_vsububm(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008414{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008415 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008416}
8417
8418static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008419vec_vsububm(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008420{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008421 return (vector unsigned char)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008422}
8423
8424static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008425vec_vsububm(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008426{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008427 return __a - (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008428}
8429
8430/* vec_vsubuhm */
8431
8432#define __builtin_altivec_vsubuhm vec_vsubuhm
8433
8434static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008435vec_vsubuhm(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008436{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008437 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008438}
8439
8440static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008441vec_vsubuhm(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008442{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008443 return (vector short)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008444}
8445
8446static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008447vec_vsubuhm(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008448{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008449 return __a - (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008450}
8451
8452static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008453vec_vsubuhm(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008454{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008455 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008456}
8457
8458static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008459vec_vsubuhm(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008460{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008461 return (vector unsigned short)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008462}
8463
8464static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008465vec_vsubuhm(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008466{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008467 return __a - (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008468}
8469
8470/* vec_vsubuwm */
8471
8472#define __builtin_altivec_vsubuwm vec_vsubuwm
8473
8474static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008475vec_vsubuwm(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008476{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008477 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008478}
8479
8480static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008481vec_vsubuwm(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008482{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008483 return (vector int)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008484}
8485
8486static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008487vec_vsubuwm(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008488{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008489 return __a - (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008490}
8491
8492static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008493vec_vsubuwm(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008494{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008495 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008496}
8497
8498static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008499vec_vsubuwm(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008500{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008501 return (vector unsigned int)__a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008502}
8503
8504static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008505vec_vsubuwm(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008506{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008507 return __a - (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08008508}
8509
8510/* vec_vsubfp */
8511
8512#define __builtin_altivec_vsubfp vec_vsubfp
8513
8514static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008515vec_vsubfp(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008516{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008517 return __a - __b;
Ying Wangb335bb02011-11-29 10:23:55 -08008518}
8519
8520/* vec_subc */
8521
8522static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008523vec_subc(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008524{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008525 return __builtin_altivec_vsubcuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008526}
8527
8528/* vec_vsubcuw */
8529
8530static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008531vec_vsubcuw(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008532{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008533 return __builtin_altivec_vsubcuw(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008534}
8535
8536/* vec_subs */
8537
8538static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008539vec_subs(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008540{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008541 return __builtin_altivec_vsubsbs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008542}
8543
8544static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008545vec_subs(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008546{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008547 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008548}
8549
8550static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008551vec_subs(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008552{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008553 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008554}
8555
8556static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008557vec_subs(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008558{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008559 return __builtin_altivec_vsububs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008560}
8561
8562static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008563vec_subs(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008564{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008565 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008566}
8567
8568static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008569vec_subs(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008570{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008571 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008572}
8573
8574static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008575vec_subs(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008576{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008577 return __builtin_altivec_vsubshs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008578}
8579
8580static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008581vec_subs(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008582{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008583 return __builtin_altivec_vsubshs((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008584}
8585
8586static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008587vec_subs(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008588{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008589 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008590}
8591
8592static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008593vec_subs(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008594{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008595 return __builtin_altivec_vsubuhs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008596}
8597
8598static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008599vec_subs(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008600{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008601 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008602}
8603
8604static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008605vec_subs(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008606{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008607 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008608}
8609
8610static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008611vec_subs(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008612{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008613 return __builtin_altivec_vsubsws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008614}
8615
8616static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008617vec_subs(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008618{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008619 return __builtin_altivec_vsubsws((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008620}
8621
8622static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008623vec_subs(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008624{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008625 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008626}
8627
8628static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008629vec_subs(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008630{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008631 return __builtin_altivec_vsubuws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008632}
8633
8634static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008635vec_subs(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008636{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008637 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008638}
8639
8640static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008641vec_subs(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008642{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008643 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008644}
8645
8646/* vec_vsubsbs */
8647
8648static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008649vec_vsubsbs(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008650{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008651 return __builtin_altivec_vsubsbs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008652}
8653
8654static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008655vec_vsubsbs(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008656{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008657 return __builtin_altivec_vsubsbs((vector signed char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008658}
8659
8660static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008661vec_vsubsbs(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008662{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008663 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008664}
8665
8666/* vec_vsububs */
8667
8668static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008669vec_vsububs(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008670{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008671 return __builtin_altivec_vsububs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008672}
8673
8674static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008675vec_vsububs(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008676{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008677 return __builtin_altivec_vsububs((vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008678}
8679
8680static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008681vec_vsububs(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008682{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008683 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008684}
8685
8686/* vec_vsubshs */
8687
8688static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008689vec_vsubshs(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008690{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008691 return __builtin_altivec_vsubshs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008692}
8693
8694static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008695vec_vsubshs(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008696{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008697 return __builtin_altivec_vsubshs((vector short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008698}
8699
8700static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008701vec_vsubshs(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008702{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008703 return __builtin_altivec_vsubshs(__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008704}
8705
8706/* vec_vsubuhs */
8707
8708static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008709vec_vsubuhs(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008710{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008711 return __builtin_altivec_vsubuhs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008712}
8713
8714static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008715vec_vsubuhs(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008716{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008717 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008718}
8719
8720static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008721vec_vsubuhs(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008722{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008723 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008724}
8725
8726/* vec_vsubsws */
8727
8728static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008729vec_vsubsws(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008730{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008731 return __builtin_altivec_vsubsws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008732}
8733
8734static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008735vec_vsubsws(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008736{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008737 return __builtin_altivec_vsubsws((vector int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008738}
8739
8740static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008741vec_vsubsws(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008742{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008743 return __builtin_altivec_vsubsws(__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008744}
8745
8746/* vec_vsubuws */
8747
8748static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008749vec_vsubuws(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008750{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008751 return __builtin_altivec_vsubuws(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008752}
8753
8754static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008755vec_vsubuws(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008756{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008757 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008758}
8759
8760static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008761vec_vsubuws(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008762{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008763 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -08008764}
8765
8766/* vec_sum4s */
8767
8768static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008769vec_sum4s(vector signed char __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008770{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008771 return __builtin_altivec_vsum4sbs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008772}
8773
8774static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008775vec_sum4s(vector unsigned char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008776{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008777 return __builtin_altivec_vsum4ubs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008778}
8779
8780static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008781vec_sum4s(vector signed short __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008782{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008783 return __builtin_altivec_vsum4shs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008784}
8785
8786/* vec_vsum4sbs */
8787
8788static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008789vec_vsum4sbs(vector signed char __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008790{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008791 return __builtin_altivec_vsum4sbs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008792}
8793
8794/* vec_vsum4ubs */
8795
8796static vector unsigned int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008797vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008798{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008799 return __builtin_altivec_vsum4ubs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008800}
8801
8802/* vec_vsum4shs */
8803
8804static vector int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008805vec_vsum4shs(vector signed short __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008806{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008807 return __builtin_altivec_vsum4shs(__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -08008808}
8809
8810/* vec_sum2s */
8811
Stephen Hines990d2fc2014-07-23 10:40:48 -07008812/* The vsum2sws instruction has a big-endian bias, so that the second
8813 input vector and the result always reference big-endian elements
8814 1 and 3 (little-endian element 0 and 2). For ease of porting the
8815 programmer wants elements 1 and 3 in both cases, so for little
8816 endian we must perform some permutes. */
8817
Ying Wangb335bb02011-11-29 10:23:55 -08008818static vector signed int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008819vec_sum2s(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008820{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008821#ifdef __LITTLE_ENDIAN__
8822 vector int __c = (vector signed int)
8823 vec_perm(__b, __b, (vector unsigned char)
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07008824 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Stephen Hines990d2fc2014-07-23 10:40:48 -07008825 __c = __builtin_altivec_vsum2sws(__a, __c);
8826 return (vector signed int)
8827 vec_perm(__c, __c, (vector unsigned char)
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07008828 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Stephen Hines990d2fc2014-07-23 10:40:48 -07008829#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008830 return __builtin_altivec_vsum2sws(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008831#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008832}
8833
8834/* vec_vsum2sws */
8835
8836static vector signed int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008837vec_vsum2sws(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008838{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008839#ifdef __LITTLE_ENDIAN__
8840 vector int __c = (vector signed int)
8841 vec_perm(__b, __b, (vector unsigned char)
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07008842 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Stephen Hines990d2fc2014-07-23 10:40:48 -07008843 __c = __builtin_altivec_vsum2sws(__a, __c);
8844 return (vector signed int)
8845 vec_perm(__c, __c, (vector unsigned char)
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07008846 (4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11));
Stephen Hines990d2fc2014-07-23 10:40:48 -07008847#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008848 return __builtin_altivec_vsum2sws(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008849#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008850}
8851
8852/* vec_sums */
8853
Stephen Hines990d2fc2014-07-23 10:40:48 -07008854/* The vsumsws instruction has a big-endian bias, so that the second
8855 input vector and the result always reference big-endian element 3
8856 (little-endian element 0). For ease of porting the programmer
8857 wants element 3 in both cases, so for little endian we must perform
8858 some permutes. */
8859
Ying Wangb335bb02011-11-29 10:23:55 -08008860static vector signed int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008861vec_sums(vector signed int __a, vector signed int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008862{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008863#ifdef __LITTLE_ENDIAN__
Stephen Hinesee4ca282014-12-02 17:05:12 -08008864 __b = (vector signed int)vec_splat(__b, 3);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008865 __b = __builtin_altivec_vsumsws(__a, __b);
Stephen Hinesee4ca282014-12-02 17:05:12 -08008866 return (vector signed int)(0, 0, 0, __b[0]);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008867#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008868 return __builtin_altivec_vsumsws(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008869#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008870}
8871
8872/* vec_vsumsws */
8873
8874static vector signed int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008875vec_vsumsws(vector signed int __a, vector signed int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08008876{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008877#ifdef __LITTLE_ENDIAN__
Stephen Hinesee4ca282014-12-02 17:05:12 -08008878 __b = (vector signed int)vec_splat(__b, 3);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008879 __b = __builtin_altivec_vsumsws(__a, __b);
Stephen Hinesee4ca282014-12-02 17:05:12 -08008880 return (vector signed int)(0, 0, 0, __b[0]);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008881#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008882 return __builtin_altivec_vsumsws(__a, __b);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008883#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008884}
8885
8886/* vec_trunc */
8887
8888static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008889vec_trunc(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008890{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008891 return __builtin_altivec_vrfiz(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08008892}
8893
8894/* vec_vrfiz */
8895
8896static vector float __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008897vec_vrfiz(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008898{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008899 return __builtin_altivec_vrfiz(__a);
Ying Wangb335bb02011-11-29 10:23:55 -08008900}
8901
8902/* vec_unpackh */
8903
Stephen Hines990d2fc2014-07-23 10:40:48 -07008904/* The vector unpack instructions all have a big-endian bias, so for
8905 little endian we must reverse the meanings of "high" and "low." */
8906
Ying Wangb335bb02011-11-29 10:23:55 -08008907static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008908vec_unpackh(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008909{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008910#ifdef __LITTLE_ENDIAN__
8911 return __builtin_altivec_vupklsb((vector char)__a);
8912#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008913 return __builtin_altivec_vupkhsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008914#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008915}
8916
8917static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008918vec_unpackh(vector bool char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008919{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008920#ifdef __LITTLE_ENDIAN__
8921 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8922#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008923 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008924#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008925}
8926
8927static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008928vec_unpackh(vector short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008929{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008930#ifdef __LITTLE_ENDIAN__
8931 return __builtin_altivec_vupklsh(__a);
8932#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008933 return __builtin_altivec_vupkhsh(__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008934#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008935}
8936
8937static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008938vec_unpackh(vector bool short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008939{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008940#ifdef __LITTLE_ENDIAN__
8941 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8942#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008943 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008944#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008945}
8946
8947static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008948vec_unpackh(vector pixel __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008949{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008950#ifdef __LITTLE_ENDIAN__
8951 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
8952#else
8953 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
8954#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008955}
8956
8957/* vec_vupkhsb */
8958
8959static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008960vec_vupkhsb(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008961{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008962#ifdef __LITTLE_ENDIAN__
8963 return __builtin_altivec_vupklsb((vector char)__a);
8964#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008965 return __builtin_altivec_vupkhsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008966#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008967}
8968
8969static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008970vec_vupkhsb(vector bool char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008971{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008972#ifdef __LITTLE_ENDIAN__
8973 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
8974#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008975 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008976#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008977}
8978
8979/* vec_vupkhsh */
8980
8981static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008982vec_vupkhsh(vector short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008983{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008984#ifdef __LITTLE_ENDIAN__
8985 return __builtin_altivec_vupklsh(__a);
8986#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008987 return __builtin_altivec_vupkhsh(__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008988#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008989}
8990
8991static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008992vec_vupkhsh(vector bool short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08008993{
Stephen Hines990d2fc2014-07-23 10:40:48 -07008994#ifdef __LITTLE_ENDIAN__
8995 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
8996#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07008997 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07008998#endif
Ying Wangb335bb02011-11-29 10:23:55 -08008999}
9000
9001static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009002vec_vupkhsh(vector pixel __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009003{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009004#ifdef __LITTLE_ENDIAN__
9005 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9006#else
9007 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9008#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009009}
9010
9011/* vec_unpackl */
9012
9013static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009014vec_unpackl(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009015{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009016#ifdef __LITTLE_ENDIAN__
9017 return __builtin_altivec_vupkhsb((vector char)__a);
9018#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009019 return __builtin_altivec_vupklsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009020#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009021}
9022
9023static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009024vec_unpackl(vector bool char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009025{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009026#ifdef __LITTLE_ENDIAN__
9027 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9028#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009029 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009030#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009031}
9032
9033static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009034vec_unpackl(vector short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009035{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009036#ifdef __LITTLE_ENDIAN__
9037 return __builtin_altivec_vupkhsh(__a);
9038#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009039 return __builtin_altivec_vupklsh(__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009040#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009041}
9042
9043static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009044vec_unpackl(vector bool short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009045{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009046#ifdef __LITTLE_ENDIAN__
9047 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9048#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009049 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009050#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009051}
9052
9053static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009054vec_unpackl(vector pixel __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009055{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009056#ifdef __LITTLE_ENDIAN__
9057 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9058#else
9059 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9060#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009061}
9062
9063/* vec_vupklsb */
9064
9065static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009066vec_vupklsb(vector signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009067{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009068#ifdef __LITTLE_ENDIAN__
9069 return __builtin_altivec_vupkhsb((vector char)__a);
9070#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009071 return __builtin_altivec_vupklsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009072#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009073}
9074
9075static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009076vec_vupklsb(vector bool char __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009077{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009078#ifdef __LITTLE_ENDIAN__
9079 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a);
9080#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009081 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009082#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009083}
9084
9085/* vec_vupklsh */
9086
9087static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009088vec_vupklsh(vector short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009089{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009090#ifdef __LITTLE_ENDIAN__
9091 return __builtin_altivec_vupkhsh(__a);
9092#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009093 return __builtin_altivec_vupklsh(__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009094#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009095}
9096
9097static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009098vec_vupklsh(vector bool short __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009099{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009100#ifdef __LITTLE_ENDIAN__
9101 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a);
9102#else
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009103 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a);
Stephen Hines990d2fc2014-07-23 10:40:48 -07009104#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009105}
9106
9107static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009108vec_vupklsh(vector pixel __a)
Ying Wangb335bb02011-11-29 10:23:55 -08009109{
Stephen Hines990d2fc2014-07-23 10:40:48 -07009110#ifdef __LITTLE_ENDIAN__
9111 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a);
9112#else
9113 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a);
9114#endif
Ying Wangb335bb02011-11-29 10:23:55 -08009115}
9116
Stephen Hinesee4ca282014-12-02 17:05:12 -08009117/* vec_vsx_ld */
9118
9119#ifdef __VSX__
9120
9121static vector signed int __ATTRS_o_ai
9122vec_vsx_ld(int __a, const vector signed int *__b)
9123{
9124 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b);
9125}
9126
9127static vector unsigned int __ATTRS_o_ai
9128vec_vsx_ld(int __a, const vector unsigned int *__b)
9129{
9130 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b);
9131}
9132
9133static vector float __ATTRS_o_ai
9134vec_vsx_ld(int __a, const vector float *__b)
9135{
9136 return (vector float)__builtin_vsx_lxvw4x(__a, __b);
9137}
9138
9139static vector signed long long __ATTRS_o_ai
9140vec_vsx_ld(int __a, const vector signed long long *__b)
9141{
9142 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b);
9143}
9144
9145static vector unsigned long long __ATTRS_o_ai
9146vec_vsx_ld(int __a, const vector unsigned long long *__b)
9147{
9148 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b);
9149}
9150
9151static vector double __ATTRS_o_ai
9152vec_vsx_ld(int __a, const vector double *__b)
9153{
9154 return (vector double)__builtin_vsx_lxvd2x(__a, __b);
9155}
9156
9157#endif
9158
9159/* vec_vsx_st */
9160
9161#ifdef __VSX__
9162
9163static void __ATTRS_o_ai
9164vec_vsx_st(vector signed int __a, int __b, vector signed int *__c)
9165{
9166 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9167}
9168
9169static void __ATTRS_o_ai
9170vec_vsx_st(vector unsigned int __a, int __b, vector unsigned int *__c)
9171{
9172 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9173}
9174
9175static void __ATTRS_o_ai
9176vec_vsx_st(vector float __a, int __b, vector float *__c)
9177{
9178 __builtin_vsx_stxvw4x((vector int)__a, __b, __c);
9179}
9180
9181static void __ATTRS_o_ai
9182vec_vsx_st(vector signed long long __a, int __b, vector signed long long *__c)
9183{
9184 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9185}
9186
9187static void __ATTRS_o_ai
9188vec_vsx_st(vector unsigned long long __a, int __b,
9189 vector unsigned long long *__c)
9190{
9191 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9192}
9193
9194static void __ATTRS_o_ai
9195vec_vsx_st(vector double __a, int __b, vector double *__c)
9196{
9197 __builtin_vsx_stxvd2x((vector double)__a, __b, __c);
9198}
9199
9200#endif
9201
Ying Wangb335bb02011-11-29 10:23:55 -08009202/* vec_xor */
9203
9204#define __builtin_altivec_vxor vec_xor
9205
9206static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009207vec_xor(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009208{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009209 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009210}
9211
9212static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009213vec_xor(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009214{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009215 return (vector signed char)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009216}
9217
9218static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009219vec_xor(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009220{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009221 return __a ^ (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009222}
9223
9224static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009225vec_xor(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009226{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009227 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009228}
9229
9230static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009231vec_xor(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009232{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009233 return (vector unsigned char)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009234}
9235
9236static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009237vec_xor(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009238{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009239 return __a ^ (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009240}
9241
9242static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009243vec_xor(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009244{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009245 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009246}
9247
9248static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009249vec_xor(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009250{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009251 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009252}
9253
9254static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009255vec_xor(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009256{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009257 return (vector short)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009258}
9259
9260static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009261vec_xor(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009262{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009263 return __a ^ (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009264}
9265
9266static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009267vec_xor(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009268{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009269 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009270}
9271
9272static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009273vec_xor(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009274{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009275 return (vector unsigned short)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009276}
9277
9278static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009279vec_xor(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009280{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009281 return __a ^ (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009282}
9283
9284static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009285vec_xor(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009286{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009287 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009288}
9289
9290static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009291vec_xor(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009292{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009293 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009294}
9295
9296static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009297vec_xor(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009298{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009299 return (vector int)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009300}
9301
9302static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009303vec_xor(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009304{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009305 return __a ^ (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009306}
9307
9308static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009309vec_xor(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009310{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009311 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009312}
9313
9314static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009315vec_xor(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009316{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009317 return (vector unsigned int)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009318}
9319
9320static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009321vec_xor(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009322{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009323 return __a ^ (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009324}
9325
9326static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009327vec_xor(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009328{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009329 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009330}
9331
9332static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009333vec_xor(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009334{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009335 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9336 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08009337}
9338
9339static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009340vec_xor(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009341{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009342 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9343 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08009344}
9345
9346static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009347vec_xor(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009348{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009349 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9350 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08009351}
9352
9353/* vec_vxor */
9354
9355static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009356vec_vxor(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009357{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009358 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009359}
9360
9361static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009362vec_vxor(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009363{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009364 return (vector signed char)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009365}
9366
9367static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009368vec_vxor(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009369{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009370 return __a ^ (vector signed char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009371}
9372
9373static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009374vec_vxor(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009375{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009376 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009377}
9378
9379static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009380vec_vxor(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009381{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009382 return (vector unsigned char)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009383}
9384
9385static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009386vec_vxor(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009387{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009388 return __a ^ (vector unsigned char)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009389}
9390
9391static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009392vec_vxor(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009393{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009394 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009395}
9396
9397static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009398vec_vxor(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009399{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009400 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009401}
9402
9403static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009404vec_vxor(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009405{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009406 return (vector short)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009407}
9408
9409static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009410vec_vxor(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009411{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009412 return __a ^ (vector short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009413}
9414
9415static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009416vec_vxor(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009417{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009418 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009419}
9420
9421static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009422vec_vxor(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009423{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009424 return (vector unsigned short)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009425}
9426
9427static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009428vec_vxor(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009429{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009430 return __a ^ (vector unsigned short)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009431}
9432
9433static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009434vec_vxor(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009435{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009436 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009437}
9438
9439static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009440vec_vxor(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009441{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009442 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009443}
9444
9445static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009446vec_vxor(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009447{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009448 return (vector int)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009449}
9450
9451static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009452vec_vxor(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009453{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009454 return __a ^ (vector int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009455}
9456
9457static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009458vec_vxor(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009459{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009460 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009461}
9462
9463static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009464vec_vxor(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009465{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009466 return (vector unsigned int)__a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009467}
9468
9469static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009470vec_vxor(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009471{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009472 return __a ^ (vector unsigned int)__b;
Ying Wangb335bb02011-11-29 10:23:55 -08009473}
9474
9475static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009476vec_vxor(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009477{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009478 return __a ^ __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009479}
9480
9481static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009482vec_vxor(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009483{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009484 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9485 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08009486}
9487
9488static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009489vec_vxor(vector bool int __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009490{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009491 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9492 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08009493}
9494
9495static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009496vec_vxor(vector float __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009497{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009498 vector unsigned int __res = (vector unsigned int)__a ^ (vector unsigned int)__b;
9499 return (vector float)__res;
Ying Wangb335bb02011-11-29 10:23:55 -08009500}
9501
9502/* ------------------------ extensions for CBEA ----------------------------- */
9503
9504/* vec_extract */
9505
9506static signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009507vec_extract(vector signed char __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009508{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009509 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009510}
9511
9512static unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009513vec_extract(vector unsigned char __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009514{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009515 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009516}
9517
9518static short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009519vec_extract(vector short __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009520{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009521 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009522}
9523
9524static unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009525vec_extract(vector unsigned short __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009526{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009527 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009528}
9529
9530static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009531vec_extract(vector int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009532{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009533 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009534}
9535
9536static unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009537vec_extract(vector unsigned int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009538{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009539 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009540}
9541
9542static float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009543vec_extract(vector float __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -08009544{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009545 return __a[__b];
Ying Wangb335bb02011-11-29 10:23:55 -08009546}
9547
9548/* vec_insert */
9549
9550static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009551vec_insert(signed char __a, vector signed char __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009552{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009553 __b[__c] = __a;
9554 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009555}
9556
9557static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009558vec_insert(unsigned char __a, vector unsigned char __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009559{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009560 __b[__c] = __a;
9561 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009562}
9563
9564static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009565vec_insert(short __a, vector short __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009566{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009567 __b[__c] = __a;
9568 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009569}
9570
9571static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009572vec_insert(unsigned short __a, vector unsigned short __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009573{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009574 __b[__c] = __a;
9575 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009576}
9577
9578static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009579vec_insert(int __a, vector int __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009580{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009581 __b[__c] = __a;
9582 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009583}
9584
9585static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009586vec_insert(unsigned int __a, vector unsigned int __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009587{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009588 __b[__c] = __a;
9589 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009590}
9591
9592static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009593vec_insert(float __a, vector float __b, int __c)
Ying Wangb335bb02011-11-29 10:23:55 -08009594{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009595 __b[__c] = __a;
9596 return __b;
Ying Wangb335bb02011-11-29 10:23:55 -08009597}
9598
9599/* vec_lvlx */
9600
9601static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009602vec_lvlx(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009603{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009604 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009605 (vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009606 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009607}
9608
9609static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009610vec_lvlx(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009611{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009612 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009613 (vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009614 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009615}
9616
9617static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009618vec_lvlx(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009619{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009620 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009621 (vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009622 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009623}
9624
9625static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009626vec_lvlx(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009627{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009628 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009629 (vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009630 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009631}
9632
9633static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009634vec_lvlx(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009635{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009636 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009637 (vector bool char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009638 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009639}
9640
9641static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009642vec_lvlx(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009643{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009644 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009645 (vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009646 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009647}
9648
9649static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009650vec_lvlx(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009651{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009652 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009653 (vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009654 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009655}
9656
9657static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009658vec_lvlx(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009659{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009660 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009661 (vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009662 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009663}
9664
9665static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009666vec_lvlx(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009667{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009668 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009669 (vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009670 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009671}
9672
9673static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009674vec_lvlx(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009675{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009676 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009677 (vector bool short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009678 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009679}
9680
9681static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009682vec_lvlx(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009683{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009684 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009685 (vector pixel)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009686 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009687}
9688
9689static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009690vec_lvlx(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009691{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009692 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009693 (vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009694 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009695}
9696
9697static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009698vec_lvlx(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009699{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009700 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009701 (vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009702 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009703}
9704
9705static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009706vec_lvlx(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009707{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009708 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009709 (vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009710 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009711}
9712
9713static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009714vec_lvlx(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009715{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009716 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009717 (vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009718 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009719}
9720
9721static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009722vec_lvlx(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009723{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009724 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009725 (vector bool int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009726 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009727}
9728
9729static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009730vec_lvlx(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009731{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009732 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009733 (vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009734 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009735}
9736
9737static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009738vec_lvlx(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009739{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009740 return vec_perm(vec_ld(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009741 (vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009742 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009743}
9744
9745/* vec_lvlxl */
9746
9747static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009748vec_lvlxl(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009749{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009750 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009751 (vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009752 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009753}
9754
9755static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009756vec_lvlxl(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009757{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009758 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009759 (vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009760 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009761}
9762
9763static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009764vec_lvlxl(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009765{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009766 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009767 (vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009768 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009769}
9770
9771static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009772vec_lvlxl(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009773{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009774 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009775 (vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009776 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009777}
9778
9779static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009780vec_lvlxl(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009781{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009782 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009783 (vector bool char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009784 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009785}
9786
9787static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009788vec_lvlxl(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009789{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009790 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009791 (vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009792 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009793}
9794
9795static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009796vec_lvlxl(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009797{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009798 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009799 (vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009800 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009801}
9802
9803static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009804vec_lvlxl(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009805{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009806 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009807 (vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009808 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009809}
9810
9811static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009812vec_lvlxl(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009813{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009814 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009815 (vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009816 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009817}
9818
9819static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009820vec_lvlxl(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009821{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009822 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009823 (vector bool short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009824 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009825}
9826
9827static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009828vec_lvlxl(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009829{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009830 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009831 (vector pixel)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009832 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009833}
9834
9835static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009836vec_lvlxl(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009837{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009838 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009839 (vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009840 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009841}
9842
9843static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009844vec_lvlxl(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009845{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009846 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009847 (vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009848 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009849}
9850
9851static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009852vec_lvlxl(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009853{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009854 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009855 (vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009856 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009857}
9858
9859static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009860vec_lvlxl(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009861{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009862 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009863 (vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009864 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009865}
9866
9867static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009868vec_lvlxl(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009869{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009870 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009871 (vector bool int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009872 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009873}
9874
9875static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009876vec_lvlxl(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009877{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009878 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009879 (vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009880 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009881}
9882
9883static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009884vec_lvlxl(int __a, vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009885{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009886 return vec_perm(vec_ldl(__a, __b),
Ying Wangb335bb02011-11-29 10:23:55 -08009887 (vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009888 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009889}
9890
9891/* vec_lvrx */
9892
9893static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009894vec_lvrx(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009895{
9896 return vec_perm((vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009897 vec_ld(__a, __b),
9898 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009899}
9900
9901static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009902vec_lvrx(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009903{
9904 return vec_perm((vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009905 vec_ld(__a, __b),
9906 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009907}
9908
9909static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009910vec_lvrx(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009911{
9912 return vec_perm((vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009913 vec_ld(__a, __b),
9914 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009915}
9916
9917static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009918vec_lvrx(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009919{
9920 return vec_perm((vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009921 vec_ld(__a, __b),
9922 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009923}
9924
9925static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009926vec_lvrx(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009927{
9928 return vec_perm((vector bool char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009929 vec_ld(__a, __b),
9930 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009931}
9932
9933static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009934vec_lvrx(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009935{
9936 return vec_perm((vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009937 vec_ld(__a, __b),
9938 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009939}
9940
9941static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009942vec_lvrx(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009943{
9944 return vec_perm((vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009945 vec_ld(__a, __b),
9946 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009947}
9948
9949static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009950vec_lvrx(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009951{
9952 return vec_perm((vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009953 vec_ld(__a, __b),
9954 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009955}
9956
9957static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009958vec_lvrx(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009959{
9960 return vec_perm((vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009961 vec_ld(__a, __b),
9962 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009963}
9964
9965static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009966vec_lvrx(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009967{
9968 return vec_perm((vector bool short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009969 vec_ld(__a, __b),
9970 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009971}
9972
9973static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009974vec_lvrx(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009975{
9976 return vec_perm((vector pixel)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009977 vec_ld(__a, __b),
9978 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009979}
9980
9981static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009982vec_lvrx(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009983{
9984 return vec_perm((vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009985 vec_ld(__a, __b),
9986 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -08009987}
9988
9989static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009990vec_lvrx(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009991{
9992 return vec_perm((vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009993 vec_ld(__a, __b),
9994 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -08009995}
9996
9997static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -07009998vec_lvrx(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -08009999{
10000 return vec_perm((vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010001 vec_ld(__a, __b),
10002 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010003}
10004
10005static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010006vec_lvrx(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010007{
10008 return vec_perm((vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010009 vec_ld(__a, __b),
10010 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010011}
10012
10013static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010014vec_lvrx(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010015{
10016 return vec_perm((vector bool int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010017 vec_ld(__a, __b),
10018 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010019}
10020
10021static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010022vec_lvrx(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010023{
10024 return vec_perm((vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010025 vec_ld(__a, __b),
10026 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010027}
10028
10029static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010030vec_lvrx(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010031{
10032 return vec_perm((vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010033 vec_ld(__a, __b),
10034 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010035}
10036
10037/* vec_lvrxl */
10038
10039static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010040vec_lvrxl(int __a, const signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010041{
10042 return vec_perm((vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010043 vec_ldl(__a, __b),
10044 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010045}
10046
10047static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010048vec_lvrxl(int __a, const vector signed char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010049{
10050 return vec_perm((vector signed char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010051 vec_ldl(__a, __b),
10052 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010053}
10054
10055static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010056vec_lvrxl(int __a, const unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010057{
10058 return vec_perm((vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010059 vec_ldl(__a, __b),
10060 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010061}
10062
10063static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010064vec_lvrxl(int __a, const vector unsigned char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010065{
10066 return vec_perm((vector unsigned char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010067 vec_ldl(__a, __b),
10068 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010069}
10070
10071static vector bool char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010072vec_lvrxl(int __a, const vector bool char *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010073{
10074 return vec_perm((vector bool char)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010075 vec_ldl(__a, __b),
10076 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010077}
10078
10079static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010080vec_lvrxl(int __a, const short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010081{
10082 return vec_perm((vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010083 vec_ldl(__a, __b),
10084 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010085}
10086
10087static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010088vec_lvrxl(int __a, const vector short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010089{
10090 return vec_perm((vector short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010091 vec_ldl(__a, __b),
10092 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010093}
10094
10095static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010096vec_lvrxl(int __a, const unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010097{
10098 return vec_perm((vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010099 vec_ldl(__a, __b),
10100 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010101}
10102
10103static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010104vec_lvrxl(int __a, const vector unsigned short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010105{
10106 return vec_perm((vector unsigned short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010107 vec_ldl(__a, __b),
10108 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010109}
10110
10111static vector bool short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010112vec_lvrxl(int __a, const vector bool short *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010113{
10114 return vec_perm((vector bool short)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010115 vec_ldl(__a, __b),
10116 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010117}
10118
10119static vector pixel __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010120vec_lvrxl(int __a, const vector pixel *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010121{
10122 return vec_perm((vector pixel)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010123 vec_ldl(__a, __b),
10124 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010125}
10126
10127static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010128vec_lvrxl(int __a, const int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010129{
10130 return vec_perm((vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010131 vec_ldl(__a, __b),
10132 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010133}
10134
10135static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010136vec_lvrxl(int __a, const vector int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010137{
10138 return vec_perm((vector int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010139 vec_ldl(__a, __b),
10140 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010141}
10142
10143static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010144vec_lvrxl(int __a, const unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010145{
10146 return vec_perm((vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010147 vec_ldl(__a, __b),
10148 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010149}
10150
10151static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010152vec_lvrxl(int __a, const vector unsigned int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010153{
10154 return vec_perm((vector unsigned int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010155 vec_ldl(__a, __b),
10156 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010157}
10158
10159static vector bool int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010160vec_lvrxl(int __a, const vector bool int *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010161{
10162 return vec_perm((vector bool int)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010163 vec_ldl(__a, __b),
10164 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010165}
10166
10167static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010168vec_lvrxl(int __a, const float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010169{
10170 return vec_perm((vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010171 vec_ldl(__a, __b),
10172 vec_lvsl(__a, __b));
Ying Wangb335bb02011-11-29 10:23:55 -080010173}
10174
10175static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010176vec_lvrxl(int __a, const vector float *__b)
Ying Wangb335bb02011-11-29 10:23:55 -080010177{
10178 return vec_perm((vector float)(0),
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010179 vec_ldl(__a, __b),
10180 vec_lvsl(__a, (unsigned char *)__b));
Ying Wangb335bb02011-11-29 10:23:55 -080010181}
10182
10183/* vec_stvlx */
10184
10185static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010186vec_stvlx(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010187{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010188 return vec_st(vec_perm(vec_lvrx(__b, __c),
10189 __a,
10190 vec_lvsr(__b, __c)),
10191 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010192}
10193
10194static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010195vec_stvlx(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010196{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010197 return vec_st(vec_perm(vec_lvrx(__b, __c),
10198 __a,
10199 vec_lvsr(__b, (unsigned char *)__c)),
10200 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010201}
10202
10203static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010204vec_stvlx(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010205{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010206 return vec_st(vec_perm(vec_lvrx(__b, __c),
10207 __a,
10208 vec_lvsr(__b, __c)),
10209 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010210}
10211
10212static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010213vec_stvlx(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010214{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010215 return vec_st(vec_perm(vec_lvrx(__b, __c),
10216 __a,
10217 vec_lvsr(__b, (unsigned char *)__c)),
10218 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010219}
10220
10221static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010222vec_stvlx(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010223{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010224 return vec_st(vec_perm(vec_lvrx(__b, __c),
10225 __a,
10226 vec_lvsr(__b, (unsigned char *)__c)),
10227 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010228}
10229
10230static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010231vec_stvlx(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010232{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010233 return vec_st(vec_perm(vec_lvrx(__b, __c),
10234 __a,
10235 vec_lvsr(__b, __c)),
10236 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010237}
10238
10239static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010240vec_stvlx(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010241{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010242 return vec_st(vec_perm(vec_lvrx(__b, __c),
10243 __a,
10244 vec_lvsr(__b, (unsigned char *)__c)),
10245 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010246}
10247
10248static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010249vec_stvlx(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010250{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010251 return vec_st(vec_perm(vec_lvrx(__b, __c),
10252 __a,
10253 vec_lvsr(__b, __c)),
10254 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010255}
10256
10257static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010258vec_stvlx(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010259{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010260 return vec_st(vec_perm(vec_lvrx(__b, __c),
10261 __a,
10262 vec_lvsr(__b, (unsigned char *)__c)),
10263 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010264}
10265
10266static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010267vec_stvlx(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010268{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010269 return vec_st(vec_perm(vec_lvrx(__b, __c),
10270 __a,
10271 vec_lvsr(__b, (unsigned char *)__c)),
10272 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010273}
10274
10275static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010276vec_stvlx(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010277{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010278 return vec_st(vec_perm(vec_lvrx(__b, __c),
10279 __a,
10280 vec_lvsr(__b, (unsigned char *)__c)),
10281 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010282}
10283
10284static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010285vec_stvlx(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010286{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010287 return vec_st(vec_perm(vec_lvrx(__b, __c),
10288 __a,
10289 vec_lvsr(__b, __c)),
10290 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010291}
10292
10293static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010294vec_stvlx(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010295{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010296 return vec_st(vec_perm(vec_lvrx(__b, __c),
10297 __a,
10298 vec_lvsr(__b, (unsigned char *)__c)),
10299 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010300}
10301
10302static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010303vec_stvlx(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010304{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010305 return vec_st(vec_perm(vec_lvrx(__b, __c),
10306 __a,
10307 vec_lvsr(__b, __c)),
10308 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010309}
10310
10311static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010312vec_stvlx(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010313{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010314 return vec_st(vec_perm(vec_lvrx(__b, __c),
10315 __a,
10316 vec_lvsr(__b, (unsigned char *)__c)),
10317 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010318}
10319
10320static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010321vec_stvlx(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010322{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010323 return vec_st(vec_perm(vec_lvrx(__b, __c),
10324 __a,
10325 vec_lvsr(__b, (unsigned char *)__c)),
10326 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010327}
10328
10329static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010330vec_stvlx(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010331{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010332 return vec_st(vec_perm(vec_lvrx(__b, __c),
10333 __a,
10334 vec_lvsr(__b, (unsigned char *)__c)),
10335 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010336}
10337
10338/* vec_stvlxl */
10339
10340static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010341vec_stvlxl(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010342{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010343 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10344 __a,
10345 vec_lvsr(__b, __c)),
10346 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010347}
10348
10349static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010350vec_stvlxl(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010351{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010352 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10353 __a,
10354 vec_lvsr(__b, (unsigned char *)__c)),
10355 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010356}
10357
10358static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010359vec_stvlxl(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010360{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010361 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10362 __a,
10363 vec_lvsr(__b, __c)),
10364 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010365}
10366
10367static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010368vec_stvlxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010369{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010370 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10371 __a,
10372 vec_lvsr(__b, (unsigned char *)__c)),
10373 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010374}
10375
10376static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010377vec_stvlxl(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010378{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010379 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10380 __a,
10381 vec_lvsr(__b, (unsigned char *)__c)),
10382 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010383}
10384
10385static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010386vec_stvlxl(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010387{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010388 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10389 __a,
10390 vec_lvsr(__b, __c)),
10391 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010392}
10393
10394static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010395vec_stvlxl(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010396{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010397 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10398 __a,
10399 vec_lvsr(__b, (unsigned char *)__c)),
10400 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010401}
10402
10403static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010404vec_stvlxl(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010405{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010406 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10407 __a,
10408 vec_lvsr(__b, __c)),
10409 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010410}
10411
10412static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010413vec_stvlxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010414{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010415 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10416 __a,
10417 vec_lvsr(__b, (unsigned char *)__c)),
10418 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010419}
10420
10421static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010422vec_stvlxl(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010423{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010424 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10425 __a,
10426 vec_lvsr(__b, (unsigned char *)__c)),
10427 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010428}
10429
10430static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010431vec_stvlxl(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010432{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010433 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10434 __a,
10435 vec_lvsr(__b, (unsigned char *)__c)),
10436 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010437}
10438
10439static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010440vec_stvlxl(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010441{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010442 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10443 __a,
10444 vec_lvsr(__b, __c)),
10445 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010446}
10447
10448static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010449vec_stvlxl(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010450{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010451 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10452 __a,
10453 vec_lvsr(__b, (unsigned char *)__c)),
10454 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010455}
10456
10457static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010458vec_stvlxl(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010459{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010460 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10461 __a,
10462 vec_lvsr(__b, __c)),
10463 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010464}
10465
10466static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010467vec_stvlxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010468{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010469 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10470 __a,
10471 vec_lvsr(__b, (unsigned char *)__c)),
10472 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010473}
10474
10475static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010476vec_stvlxl(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010477{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010478 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10479 __a,
10480 vec_lvsr(__b, (unsigned char *)__c)),
10481 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010482}
10483
10484static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010485vec_stvlxl(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010486{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010487 return vec_stl(vec_perm(vec_lvrx(__b, __c),
10488 __a,
10489 vec_lvsr(__b, (unsigned char *)__c)),
10490 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010491}
10492
10493/* vec_stvrx */
10494
10495static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010496vec_stvrx(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010497{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010498 return vec_st(vec_perm(__a,
10499 vec_lvlx(__b, __c),
10500 vec_lvsr(__b, __c)),
10501 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010502}
10503
10504static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010505vec_stvrx(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010506{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010507 return vec_st(vec_perm(__a,
10508 vec_lvlx(__b, __c),
10509 vec_lvsr(__b, (unsigned char *)__c)),
10510 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010511}
10512
10513static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010514vec_stvrx(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010515{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010516 return vec_st(vec_perm(__a,
10517 vec_lvlx(__b, __c),
10518 vec_lvsr(__b, __c)),
10519 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010520}
10521
10522static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010523vec_stvrx(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010524{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010525 return vec_st(vec_perm(__a,
10526 vec_lvlx(__b, __c),
10527 vec_lvsr(__b, (unsigned char *)__c)),
10528 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010529}
10530
10531static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010532vec_stvrx(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010533{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010534 return vec_st(vec_perm(__a,
10535 vec_lvlx(__b, __c),
10536 vec_lvsr(__b, (unsigned char *)__c)),
10537 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010538}
10539
10540static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010541vec_stvrx(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010542{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010543 return vec_st(vec_perm(__a,
10544 vec_lvlx(__b, __c),
10545 vec_lvsr(__b, __c)),
10546 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010547}
10548
10549static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010550vec_stvrx(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010551{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010552 return vec_st(vec_perm(__a,
10553 vec_lvlx(__b, __c),
10554 vec_lvsr(__b, (unsigned char *)__c)),
10555 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010556}
10557
10558static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010559vec_stvrx(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010560{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010561 return vec_st(vec_perm(__a,
10562 vec_lvlx(__b, __c),
10563 vec_lvsr(__b, __c)),
10564 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010565}
10566
10567static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010568vec_stvrx(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010569{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010570 return vec_st(vec_perm(__a,
10571 vec_lvlx(__b, __c),
10572 vec_lvsr(__b, (unsigned char *)__c)),
10573 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010574}
10575
10576static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010577vec_stvrx(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010578{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010579 return vec_st(vec_perm(__a,
10580 vec_lvlx(__b, __c),
10581 vec_lvsr(__b, (unsigned char *)__c)),
10582 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010583}
10584
10585static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010586vec_stvrx(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010587{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010588 return vec_st(vec_perm(__a,
10589 vec_lvlx(__b, __c),
10590 vec_lvsr(__b, (unsigned char *)__c)),
10591 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010592}
10593
10594static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010595vec_stvrx(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010596{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010597 return vec_st(vec_perm(__a,
10598 vec_lvlx(__b, __c),
10599 vec_lvsr(__b, __c)),
10600 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010601}
10602
10603static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010604vec_stvrx(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010605{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010606 return vec_st(vec_perm(__a,
10607 vec_lvlx(__b, __c),
10608 vec_lvsr(__b, (unsigned char *)__c)),
10609 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010610}
10611
10612static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010613vec_stvrx(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010614{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010615 return vec_st(vec_perm(__a,
10616 vec_lvlx(__b, __c),
10617 vec_lvsr(__b, __c)),
10618 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010619}
10620
10621static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010622vec_stvrx(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010623{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010624 return vec_st(vec_perm(__a,
10625 vec_lvlx(__b, __c),
10626 vec_lvsr(__b, (unsigned char *)__c)),
10627 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010628}
10629
10630static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010631vec_stvrx(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010632{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010633 return vec_st(vec_perm(__a,
10634 vec_lvlx(__b, __c),
10635 vec_lvsr(__b, (unsigned char *)__c)),
10636 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010637}
10638
10639static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010640vec_stvrx(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010641{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010642 return vec_st(vec_perm(__a,
10643 vec_lvlx(__b, __c),
10644 vec_lvsr(__b, (unsigned char *)__c)),
10645 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010646}
10647
10648/* vec_stvrxl */
10649
10650static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010651vec_stvrxl(vector signed char __a, int __b, signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010652{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010653 return vec_stl(vec_perm(__a,
10654 vec_lvlx(__b, __c),
10655 vec_lvsr(__b, __c)),
10656 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010657}
10658
10659static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010660vec_stvrxl(vector signed char __a, int __b, vector signed char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010661{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010662 return vec_stl(vec_perm(__a,
10663 vec_lvlx(__b, __c),
10664 vec_lvsr(__b, (unsigned char *)__c)),
10665 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010666}
10667
10668static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010669vec_stvrxl(vector unsigned char __a, int __b, unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010670{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010671 return vec_stl(vec_perm(__a,
10672 vec_lvlx(__b, __c),
10673 vec_lvsr(__b, __c)),
10674 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010675}
10676
10677static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010678vec_stvrxl(vector unsigned char __a, int __b, vector unsigned char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010679{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010680 return vec_stl(vec_perm(__a,
10681 vec_lvlx(__b, __c),
10682 vec_lvsr(__b, (unsigned char *)__c)),
10683 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010684}
10685
10686static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010687vec_stvrxl(vector bool char __a, int __b, vector bool char *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010688{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010689 return vec_stl(vec_perm(__a,
10690 vec_lvlx(__b, __c),
10691 vec_lvsr(__b, (unsigned char *)__c)),
10692 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010693}
10694
10695static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010696vec_stvrxl(vector short __a, int __b, short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010697{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010698 return vec_stl(vec_perm(__a,
10699 vec_lvlx(__b, __c),
10700 vec_lvsr(__b, __c)),
10701 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010702}
10703
10704static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010705vec_stvrxl(vector short __a, int __b, vector short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010706{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010707 return vec_stl(vec_perm(__a,
10708 vec_lvlx(__b, __c),
10709 vec_lvsr(__b, (unsigned char *)__c)),
10710 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010711}
10712
10713static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010714vec_stvrxl(vector unsigned short __a, int __b, unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010715{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010716 return vec_stl(vec_perm(__a,
10717 vec_lvlx(__b, __c),
10718 vec_lvsr(__b, __c)),
10719 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010720}
10721
10722static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010723vec_stvrxl(vector unsigned short __a, int __b, vector unsigned short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010724{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010725 return vec_stl(vec_perm(__a,
10726 vec_lvlx(__b, __c),
10727 vec_lvsr(__b, (unsigned char *)__c)),
10728 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010729}
10730
10731static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010732vec_stvrxl(vector bool short __a, int __b, vector bool short *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010733{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010734 return vec_stl(vec_perm(__a,
10735 vec_lvlx(__b, __c),
10736 vec_lvsr(__b, (unsigned char *)__c)),
10737 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010738}
10739
10740static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010741vec_stvrxl(vector pixel __a, int __b, vector pixel *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010742{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010743 return vec_stl(vec_perm(__a,
10744 vec_lvlx(__b, __c),
10745 vec_lvsr(__b, (unsigned char *)__c)),
10746 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010747}
10748
10749static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010750vec_stvrxl(vector int __a, int __b, int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010751{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010752 return vec_stl(vec_perm(__a,
10753 vec_lvlx(__b, __c),
10754 vec_lvsr(__b, __c)),
10755 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010756}
10757
10758static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010759vec_stvrxl(vector int __a, int __b, vector int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010760{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010761 return vec_stl(vec_perm(__a,
10762 vec_lvlx(__b, __c),
10763 vec_lvsr(__b, (unsigned char *)__c)),
10764 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010765}
10766
10767static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010768vec_stvrxl(vector unsigned int __a, int __b, unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010769{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010770 return vec_stl(vec_perm(__a,
10771 vec_lvlx(__b, __c),
10772 vec_lvsr(__b, __c)),
10773 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010774}
10775
10776static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010777vec_stvrxl(vector unsigned int __a, int __b, vector unsigned int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010778{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010779 return vec_stl(vec_perm(__a,
10780 vec_lvlx(__b, __c),
10781 vec_lvsr(__b, (unsigned char *)__c)),
10782 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010783}
10784
10785static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010786vec_stvrxl(vector bool int __a, int __b, vector bool int *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010787{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010788 return vec_stl(vec_perm(__a,
10789 vec_lvlx(__b, __c),
10790 vec_lvsr(__b, (unsigned char *)__c)),
10791 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010792}
10793
10794static void __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010795vec_stvrxl(vector float __a, int __b, vector float *__c)
Ying Wangb335bb02011-11-29 10:23:55 -080010796{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010797 return vec_stl(vec_perm(__a,
10798 vec_lvlx(__b, __c),
10799 vec_lvsr(__b, (unsigned char *)__c)),
10800 __b, __c);
Ying Wangb335bb02011-11-29 10:23:55 -080010801}
10802
10803/* vec_promote */
10804
10805static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010806vec_promote(signed char __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010807{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010808 vector signed char __res = (vector signed char)(0);
10809 __res[__b] = __a;
10810 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010811}
10812
10813static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010814vec_promote(unsigned char __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010815{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010816 vector unsigned char __res = (vector unsigned char)(0);
10817 __res[__b] = __a;
10818 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010819}
10820
10821static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010822vec_promote(short __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010823{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010824 vector short __res = (vector short)(0);
10825 __res[__b] = __a;
10826 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010827}
10828
10829static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010830vec_promote(unsigned short __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010831{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010832 vector unsigned short __res = (vector unsigned short)(0);
10833 __res[__b] = __a;
10834 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010835}
10836
10837static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010838vec_promote(int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010839{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010840 vector int __res = (vector int)(0);
10841 __res[__b] = __a;
10842 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010843}
10844
10845static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010846vec_promote(unsigned int __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010847{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010848 vector unsigned int __res = (vector unsigned int)(0);
10849 __res[__b] = __a;
10850 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010851}
10852
10853static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010854vec_promote(float __a, int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010855{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010856 vector float __res = (vector float)(0);
10857 __res[__b] = __a;
10858 return __res;
Ying Wangb335bb02011-11-29 10:23:55 -080010859}
10860
10861/* vec_splats */
10862
10863static vector signed char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010864vec_splats(signed char __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010865{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010866 return (vector signed char)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010867}
10868
10869static vector unsigned char __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010870vec_splats(unsigned char __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010871{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010872 return (vector unsigned char)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010873}
10874
10875static vector short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010876vec_splats(short __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010877{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010878 return (vector short)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010879}
10880
10881static vector unsigned short __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010882vec_splats(unsigned short __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010883{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010884 return (vector unsigned short)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010885}
10886
10887static vector int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010888vec_splats(int __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010889{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010890 return (vector int)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010891}
10892
10893static vector unsigned int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010894vec_splats(unsigned int __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010895{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010896 return (vector unsigned int)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010897}
10898
10899static vector float __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010900vec_splats(float __a)
Ying Wangb335bb02011-11-29 10:23:55 -080010901{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010902 return (vector float)(__a);
Ying Wangb335bb02011-11-29 10:23:55 -080010903}
10904
10905/* ----------------------------- predicates --------------------------------- */
10906
10907/* vec_all_eq */
10908
10909static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010910vec_all_eq(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010911{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010912 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010913}
10914
10915static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010916vec_all_eq(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010917{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010918 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010919}
10920
10921static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010922vec_all_eq(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010923{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010924 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010925}
10926
10927static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010928vec_all_eq(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010929{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010930 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010931}
10932
10933static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010934vec_all_eq(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010935{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010936 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010937}
10938
10939static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010940vec_all_eq(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010941{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010942 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010943}
10944
10945static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010946vec_all_eq(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010947{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010948 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010949}
10950
10951static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010952vec_all_eq(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010953{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010954 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080010955}
10956
10957static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010958vec_all_eq(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010959{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010960 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010961}
10962
10963static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010964vec_all_eq(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010965{
10966 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010967 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010968}
10969
10970static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010971vec_all_eq(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010972{
10973 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010974 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010975}
10976
10977static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010978vec_all_eq(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010979{
10980 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010981 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010982}
10983
10984static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010985vec_all_eq(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010986{
10987 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010988 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010989}
10990
10991static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010992vec_all_eq(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080010993{
10994 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010995 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080010996}
10997
10998static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070010999vec_all_eq(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011000{
11001 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011002 __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011003}
11004
11005static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011006vec_all_eq(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011007{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011008 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011009}
11010
11011static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011012vec_all_eq(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011013{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011014 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011015}
11016
11017static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011018vec_all_eq(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011019{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011020 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011021}
11022
11023static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011024vec_all_eq(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011025{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011026 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011027}
11028
11029static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011030vec_all_eq(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011031{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011032 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011033}
11034
11035static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011036vec_all_eq(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011037{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011038 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011039}
11040
11041static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011042vec_all_eq(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011043{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011044 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011045}
11046
Stephen Hines3f868232015-04-10 09:22:19 -070011047#ifdef __POWER8_VECTOR__
11048static int __ATTRS_o_ai
11049vec_all_eq(vector signed long long __a, vector signed long long __b)
11050{
11051 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b);
11052}
11053
11054static int __ATTRS_o_ai
11055vec_all_eq(vector long long __a, vector bool long long __b)
11056{
11057 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b);
11058}
11059
11060static int __ATTRS_o_ai
11061vec_all_eq(vector unsigned long long __a, vector unsigned long long __b)
11062{
11063 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11064 (vector long long)__b);
11065}
11066
11067static int __ATTRS_o_ai
11068vec_all_eq(vector unsigned long long __a, vector bool long long __b)
11069{
11070 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11071 (vector long long)__b);
11072}
11073
11074static int __ATTRS_o_ai
11075vec_all_eq(vector bool long long __a, vector long long __b)
11076{
11077 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11078 (vector long long)__b);
11079}
11080
11081static int __ATTRS_o_ai
11082vec_all_eq(vector bool long long __a, vector unsigned long long __b)
11083{
11084 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11085 (vector long long)__b);
11086}
11087
11088static int __ATTRS_o_ai
11089vec_all_eq(vector bool long long __a, vector bool long long __b)
11090{
11091 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a,
11092 (vector long long)__b);
11093}
11094#endif
11095
Ying Wangb335bb02011-11-29 10:23:55 -080011096static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011097vec_all_eq(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011098{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011099 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011100}
11101
11102/* vec_all_ge */
11103
11104static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011105vec_all_ge(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011106{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011107 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011108}
11109
11110static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011111vec_all_ge(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011112{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011113 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011114}
11115
11116static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011117vec_all_ge(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011118{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011119 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011120}
11121
11122static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011123vec_all_ge(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011124{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011125 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011126}
11127
11128static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011129vec_all_ge(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011130{
11131 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011132 (vector unsigned char)__b,
11133 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011134}
11135
11136static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011137vec_all_ge(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011138{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011139 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011140}
11141
11142static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011143vec_all_ge(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011144{
11145 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011146 (vector unsigned char)__b,
11147 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011148}
11149
11150static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011151vec_all_ge(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011152{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011153 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011154}
11155
11156static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011157vec_all_ge(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011158{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011159 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011160}
11161
11162static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011163vec_all_ge(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011164{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011165 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011166}
11167
11168static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011169vec_all_ge(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011170{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011171 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011172}
11173
11174static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011175vec_all_ge(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011176{
11177 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011178 (vector unsigned short)__b,
11179 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011180}
11181
11182static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011183vec_all_ge(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011184{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011185 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011186}
11187
11188static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011189vec_all_ge(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011190{
11191 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011192 (vector unsigned short)__b,
11193 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011194}
11195
11196static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011197vec_all_ge(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011198{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011199 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011200}
11201
11202static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011203vec_all_ge(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011204{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011205 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011206}
11207
11208static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011209vec_all_ge(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011210{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011211 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011212}
11213
11214static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011215vec_all_ge(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011216{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011217 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011218}
11219
11220static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011221vec_all_ge(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011222{
11223 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011224 (vector unsigned int)__b,
11225 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011226}
11227
11228static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011229vec_all_ge(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011230{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011231 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011232}
11233
11234static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011235vec_all_ge(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011236{
11237 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011238 (vector unsigned int)__b,
11239 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011240}
11241
Stephen Hines3f868232015-04-10 09:22:19 -070011242#ifdef __POWER8_VECTOR__
11243static int __ATTRS_o_ai
11244vec_all_ge(vector signed long long __a, vector signed long long __b)
11245{
11246 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a);
11247}
11248static int __ATTRS_o_ai
11249vec_all_ge(vector signed long long __a, vector bool long long __b)
11250{
11251 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b,
11252 __a);
11253}
11254
11255static int __ATTRS_o_ai
11256vec_all_ge(vector unsigned long long __a, vector unsigned long long __b)
11257{
11258 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a);
11259}
11260
11261static int __ATTRS_o_ai
11262vec_all_ge(vector unsigned long long __a, vector bool long long __b)
11263{
11264 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b,
11265 __a);
11266}
11267
11268static int __ATTRS_o_ai
11269vec_all_ge(vector bool long long __a, vector signed long long __b)
11270{
11271 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11272 (vector unsigned long long)__b,
11273 (vector unsigned long long)__a);
11274}
11275
11276static int __ATTRS_o_ai
11277vec_all_ge(vector bool long long __a, vector unsigned long long __b)
11278{
11279 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b,
11280 (vector unsigned long long)__a);
11281}
11282
11283static int __ATTRS_o_ai
11284vec_all_ge(vector bool long long __a, vector bool long long __b)
11285{
11286 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11287 (vector unsigned long long)__b,
11288 (vector unsigned long long)__a);
11289}
11290#endif
11291
Ying Wangb335bb02011-11-29 10:23:55 -080011292static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011293vec_all_ge(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011294{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011295 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011296}
11297
11298/* vec_all_gt */
11299
11300static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011301vec_all_gt(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011302{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011303 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011304}
11305
11306static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011307vec_all_gt(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011308{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011309 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011310}
11311
11312static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011313vec_all_gt(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011314{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011315 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011316}
11317
11318static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011319vec_all_gt(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011320{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011321 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011322}
11323
11324static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011325vec_all_gt(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011326{
11327 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011328 (vector unsigned char)__a,
11329 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011330}
11331
11332static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011333vec_all_gt(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011334{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011335 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011336}
11337
11338static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011339vec_all_gt(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011340{
11341 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011342 (vector unsigned char)__a,
11343 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011344}
11345
11346static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011347vec_all_gt(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011348{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011349 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011350}
11351
11352static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011353vec_all_gt(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011354{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011355 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011356}
11357
11358static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011359vec_all_gt(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011360{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011361 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011362}
11363
11364static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011365vec_all_gt(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011366{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011367 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011368}
11369
11370static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011371vec_all_gt(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011372{
11373 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011374 (vector unsigned short)__a,
11375 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011376}
11377
11378static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011379vec_all_gt(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011380{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011381 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011382}
11383
11384static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011385vec_all_gt(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011386{
11387 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011388 (vector unsigned short)__a,
11389 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011390}
11391
11392static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011393vec_all_gt(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011394{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011395 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011396}
11397
11398static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011399vec_all_gt(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011400{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011401 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011402}
11403
11404static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011405vec_all_gt(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011406{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011407 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011408}
11409
11410static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011411vec_all_gt(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011412{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011413 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011414}
11415
11416static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011417vec_all_gt(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011418{
11419 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011420 (vector unsigned int)__a,
11421 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011422}
11423
11424static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011425vec_all_gt(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011426{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011427 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011428}
11429
11430static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011431vec_all_gt(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011432{
11433 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011434 (vector unsigned int)__a,
11435 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011436}
11437
Stephen Hines3f868232015-04-10 09:22:19 -070011438#ifdef __POWER8_VECTOR__
11439static int __ATTRS_o_ai
11440vec_all_gt(vector signed long long __a, vector signed long long __b)
11441{
11442 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b);
11443}
11444static int __ATTRS_o_ai
11445vec_all_gt(vector signed long long __a, vector bool long long __b)
11446{
11447 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a,
11448 (vector signed long long)__b);
11449}
11450
11451static int __ATTRS_o_ai
11452vec_all_gt(vector unsigned long long __a, vector unsigned long long __b)
11453{
11454 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b);
11455}
11456
11457static int __ATTRS_o_ai
11458vec_all_gt(vector unsigned long long __a, vector bool long long __b)
11459{
11460 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a,
11461 (vector unsigned long long)__b);
11462}
11463
11464static int __ATTRS_o_ai
11465vec_all_gt(vector bool long long __a, vector signed long long __b)
11466{
11467 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11468 (vector unsigned long long)__a,
11469 (vector unsigned long long)__b);
11470}
11471
11472static int __ATTRS_o_ai
11473vec_all_gt(vector bool long long __a, vector unsigned long long __b)
11474{
11475 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a,
11476 __b);
11477}
11478
11479static int __ATTRS_o_ai
11480vec_all_gt(vector bool long long __a, vector bool long long __b)
11481{
11482 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11483 (vector unsigned long long)__a,
11484 (vector unsigned long long)__b);
11485}
11486#endif
11487
Ying Wangb335bb02011-11-29 10:23:55 -080011488static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011489vec_all_gt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011490{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011491 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011492}
11493
11494/* vec_all_in */
11495
11496static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011497vec_all_in(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011498{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011499 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011500}
11501
11502/* vec_all_le */
11503
11504static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011505vec_all_le(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011506{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011507 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011508}
11509
11510static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011511vec_all_le(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011512{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011513 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011514}
11515
11516static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011517vec_all_le(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011518{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011519 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011520}
11521
11522static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011523vec_all_le(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011524{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011525 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011526}
11527
11528static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011529vec_all_le(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011530{
11531 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011532 (vector unsigned char)__a,
11533 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011534}
11535
11536static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011537vec_all_le(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011538{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011539 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011540}
11541
11542static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011543vec_all_le(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011544{
11545 return __builtin_altivec_vcmpgtub_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011546 (vector unsigned char)__a,
11547 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011548}
11549
11550static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011551vec_all_le(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011552{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011553 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011554}
11555
11556static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011557vec_all_le(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011558{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011559 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011560}
11561
11562static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011563vec_all_le(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011564{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011565 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011566}
11567
11568static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011569vec_all_le(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011570{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011571 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011572}
11573
11574static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011575vec_all_le(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011576{
11577 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011578 (vector unsigned short)__a,
11579 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011580}
11581
11582static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011583vec_all_le(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011584{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011585 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011586}
11587
11588static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011589vec_all_le(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011590{
11591 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011592 (vector unsigned short)__a,
11593 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011594}
11595
11596static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011597vec_all_le(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011598{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011599 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011600}
11601
11602static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011603vec_all_le(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011604{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011605 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011606}
11607
11608static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011609vec_all_le(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011610{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011611 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011612}
11613
11614static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011615vec_all_le(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011616{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011617 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011618}
11619
11620static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011621vec_all_le(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011622{
11623 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011624 (vector unsigned int)__a,
11625 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011626}
11627
11628static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011629vec_all_le(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011630{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011631 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011632}
11633
11634static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011635vec_all_le(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011636{
11637 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011638 (vector unsigned int)__a,
11639 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011640}
11641
Stephen Hines3f868232015-04-10 09:22:19 -070011642#ifdef __POWER8_VECTOR__
11643static int __ATTRS_o_ai
11644vec_all_le(vector signed long long __a, vector signed long long __b)
11645{
11646 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b);
11647}
11648
11649static int __ATTRS_o_ai
11650vec_all_le(vector unsigned long long __a, vector unsigned long long __b)
11651{
11652 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b);
11653}
11654
11655static int __ATTRS_o_ai
11656vec_all_le(vector signed long long __a, vector bool long long __b)
11657{
11658 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a,
11659 (vector signed long long)__b);
11660}
11661
11662static int __ATTRS_o_ai
11663vec_all_le(vector unsigned long long __a, vector bool long long __b)
11664{
11665 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a,
11666 (vector unsigned long long)__b);
11667}
11668
11669static int __ATTRS_o_ai
11670vec_all_le(vector bool long long __a, vector signed long long __b)
11671{
11672 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11673 (vector unsigned long long)__a,
11674 (vector unsigned long long)__b);
11675}
11676
11677static int __ATTRS_o_ai
11678vec_all_le(vector bool long long __a, vector unsigned long long __b)
11679{
11680 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a,
11681 __b);
11682}
11683
11684static int __ATTRS_o_ai
11685vec_all_le(vector bool long long __a, vector bool long long __b)
11686{
11687 return __builtin_altivec_vcmpgtud_p(__CR6_EQ,
11688 (vector unsigned long long)__a,
11689 (vector unsigned long long)__b);
11690}
11691#endif
11692
Ying Wangb335bb02011-11-29 10:23:55 -080011693static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011694vec_all_le(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011695{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011696 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011697}
11698
11699/* vec_all_lt */
11700
11701static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011702vec_all_lt(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011703{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011704 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011705}
11706
11707static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011708vec_all_lt(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011709{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011710 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011711}
11712
11713static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011714vec_all_lt(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011715{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011716 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011717}
11718
11719static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011720vec_all_lt(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011721{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011722 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011723}
11724
11725static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011726vec_all_lt(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011727{
11728 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011729 (vector unsigned char)__b,
11730 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011731}
11732
11733static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011734vec_all_lt(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011735{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011736 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011737}
11738
11739static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011740vec_all_lt(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011741{
11742 return __builtin_altivec_vcmpgtub_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011743 (vector unsigned char)__b,
11744 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011745}
11746
11747static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011748vec_all_lt(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011749{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011750 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011751}
11752
11753static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011754vec_all_lt(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011755{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011756 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011757}
11758
11759static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011760vec_all_lt(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011761{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011762 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011763}
11764
11765static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011766vec_all_lt(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011767{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011768 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011769}
11770
11771static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011772vec_all_lt(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011773{
11774 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011775 (vector unsigned short)__b,
11776 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011777}
11778
11779static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011780vec_all_lt(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011781{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011782 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011783}
11784
11785static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011786vec_all_lt(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011787{
11788 return __builtin_altivec_vcmpgtuh_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011789 (vector unsigned short)__b,
11790 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011791}
11792
11793static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011794vec_all_lt(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011795{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011796 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011797}
11798
11799static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011800vec_all_lt(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011801{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011802 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011803}
11804
11805static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011806vec_all_lt(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011807{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011808 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011809}
11810
11811static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011812vec_all_lt(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011813{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011814 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011815}
11816
11817static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011818vec_all_lt(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011819{
11820 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011821 (vector unsigned int)__b,
11822 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011823}
11824
11825static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011826vec_all_lt(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011827{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011828 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011829}
11830
11831static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011832vec_all_lt(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011833{
11834 return __builtin_altivec_vcmpgtuw_p(__CR6_LT,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011835 (vector unsigned int)__b,
11836 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080011837}
11838
Stephen Hines3f868232015-04-10 09:22:19 -070011839#ifdef __POWER8_VECTOR__
11840static int __ATTRS_o_ai
11841vec_all_lt(vector signed long long __a, vector signed long long __b)
11842{
11843 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a);
11844}
11845
11846static int __ATTRS_o_ai
11847vec_all_lt(vector unsigned long long __a, vector unsigned long long __b)
11848{
11849 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a);
11850}
11851
11852static int __ATTRS_o_ai
11853vec_all_lt(vector signed long long __a, vector bool long long __b)
11854{
11855 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b,
11856 __a);
11857}
11858
11859static int __ATTRS_o_ai
11860vec_all_lt(vector unsigned long long __a, vector bool long long __b)
11861{
11862 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b,
11863 __a);
11864}
11865
11866static int __ATTRS_o_ai
11867vec_all_lt(vector bool long long __a, vector signed long long __b)
11868{
11869 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11870 (vector unsigned long long)__b,
11871 (vector unsigned long long)__a);
11872}
11873
11874static int __ATTRS_o_ai
11875vec_all_lt(vector bool long long __a, vector unsigned long long __b)
11876{
11877 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b,
11878 (vector unsigned long long)__a);
11879}
11880
11881static int __ATTRS_o_ai
11882vec_all_lt(vector bool long long __a, vector bool long long __b)
11883{
11884 return __builtin_altivec_vcmpgtud_p(__CR6_LT,
11885 (vector unsigned long long)__b,
11886 (vector unsigned long long)__a);
11887}
11888#endif
11889
Ying Wangb335bb02011-11-29 10:23:55 -080011890static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011891vec_all_lt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011892{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011893 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011894}
11895
11896/* vec_all_nan */
11897
11898static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011899vec_all_nan(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -080011900{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011901 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080011902}
11903
11904/* vec_all_ne */
11905
11906static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011907vec_all_ne(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011908{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011909 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011910}
11911
11912static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011913vec_all_ne(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011914{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011915 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011916}
11917
11918static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011919vec_all_ne(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011920{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011921 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011922}
11923
11924static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011925vec_all_ne(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011926{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011927 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011928}
11929
11930static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011931vec_all_ne(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011932{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011933 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011934}
11935
11936static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011937vec_all_ne(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011938{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011939 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011940}
11941
11942static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011943vec_all_ne(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011944{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011945 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011946}
11947
11948static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011949vec_all_ne(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011950{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011951 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080011952}
11953
11954static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011955vec_all_ne(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011956{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011957 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011958}
11959
11960static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011961vec_all_ne(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011962{
11963 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011964 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011965}
11966
11967static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011968vec_all_ne(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011969{
11970 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011971 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011972}
11973
11974static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011975vec_all_ne(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011976{
11977 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011978 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011979}
11980
11981static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011982vec_all_ne(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011983{
11984 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011985 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011986}
11987
11988static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011989vec_all_ne(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011990{
11991 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011992 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080011993}
11994
11995static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011996vec_all_ne(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -080011997{
11998 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070011999 __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012000}
12001
12002static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012003vec_all_ne(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012004{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012005 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012006}
12007
12008static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012009vec_all_ne(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012010{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012011 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012012}
12013
12014static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012015vec_all_ne(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012016{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012017 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012018}
12019
12020static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012021vec_all_ne(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012022{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012023 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012024}
12025
12026static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012027vec_all_ne(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012028{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012029 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012030}
12031
12032static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012033vec_all_ne(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012034{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012035 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012036}
12037
12038static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012039vec_all_ne(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012040{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012041 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012042}
12043
Stephen Hines3f868232015-04-10 09:22:19 -070012044#ifdef __POWER8_VECTOR__
12045static int __ATTRS_o_ai
12046vec_all_ne(vector signed long long __a, vector signed long long __b)
12047{
12048 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b);
12049}
12050
12051static int __ATTRS_o_ai
12052vec_all_ne(vector unsigned long long __a, vector unsigned long long __b)
12053{
12054 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a,
12055 (vector long long)__b);
12056}
12057
12058static int __ATTRS_o_ai
12059vec_all_ne(vector signed long long __a, vector bool long long __b)
12060{
12061 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a,
12062 (vector signed long long)__b);
12063}
12064
12065static int __ATTRS_o_ai
12066vec_all_ne(vector unsigned long long __a, vector bool long long __b)
12067{
12068 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12069 (vector signed long long)__b);
12070}
12071
12072static int __ATTRS_o_ai
12073vec_all_ne(vector bool long long __a, vector signed long long __b)
12074{
12075 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12076 (vector signed long long)__b);
12077}
12078
12079static int __ATTRS_o_ai
12080vec_all_ne(vector bool long long __a, vector unsigned long long __b)
12081{
12082 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12083 (vector signed long long)__b);
12084}
12085
12086static int __ATTRS_o_ai
12087vec_all_ne(vector bool long long __a, vector bool long long __b)
12088{
12089 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a,
12090 (vector signed long long)__b);
12091}
12092#endif
12093
Ying Wangb335bb02011-11-29 10:23:55 -080012094static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012095vec_all_ne(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012096{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012097 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012098}
12099
12100/* vec_all_nge */
12101
12102static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012103vec_all_nge(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012104{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012105 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012106}
12107
12108/* vec_all_ngt */
12109
12110static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012111vec_all_ngt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012112{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012113 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012114}
12115
12116/* vec_all_nle */
12117
12118static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012119vec_all_nle(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012120{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012121 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012122}
12123
12124/* vec_all_nlt */
12125
12126static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012127vec_all_nlt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012128{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012129 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012130}
12131
12132/* vec_all_numeric */
12133
12134static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012135vec_all_numeric(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -080012136{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012137 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012138}
12139
12140/* vec_any_eq */
12141
12142static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012143vec_any_eq(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012144{
12145 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012146 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012147}
12148
12149static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012150vec_any_eq(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012151{
12152 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012153 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012154}
12155
12156static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012157vec_any_eq(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012158{
12159 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012160 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012161}
12162
12163static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012164vec_any_eq(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012165{
12166 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012167 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012168}
12169
12170static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012171vec_any_eq(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012172{
12173 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012174 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012175}
12176
12177static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012178vec_any_eq(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012179{
12180 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012181 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012182}
12183
12184static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012185vec_any_eq(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012186{
12187 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012188 __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012189}
12190
12191static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012192vec_any_eq(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012193{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012194 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012195}
12196
12197static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012198vec_any_eq(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012199{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012200 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012201}
12202
12203static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012204vec_any_eq(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012205{
12206 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012207 (vector short)__a,
12208 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012209}
12210
12211static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012212vec_any_eq(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012213{
12214 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012215 (vector short)__a,
12216 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012217}
12218
12219static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012220vec_any_eq(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012221{
12222 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012223 (vector short)__a,
12224 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012225}
12226
12227static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012228vec_any_eq(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012229{
12230 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012231 (vector short)__a,
12232 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012233}
12234
12235static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012236vec_any_eq(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012237{
12238 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012239 (vector short)__a,
12240 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012241}
12242
12243static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012244vec_any_eq(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012245{
12246 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012247 (vector short)__a,
12248 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012249}
12250
12251static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012252vec_any_eq(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012253{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012254 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012255}
12256
12257static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012258vec_any_eq(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012259{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012260 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012261}
12262
12263static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012264vec_any_eq(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012265{
12266 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012267 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012268}
12269
12270static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012271vec_any_eq(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012272{
12273 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012274 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012275}
12276
12277static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012278vec_any_eq(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012279{
12280 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012281 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012282}
12283
12284static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012285vec_any_eq(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012286{
12287 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012288 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012289}
12290
12291static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012292vec_any_eq(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012293{
12294 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012295 __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012296}
12297
Stephen Hines3f868232015-04-10 09:22:19 -070012298#ifdef __POWER8_VECTOR__
12299static int __ATTRS_o_ai
12300vec_any_eq(vector signed long long __a, vector signed long long __b)
12301{
12302 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b);
12303}
12304
12305static int __ATTRS_o_ai
12306vec_any_eq(vector unsigned long long __a, vector unsigned long long __b)
12307{
12308 return
12309 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a,
12310 (vector long long)__b);
12311}
12312
12313static int __ATTRS_o_ai
12314vec_any_eq(vector signed long long __a, vector bool long long __b)
12315{
12316 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a,
12317 (vector signed long long)__b);
12318}
12319
12320static int __ATTRS_o_ai
12321vec_any_eq(vector unsigned long long __a, vector bool long long __b)
12322{
12323 return
12324 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12325 (vector signed long long)__b);
12326}
12327
12328static int __ATTRS_o_ai
12329vec_any_eq(vector bool long long __a, vector signed long long __b)
12330{
12331 return
12332 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12333 (vector signed long long)__b);
12334}
12335
12336static int __ATTRS_o_ai
12337vec_any_eq(vector bool long long __a, vector unsigned long long __b)
12338{
12339 return
12340 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12341 (vector signed long long)__b);
12342}
12343
12344static int __ATTRS_o_ai
12345vec_any_eq(vector bool long long __a, vector bool long long __b)
12346{
12347 return
12348 __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector signed long long)__a,
12349 (vector signed long long)__b);
12350}
12351#endif
12352
Ying Wangb335bb02011-11-29 10:23:55 -080012353static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012354vec_any_eq(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012355{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012356 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012357}
12358
12359/* vec_any_ge */
12360
12361static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012362vec_any_ge(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012363{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012364 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012365}
12366
12367static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012368vec_any_ge(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012369{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012370 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012371}
12372
12373static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012374vec_any_ge(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012375{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012376 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012377}
12378
12379static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012380vec_any_ge(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012381{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012382 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012383}
12384
12385static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012386vec_any_ge(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012387{
12388 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012389 (vector unsigned char)__b,
12390 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012391}
12392
12393static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012394vec_any_ge(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012395{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012396 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012397}
12398
12399static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012400vec_any_ge(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012401{
12402 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012403 (vector unsigned char)__b,
12404 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012405}
12406
12407static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012408vec_any_ge(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012409{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012410 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012411}
12412
12413static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012414vec_any_ge(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012415{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012416 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012417}
12418
12419static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012420vec_any_ge(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012421{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012422 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012423}
12424
12425static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012426vec_any_ge(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012427{
12428 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012429 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012430}
12431
12432static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012433vec_any_ge(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012434{
12435 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012436 (vector unsigned short)__b,
12437 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012438}
12439
12440static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012441vec_any_ge(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012442{
12443 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012444 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012445}
12446
12447static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012448vec_any_ge(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012449{
12450 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012451 (vector unsigned short)__b,
12452 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012453}
12454
12455static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012456vec_any_ge(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012457{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012458 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012459}
12460
12461static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012462vec_any_ge(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012463{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012464 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012465}
12466
12467static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012468vec_any_ge(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012469{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012470 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012471}
12472
12473static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012474vec_any_ge(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012475{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012476 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012477}
12478
12479static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012480vec_any_ge(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012481{
12482 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012483 (vector unsigned int)__b,
12484 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012485}
12486
12487static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012488vec_any_ge(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012489{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012490 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012491}
12492
12493static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012494vec_any_ge(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012495{
12496 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012497 (vector unsigned int)__b,
12498 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012499}
12500
Stephen Hines3f868232015-04-10 09:22:19 -070012501#ifdef __POWER8_VECTOR__
12502static int __ATTRS_o_ai
12503vec_any_ge(vector signed long long __a, vector signed long long __b)
12504{
12505 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a);
12506}
12507
12508static int __ATTRS_o_ai
12509vec_any_ge(vector unsigned long long __a, vector unsigned long long __b)
12510{
12511 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a);
12512}
12513
12514static int __ATTRS_o_ai
12515vec_any_ge(vector signed long long __a, vector bool long long __b)
12516{
12517 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV,
12518 (vector signed long long)__b, __a);
12519}
12520
12521static int __ATTRS_o_ai
12522vec_any_ge(vector unsigned long long __a, vector bool long long __b)
12523{
12524 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12525 (vector unsigned long long)__b, __a);
12526}
12527
12528static int __ATTRS_o_ai
12529vec_any_ge(vector bool long long __a, vector signed long long __b)
12530{
12531 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12532 (vector unsigned long long)__b,
12533 (vector unsigned long long)__a);
12534}
12535
12536static int __ATTRS_o_ai
12537vec_any_ge(vector bool long long __a, vector unsigned long long __b)
12538{
12539 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b,
12540 (vector unsigned long long)__a);
12541}
12542
12543static int __ATTRS_o_ai
12544vec_any_ge(vector bool long long __a, vector bool long long __b)
12545{
12546 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12547 (vector unsigned long long)__b,
12548 (vector unsigned long long)__a);
12549}
12550#endif
12551
Ying Wangb335bb02011-11-29 10:23:55 -080012552static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012553vec_any_ge(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012554{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012555 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012556}
12557
12558/* vec_any_gt */
12559
12560static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012561vec_any_gt(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012562{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012563 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012564}
12565
12566static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012567vec_any_gt(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012568{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012569 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012570}
12571
12572static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012573vec_any_gt(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012574{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012575 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012576}
12577
12578static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012579vec_any_gt(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012580{
12581 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012582 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012583}
12584
12585static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012586vec_any_gt(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012587{
12588 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012589 (vector unsigned char)__a,
12590 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012591}
12592
12593static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012594vec_any_gt(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012595{
12596 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012597 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012598}
12599
12600static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012601vec_any_gt(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012602{
12603 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012604 (vector unsigned char)__a,
12605 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012606}
12607
12608static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012609vec_any_gt(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012610{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012611 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012612}
12613
12614static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012615vec_any_gt(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012616{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012617 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012618}
12619
12620static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012621vec_any_gt(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012622{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012623 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012624}
12625
12626static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012627vec_any_gt(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012628{
12629 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012630 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012631}
12632
12633static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012634vec_any_gt(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012635{
12636 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012637 (vector unsigned short)__a,
12638 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012639}
12640
12641static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012642vec_any_gt(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012643{
12644 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012645 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012646}
12647
12648static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012649vec_any_gt(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012650{
12651 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012652 (vector unsigned short)__a,
12653 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012654}
12655
12656static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012657vec_any_gt(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012658{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012659 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012660}
12661
12662static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012663vec_any_gt(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012664{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012665 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012666}
12667
12668static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012669vec_any_gt(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012670{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012671 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012672}
12673
12674static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012675vec_any_gt(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012676{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012677 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012678}
12679
12680static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012681vec_any_gt(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012682{
12683 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012684 (vector unsigned int)__a,
12685 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012686}
12687
12688static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012689vec_any_gt(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012690{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012691 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012692}
12693
12694static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012695vec_any_gt(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012696{
12697 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012698 (vector unsigned int)__a,
12699 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012700}
12701
Stephen Hines3f868232015-04-10 09:22:19 -070012702#ifdef __POWER8_VECTOR__
12703static int __ATTRS_o_ai
12704vec_any_gt(vector signed long long __a, vector signed long long __b)
12705{
12706 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b);
12707}
12708
12709static int __ATTRS_o_ai
12710vec_any_gt(vector unsigned long long __a, vector unsigned long long __b)
12711{
12712 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b);
12713}
12714
12715static int __ATTRS_o_ai
12716vec_any_gt(vector signed long long __a, vector bool long long __b)
12717{
12718 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a,
12719 (vector signed long long)__b);
12720}
12721
12722
12723static int __ATTRS_o_ai
12724vec_any_gt(vector unsigned long long __a, vector bool long long __b)
12725{
12726 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a,
12727 (vector unsigned long long)__b);
12728}
12729
12730static int __ATTRS_o_ai
12731vec_any_gt(vector bool long long __a, vector signed long long __b)
12732{
12733 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12734 (vector unsigned long long)__a,
12735 (vector unsigned long long)__b);
12736}
12737
12738static int __ATTRS_o_ai
12739vec_any_gt(vector bool long long __a, vector unsigned long long __b)
12740{
12741 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12742 (vector unsigned long long)__a, __b);
12743}
12744
12745static int __ATTRS_o_ai
12746vec_any_gt(vector bool long long __a, vector bool long long __b)
12747{
12748 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
12749 (vector unsigned long long)__a,
12750 (vector unsigned long long)__b);
12751}
12752#endif
12753
Ying Wangb335bb02011-11-29 10:23:55 -080012754static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012755vec_any_gt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012756{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012757 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012758}
12759
12760/* vec_any_le */
12761
12762static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012763vec_any_le(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012764{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012765 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012766}
12767
12768static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012769vec_any_le(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012770{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012771 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, (vector signed char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012772}
12773
12774static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012775vec_any_le(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012776{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012777 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012778}
12779
12780static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012781vec_any_le(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012782{
12783 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012784 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012785}
12786
12787static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012788vec_any_le(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012789{
12790 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012791 (vector unsigned char)__a,
12792 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012793}
12794
12795static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012796vec_any_le(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012797{
12798 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012799 __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012800}
12801
12802static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012803vec_any_le(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012804{
12805 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012806 (vector unsigned char)__a,
12807 (vector unsigned char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012808}
12809
12810static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012811vec_any_le(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012812{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012813 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012814}
12815
12816static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012817vec_any_le(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012818{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012819 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012820}
12821
12822static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012823vec_any_le(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012824{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012825 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012826}
12827
12828static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012829vec_any_le(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012830{
12831 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012832 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012833}
12834
12835static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012836vec_any_le(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012837{
12838 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012839 (vector unsigned short)__a,
12840 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012841}
12842
12843static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012844vec_any_le(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012845{
12846 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012847 __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012848}
12849
12850static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012851vec_any_le(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012852{
12853 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012854 (vector unsigned short)__a,
12855 (vector unsigned short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012856}
12857
12858static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012859vec_any_le(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012860{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012861 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012862}
12863
12864static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012865vec_any_le(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012866{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012867 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012868}
12869
12870static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012871vec_any_le(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012872{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012873 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012874}
12875
12876static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012877vec_any_le(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012878{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012879 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012880}
12881
12882static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012883vec_any_le(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012884{
12885 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012886 (vector unsigned int)__a,
12887 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012888}
12889
12890static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012891vec_any_le(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012892{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012893 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080012894}
12895
12896static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012897vec_any_le(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012898{
12899 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012900 (vector unsigned int)__a,
12901 (vector unsigned int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080012902}
12903
Stephen Hines3f868232015-04-10 09:22:19 -070012904#ifdef __POWER8_VECTOR__
12905static int __ATTRS_o_ai
12906vec_any_le(vector signed long long __a, vector signed long long __b)
12907{
12908 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b);
12909}
12910
12911static int __ATTRS_o_ai
12912vec_any_le(vector unsigned long long __a, vector unsigned long long __b)
12913{
12914 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b);
12915}
12916
12917static int __ATTRS_o_ai
12918vec_any_le(vector signed long long __a, vector bool long long __b)
12919{
12920 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a,
12921 (vector signed long long)__b);
12922}
12923
12924static int __ATTRS_o_ai
12925vec_any_le(vector unsigned long long __a, vector bool long long __b)
12926{
12927 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a,
12928 (vector unsigned long long)__b);
12929}
12930
12931static int __ATTRS_o_ai
12932vec_any_le(vector bool long long __a, vector signed long long __b)
12933{
12934 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12935 (vector unsigned long long)__a,
12936 (vector unsigned long long)__b);
12937}
12938
12939static int __ATTRS_o_ai
12940vec_any_le(vector bool long long __a, vector unsigned long long __b)
12941{
12942 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12943 (vector unsigned long long)__a, __b);
12944}
12945
12946static int __ATTRS_o_ai
12947vec_any_le(vector bool long long __a, vector bool long long __b)
12948{
12949 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV,
12950 (vector unsigned long long)__a,
12951 (vector unsigned long long)__b);
12952}
12953#endif
12954
Ying Wangb335bb02011-11-29 10:23:55 -080012955static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012956vec_any_le(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012957{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012958 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012959}
12960
12961/* vec_any_lt */
12962
12963static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012964vec_any_lt(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012965{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012966 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012967}
12968
12969static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012970vec_any_lt(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012971{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012972 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012973}
12974
12975static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012976vec_any_lt(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012977{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012978 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012979}
12980
12981static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012982vec_any_lt(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012983{
12984 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012985 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080012986}
12987
12988static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012989vec_any_lt(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012990{
12991 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012992 (vector unsigned char)__b,
12993 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080012994}
12995
12996static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070012997vec_any_lt(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080012998{
12999 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013000 __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013001}
13002
13003static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013004vec_any_lt(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013005{
13006 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013007 (vector unsigned char)__b,
13008 (vector unsigned char)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013009}
13010
13011static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013012vec_any_lt(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013013{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013014 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013015}
13016
13017static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013018vec_any_lt(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013019{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013020 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013021}
13022
13023static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013024vec_any_lt(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013025{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013026 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013027}
13028
13029static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013030vec_any_lt(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013031{
13032 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013033 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013034}
13035
13036static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013037vec_any_lt(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013038{
13039 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013040 (vector unsigned short)__b,
13041 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013042}
13043
13044static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013045vec_any_lt(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013046{
13047 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013048 __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013049}
13050
13051static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013052vec_any_lt(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013053{
13054 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013055 (vector unsigned short)__b,
13056 (vector unsigned short)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013057}
13058
13059static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013060vec_any_lt(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013061{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013062 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013063}
13064
13065static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013066vec_any_lt(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013067{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013068 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013069}
13070
13071static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013072vec_any_lt(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013073{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013074 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013075}
13076
13077static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013078vec_any_lt(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013079{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013080 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013081}
13082
13083static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013084vec_any_lt(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013085{
13086 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013087 (vector unsigned int)__b,
13088 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013089}
13090
13091static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013092vec_any_lt(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013093{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013094 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013095}
13096
13097static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013098vec_any_lt(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013099{
13100 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013101 (vector unsigned int)__b,
13102 (vector unsigned int)__a);
Ying Wangb335bb02011-11-29 10:23:55 -080013103}
13104
Stephen Hines3f868232015-04-10 09:22:19 -070013105#ifdef __POWER8_VECTOR__
13106static int __ATTRS_o_ai
13107vec_any_lt(vector signed long long __a, vector signed long long __b)
13108{
13109 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a);
13110}
13111
13112static int __ATTRS_o_ai
13113vec_any_lt(vector unsigned long long __a, vector unsigned long long __b)
13114{
13115 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a);
13116}
13117
13118static int __ATTRS_o_ai
13119vec_any_lt(vector signed long long __a, vector bool long long __b)
13120{
13121 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV,
13122 (vector signed long long)__b, __a);
13123}
13124
13125static int __ATTRS_o_ai
13126vec_any_lt(vector unsigned long long __a, vector bool long long __b)
13127{
13128 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13129 (vector unsigned long long)__b, __a);
13130}
13131
13132static int __ATTRS_o_ai
13133vec_any_lt(vector bool long long __a, vector signed long long __b)
13134{
13135 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13136 (vector unsigned long long)__b,
13137 (vector unsigned long long)__a);
13138}
13139
13140static int __ATTRS_o_ai
13141vec_any_lt(vector bool long long __a, vector unsigned long long __b)
13142{
13143 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b,
13144 (vector unsigned long long)__a);
13145}
13146
13147static int __ATTRS_o_ai
13148vec_any_lt(vector bool long long __a, vector bool long long __b)
13149{
13150 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV,
13151 (vector unsigned long long)__b,
13152 (vector unsigned long long)__a);
13153}
13154#endif
13155
Ying Wangb335bb02011-11-29 10:23:55 -080013156static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013157vec_any_lt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013158{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013159 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013160}
13161
13162/* vec_any_nan */
13163
13164static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013165vec_any_nan(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -080013166{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013167 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013168}
13169
13170/* vec_any_ne */
13171
13172static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013173vec_any_ne(vector signed char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013174{
13175 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013176 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013177}
13178
13179static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013180vec_any_ne(vector signed char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013181{
13182 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013183 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013184}
13185
13186static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013187vec_any_ne(vector unsigned char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013188{
13189 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013190 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013191}
13192
13193static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013194vec_any_ne(vector unsigned char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013195{
13196 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013197 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013198}
13199
13200static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013201vec_any_ne(vector bool char __a, vector signed char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013202{
13203 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013204 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013205}
13206
13207static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013208vec_any_ne(vector bool char __a, vector unsigned char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013209{
13210 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013211 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013212}
13213
13214static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013215vec_any_ne(vector bool char __a, vector bool char __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013216{
13217 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013218 __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, (vector char)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013219}
13220
13221static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013222vec_any_ne(vector short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013223{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013224 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080013225}
13226
13227static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013228vec_any_ne(vector short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013229{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013230 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013231}
13232
13233static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013234vec_any_ne(vector unsigned short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013235{
13236 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013237 (vector short)__a,
13238 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013239}
13240
13241static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013242vec_any_ne(vector unsigned short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013243{
13244 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013245 (vector short)__a,
13246 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013247}
13248
13249static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013250vec_any_ne(vector bool short __a, vector short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013251{
13252 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013253 (vector short)__a,
13254 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013255}
13256
13257static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013258vec_any_ne(vector bool short __a, vector unsigned short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013259{
13260 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013261 (vector short)__a,
13262 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013263}
13264
13265static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013266vec_any_ne(vector bool short __a, vector bool short __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013267{
13268 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013269 (vector short)__a,
13270 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013271}
13272
13273static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013274vec_any_ne(vector pixel __a, vector pixel __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013275{
13276 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013277 (vector short)__a,
13278 (vector short)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013279}
13280
13281static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013282vec_any_ne(vector int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013283{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013284 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080013285}
13286
13287static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013288vec_any_ne(vector int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013289{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013290 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013291}
13292
13293static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013294vec_any_ne(vector unsigned int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013295{
13296 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013297 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013298}
13299
13300static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013301vec_any_ne(vector unsigned int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013302{
13303 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013304 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013305}
13306
13307static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013308vec_any_ne(vector bool int __a, vector int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013309{
13310 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013311 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013312}
13313
13314static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013315vec_any_ne(vector bool int __a, vector unsigned int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013316{
13317 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013318 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013319}
13320
13321static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013322vec_any_ne(vector bool int __a, vector bool int __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013323{
13324 return
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013325 __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, (vector int)__b);
Ying Wangb335bb02011-11-29 10:23:55 -080013326}
13327
Stephen Hines3f868232015-04-10 09:22:19 -070013328#ifdef __POWER8_VECTOR__
13329static int __ATTRS_o_ai
13330vec_any_ne(vector signed long long __a, vector signed long long __b)
13331{
13332 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b);
13333}
13334
13335static int __ATTRS_o_ai
13336vec_any_ne(vector unsigned long long __a, vector unsigned long long __b)
13337{
13338 return
13339 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a,
13340 (vector long long)__b);
13341}
13342
13343static int __ATTRS_o_ai
13344vec_any_ne(vector signed long long __a, vector bool long long __b)
13345{
13346 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a,
13347 (vector signed long long)__b);
13348}
13349
13350static int __ATTRS_o_ai
13351vec_any_ne(vector unsigned long long __a, vector bool long long __b)
13352{
13353 return
13354 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13355 (vector signed long long)__b);
13356}
13357
13358static int __ATTRS_o_ai
13359vec_any_ne(vector bool long long __a, vector signed long long __b)
13360{
13361 return
13362 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13363 (vector signed long long)__b);
13364}
13365
13366static int __ATTRS_o_ai
13367vec_any_ne(vector bool long long __a, vector unsigned long long __b)
13368{
13369 return
13370 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13371 (vector signed long long)__b);
13372}
13373
13374static int __ATTRS_o_ai
13375vec_any_ne(vector bool long long __a, vector bool long long __b)
13376{
13377 return
13378 __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector signed long long)__a,
13379 (vector signed long long)__b);
13380}
13381#endif
13382
Ying Wangb335bb02011-11-29 10:23:55 -080013383static int __ATTRS_o_ai
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013384vec_any_ne(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013385{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013386 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080013387}
13388
13389/* vec_any_nge */
13390
13391static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013392vec_any_nge(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013393{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013394 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080013395}
13396
13397/* vec_any_ngt */
13398
13399static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013400vec_any_ngt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013401{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013402 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080013403}
13404
13405/* vec_any_nle */
13406
13407static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013408vec_any_nle(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013409{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013410 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013411}
13412
13413/* vec_any_nlt */
13414
13415static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013416vec_any_nlt(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013417{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013418 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013419}
13420
13421/* vec_any_numeric */
13422
13423static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013424vec_any_numeric(vector float __a)
Ying Wangb335bb02011-11-29 10:23:55 -080013425{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013426 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a);
Ying Wangb335bb02011-11-29 10:23:55 -080013427}
13428
13429/* vec_any_out */
13430
13431static int __attribute__((__always_inline__))
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013432vec_any_out(vector float __a, vector float __b)
Ying Wangb335bb02011-11-29 10:23:55 -080013433{
Stephen Hinesc6ee7df2013-04-02 18:41:57 -070013434 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b);
Ying Wangb335bb02011-11-29 10:23:55 -080013435}
13436
Stephen Hines3f868232015-04-10 09:22:19 -070013437/* Power 8 Crypto functions
13438Note: We diverge from the current GCC implementation with regard
13439to cryptography and related functions as follows:
13440- Only the SHA and AES instructions and builtins are disabled by -mno-crypto
13441- The remaining ones are only available on Power8 and up so
13442 require -mpower8-vector
13443The justification for this is that export requirements require that
13444Category:Vector.Crypto is optional (i.e. compliant hardware may not provide
13445support). As a result, we need to be able to turn off support for those.
13446The remaining ones (currently controlled by -mcrypto for GCC) still
13447need to be provided on compliant hardware even if Vector.Crypto is not
13448provided.
13449FIXME: the naming convention for the builtins will be adjusted due
13450to the inconsistency (__builtin_crypto_ prefix on builtins that cannot be
13451removed with -mno-crypto). This is under development.
13452*/
13453#ifdef __CRYPTO__
13454static vector unsigned long long __attribute__((__always_inline__))
13455__builtin_crypto_vsbox (vector unsigned long long __a)
13456{
13457 return __builtin_altivec_crypto_vsbox(__a);
13458}
13459
13460static vector unsigned long long __attribute__((__always_inline__))
13461__builtin_crypto_vcipher (vector unsigned long long __a,
13462 vector unsigned long long __b)
13463{
13464 return __builtin_altivec_crypto_vcipher(__a, __b);
13465}
13466
13467static vector unsigned long long __attribute__((__always_inline__))
13468__builtin_crypto_vcipherlast (vector unsigned long long __a,
13469 vector unsigned long long __b)
13470{
13471 return __builtin_altivec_crypto_vcipherlast(__a, __b);
13472}
13473
13474static vector unsigned long long __attribute__((__always_inline__))
13475__builtin_crypto_vncipher (vector unsigned long long __a,
13476 vector unsigned long long __b)
13477{
13478 return __builtin_altivec_crypto_vncipher(__a, __b);
13479}
13480
13481static vector unsigned long long __attribute__((__always_inline__))
13482__builtin_crypto_vncipherlast (vector unsigned long long __a,
13483 vector unsigned long long __b)
13484{
13485 return __builtin_altivec_crypto_vncipherlast(__a, __b);
13486}
13487
13488
13489#define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad
13490#define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw
13491#endif
13492
13493#ifdef __POWER8_VECTOR__
13494static vector unsigned char __ATTRS_o_ai
13495__builtin_crypto_vpermxor (vector unsigned char __a,
13496 vector unsigned char __b,
13497 vector unsigned char __c)
13498{
13499 return __builtin_altivec_crypto_vpermxor(__a, __b, __c);
13500}
13501
13502static vector unsigned short __ATTRS_o_ai
13503__builtin_crypto_vpermxor (vector unsigned short __a,
13504 vector unsigned short __b,
13505 vector unsigned short __c)
13506{
13507 return (vector unsigned short)
13508 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13509 (vector unsigned char) __b,
13510 (vector unsigned char) __c);
13511}
13512
13513static vector unsigned int __ATTRS_o_ai
13514__builtin_crypto_vpermxor (vector unsigned int __a,
13515 vector unsigned int __b,
13516 vector unsigned int __c)
13517{
13518 return (vector unsigned int)
13519 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13520 (vector unsigned char) __b,
13521 (vector unsigned char) __c);
13522}
13523
13524static vector unsigned long long __ATTRS_o_ai
13525__builtin_crypto_vpermxor (vector unsigned long long __a,
13526 vector unsigned long long __b,
13527 vector unsigned long long __c)
13528{
13529 return (vector unsigned long long)
13530 __builtin_altivec_crypto_vpermxor((vector unsigned char) __a,
13531 (vector unsigned char) __b,
13532 (vector unsigned char) __c);
13533}
13534
13535static vector unsigned char __ATTRS_o_ai
13536__builtin_crypto_vpmsumb (vector unsigned char __a,
13537 vector unsigned char __b)
13538{
13539 return __builtin_altivec_crypto_vpmsumb(__a, __b);
13540}
13541
13542static vector unsigned short __ATTRS_o_ai
13543__builtin_crypto_vpmsumb (vector unsigned short __a,
13544 vector unsigned short __b)
13545{
13546 return __builtin_altivec_crypto_vpmsumh(__a, __b);
13547}
13548
13549static vector unsigned int __ATTRS_o_ai
13550__builtin_crypto_vpmsumb (vector unsigned int __a,
13551 vector unsigned int __b)
13552{
13553 return __builtin_altivec_crypto_vpmsumw(__a, __b);
13554}
13555
13556static vector unsigned long long __ATTRS_o_ai
13557__builtin_crypto_vpmsumb (vector unsigned long long __a,
13558 vector unsigned long long __b)
13559{
13560 return __builtin_altivec_crypto_vpmsumd(__a, __b);
13561}
13562#endif
13563
Ying Wangb335bb02011-11-29 10:23:55 -080013564#undef __ATTRS_o_ai
13565
13566#endif /* __ALTIVEC_H */