Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1 | /*===---- 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 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 23 | // TODO: add functions for 'vector bool ..' and 'vector pixel' argument types according to |
| 24 | // the 'AltiVec Technology Programming Interface Manual' |
| 25 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 26 | #ifndef __ALTIVEC_H |
| 27 | #define __ALTIVEC_H |
| 28 | |
| 29 | #ifndef __ALTIVEC__ |
| 30 | #error "AltiVec support not enabled" |
| 31 | #endif |
| 32 | |
| 33 | /* constants for mapping CR6 bits to predicate result. */ |
| 34 | |
| 35 | #define __CR6_EQ 0 |
| 36 | #define __CR6_EQ_REV 1 |
| 37 | #define __CR6_LT 2 |
| 38 | #define __CR6_LT_REV 3 |
| 39 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 40 | #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) |
| 41 | |
| 42 | static vector signed char __ATTRS_o_ai |
| 43 | vec_perm(vector signed char a, vector signed char b, vector unsigned char c); |
| 44 | |
| 45 | static vector unsigned char __ATTRS_o_ai |
| 46 | vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c); |
| 47 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 48 | static vector bool char __ATTRS_o_ai |
| 49 | vec_perm(vector bool char a, vector bool char b, vector unsigned char c); |
| 50 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 51 | static vector short __ATTRS_o_ai |
| 52 | vec_perm(vector short a, vector short b, vector unsigned char c); |
| 53 | |
| 54 | static vector unsigned short __ATTRS_o_ai |
| 55 | vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c); |
| 56 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 57 | static vector bool short __ATTRS_o_ai |
| 58 | vec_perm(vector bool short a, vector bool short b, vector unsigned char c); |
| 59 | |
| 60 | static vector pixel __ATTRS_o_ai |
| 61 | vec_perm(vector pixel a, vector pixel b, vector unsigned char c); |
| 62 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 63 | static vector int __ATTRS_o_ai |
| 64 | vec_perm(vector int a, vector int b, vector unsigned char c); |
| 65 | |
| 66 | static vector unsigned int __ATTRS_o_ai |
| 67 | vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c); |
| 68 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 69 | static vector bool int __ATTRS_o_ai |
| 70 | vec_perm(vector bool int a, vector bool int b, vector unsigned char c); |
| 71 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 72 | static vector float __ATTRS_o_ai |
| 73 | vec_perm(vector float a, vector float b, vector unsigned char c); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 74 | |
| 75 | /* vec_abs */ |
| 76 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 77 | #define __builtin_altivec_abs_v16qi vec_abs |
| 78 | #define __builtin_altivec_abs_v8hi vec_abs |
| 79 | #define __builtin_altivec_abs_v4si vec_abs |
| 80 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 81 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 82 | vec_abs(vector signed char a) |
| 83 | { |
| 84 | return __builtin_altivec_vmaxsb(a, -a); |
| 85 | } |
| 86 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 87 | static vector signed short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 88 | vec_abs(vector signed short a) |
| 89 | { |
| 90 | return __builtin_altivec_vmaxsh(a, -a); |
| 91 | } |
| 92 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 93 | static vector signed int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 94 | vec_abs(vector signed int a) |
| 95 | { |
| 96 | return __builtin_altivec_vmaxsw(a, -a); |
| 97 | } |
| 98 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 99 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 100 | vec_abs(vector float a) |
| 101 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 102 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)(0x7FFFFFFF); |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 103 | return (vector float)res; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /* vec_abss */ |
| 107 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 108 | #define __builtin_altivec_abss_v16qi vec_abss |
| 109 | #define __builtin_altivec_abss_v8hi vec_abss |
| 110 | #define __builtin_altivec_abss_v4si vec_abss |
| 111 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 112 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 113 | vec_abss(vector signed char a) |
| 114 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 115 | return __builtin_altivec_vmaxsb(a, __builtin_altivec_vsubsbs((vector signed char)(0), a)); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 116 | } |
| 117 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 118 | static vector signed short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 119 | vec_abss(vector signed short a) |
| 120 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 121 | return __builtin_altivec_vmaxsh(a, __builtin_altivec_vsubshs((vector signed short)(0), a)); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 122 | } |
| 123 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 124 | static vector signed int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 125 | vec_abss(vector signed int a) |
| 126 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 127 | return __builtin_altivec_vmaxsw(a, __builtin_altivec_vsubsws((vector signed int)(0), a)); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | /* vec_add */ |
| 131 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 132 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 133 | vec_add(vector signed char a, vector signed char b) |
| 134 | { |
| 135 | return a + b; |
| 136 | } |
| 137 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 138 | static vector signed char __ATTRS_o_ai |
| 139 | vec_add(vector bool char a, vector signed char b) |
| 140 | { |
| 141 | return (vector signed char)a + b; |
| 142 | } |
| 143 | |
| 144 | static vector signed char __ATTRS_o_ai |
| 145 | vec_add(vector signed char a, vector bool char b) |
| 146 | { |
| 147 | return a + (vector signed char)b; |
| 148 | } |
| 149 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 150 | static vector unsigned char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 151 | vec_add(vector unsigned char a, vector unsigned char b) |
| 152 | { |
| 153 | return a + b; |
| 154 | } |
| 155 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 156 | static vector unsigned char __ATTRS_o_ai |
| 157 | vec_add(vector bool char a, vector unsigned char b) |
| 158 | { |
| 159 | return (vector unsigned char)a + b; |
| 160 | } |
| 161 | |
| 162 | static vector unsigned char __ATTRS_o_ai |
| 163 | vec_add(vector unsigned char a, vector bool char b) |
| 164 | { |
| 165 | return a + (vector unsigned char)b; |
| 166 | } |
| 167 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 168 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 169 | vec_add(vector short a, vector short b) |
| 170 | { |
| 171 | return a + b; |
| 172 | } |
| 173 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 174 | static vector short __ATTRS_o_ai |
| 175 | vec_add(vector bool short a, vector short b) |
| 176 | { |
| 177 | return (vector short)a + b; |
| 178 | } |
| 179 | |
| 180 | static vector short __ATTRS_o_ai |
| 181 | vec_add(vector short a, vector bool short b) |
| 182 | { |
| 183 | return a + (vector short)b; |
| 184 | } |
| 185 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 186 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 187 | vec_add(vector unsigned short a, vector unsigned short b) |
| 188 | { |
| 189 | return a + b; |
| 190 | } |
| 191 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 192 | static vector unsigned short __ATTRS_o_ai |
| 193 | vec_add(vector bool short a, vector unsigned short b) |
| 194 | { |
| 195 | return (vector unsigned short)a + b; |
| 196 | } |
| 197 | |
| 198 | static vector unsigned short __ATTRS_o_ai |
| 199 | vec_add(vector unsigned short a, vector bool short b) |
| 200 | { |
| 201 | return a + (vector unsigned short)b; |
| 202 | } |
| 203 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 204 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 205 | vec_add(vector int a, vector int b) |
| 206 | { |
| 207 | return a + b; |
| 208 | } |
| 209 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 210 | static vector int __ATTRS_o_ai |
| 211 | vec_add(vector bool int a, vector int b) |
| 212 | { |
| 213 | return (vector int)a + b; |
| 214 | } |
| 215 | |
| 216 | static vector int __ATTRS_o_ai |
| 217 | vec_add(vector int a, vector bool int b) |
| 218 | { |
| 219 | return a + (vector int)b; |
| 220 | } |
| 221 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 222 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 223 | vec_add(vector unsigned int a, vector unsigned int b) |
| 224 | { |
| 225 | return a + b; |
| 226 | } |
| 227 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 228 | static vector unsigned int __ATTRS_o_ai |
| 229 | vec_add(vector bool int a, vector unsigned int b) |
| 230 | { |
| 231 | return (vector unsigned int)a + b; |
| 232 | } |
| 233 | |
| 234 | static vector unsigned int __ATTRS_o_ai |
| 235 | vec_add(vector unsigned int a, vector bool int b) |
| 236 | { |
| 237 | return a + (vector unsigned int)b; |
| 238 | } |
| 239 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 240 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 241 | vec_add(vector float a, vector float b) |
| 242 | { |
| 243 | return a + b; |
| 244 | } |
| 245 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 246 | /* vec_vaddubm */ |
| 247 | |
| 248 | #define __builtin_altivec_vaddubm vec_vaddubm |
| 249 | |
| 250 | static vector signed char __ATTRS_o_ai |
| 251 | vec_vaddubm(vector signed char a, vector signed char b) |
| 252 | { |
| 253 | return a + b; |
| 254 | } |
| 255 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 256 | static vector signed char __ATTRS_o_ai |
| 257 | vec_vaddubm(vector bool char a, vector signed char b) |
| 258 | { |
| 259 | return (vector signed char)a + b; |
| 260 | } |
| 261 | |
| 262 | static vector signed char __ATTRS_o_ai |
| 263 | vec_vaddubm(vector signed char a, vector bool char b) |
| 264 | { |
| 265 | return a + (vector signed char)b; |
| 266 | } |
| 267 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 268 | static vector unsigned char __ATTRS_o_ai |
| 269 | vec_vaddubm(vector unsigned char a, vector unsigned char b) |
| 270 | { |
| 271 | return a + b; |
| 272 | } |
| 273 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 274 | static vector unsigned char __ATTRS_o_ai |
| 275 | vec_vaddubm(vector bool char a, vector unsigned char b) |
| 276 | { |
| 277 | return (vector unsigned char)a + b; |
| 278 | } |
| 279 | |
| 280 | static vector unsigned char __ATTRS_o_ai |
| 281 | vec_vaddubm(vector unsigned char a, vector bool char b) |
| 282 | { |
| 283 | return a + (vector unsigned char)b; |
| 284 | } |
| 285 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 286 | /* vec_vadduhm */ |
| 287 | |
| 288 | #define __builtin_altivec_vadduhm vec_vadduhm |
| 289 | |
| 290 | static vector short __ATTRS_o_ai |
| 291 | vec_vadduhm(vector short a, vector short b) |
| 292 | { |
| 293 | return a + b; |
| 294 | } |
| 295 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 296 | static vector short __ATTRS_o_ai |
| 297 | vec_vadduhm(vector bool short a, vector short b) |
| 298 | { |
| 299 | return (vector short)a + b; |
| 300 | } |
| 301 | |
| 302 | static vector short __ATTRS_o_ai |
| 303 | vec_vadduhm(vector short a, vector bool short b) |
| 304 | { |
| 305 | return a + (vector short)b; |
| 306 | } |
| 307 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 308 | static vector unsigned short __ATTRS_o_ai |
| 309 | vec_vadduhm(vector unsigned short a, vector unsigned short b) |
| 310 | { |
| 311 | return a + b; |
| 312 | } |
| 313 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 314 | static vector unsigned short __ATTRS_o_ai |
| 315 | vec_vadduhm(vector bool short a, vector unsigned short b) |
| 316 | { |
| 317 | return (vector unsigned short)a + b; |
| 318 | } |
| 319 | |
| 320 | static vector unsigned short __ATTRS_o_ai |
| 321 | vec_vadduhm(vector unsigned short a, vector bool short b) |
| 322 | { |
| 323 | return a + (vector unsigned short)b; |
| 324 | } |
| 325 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 326 | /* vec_vadduwm */ |
| 327 | |
| 328 | #define __builtin_altivec_vadduwm vec_vadduwm |
| 329 | |
| 330 | static vector int __ATTRS_o_ai |
| 331 | vec_vadduwm(vector int a, vector int b) |
| 332 | { |
| 333 | return a + b; |
| 334 | } |
| 335 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 336 | static vector int __ATTRS_o_ai |
| 337 | vec_vadduwm(vector bool int a, vector int b) |
| 338 | { |
| 339 | return (vector int)a + b; |
| 340 | } |
| 341 | |
| 342 | static vector int __ATTRS_o_ai |
| 343 | vec_vadduwm(vector int a, vector bool int b) |
| 344 | { |
| 345 | return a + (vector int)b; |
| 346 | } |
| 347 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 348 | static vector unsigned int __ATTRS_o_ai |
| 349 | vec_vadduwm(vector unsigned int a, vector unsigned int b) |
| 350 | { |
| 351 | return a + b; |
| 352 | } |
| 353 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 354 | static vector unsigned int __ATTRS_o_ai |
| 355 | vec_vadduwm(vector bool int a, vector unsigned int b) |
| 356 | { |
| 357 | return (vector unsigned int)a + b; |
| 358 | } |
| 359 | |
| 360 | static vector unsigned int __ATTRS_o_ai |
| 361 | vec_vadduwm(vector unsigned int a, vector bool int b) |
| 362 | { |
| 363 | return a + (vector unsigned int)b; |
| 364 | } |
| 365 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 366 | /* vec_vaddfp */ |
| 367 | |
| 368 | #define __builtin_altivec_vaddfp vec_vaddfp |
| 369 | |
| 370 | static vector float __attribute__((__always_inline__)) |
| 371 | vec_vaddfp(vector float a, vector float b) |
| 372 | { |
| 373 | return a + b; |
| 374 | } |
| 375 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 376 | /* vec_addc */ |
| 377 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 378 | static vector unsigned int __attribute__((__always_inline__)) |
| 379 | vec_addc(vector unsigned int a, vector unsigned int b) |
| 380 | { |
| 381 | return __builtin_altivec_vaddcuw(a, b); |
| 382 | } |
| 383 | |
| 384 | /* vec_vaddcuw */ |
| 385 | |
| 386 | static vector unsigned int __attribute__((__always_inline__)) |
| 387 | vec_vaddcuw(vector unsigned int a, vector unsigned int b) |
| 388 | { |
| 389 | return __builtin_altivec_vaddcuw(a, b); |
| 390 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 391 | |
| 392 | /* vec_adds */ |
| 393 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 394 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 395 | vec_adds(vector signed char a, vector signed char b) |
| 396 | { |
| 397 | return __builtin_altivec_vaddsbs(a, b); |
| 398 | } |
| 399 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 400 | static vector signed char __ATTRS_o_ai |
| 401 | vec_adds(vector bool char a, vector signed char b) |
| 402 | { |
| 403 | return __builtin_altivec_vaddsbs((vector signed char)a, b); |
| 404 | } |
| 405 | |
| 406 | static vector signed char __ATTRS_o_ai |
| 407 | vec_adds(vector signed char a, vector bool char b) |
| 408 | { |
| 409 | return __builtin_altivec_vaddsbs(a, (vector signed char)b); |
| 410 | } |
| 411 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 412 | static vector unsigned char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 413 | vec_adds(vector unsigned char a, vector unsigned char b) |
| 414 | { |
| 415 | return __builtin_altivec_vaddubs(a, b); |
| 416 | } |
| 417 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 418 | static vector unsigned char __ATTRS_o_ai |
| 419 | vec_adds(vector bool char a, vector unsigned char b) |
| 420 | { |
| 421 | return __builtin_altivec_vaddubs((vector unsigned char)a, b); |
| 422 | } |
| 423 | |
| 424 | static vector unsigned char __ATTRS_o_ai |
| 425 | vec_adds(vector unsigned char a, vector bool char b) |
| 426 | { |
| 427 | return __builtin_altivec_vaddubs(a, (vector unsigned char)b); |
| 428 | } |
| 429 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 430 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 431 | vec_adds(vector short a, vector short b) |
| 432 | { |
| 433 | return __builtin_altivec_vaddshs(a, b); |
| 434 | } |
| 435 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 436 | static vector short __ATTRS_o_ai |
| 437 | vec_adds(vector bool short a, vector short b) |
| 438 | { |
| 439 | return __builtin_altivec_vaddshs((vector short)a, b); |
| 440 | } |
| 441 | |
| 442 | static vector short __ATTRS_o_ai |
| 443 | vec_adds(vector short a, vector bool short b) |
| 444 | { |
| 445 | return __builtin_altivec_vaddshs(a, (vector short)b); |
| 446 | } |
| 447 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 448 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 449 | vec_adds(vector unsigned short a, vector unsigned short b) |
| 450 | { |
| 451 | return __builtin_altivec_vadduhs(a, b); |
| 452 | } |
| 453 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 454 | static vector unsigned short __ATTRS_o_ai |
| 455 | vec_adds(vector bool short a, vector unsigned short b) |
| 456 | { |
| 457 | return __builtin_altivec_vadduhs((vector unsigned short)a, b); |
| 458 | } |
| 459 | |
| 460 | static vector unsigned short __ATTRS_o_ai |
| 461 | vec_adds(vector unsigned short a, vector bool short b) |
| 462 | { |
| 463 | return __builtin_altivec_vadduhs(a, (vector unsigned short)b); |
| 464 | } |
| 465 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 466 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 467 | vec_adds(vector int a, vector int b) |
| 468 | { |
| 469 | return __builtin_altivec_vaddsws(a, b); |
| 470 | } |
| 471 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 472 | static vector int __ATTRS_o_ai |
| 473 | vec_adds(vector bool int a, vector int b) |
| 474 | { |
| 475 | return __builtin_altivec_vaddsws((vector int)a, b); |
| 476 | } |
| 477 | |
| 478 | static vector int __ATTRS_o_ai |
| 479 | vec_adds(vector int a, vector bool int b) |
| 480 | { |
| 481 | return __builtin_altivec_vaddsws(a, (vector int)b); |
| 482 | } |
| 483 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 484 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 485 | vec_adds(vector unsigned int a, vector unsigned int b) |
| 486 | { |
| 487 | return __builtin_altivec_vadduws(a, b); |
| 488 | } |
| 489 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 490 | static vector unsigned int __ATTRS_o_ai |
| 491 | vec_adds(vector bool int a, vector unsigned int b) |
| 492 | { |
| 493 | return __builtin_altivec_vadduws((vector unsigned int)a, b); |
| 494 | } |
| 495 | |
| 496 | static vector unsigned int __ATTRS_o_ai |
| 497 | vec_adds(vector unsigned int a, vector bool int b) |
| 498 | { |
| 499 | return __builtin_altivec_vadduws(a, (vector unsigned int)b); |
| 500 | } |
| 501 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 502 | /* vec_vaddsbs */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 503 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 504 | static vector signed char __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 505 | vec_vaddsbs(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 506 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 507 | return __builtin_altivec_vaddsbs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 508 | } |
| 509 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 510 | static vector signed char __ATTRS_o_ai |
| 511 | vec_vaddsbs(vector bool char a, vector signed char b) |
| 512 | { |
| 513 | return __builtin_altivec_vaddsbs((vector signed char)a, b); |
| 514 | } |
| 515 | |
| 516 | static vector signed char __ATTRS_o_ai |
| 517 | vec_vaddsbs(vector signed char a, vector bool char b) |
| 518 | { |
| 519 | return __builtin_altivec_vaddsbs(a, (vector signed char)b); |
| 520 | } |
| 521 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 522 | /* vec_vaddubs */ |
| 523 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 524 | static vector unsigned char __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 525 | vec_vaddubs(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 526 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 527 | return __builtin_altivec_vaddubs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 528 | } |
| 529 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 530 | static vector unsigned char __ATTRS_o_ai |
| 531 | vec_vaddubs(vector bool char a, vector unsigned char b) |
| 532 | { |
| 533 | return __builtin_altivec_vaddubs((vector unsigned char)a, b); |
| 534 | } |
| 535 | |
| 536 | static vector unsigned char __ATTRS_o_ai |
| 537 | vec_vaddubs(vector unsigned char a, vector bool char b) |
| 538 | { |
| 539 | return __builtin_altivec_vaddubs(a, (vector unsigned char)b); |
| 540 | } |
| 541 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 542 | /* vec_vaddshs */ |
| 543 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 544 | static vector short __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 545 | vec_vaddshs(vector short a, vector short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 546 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 547 | return __builtin_altivec_vaddshs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 548 | } |
| 549 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 550 | static vector short __ATTRS_o_ai |
| 551 | vec_vaddshs(vector bool short a, vector short b) |
| 552 | { |
| 553 | return __builtin_altivec_vaddshs((vector short)a, b); |
| 554 | } |
| 555 | |
| 556 | static vector short __ATTRS_o_ai |
| 557 | vec_vaddshs(vector short a, vector bool short b) |
| 558 | { |
| 559 | return __builtin_altivec_vaddshs(a, (vector short)b); |
| 560 | } |
| 561 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 562 | /* vec_vadduhs */ |
| 563 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 564 | static vector unsigned short __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 565 | vec_vadduhs(vector unsigned short a, vector unsigned short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 566 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 567 | return __builtin_altivec_vadduhs(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 568 | } |
| 569 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 570 | static vector unsigned short __ATTRS_o_ai |
| 571 | vec_vadduhs(vector bool short a, vector unsigned short b) |
| 572 | { |
| 573 | return __builtin_altivec_vadduhs((vector unsigned short)a, b); |
| 574 | } |
| 575 | |
| 576 | static vector unsigned short __ATTRS_o_ai |
| 577 | vec_vadduhs(vector unsigned short a, vector bool short b) |
| 578 | { |
| 579 | return __builtin_altivec_vadduhs(a, (vector unsigned short)b); |
| 580 | } |
| 581 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 582 | /* vec_vaddsws */ |
| 583 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 584 | static vector int __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 585 | vec_vaddsws(vector int a, vector int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 586 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 587 | return __builtin_altivec_vaddsws(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 588 | } |
| 589 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 590 | static vector int __ATTRS_o_ai |
| 591 | vec_vaddsws(vector bool int a, vector int b) |
| 592 | { |
| 593 | return __builtin_altivec_vaddsws((vector int)a, b); |
| 594 | } |
| 595 | |
| 596 | static vector int __ATTRS_o_ai |
| 597 | vec_vaddsws(vector int a, vector bool int b) |
| 598 | { |
| 599 | return __builtin_altivec_vaddsws(a, (vector int)b); |
| 600 | } |
| 601 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 602 | /* vec_vadduws */ |
| 603 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 604 | static vector unsigned int __ATTRS_o_ai |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 605 | vec_vadduws(vector unsigned int a, vector unsigned int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 606 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 607 | return __builtin_altivec_vadduws(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 608 | } |
| 609 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 610 | static vector unsigned int __ATTRS_o_ai |
| 611 | vec_vadduws(vector bool int a, vector unsigned int b) |
| 612 | { |
| 613 | return __builtin_altivec_vadduws((vector unsigned int)a, b); |
| 614 | } |
| 615 | |
| 616 | static vector unsigned int __ATTRS_o_ai |
| 617 | vec_vadduws(vector unsigned int a, vector bool int b) |
| 618 | { |
| 619 | return __builtin_altivec_vadduws(a, (vector unsigned int)b); |
| 620 | } |
| 621 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 622 | /* vec_and */ |
| 623 | |
| 624 | #define __builtin_altivec_vand vec_and |
| 625 | |
| 626 | static vector signed char __ATTRS_o_ai |
| 627 | vec_and(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 628 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 629 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 630 | } |
| 631 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 632 | static vector signed char __ATTRS_o_ai |
| 633 | vec_and(vector bool char a, vector signed char b) |
| 634 | { |
| 635 | return (vector signed char)a & b; |
| 636 | } |
| 637 | |
| 638 | static vector signed char __ATTRS_o_ai |
| 639 | vec_and(vector signed char a, vector bool char b) |
| 640 | { |
| 641 | return a & (vector signed char)b; |
| 642 | } |
| 643 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 644 | static vector unsigned char __ATTRS_o_ai |
| 645 | vec_and(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 646 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 647 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 650 | static vector unsigned char __ATTRS_o_ai |
| 651 | vec_and(vector bool char a, vector unsigned char b) |
| 652 | { |
| 653 | return (vector unsigned char)a & b; |
| 654 | } |
| 655 | |
| 656 | static vector unsigned char __ATTRS_o_ai |
| 657 | vec_and(vector unsigned char a, vector bool char b) |
| 658 | { |
| 659 | return a & (vector unsigned char)b; |
| 660 | } |
| 661 | |
| 662 | static vector bool char __ATTRS_o_ai |
| 663 | vec_and(vector bool char a, vector bool char b) |
| 664 | { |
| 665 | return a & b; |
| 666 | } |
| 667 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 668 | static vector short __ATTRS_o_ai |
| 669 | vec_and(vector short a, vector short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 670 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 671 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 672 | } |
| 673 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 674 | static vector short __ATTRS_o_ai |
| 675 | vec_and(vector bool short a, vector short b) |
| 676 | { |
| 677 | return (vector short)a & b; |
| 678 | } |
| 679 | |
| 680 | static vector short __ATTRS_o_ai |
| 681 | vec_and(vector short a, vector bool short b) |
| 682 | { |
| 683 | return a & (vector short)b; |
| 684 | } |
| 685 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 686 | static vector unsigned short __ATTRS_o_ai |
| 687 | vec_and(vector unsigned short a, vector unsigned short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 688 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 689 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 690 | } |
| 691 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 692 | static vector unsigned short __ATTRS_o_ai |
| 693 | vec_and(vector bool short a, vector unsigned short b) |
| 694 | { |
| 695 | return (vector unsigned short)a & b; |
| 696 | } |
| 697 | |
| 698 | static vector unsigned short __ATTRS_o_ai |
| 699 | vec_and(vector unsigned short a, vector bool short b) |
| 700 | { |
| 701 | return a & (vector unsigned short)b; |
| 702 | } |
| 703 | |
| 704 | static vector bool short __ATTRS_o_ai |
| 705 | vec_and(vector bool short a, vector bool short b) |
| 706 | { |
| 707 | return a & b; |
| 708 | } |
| 709 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 710 | static vector int __ATTRS_o_ai |
| 711 | vec_and(vector int a, vector int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 712 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 713 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 714 | } |
| 715 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 716 | static vector int __ATTRS_o_ai |
| 717 | vec_and(vector bool int a, vector int b) |
| 718 | { |
| 719 | return (vector int)a & b; |
| 720 | } |
| 721 | |
| 722 | static vector int __ATTRS_o_ai |
| 723 | vec_and(vector int a, vector bool int b) |
| 724 | { |
| 725 | return a & (vector int)b; |
| 726 | } |
| 727 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 728 | static vector unsigned int __ATTRS_o_ai |
| 729 | vec_and(vector unsigned int a, vector unsigned int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 730 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 731 | return a & b; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 732 | } |
| 733 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 734 | static vector unsigned int __ATTRS_o_ai |
| 735 | vec_and(vector bool int a, vector unsigned int b) |
| 736 | { |
| 737 | return (vector unsigned int)a & b; |
| 738 | } |
| 739 | |
| 740 | static vector unsigned int __ATTRS_o_ai |
| 741 | vec_and(vector unsigned int a, vector bool int b) |
| 742 | { |
| 743 | return a & (vector unsigned int)b; |
| 744 | } |
| 745 | |
| 746 | static vector bool int __ATTRS_o_ai |
| 747 | vec_and(vector bool int a, vector bool int b) |
| 748 | { |
| 749 | return a & b; |
| 750 | } |
| 751 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 752 | static vector float __ATTRS_o_ai |
| 753 | vec_and(vector float a, vector float b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 754 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 755 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 756 | return (vector float)res; |
| 757 | } |
| 758 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 759 | static vector float __ATTRS_o_ai |
| 760 | vec_and(vector bool int a, vector float b) |
| 761 | { |
| 762 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 763 | return (vector float)res; |
| 764 | } |
| 765 | |
| 766 | static vector float __ATTRS_o_ai |
| 767 | vec_and(vector float a, vector bool int b) |
| 768 | { |
| 769 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 770 | return (vector float)res; |
| 771 | } |
| 772 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 773 | /* vec_vand */ |
| 774 | |
| 775 | static vector signed char __ATTRS_o_ai |
| 776 | vec_vand(vector signed char a, vector signed char b) |
| 777 | { |
| 778 | return a & b; |
| 779 | } |
| 780 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 781 | static vector signed char __ATTRS_o_ai |
| 782 | vec_vand(vector bool char a, vector signed char b) |
| 783 | { |
| 784 | return (vector signed char)a & b; |
| 785 | } |
| 786 | |
| 787 | static vector signed char __ATTRS_o_ai |
| 788 | vec_vand(vector signed char a, vector bool char b) |
| 789 | { |
| 790 | return a & (vector signed char)b; |
| 791 | } |
| 792 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 793 | static vector unsigned char __ATTRS_o_ai |
| 794 | vec_vand(vector unsigned char a, vector unsigned char b) |
| 795 | { |
| 796 | return a & b; |
| 797 | } |
| 798 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 799 | static vector unsigned char __ATTRS_o_ai |
| 800 | vec_vand(vector bool char a, vector unsigned char b) |
| 801 | { |
| 802 | return (vector unsigned char)a & b; |
| 803 | } |
| 804 | |
| 805 | static vector unsigned char __ATTRS_o_ai |
| 806 | vec_vand(vector unsigned char a, vector bool char b) |
| 807 | { |
| 808 | return a & (vector unsigned char)b; |
| 809 | } |
| 810 | |
| 811 | static vector bool char __ATTRS_o_ai |
| 812 | vec_vand(vector bool char a, vector bool char b) |
| 813 | { |
| 814 | return a & b; |
| 815 | } |
| 816 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 817 | static vector short __ATTRS_o_ai |
| 818 | vec_vand(vector short a, vector short b) |
| 819 | { |
| 820 | return a & b; |
| 821 | } |
| 822 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 823 | static vector short __ATTRS_o_ai |
| 824 | vec_vand(vector bool short a, vector short b) |
| 825 | { |
| 826 | return (vector short)a & b; |
| 827 | } |
| 828 | |
| 829 | static vector short __ATTRS_o_ai |
| 830 | vec_vand(vector short a, vector bool short b) |
| 831 | { |
| 832 | return a & (vector short)b; |
| 833 | } |
| 834 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 835 | static vector unsigned short __ATTRS_o_ai |
| 836 | vec_vand(vector unsigned short a, vector unsigned short b) |
| 837 | { |
| 838 | return a & b; |
| 839 | } |
| 840 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 841 | static vector unsigned short __ATTRS_o_ai |
| 842 | vec_vand(vector bool short a, vector unsigned short b) |
| 843 | { |
| 844 | return (vector unsigned short)a & b; |
| 845 | } |
| 846 | |
| 847 | static vector unsigned short __ATTRS_o_ai |
| 848 | vec_vand(vector unsigned short a, vector bool short b) |
| 849 | { |
| 850 | return a & (vector unsigned short)b; |
| 851 | } |
| 852 | |
| 853 | static vector bool short __ATTRS_o_ai |
| 854 | vec_vand(vector bool short a, vector bool short b) |
| 855 | { |
| 856 | return a & b; |
| 857 | } |
| 858 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 859 | static vector int __ATTRS_o_ai |
| 860 | vec_vand(vector int a, vector int b) |
| 861 | { |
| 862 | return a & b; |
| 863 | } |
| 864 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 865 | static vector int __ATTRS_o_ai |
| 866 | vec_vand(vector bool int a, vector int b) |
| 867 | { |
| 868 | return (vector int)a & b; |
| 869 | } |
| 870 | |
| 871 | static vector int __ATTRS_o_ai |
| 872 | vec_vand(vector int a, vector bool int b) |
| 873 | { |
| 874 | return a & (vector int)b; |
| 875 | } |
| 876 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 877 | static vector unsigned int __ATTRS_o_ai |
| 878 | vec_vand(vector unsigned int a, vector unsigned int b) |
| 879 | { |
| 880 | return a & b; |
| 881 | } |
| 882 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 883 | static vector unsigned int __ATTRS_o_ai |
| 884 | vec_vand(vector bool int a, vector unsigned int b) |
| 885 | { |
| 886 | return (vector unsigned int)a & b; |
| 887 | } |
| 888 | |
| 889 | static vector unsigned int __ATTRS_o_ai |
| 890 | vec_vand(vector unsigned int a, vector bool int b) |
| 891 | { |
| 892 | return a & (vector unsigned int)b; |
| 893 | } |
| 894 | |
| 895 | static vector bool int __ATTRS_o_ai |
| 896 | vec_vand(vector bool int a, vector bool int b) |
| 897 | { |
| 898 | return a & b; |
| 899 | } |
| 900 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 901 | static vector float __ATTRS_o_ai |
| 902 | vec_vand(vector float a, vector float b) |
| 903 | { |
| 904 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 905 | return (vector float)res; |
| 906 | } |
| 907 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 908 | static vector float __ATTRS_o_ai |
| 909 | vec_vand(vector bool int a, vector float b) |
| 910 | { |
| 911 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 912 | return (vector float)res; |
| 913 | } |
| 914 | |
| 915 | static vector float __ATTRS_o_ai |
| 916 | vec_vand(vector float a, vector bool int b) |
| 917 | { |
| 918 | vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b; |
| 919 | return (vector float)res; |
| 920 | } |
| 921 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 922 | /* vec_andc */ |
| 923 | |
| 924 | #define __builtin_altivec_vandc vec_andc |
| 925 | |
| 926 | static vector signed char __ATTRS_o_ai |
| 927 | vec_andc(vector signed char a, vector signed char b) |
| 928 | { |
| 929 | return a & ~b; |
| 930 | } |
| 931 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 932 | static vector signed char __ATTRS_o_ai |
| 933 | vec_andc(vector bool char a, vector signed char b) |
| 934 | { |
| 935 | return (vector signed char)a & ~b; |
| 936 | } |
| 937 | |
| 938 | static vector signed char __ATTRS_o_ai |
| 939 | vec_andc(vector signed char a, vector bool char b) |
| 940 | { |
| 941 | return a & ~(vector signed char)b; |
| 942 | } |
| 943 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 944 | static vector unsigned char __ATTRS_o_ai |
| 945 | vec_andc(vector unsigned char a, vector unsigned char b) |
| 946 | { |
| 947 | return a & ~b; |
| 948 | } |
| 949 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 950 | static vector unsigned char __ATTRS_o_ai |
| 951 | vec_andc(vector bool char a, vector unsigned char b) |
| 952 | { |
| 953 | return (vector unsigned char)a & ~b; |
| 954 | } |
| 955 | |
| 956 | static vector unsigned char __ATTRS_o_ai |
| 957 | vec_andc(vector unsigned char a, vector bool char b) |
| 958 | { |
| 959 | return a & ~(vector unsigned char)b; |
| 960 | } |
| 961 | |
| 962 | static vector bool char __ATTRS_o_ai |
| 963 | vec_andc(vector bool char a, vector bool char b) |
| 964 | { |
| 965 | return a & ~b; |
| 966 | } |
| 967 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 968 | static vector short __ATTRS_o_ai |
| 969 | vec_andc(vector short a, vector short b) |
| 970 | { |
| 971 | return a & ~b; |
| 972 | } |
| 973 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 974 | static vector short __ATTRS_o_ai |
| 975 | vec_andc(vector bool short a, vector short b) |
| 976 | { |
| 977 | return (vector short)a & ~b; |
| 978 | } |
| 979 | |
| 980 | static vector short __ATTRS_o_ai |
| 981 | vec_andc(vector short a, vector bool short b) |
| 982 | { |
| 983 | return a & ~(vector short)b; |
| 984 | } |
| 985 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 986 | static vector unsigned short __ATTRS_o_ai |
| 987 | vec_andc(vector unsigned short a, vector unsigned short b) |
| 988 | { |
| 989 | return a & ~b; |
| 990 | } |
| 991 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 992 | static vector unsigned short __ATTRS_o_ai |
| 993 | vec_andc(vector bool short a, vector unsigned short b) |
| 994 | { |
| 995 | return (vector unsigned short)a & ~b; |
| 996 | } |
| 997 | |
| 998 | static vector unsigned short __ATTRS_o_ai |
| 999 | vec_andc(vector unsigned short a, vector bool short b) |
| 1000 | { |
| 1001 | return a & ~(vector unsigned short)b; |
| 1002 | } |
| 1003 | |
| 1004 | static vector bool short __ATTRS_o_ai |
| 1005 | vec_andc(vector bool short a, vector bool short b) |
| 1006 | { |
| 1007 | return a & ~b; |
| 1008 | } |
| 1009 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1010 | static vector int __ATTRS_o_ai |
| 1011 | vec_andc(vector int a, vector int b) |
| 1012 | { |
| 1013 | return a & ~b; |
| 1014 | } |
| 1015 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1016 | static vector int __ATTRS_o_ai |
| 1017 | vec_andc(vector bool int a, vector int b) |
| 1018 | { |
| 1019 | return (vector int)a & ~b; |
| 1020 | } |
| 1021 | |
| 1022 | static vector int __ATTRS_o_ai |
| 1023 | vec_andc(vector int a, vector bool int b) |
| 1024 | { |
| 1025 | return a & ~(vector int)b; |
| 1026 | } |
| 1027 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1028 | static vector unsigned int __ATTRS_o_ai |
| 1029 | vec_andc(vector unsigned int a, vector unsigned int b) |
| 1030 | { |
| 1031 | return a & ~b; |
| 1032 | } |
| 1033 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1034 | static vector unsigned int __ATTRS_o_ai |
| 1035 | vec_andc(vector bool int a, vector unsigned int b) |
| 1036 | { |
| 1037 | return (vector unsigned int)a & ~b; |
| 1038 | } |
| 1039 | |
| 1040 | static vector unsigned int __ATTRS_o_ai |
| 1041 | vec_andc(vector unsigned int a, vector bool int b) |
| 1042 | { |
| 1043 | return a & ~(vector unsigned int)b; |
| 1044 | } |
| 1045 | |
| 1046 | static vector bool int __ATTRS_o_ai |
| 1047 | vec_andc(vector bool int a, vector bool int b) |
| 1048 | { |
| 1049 | return a & ~b; |
| 1050 | } |
| 1051 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1052 | static vector float __ATTRS_o_ai |
| 1053 | vec_andc(vector float a, vector float b) |
| 1054 | { |
| 1055 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1056 | return (vector float)res; |
| 1057 | } |
| 1058 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1059 | static vector float __ATTRS_o_ai |
| 1060 | vec_andc(vector bool int a, vector float b) |
| 1061 | { |
| 1062 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1063 | return (vector float)res; |
| 1064 | } |
| 1065 | |
| 1066 | static vector float __ATTRS_o_ai |
| 1067 | vec_andc(vector float a, vector bool int b) |
| 1068 | { |
| 1069 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1070 | return (vector float)res; |
| 1071 | } |
| 1072 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1073 | /* vec_vandc */ |
| 1074 | |
| 1075 | static vector signed char __ATTRS_o_ai |
| 1076 | vec_vandc(vector signed char a, vector signed char b) |
| 1077 | { |
| 1078 | return a & ~b; |
| 1079 | } |
| 1080 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1081 | static vector signed char __ATTRS_o_ai |
| 1082 | vec_vandc(vector bool char a, vector signed char b) |
| 1083 | { |
| 1084 | return (vector signed char)a & ~b; |
| 1085 | } |
| 1086 | |
| 1087 | static vector signed char __ATTRS_o_ai |
| 1088 | vec_vandc(vector signed char a, vector bool char b) |
| 1089 | { |
| 1090 | return a & ~(vector signed char)b; |
| 1091 | } |
| 1092 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1093 | static vector unsigned char __ATTRS_o_ai |
| 1094 | vec_vandc(vector unsigned char a, vector unsigned char b) |
| 1095 | { |
| 1096 | return a & ~b; |
| 1097 | } |
| 1098 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1099 | static vector unsigned char __ATTRS_o_ai |
| 1100 | vec_vandc(vector bool char a, vector unsigned char b) |
| 1101 | { |
| 1102 | return (vector unsigned char)a & ~b; |
| 1103 | } |
| 1104 | |
| 1105 | static vector unsigned char __ATTRS_o_ai |
| 1106 | vec_vandc(vector unsigned char a, vector bool char b) |
| 1107 | { |
| 1108 | return a & ~(vector unsigned char)b; |
| 1109 | } |
| 1110 | |
| 1111 | static vector bool char __ATTRS_o_ai |
| 1112 | vec_vandc(vector bool char a, vector bool char b) |
| 1113 | { |
| 1114 | return a & ~b; |
| 1115 | } |
| 1116 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1117 | static vector short __ATTRS_o_ai |
| 1118 | vec_vandc(vector short a, vector short b) |
| 1119 | { |
| 1120 | return a & ~b; |
| 1121 | } |
| 1122 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1123 | static vector short __ATTRS_o_ai |
| 1124 | vec_vandc(vector bool short a, vector short b) |
| 1125 | { |
| 1126 | return (vector short)a & ~b; |
| 1127 | } |
| 1128 | |
| 1129 | static vector short __ATTRS_o_ai |
| 1130 | vec_vandc(vector short a, vector bool short b) |
| 1131 | { |
| 1132 | return a & ~(vector short)b; |
| 1133 | } |
| 1134 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1135 | static vector unsigned short __ATTRS_o_ai |
| 1136 | vec_vandc(vector unsigned short a, vector unsigned short b) |
| 1137 | { |
| 1138 | return a & ~b; |
| 1139 | } |
| 1140 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1141 | static vector unsigned short __ATTRS_o_ai |
| 1142 | vec_vandc(vector bool short a, vector unsigned short b) |
| 1143 | { |
| 1144 | return (vector unsigned short)a & ~b; |
| 1145 | } |
| 1146 | |
| 1147 | static vector unsigned short __ATTRS_o_ai |
| 1148 | vec_vandc(vector unsigned short a, vector bool short b) |
| 1149 | { |
| 1150 | return a & ~(vector unsigned short)b; |
| 1151 | } |
| 1152 | |
| 1153 | static vector bool short __ATTRS_o_ai |
| 1154 | vec_vandc(vector bool short a, vector bool short b) |
| 1155 | { |
| 1156 | return a & ~b; |
| 1157 | } |
| 1158 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1159 | static vector int __ATTRS_o_ai |
| 1160 | vec_vandc(vector int a, vector int b) |
| 1161 | { |
| 1162 | return a & ~b; |
| 1163 | } |
| 1164 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1165 | static vector int __ATTRS_o_ai |
| 1166 | vec_vandc(vector bool int a, vector int b) |
| 1167 | { |
| 1168 | return (vector int)a & ~b; |
| 1169 | } |
| 1170 | |
| 1171 | static vector int __ATTRS_o_ai |
| 1172 | vec_vandc(vector int a, vector bool int b) |
| 1173 | { |
| 1174 | return a & ~(vector int)b; |
| 1175 | } |
| 1176 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1177 | static vector unsigned int __ATTRS_o_ai |
| 1178 | vec_vandc(vector unsigned int a, vector unsigned int b) |
| 1179 | { |
| 1180 | return a & ~b; |
| 1181 | } |
| 1182 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1183 | static vector unsigned int __ATTRS_o_ai |
| 1184 | vec_vandc(vector bool int a, vector unsigned int b) |
| 1185 | { |
| 1186 | return (vector unsigned int)a & ~b; |
| 1187 | } |
| 1188 | |
| 1189 | static vector unsigned int __ATTRS_o_ai |
| 1190 | vec_vandc(vector unsigned int a, vector bool int b) |
| 1191 | { |
| 1192 | return a & ~(vector unsigned int)b; |
| 1193 | } |
| 1194 | |
| 1195 | static vector bool int __ATTRS_o_ai |
| 1196 | vec_vandc(vector bool int a, vector bool int b) |
| 1197 | { |
| 1198 | return a & ~b; |
| 1199 | } |
| 1200 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1201 | static vector float __ATTRS_o_ai |
| 1202 | vec_vandc(vector float a, vector float b) |
| 1203 | { |
| 1204 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1205 | return (vector float)res; |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1206 | } |
| 1207 | |
Anton Yartsev | 05e3555 | 2010-08-16 16:22:12 +0000 | [diff] [blame] | 1208 | static vector float __ATTRS_o_ai |
| 1209 | vec_vandc(vector bool int a, vector float b) |
| 1210 | { |
| 1211 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1212 | return (vector float)res; |
| 1213 | } |
| 1214 | |
| 1215 | static vector float __ATTRS_o_ai |
| 1216 | vec_vandc(vector float a, vector bool int b) |
| 1217 | { |
| 1218 | vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b; |
| 1219 | return (vector float)res; |
| 1220 | } |
| 1221 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1222 | /* vec_avg */ |
| 1223 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1224 | static vector signed char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1225 | vec_avg(vector signed char a, vector signed char b) |
| 1226 | { |
| 1227 | return __builtin_altivec_vavgsb(a, b); |
| 1228 | } |
| 1229 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1230 | static vector unsigned char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1231 | vec_avg(vector unsigned char a, vector unsigned char b) |
| 1232 | { |
| 1233 | return __builtin_altivec_vavgub(a, b); |
| 1234 | } |
| 1235 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1236 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1237 | vec_avg(vector short a, vector short b) |
| 1238 | { |
| 1239 | return __builtin_altivec_vavgsh(a, b); |
| 1240 | } |
| 1241 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1242 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1243 | vec_avg(vector unsigned short a, vector unsigned short b) |
| 1244 | { |
| 1245 | return __builtin_altivec_vavguh(a, b); |
| 1246 | } |
| 1247 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1248 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1249 | vec_avg(vector int a, vector int b) |
| 1250 | { |
| 1251 | return __builtin_altivec_vavgsw(a, b); |
| 1252 | } |
| 1253 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1254 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1255 | vec_avg(vector unsigned int a, vector unsigned int b) |
| 1256 | { |
| 1257 | return __builtin_altivec_vavguw(a, b); |
| 1258 | } |
| 1259 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1260 | /* vec_vavgsb */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1261 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1262 | static vector signed char __attribute__((__always_inline__)) |
| 1263 | vec_vavgsb(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1264 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1265 | return __builtin_altivec_vavgsb(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1266 | } |
| 1267 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1268 | /* vec_vavgub */ |
| 1269 | |
| 1270 | static vector unsigned char __attribute__((__always_inline__)) |
| 1271 | vec_vavgub(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1272 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1273 | return __builtin_altivec_vavgub(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1274 | } |
| 1275 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1276 | /* vec_vavgsh */ |
| 1277 | |
| 1278 | static vector short __attribute__((__always_inline__)) |
| 1279 | vec_vavgsh(vector short a, vector short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1280 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1281 | return __builtin_altivec_vavgsh(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1282 | } |
| 1283 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1284 | /* vec_vavguh */ |
| 1285 | |
| 1286 | static vector unsigned short __attribute__((__always_inline__)) |
| 1287 | vec_vavguh(vector unsigned short a, vector unsigned short b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1288 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1289 | return __builtin_altivec_vavguh(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1290 | } |
| 1291 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1292 | /* vec_vavgsw */ |
| 1293 | |
| 1294 | static vector int __attribute__((__always_inline__)) |
| 1295 | vec_vavgsw(vector int a, vector int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1296 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1297 | return __builtin_altivec_vavgsw(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1298 | } |
| 1299 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1300 | /* vec_vavguw */ |
| 1301 | |
| 1302 | static vector unsigned int __attribute__((__always_inline__)) |
| 1303 | vec_vavguw(vector unsigned int a, vector unsigned int b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1304 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1305 | return __builtin_altivec_vavguw(a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1306 | } |
| 1307 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1308 | /* vec_ceil */ |
| 1309 | |
| 1310 | static vector float __attribute__((__always_inline__)) |
| 1311 | vec_ceil(vector float a) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1312 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1313 | return __builtin_altivec_vrfip(a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1314 | } |
| 1315 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1316 | /* vec_vrfip */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1317 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1318 | static vector float __attribute__((__always_inline__)) |
| 1319 | vec_vrfip(vector float a) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1320 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1321 | return __builtin_altivec_vrfip(a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1322 | } |
| 1323 | |
| 1324 | /* vec_cmpb */ |
| 1325 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1326 | static vector int __attribute__((__always_inline__)) |
| 1327 | vec_cmpb(vector float a, vector float b) |
| 1328 | { |
| 1329 | return __builtin_altivec_vcmpbfp(a, b); |
| 1330 | } |
| 1331 | |
| 1332 | /* vec_vcmpbfp */ |
| 1333 | |
| 1334 | static vector int __attribute__((__always_inline__)) |
| 1335 | vec_vcmpbfp(vector float a, vector float b) |
| 1336 | { |
| 1337 | return __builtin_altivec_vcmpbfp(a, b); |
| 1338 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1339 | |
| 1340 | /* vec_cmpeq */ |
| 1341 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1342 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1343 | vec_cmpeq(vector signed char a, vector signed char b) |
| 1344 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1345 | return __builtin_altivec_vcmpequb((vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1346 | } |
| 1347 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1348 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1349 | vec_cmpeq(vector unsigned char a, vector unsigned char b) |
| 1350 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1351 | return __builtin_altivec_vcmpequb((vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1352 | } |
| 1353 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1354 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1355 | vec_cmpeq(vector short a, vector short b) |
| 1356 | { |
| 1357 | return __builtin_altivec_vcmpequh(a, b); |
| 1358 | } |
| 1359 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1360 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1361 | vec_cmpeq(vector unsigned short a, vector unsigned short b) |
| 1362 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1363 | return __builtin_altivec_vcmpequh((vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1364 | } |
| 1365 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1366 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1367 | vec_cmpeq(vector int a, vector int b) |
| 1368 | { |
| 1369 | return __builtin_altivec_vcmpequw(a, b); |
| 1370 | } |
| 1371 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1372 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1373 | vec_cmpeq(vector unsigned int a, vector unsigned int b) |
| 1374 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1375 | return __builtin_altivec_vcmpequw((vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1376 | } |
| 1377 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1378 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1379 | vec_cmpeq(vector float a, vector float b) |
| 1380 | { |
| 1381 | return __builtin_altivec_vcmpeqfp(a, b); |
| 1382 | } |
| 1383 | |
| 1384 | /* vec_cmpge */ |
| 1385 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1386 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1387 | vec_cmpge(vector float a, vector float b) |
| 1388 | { |
| 1389 | return __builtin_altivec_vcmpgefp(a, b); |
| 1390 | } |
| 1391 | |
| 1392 | /* vec_vcmpgefp */ |
| 1393 | |
| 1394 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1395 | vec_vcmpgefp(vector float a, vector float b) |
| 1396 | { |
| 1397 | return __builtin_altivec_vcmpgefp(a, b); |
| 1398 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1399 | |
| 1400 | /* vec_cmpgt */ |
| 1401 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1402 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1403 | vec_cmpgt(vector signed char a, vector signed char b) |
| 1404 | { |
| 1405 | return __builtin_altivec_vcmpgtsb(a, b); |
| 1406 | } |
| 1407 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1408 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1409 | vec_cmpgt(vector unsigned char a, vector unsigned char b) |
| 1410 | { |
| 1411 | return __builtin_altivec_vcmpgtub(a, b); |
| 1412 | } |
| 1413 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1414 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1415 | vec_cmpgt(vector short a, vector short b) |
| 1416 | { |
| 1417 | return __builtin_altivec_vcmpgtsh(a, b); |
| 1418 | } |
| 1419 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1420 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1421 | vec_cmpgt(vector unsigned short a, vector unsigned short b) |
| 1422 | { |
| 1423 | return __builtin_altivec_vcmpgtuh(a, b); |
| 1424 | } |
| 1425 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1426 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1427 | vec_cmpgt(vector int a, vector int b) |
| 1428 | { |
| 1429 | return __builtin_altivec_vcmpgtsw(a, b); |
| 1430 | } |
| 1431 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1432 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1433 | vec_cmpgt(vector unsigned int a, vector unsigned int b) |
| 1434 | { |
| 1435 | return __builtin_altivec_vcmpgtuw(a, b); |
| 1436 | } |
| 1437 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1438 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1439 | vec_cmpgt(vector float a, vector float b) |
| 1440 | { |
| 1441 | return __builtin_altivec_vcmpgtfp(a, b); |
| 1442 | } |
| 1443 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1444 | /* vec_vcmpgtsb */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1445 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1446 | static vector /*bool*/ char __attribute__((__always_inline__)) |
| 1447 | vec_vcmpgtsb(vector signed char a, vector signed char b) |
| 1448 | { |
| 1449 | return __builtin_altivec_vcmpgtsb(a, b); |
| 1450 | } |
| 1451 | |
| 1452 | /* vec_vcmpgtub */ |
| 1453 | |
| 1454 | static vector /*bool*/ char __attribute__((__always_inline__)) |
| 1455 | vec_vcmpgtub(vector unsigned char a, vector unsigned char b) |
| 1456 | { |
| 1457 | return __builtin_altivec_vcmpgtub(a, b); |
| 1458 | } |
| 1459 | |
| 1460 | /* vec_vcmpgtsh */ |
| 1461 | |
| 1462 | static vector /*bool*/ short __attribute__((__always_inline__)) |
| 1463 | vec_vcmpgtsh(vector short a, vector short b) |
| 1464 | { |
| 1465 | return __builtin_altivec_vcmpgtsh(a, b); |
| 1466 | } |
| 1467 | |
| 1468 | /* vec_vcmpgtuh */ |
| 1469 | |
| 1470 | static vector /*bool*/ short __attribute__((__always_inline__)) |
| 1471 | vec_vcmpgtuh(vector unsigned short a, vector unsigned short b) |
| 1472 | { |
| 1473 | return __builtin_altivec_vcmpgtuh(a, b); |
| 1474 | } |
| 1475 | |
| 1476 | /* vec_vcmpgtsw */ |
| 1477 | |
| 1478 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1479 | vec_vcmpgtsw(vector int a, vector int b) |
| 1480 | { |
| 1481 | return __builtin_altivec_vcmpgtsw(a, b); |
| 1482 | } |
| 1483 | |
| 1484 | /* vec_vcmpgtuw */ |
| 1485 | |
| 1486 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1487 | vec_vcmpgtuw(vector unsigned int a, vector unsigned int b) |
| 1488 | { |
| 1489 | return __builtin_altivec_vcmpgtuw(a, b); |
| 1490 | } |
| 1491 | |
| 1492 | /* vec_vcmpgtfp */ |
| 1493 | |
| 1494 | static vector /*bool*/ int __attribute__((__always_inline__)) |
| 1495 | vec_vcmpgtfp(vector float a, vector float b) |
| 1496 | { |
| 1497 | return __builtin_altivec_vcmpgtfp(a, b); |
| 1498 | } |
| 1499 | |
| 1500 | /* vec_cmple */ |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1501 | |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 1502 | static vector /*bool*/ int __attribute__((__always_inline__)) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1503 | vec_cmple(vector float a, vector float b) |
| 1504 | { |
| 1505 | return __builtin_altivec_vcmpgefp(b, a); |
| 1506 | } |
| 1507 | |
| 1508 | /* vec_cmplt */ |
| 1509 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1510 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1511 | vec_cmplt(vector signed char a, vector signed char b) |
| 1512 | { |
| 1513 | return __builtin_altivec_vcmpgtsb(b, a); |
| 1514 | } |
| 1515 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1516 | static vector /*bool*/ char __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1517 | vec_cmplt(vector unsigned char a, vector unsigned char b) |
| 1518 | { |
| 1519 | return __builtin_altivec_vcmpgtub(b, a); |
| 1520 | } |
| 1521 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1522 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1523 | vec_cmplt(vector short a, vector short b) |
| 1524 | { |
| 1525 | return __builtin_altivec_vcmpgtsh(b, a); |
| 1526 | } |
| 1527 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1528 | static vector /*bool*/ short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1529 | vec_cmplt(vector unsigned short a, vector unsigned short b) |
| 1530 | { |
| 1531 | return __builtin_altivec_vcmpgtuh(b, a); |
| 1532 | } |
| 1533 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1534 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1535 | vec_cmplt(vector int a, vector int b) |
| 1536 | { |
| 1537 | return __builtin_altivec_vcmpgtsw(b, a); |
| 1538 | } |
| 1539 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1540 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1541 | vec_cmplt(vector unsigned int a, vector unsigned int b) |
| 1542 | { |
| 1543 | return __builtin_altivec_vcmpgtuw(b, a); |
| 1544 | } |
| 1545 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1546 | static vector /*bool*/ int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1547 | vec_cmplt(vector float a, vector float b) |
| 1548 | { |
| 1549 | return __builtin_altivec_vcmpgtfp(b, a); |
| 1550 | } |
| 1551 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 1552 | /* vec_ctf */ |
| 1553 | |
| 1554 | static vector float __ATTRS_o_ai |
| 1555 | vec_ctf(vector int a, int b) |
| 1556 | { |
| 1557 | return __builtin_altivec_vcfsx(a, b); |
| 1558 | } |
| 1559 | |
| 1560 | static vector float __ATTRS_o_ai |
| 1561 | vec_ctf(vector unsigned int a, int b) |
| 1562 | { |
| 1563 | return __builtin_altivec_vcfux((vector int)a, b); |
| 1564 | } |
| 1565 | |
| 1566 | /* vec_vcfsx */ |
| 1567 | |
| 1568 | static vector float __attribute__((__always_inline__)) |
| 1569 | vec_vcfsx(vector int a, int b) |
| 1570 | { |
| 1571 | return __builtin_altivec_vcfsx(a, b); |
| 1572 | } |
| 1573 | |
| 1574 | /* vec_vcfux */ |
| 1575 | |
| 1576 | static vector float __attribute__((__always_inline__)) |
| 1577 | vec_vcfux(vector unsigned int a, int b) |
| 1578 | { |
| 1579 | return __builtin_altivec_vcfux((vector int)a, b); |
| 1580 | } |
| 1581 | |
| 1582 | /* vec_cts */ |
| 1583 | |
| 1584 | static vector int __attribute__((__always_inline__)) |
| 1585 | vec_cts(vector float a, int b) |
| 1586 | { |
| 1587 | return __builtin_altivec_vctsxs(a, b); |
| 1588 | } |
| 1589 | |
| 1590 | /* vec_vctsxs */ |
| 1591 | |
| 1592 | static vector int __attribute__((__always_inline__)) |
| 1593 | vec_vctsxs(vector float a, int b) |
| 1594 | { |
| 1595 | return __builtin_altivec_vctsxs(a, b); |
| 1596 | } |
| 1597 | |
| 1598 | /* vec_ctu */ |
| 1599 | |
| 1600 | static vector unsigned int __attribute__((__always_inline__)) |
| 1601 | vec_ctu(vector float a, int b) |
| 1602 | { |
| 1603 | return __builtin_altivec_vctuxs(a, b); |
| 1604 | } |
| 1605 | |
| 1606 | /* vec_vctuxs */ |
| 1607 | |
| 1608 | static vector unsigned int __attribute__((__always_inline__)) |
| 1609 | vec_vctuxs(vector float a, int b) |
| 1610 | { |
| 1611 | return __builtin_altivec_vctuxs(a, b); |
| 1612 | } |
| 1613 | |
| 1614 | /* vec_dss */ |
| 1615 | |
| 1616 | static void __attribute__((__always_inline__)) |
| 1617 | vec_dss(int a) |
| 1618 | { |
| 1619 | __builtin_altivec_dss(a); |
| 1620 | } |
| 1621 | |
| 1622 | /* vec_dssall */ |
| 1623 | |
| 1624 | static void __attribute__((__always_inline__)) |
| 1625 | vec_dssall(void) |
| 1626 | { |
| 1627 | __builtin_altivec_dssall(); |
| 1628 | } |
| 1629 | |
| 1630 | /* vec_dst */ |
| 1631 | |
| 1632 | static void __attribute__((__always_inline__)) |
| 1633 | vec_dst(void *a, int b, int c) |
| 1634 | { |
| 1635 | __builtin_altivec_dst(a, b, c); |
| 1636 | } |
| 1637 | |
| 1638 | /* vec_dstst */ |
| 1639 | |
| 1640 | static void __attribute__((__always_inline__)) |
| 1641 | vec_dstst(void *a, int b, int c) |
| 1642 | { |
| 1643 | __builtin_altivec_dstst(a, b, c); |
| 1644 | } |
| 1645 | |
| 1646 | /* vec_dststt */ |
| 1647 | |
| 1648 | static void __attribute__((__always_inline__)) |
| 1649 | vec_dststt(void *a, int b, int c) |
| 1650 | { |
| 1651 | __builtin_altivec_dststt(a, b, c); |
| 1652 | } |
| 1653 | |
| 1654 | /* vec_dstt */ |
| 1655 | |
| 1656 | static void __attribute__((__always_inline__)) |
| 1657 | vec_dstt(void *a, int b, int c) |
| 1658 | { |
| 1659 | __builtin_altivec_dstt(a, b, c); |
| 1660 | } |
| 1661 | |
| 1662 | /* vec_expte */ |
| 1663 | |
| 1664 | static vector float __attribute__((__always_inline__)) |
| 1665 | vec_expte(vector float a) |
| 1666 | { |
| 1667 | return __builtin_altivec_vexptefp(a); |
| 1668 | } |
| 1669 | |
| 1670 | /* vec_vexptefp */ |
| 1671 | |
| 1672 | static vector float __attribute__((__always_inline__)) |
| 1673 | vec_vexptefp(vector float a) |
| 1674 | { |
| 1675 | return __builtin_altivec_vexptefp(a); |
| 1676 | } |
| 1677 | |
| 1678 | /* vec_floor */ |
| 1679 | |
| 1680 | static vector float __attribute__((__always_inline__)) |
| 1681 | vec_floor(vector float a) |
| 1682 | { |
| 1683 | return __builtin_altivec_vrfim(a); |
| 1684 | } |
| 1685 | |
| 1686 | /* vec_vrfim */ |
| 1687 | |
| 1688 | static vector float __attribute__((__always_inline__)) |
| 1689 | vec_vrfim(vector float a) |
| 1690 | { |
| 1691 | return __builtin_altivec_vrfim(a); |
| 1692 | } |
| 1693 | |
| 1694 | /* vec_ld */ |
| 1695 | |
| 1696 | static vector signed char __ATTRS_o_ai |
| 1697 | vec_ld(int a, vector signed char *b) |
| 1698 | { |
| 1699 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1700 | } |
| 1701 | |
| 1702 | static vector signed char __ATTRS_o_ai |
| 1703 | vec_ld(int a, signed char *b) |
| 1704 | { |
| 1705 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1706 | } |
| 1707 | |
| 1708 | static vector unsigned char __ATTRS_o_ai |
| 1709 | vec_ld(int a, vector unsigned char *b) |
| 1710 | { |
| 1711 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1712 | } |
| 1713 | |
| 1714 | static vector unsigned char __ATTRS_o_ai |
| 1715 | vec_ld(int a, unsigned char *b) |
| 1716 | { |
| 1717 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1718 | } |
| 1719 | |
| 1720 | static vector short __ATTRS_o_ai |
| 1721 | vec_ld(int a, vector short *b) |
| 1722 | { |
| 1723 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1724 | } |
| 1725 | |
| 1726 | static vector short __ATTRS_o_ai |
| 1727 | vec_ld(int a, short *b) |
| 1728 | { |
| 1729 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1730 | } |
| 1731 | |
| 1732 | static vector unsigned short __ATTRS_o_ai |
| 1733 | vec_ld(int a, vector unsigned short *b) |
| 1734 | { |
| 1735 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1736 | } |
| 1737 | |
| 1738 | static vector unsigned short __ATTRS_o_ai |
| 1739 | vec_ld(int a, unsigned short *b) |
| 1740 | { |
| 1741 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1742 | } |
| 1743 | |
| 1744 | static vector int __ATTRS_o_ai |
| 1745 | vec_ld(int a, vector int *b) |
| 1746 | { |
| 1747 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1748 | } |
| 1749 | |
| 1750 | static vector int __ATTRS_o_ai |
| 1751 | vec_ld(int a, int *b) |
| 1752 | { |
| 1753 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1754 | } |
| 1755 | |
| 1756 | static vector unsigned int __ATTRS_o_ai |
| 1757 | vec_ld(int a, vector unsigned int *b) |
| 1758 | { |
| 1759 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1760 | } |
| 1761 | |
| 1762 | static vector unsigned int __ATTRS_o_ai |
| 1763 | vec_ld(int a, unsigned int *b) |
| 1764 | { |
| 1765 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1766 | } |
| 1767 | |
| 1768 | static vector float __ATTRS_o_ai |
| 1769 | vec_ld(int a, vector float *b) |
| 1770 | { |
| 1771 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1772 | } |
| 1773 | |
| 1774 | static vector float __ATTRS_o_ai |
| 1775 | vec_ld(int a, float *b) |
| 1776 | { |
| 1777 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1778 | } |
| 1779 | |
| 1780 | /* vec_lvx */ |
| 1781 | |
| 1782 | static vector signed char __ATTRS_o_ai |
| 1783 | vec_lvx(int a, vector signed char *b) |
| 1784 | { |
| 1785 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1786 | } |
| 1787 | |
| 1788 | static vector signed char __ATTRS_o_ai |
| 1789 | vec_lvx(int a, signed char *b) |
| 1790 | { |
| 1791 | return (vector signed char)__builtin_altivec_lvx(a, b); |
| 1792 | } |
| 1793 | |
| 1794 | static vector unsigned char __ATTRS_o_ai |
| 1795 | vec_lvx(int a, vector unsigned char *b) |
| 1796 | { |
| 1797 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1798 | } |
| 1799 | |
| 1800 | static vector unsigned char __ATTRS_o_ai |
| 1801 | vec_lvx(int a, unsigned char *b) |
| 1802 | { |
| 1803 | return (vector unsigned char)__builtin_altivec_lvx(a, b); |
| 1804 | } |
| 1805 | |
| 1806 | static vector short __ATTRS_o_ai |
| 1807 | vec_lvx(int a, vector short *b) |
| 1808 | { |
| 1809 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1810 | } |
| 1811 | |
| 1812 | static vector short __ATTRS_o_ai |
| 1813 | vec_lvx(int a, short *b) |
| 1814 | { |
| 1815 | return (vector short)__builtin_altivec_lvx(a, b); |
| 1816 | } |
| 1817 | |
| 1818 | static vector unsigned short __ATTRS_o_ai |
| 1819 | vec_lvx(int a, vector unsigned short *b) |
| 1820 | { |
| 1821 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1822 | } |
| 1823 | |
| 1824 | static vector unsigned short __ATTRS_o_ai |
| 1825 | vec_lvx(int a, unsigned short *b) |
| 1826 | { |
| 1827 | return (vector unsigned short)__builtin_altivec_lvx(a, b); |
| 1828 | } |
| 1829 | |
| 1830 | static vector int __ATTRS_o_ai |
| 1831 | vec_lvx(int a, vector int *b) |
| 1832 | { |
| 1833 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1834 | } |
| 1835 | |
| 1836 | static vector int __ATTRS_o_ai |
| 1837 | vec_lvx(int a, int *b) |
| 1838 | { |
| 1839 | return (vector int)__builtin_altivec_lvx(a, b); |
| 1840 | } |
| 1841 | |
| 1842 | static vector unsigned int __ATTRS_o_ai |
| 1843 | vec_lvx(int a, vector unsigned int *b) |
| 1844 | { |
| 1845 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1846 | } |
| 1847 | |
| 1848 | static vector unsigned int __ATTRS_o_ai |
| 1849 | vec_lvx(int a, unsigned int *b) |
| 1850 | { |
| 1851 | return (vector unsigned int)__builtin_altivec_lvx(a, b); |
| 1852 | } |
| 1853 | |
| 1854 | static vector float __ATTRS_o_ai |
| 1855 | vec_lvx(int a, vector float *b) |
| 1856 | { |
| 1857 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1858 | } |
| 1859 | |
| 1860 | static vector float __ATTRS_o_ai |
| 1861 | vec_lvx(int a, float *b) |
| 1862 | { |
| 1863 | return (vector float)__builtin_altivec_lvx(a, b); |
| 1864 | } |
| 1865 | |
| 1866 | /* vec_lde */ |
| 1867 | |
| 1868 | static vector signed char __ATTRS_o_ai |
| 1869 | vec_lde(int a, vector signed char *b) |
| 1870 | { |
| 1871 | return (vector signed char)__builtin_altivec_lvebx(a, b); |
| 1872 | } |
| 1873 | |
| 1874 | static vector unsigned char __ATTRS_o_ai |
| 1875 | vec_lde(int a, vector unsigned char *b) |
| 1876 | { |
| 1877 | return (vector unsigned char)__builtin_altivec_lvebx(a, b); |
| 1878 | } |
| 1879 | |
| 1880 | static vector short __ATTRS_o_ai |
| 1881 | vec_lde(int a, vector short *b) |
| 1882 | { |
| 1883 | return (vector short)__builtin_altivec_lvehx(a, b); |
| 1884 | } |
| 1885 | |
| 1886 | static vector unsigned short __ATTRS_o_ai |
| 1887 | vec_lde(int a, vector unsigned short *b) |
| 1888 | { |
| 1889 | return (vector unsigned short)__builtin_altivec_lvehx(a, b); |
| 1890 | } |
| 1891 | |
| 1892 | static vector int __ATTRS_o_ai |
| 1893 | vec_lde(int a, vector int *b) |
| 1894 | { |
| 1895 | return (vector int)__builtin_altivec_lvewx(a, b); |
| 1896 | } |
| 1897 | |
| 1898 | static vector unsigned int __ATTRS_o_ai |
| 1899 | vec_lde(int a, vector unsigned int *b) |
| 1900 | { |
| 1901 | return (vector unsigned int)__builtin_altivec_lvewx(a, b); |
| 1902 | } |
| 1903 | |
| 1904 | static vector float __ATTRS_o_ai |
| 1905 | vec_lde(int a, vector float *b) |
| 1906 | { |
| 1907 | return (vector float)__builtin_altivec_lvewx(a, b); |
| 1908 | } |
| 1909 | |
| 1910 | /* vec_lvebx */ |
| 1911 | |
| 1912 | static vector signed char __ATTRS_o_ai |
| 1913 | vec_lvebx(int a, vector signed char *b) |
| 1914 | { |
| 1915 | return (vector signed char)__builtin_altivec_lvebx(a, b); |
| 1916 | } |
| 1917 | |
| 1918 | static vector unsigned char __ATTRS_o_ai |
| 1919 | vec_lvebx(int a, vector unsigned char *b) |
| 1920 | { |
| 1921 | return (vector unsigned char)__builtin_altivec_lvebx(a, b); |
| 1922 | } |
| 1923 | |
| 1924 | /* vec_lvehx */ |
| 1925 | |
| 1926 | static vector short __ATTRS_o_ai |
| 1927 | vec_lvehx(int a, vector short *b) |
| 1928 | { |
| 1929 | return (vector short)__builtin_altivec_lvehx(a, b); |
| 1930 | } |
| 1931 | |
| 1932 | static vector unsigned short __ATTRS_o_ai |
| 1933 | vec_lvehx(int a, vector unsigned short *b) |
| 1934 | { |
| 1935 | return (vector unsigned short)__builtin_altivec_lvehx(a, b); |
| 1936 | } |
| 1937 | |
| 1938 | /* vec_lvewx */ |
| 1939 | |
| 1940 | static vector int __ATTRS_o_ai |
| 1941 | vec_lvewx(int a, vector int *b) |
| 1942 | { |
| 1943 | return (vector int)__builtin_altivec_lvewx(a, b); |
| 1944 | } |
| 1945 | |
| 1946 | static vector unsigned int __ATTRS_o_ai |
| 1947 | vec_lvewx(int a, vector unsigned int *b) |
| 1948 | { |
| 1949 | return (vector unsigned int)__builtin_altivec_lvewx(a, b); |
| 1950 | } |
| 1951 | |
| 1952 | static vector float __ATTRS_o_ai |
| 1953 | vec_lvewx(int a, vector float *b) |
| 1954 | { |
| 1955 | return (vector float)__builtin_altivec_lvewx(a, b); |
| 1956 | } |
| 1957 | |
| 1958 | /* vec_ldl */ |
| 1959 | |
| 1960 | static vector signed char __ATTRS_o_ai |
| 1961 | vec_ldl(int a, vector signed char *b) |
| 1962 | { |
| 1963 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 1964 | } |
| 1965 | |
| 1966 | static vector signed char __ATTRS_o_ai |
| 1967 | vec_ldl(int a, signed char *b) |
| 1968 | { |
| 1969 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 1970 | } |
| 1971 | |
| 1972 | static vector unsigned char __ATTRS_o_ai |
| 1973 | vec_ldl(int a, vector unsigned char *b) |
| 1974 | { |
| 1975 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 1976 | } |
| 1977 | |
| 1978 | static vector unsigned char __ATTRS_o_ai |
| 1979 | vec_ldl(int a, unsigned char *b) |
| 1980 | { |
| 1981 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 1982 | } |
| 1983 | |
| 1984 | static vector short __ATTRS_o_ai |
| 1985 | vec_ldl(int a, vector short *b) |
| 1986 | { |
| 1987 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 1988 | } |
| 1989 | |
| 1990 | static vector short __ATTRS_o_ai |
| 1991 | vec_ldl(int a, short *b) |
| 1992 | { |
| 1993 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 1994 | } |
| 1995 | |
| 1996 | static vector unsigned short __ATTRS_o_ai |
| 1997 | vec_ldl(int a, vector unsigned short *b) |
| 1998 | { |
| 1999 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 2000 | } |
| 2001 | |
| 2002 | static vector unsigned short __ATTRS_o_ai |
| 2003 | vec_ldl(int a, unsigned short *b) |
| 2004 | { |
| 2005 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 2006 | } |
| 2007 | |
| 2008 | static vector int __ATTRS_o_ai |
| 2009 | vec_ldl(int a, vector int *b) |
| 2010 | { |
| 2011 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2012 | } |
| 2013 | |
| 2014 | static vector int __ATTRS_o_ai |
| 2015 | vec_ldl(int a, int *b) |
| 2016 | { |
| 2017 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2018 | } |
| 2019 | |
| 2020 | static vector unsigned int __ATTRS_o_ai |
| 2021 | vec_ldl(int a, vector unsigned int *b) |
| 2022 | { |
| 2023 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2024 | } |
| 2025 | |
| 2026 | static vector unsigned int __ATTRS_o_ai |
| 2027 | vec_ldl(int a, unsigned int *b) |
| 2028 | { |
| 2029 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2030 | } |
| 2031 | |
| 2032 | static vector float __ATTRS_o_ai |
| 2033 | vec_ldl(int a, vector float *b) |
| 2034 | { |
| 2035 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2036 | } |
| 2037 | |
| 2038 | static vector float __ATTRS_o_ai |
| 2039 | vec_ldl(int a, float *b) |
| 2040 | { |
| 2041 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2042 | } |
| 2043 | |
| 2044 | /* vec_lvxl */ |
| 2045 | |
| 2046 | static vector signed char __ATTRS_o_ai |
| 2047 | vec_lvxl(int a, vector signed char *b) |
| 2048 | { |
| 2049 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 2050 | } |
| 2051 | |
| 2052 | static vector signed char __ATTRS_o_ai |
| 2053 | vec_lvxl(int a, signed char *b) |
| 2054 | { |
| 2055 | return (vector signed char)__builtin_altivec_lvxl(a, b); |
| 2056 | } |
| 2057 | |
| 2058 | static vector unsigned char __ATTRS_o_ai |
| 2059 | vec_lvxl(int a, vector unsigned char *b) |
| 2060 | { |
| 2061 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 2062 | } |
| 2063 | |
| 2064 | static vector unsigned char __ATTRS_o_ai |
| 2065 | vec_lvxl(int a, unsigned char *b) |
| 2066 | { |
| 2067 | return (vector unsigned char)__builtin_altivec_lvxl(a, b); |
| 2068 | } |
| 2069 | |
| 2070 | static vector short __ATTRS_o_ai |
| 2071 | vec_lvxl(int a, vector short *b) |
| 2072 | { |
| 2073 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 2074 | } |
| 2075 | |
| 2076 | static vector short __ATTRS_o_ai |
| 2077 | vec_lvxl(int a, short *b) |
| 2078 | { |
| 2079 | return (vector short)__builtin_altivec_lvxl(a, b); |
| 2080 | } |
| 2081 | |
| 2082 | static vector unsigned short __ATTRS_o_ai |
| 2083 | vec_lvxl(int a, vector unsigned short *b) |
| 2084 | { |
| 2085 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 2086 | } |
| 2087 | |
| 2088 | static vector unsigned short __ATTRS_o_ai |
| 2089 | vec_lvxl(int a, unsigned short *b) |
| 2090 | { |
| 2091 | return (vector unsigned short)__builtin_altivec_lvxl(a, b); |
| 2092 | } |
| 2093 | |
| 2094 | static vector int __ATTRS_o_ai |
| 2095 | vec_lvxl(int a, vector int *b) |
| 2096 | { |
| 2097 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2098 | } |
| 2099 | |
| 2100 | static vector int __ATTRS_o_ai |
| 2101 | vec_lvxl(int a, int *b) |
| 2102 | { |
| 2103 | return (vector int)__builtin_altivec_lvxl(a, b); |
| 2104 | } |
| 2105 | |
| 2106 | static vector unsigned int __ATTRS_o_ai |
| 2107 | vec_lvxl(int a, vector unsigned int *b) |
| 2108 | { |
| 2109 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2110 | } |
| 2111 | |
| 2112 | static vector unsigned int __ATTRS_o_ai |
| 2113 | vec_lvxl(int a, unsigned int *b) |
| 2114 | { |
| 2115 | return (vector unsigned int)__builtin_altivec_lvxl(a, b); |
| 2116 | } |
| 2117 | |
| 2118 | static vector float __ATTRS_o_ai |
| 2119 | vec_lvxl(int a, vector float *b) |
| 2120 | { |
| 2121 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2122 | } |
| 2123 | |
| 2124 | static vector float __ATTRS_o_ai |
| 2125 | vec_lvxl(int a, float *b) |
| 2126 | { |
| 2127 | return (vector float)__builtin_altivec_lvxl(a, b); |
| 2128 | } |
| 2129 | |
| 2130 | /* vec_loge */ |
| 2131 | |
| 2132 | static vector float __attribute__((__always_inline__)) |
| 2133 | vec_loge(vector float a) |
| 2134 | { |
| 2135 | return __builtin_altivec_vlogefp(a); |
| 2136 | } |
| 2137 | |
| 2138 | /* vec_vlogefp */ |
| 2139 | |
| 2140 | static vector float __attribute__((__always_inline__)) |
| 2141 | vec_vlogefp(vector float a) |
| 2142 | { |
| 2143 | return __builtin_altivec_vlogefp(a); |
| 2144 | } |
| 2145 | |
| 2146 | /* vec_lvsl */ |
| 2147 | |
| 2148 | static vector unsigned char __ATTRS_o_ai |
| 2149 | vec_lvsl(int a, signed char *b) |
| 2150 | { |
| 2151 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2152 | } |
| 2153 | |
| 2154 | static vector unsigned char __ATTRS_o_ai |
| 2155 | vec_lvsl(int a, unsigned char *b) |
| 2156 | { |
| 2157 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2158 | } |
| 2159 | |
| 2160 | static vector unsigned char __ATTRS_o_ai |
| 2161 | vec_lvsl(int a, short *b) |
| 2162 | { |
| 2163 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2164 | } |
| 2165 | |
| 2166 | static vector unsigned char __ATTRS_o_ai |
| 2167 | vec_lvsl(int a, unsigned short *b) |
| 2168 | { |
| 2169 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2170 | } |
| 2171 | |
| 2172 | static vector unsigned char __ATTRS_o_ai |
| 2173 | vec_lvsl(int a, int *b) |
| 2174 | { |
| 2175 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2176 | } |
| 2177 | |
| 2178 | static vector unsigned char __ATTRS_o_ai |
| 2179 | vec_lvsl(int a, unsigned int *b) |
| 2180 | { |
| 2181 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2182 | } |
| 2183 | |
| 2184 | static vector unsigned char __ATTRS_o_ai |
| 2185 | vec_lvsl(int a, float *b) |
| 2186 | { |
| 2187 | return (vector unsigned char)__builtin_altivec_lvsl(a, b); |
| 2188 | } |
| 2189 | |
| 2190 | /* vec_lvsr */ |
| 2191 | |
| 2192 | static vector unsigned char __ATTRS_o_ai |
| 2193 | vec_lvsr(int a, signed char *b) |
| 2194 | { |
| 2195 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2196 | } |
| 2197 | |
| 2198 | static vector unsigned char __ATTRS_o_ai |
| 2199 | vec_lvsr(int a, unsigned char *b) |
| 2200 | { |
| 2201 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2202 | } |
| 2203 | |
| 2204 | static vector unsigned char __ATTRS_o_ai |
| 2205 | vec_lvsr(int a, short *b) |
| 2206 | { |
| 2207 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2208 | } |
| 2209 | |
| 2210 | static vector unsigned char __ATTRS_o_ai |
| 2211 | vec_lvsr(int a, unsigned short *b) |
| 2212 | { |
| 2213 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2214 | } |
| 2215 | |
| 2216 | static vector unsigned char __ATTRS_o_ai |
| 2217 | vec_lvsr(int a, int *b) |
| 2218 | { |
| 2219 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2220 | } |
| 2221 | |
| 2222 | static vector unsigned char __ATTRS_o_ai |
| 2223 | vec_lvsr(int a, unsigned int *b) |
| 2224 | { |
| 2225 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2226 | } |
| 2227 | |
| 2228 | static vector unsigned char __ATTRS_o_ai |
| 2229 | vec_lvsr(int a, float *b) |
| 2230 | { |
| 2231 | return (vector unsigned char)__builtin_altivec_lvsr(a, b); |
| 2232 | } |
| 2233 | |
| 2234 | /* vec_madd */ |
| 2235 | |
| 2236 | static vector float __attribute__((__always_inline__)) |
| 2237 | vec_madd(vector float a, vector float b, vector float c) |
| 2238 | { |
| 2239 | return __builtin_altivec_vmaddfp(a, b, c); |
| 2240 | } |
| 2241 | |
| 2242 | /* vec_vmaddfp */ |
| 2243 | |
| 2244 | static vector float __attribute__((__always_inline__)) |
| 2245 | vec_vmaddfp(vector float a, vector float b, vector float c) |
| 2246 | { |
| 2247 | return __builtin_altivec_vmaddfp(a, b, c); |
| 2248 | } |
| 2249 | |
| 2250 | /* vec_madds */ |
| 2251 | |
| 2252 | static vector signed short __attribute__((__always_inline__)) |
| 2253 | vec_madds(vector signed short a, vector signed short b, vector signed short c) |
| 2254 | { |
| 2255 | return __builtin_altivec_vmhaddshs(a, b, c); |
| 2256 | } |
| 2257 | |
| 2258 | /* vec_vmhaddshs */ |
| 2259 | static vector signed short __attribute__((__always_inline__)) |
| 2260 | vec_vmhaddshs(vector signed short a, vector signed short b, vector signed short c) |
| 2261 | { |
| 2262 | return __builtin_altivec_vmhaddshs(a, b, c); |
| 2263 | } |
| 2264 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2265 | /* vec_max */ |
| 2266 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2267 | static vector signed char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2268 | vec_max(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2269 | { |
| 2270 | return __builtin_altivec_vmaxsb(a, b); |
| 2271 | } |
| 2272 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2273 | static vector unsigned char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2274 | vec_max(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2275 | { |
| 2276 | return __builtin_altivec_vmaxub(a, b); |
| 2277 | } |
| 2278 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2279 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2280 | vec_max(vector short a, vector short b) |
| 2281 | { |
| 2282 | return __builtin_altivec_vmaxsh(a, b); |
| 2283 | } |
| 2284 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2285 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2286 | vec_max(vector unsigned short a, vector unsigned short b) |
| 2287 | { |
| 2288 | return __builtin_altivec_vmaxuh(a, b); |
| 2289 | } |
| 2290 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2291 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2292 | vec_max(vector int a, vector int b) |
| 2293 | { |
| 2294 | return __builtin_altivec_vmaxsw(a, b); |
| 2295 | } |
| 2296 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2297 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2298 | vec_max(vector unsigned int a, vector unsigned int b) |
| 2299 | { |
| 2300 | return __builtin_altivec_vmaxuw(a, b); |
| 2301 | } |
| 2302 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2303 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2304 | vec_max(vector float a, vector float b) |
| 2305 | { |
| 2306 | return __builtin_altivec_vmaxfp(a, b); |
| 2307 | } |
| 2308 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2309 | /* vec_vmaxsb */ |
| 2310 | |
| 2311 | static vector signed char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2312 | vec_vmaxsb(vector signed char a, vector signed char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2313 | { |
| 2314 | return __builtin_altivec_vmaxsb(a, b); |
| 2315 | } |
| 2316 | |
| 2317 | /* vec_vmaxub */ |
| 2318 | |
| 2319 | static vector unsigned char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2320 | vec_vmaxub(vector unsigned char a, vector unsigned char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2321 | { |
| 2322 | return __builtin_altivec_vmaxub(a, b); |
| 2323 | } |
| 2324 | |
| 2325 | /* vec_vmaxsh */ |
| 2326 | |
| 2327 | static vector short __attribute__((__always_inline__)) |
| 2328 | vec_vmaxsh(vector short a, vector short b) |
| 2329 | { |
| 2330 | return __builtin_altivec_vmaxsh(a, b); |
| 2331 | } |
| 2332 | |
| 2333 | /* vec_vmaxuh */ |
| 2334 | |
| 2335 | static vector unsigned short __attribute__((__always_inline__)) |
| 2336 | vec_vmaxuh(vector unsigned short a, vector unsigned short b) |
| 2337 | { |
| 2338 | return __builtin_altivec_vmaxuh(a, b); |
| 2339 | } |
| 2340 | |
| 2341 | /* vec_vmaxsw */ |
| 2342 | |
| 2343 | static vector int __attribute__((__always_inline__)) |
| 2344 | vec_vmaxsw(vector int a, vector int b) |
| 2345 | { |
| 2346 | return __builtin_altivec_vmaxsw(a, b); |
| 2347 | } |
| 2348 | |
| 2349 | /* vec_vmaxuw */ |
| 2350 | |
| 2351 | static vector unsigned int __attribute__((__always_inline__)) |
| 2352 | vec_vmaxuw(vector unsigned int a, vector unsigned int b) |
| 2353 | { |
| 2354 | return __builtin_altivec_vmaxuw(a, b); |
| 2355 | } |
| 2356 | |
| 2357 | /* vec_vmaxfp */ |
| 2358 | |
| 2359 | static vector float __attribute__((__always_inline__)) |
| 2360 | vec_vmaxfp(vector float a, vector float b) |
| 2361 | { |
| 2362 | return __builtin_altivec_vmaxfp(a, b); |
| 2363 | } |
| 2364 | |
| 2365 | /* vec_mergeh */ |
| 2366 | |
| 2367 | static vector signed char __ATTRS_o_ai |
| 2368 | vec_mergeh(vector signed char a, vector signed char b) |
| 2369 | { |
| 2370 | return vec_perm(a, b, (vector unsigned char) |
| 2371 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2372 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2373 | } |
| 2374 | |
| 2375 | static vector unsigned char __ATTRS_o_ai |
| 2376 | vec_mergeh(vector unsigned char a, vector unsigned char b) |
| 2377 | { |
| 2378 | return vec_perm(a, b, (vector unsigned char) |
| 2379 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2380 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2381 | } |
| 2382 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2383 | static vector bool char __ATTRS_o_ai |
| 2384 | vec_mergeh(vector bool char a, vector bool char b) |
| 2385 | { |
| 2386 | return vec_perm(a, b, (vector unsigned char) |
| 2387 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2388 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2389 | } |
| 2390 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2391 | static vector short __ATTRS_o_ai |
| 2392 | vec_mergeh(vector short a, vector short b) |
| 2393 | { |
| 2394 | return vec_perm(a, b, (vector unsigned char) |
| 2395 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2396 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2397 | } |
| 2398 | |
| 2399 | static vector unsigned short __ATTRS_o_ai |
| 2400 | vec_mergeh(vector unsigned short a, vector unsigned short b) |
| 2401 | { |
| 2402 | return vec_perm(a, b, (vector unsigned char) |
| 2403 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2404 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2405 | } |
| 2406 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2407 | static vector bool short __ATTRS_o_ai |
| 2408 | vec_mergeh(vector bool short a, vector bool short b) |
| 2409 | { |
| 2410 | return vec_perm(a, b, (vector unsigned char) |
| 2411 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2412 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2413 | } |
| 2414 | |
| 2415 | static vector pixel __ATTRS_o_ai |
| 2416 | vec_mergeh(vector pixel a, vector pixel b) |
| 2417 | { |
| 2418 | return vec_perm(a, b, (vector unsigned char) |
| 2419 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2420 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2421 | } |
| 2422 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2423 | static vector int __ATTRS_o_ai |
| 2424 | vec_mergeh(vector int a, vector int b) |
| 2425 | { |
| 2426 | return vec_perm(a, b, (vector unsigned char) |
| 2427 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2428 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2429 | } |
| 2430 | |
| 2431 | static vector unsigned int __ATTRS_o_ai |
| 2432 | vec_mergeh(vector unsigned int a, vector unsigned int b) |
| 2433 | { |
| 2434 | return vec_perm(a, b, (vector unsigned char) |
| 2435 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2436 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2437 | } |
| 2438 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2439 | static vector bool int __ATTRS_o_ai |
| 2440 | vec_mergeh(vector bool int a, vector bool int b) |
| 2441 | { |
| 2442 | return vec_perm(a, b, (vector unsigned char) |
| 2443 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2444 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2445 | } |
| 2446 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2447 | static vector float __ATTRS_o_ai |
| 2448 | vec_mergeh(vector float a, vector float b) |
| 2449 | { |
| 2450 | return vec_perm(a, b, (vector unsigned char) |
| 2451 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2452 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2453 | } |
| 2454 | |
| 2455 | /* vec_vmrghb */ |
| 2456 | |
| 2457 | #define __builtin_altivec_vmrghb vec_vmrghb |
| 2458 | |
| 2459 | static vector signed char __ATTRS_o_ai |
| 2460 | vec_vmrghb(vector signed char a, vector signed char b) |
| 2461 | { |
| 2462 | return vec_perm(a, b, (vector unsigned char) |
| 2463 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2464 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2465 | } |
| 2466 | |
| 2467 | static vector unsigned char __ATTRS_o_ai |
| 2468 | vec_vmrghb(vector unsigned char a, vector unsigned char b) |
| 2469 | { |
| 2470 | return vec_perm(a, b, (vector unsigned char) |
| 2471 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2472 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2473 | } |
| 2474 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2475 | static vector bool char __ATTRS_o_ai |
| 2476 | vec_vmrghb(vector bool char a, vector bool char b) |
| 2477 | { |
| 2478 | return vec_perm(a, b, (vector unsigned char) |
| 2479 | (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, |
| 2480 | 0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17)); |
| 2481 | } |
| 2482 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2483 | /* vec_vmrghh */ |
| 2484 | |
| 2485 | #define __builtin_altivec_vmrghh vec_vmrghh |
| 2486 | |
| 2487 | static vector short __ATTRS_o_ai |
| 2488 | vec_vmrghh(vector short a, vector short b) |
| 2489 | { |
| 2490 | return vec_perm(a, b, (vector unsigned char) |
| 2491 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2492 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2493 | } |
| 2494 | |
| 2495 | static vector unsigned short __ATTRS_o_ai |
| 2496 | vec_vmrghh(vector unsigned short a, vector unsigned short b) |
| 2497 | { |
| 2498 | return vec_perm(a, b, (vector unsigned char) |
| 2499 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2500 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2501 | } |
| 2502 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2503 | static vector bool short __ATTRS_o_ai |
| 2504 | vec_vmrghh(vector bool short a, vector bool short b) |
| 2505 | { |
| 2506 | return vec_perm(a, b, (vector unsigned char) |
| 2507 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2508 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2509 | } |
| 2510 | |
| 2511 | static vector pixel __ATTRS_o_ai |
| 2512 | vec_vmrghh(vector pixel a, vector pixel b) |
| 2513 | { |
| 2514 | return vec_perm(a, b, (vector unsigned char) |
| 2515 | (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13, |
| 2516 | 0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17)); |
| 2517 | } |
| 2518 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2519 | /* vec_vmrghw */ |
| 2520 | |
| 2521 | #define __builtin_altivec_vmrghw vec_vmrghw |
| 2522 | |
| 2523 | static vector int __ATTRS_o_ai |
| 2524 | vec_vmrghw(vector int a, vector int b) |
| 2525 | { |
| 2526 | return vec_perm(a, b, (vector unsigned char) |
| 2527 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2528 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2529 | } |
| 2530 | |
| 2531 | static vector unsigned int __ATTRS_o_ai |
| 2532 | vec_vmrghw(vector unsigned int a, vector unsigned int b) |
| 2533 | { |
| 2534 | return vec_perm(a, b, (vector unsigned char) |
| 2535 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2536 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2537 | } |
| 2538 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2539 | static vector bool int __ATTRS_o_ai |
| 2540 | vec_vmrghw(vector bool int a, vector bool int b) |
| 2541 | { |
| 2542 | return vec_perm(a, b, (vector unsigned char) |
| 2543 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2544 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2545 | } |
| 2546 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2547 | static vector float __ATTRS_o_ai |
| 2548 | vec_vmrghw(vector float a, vector float b) |
| 2549 | { |
| 2550 | return vec_perm(a, b, (vector unsigned char) |
| 2551 | (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, |
| 2552 | 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17)); |
| 2553 | } |
| 2554 | |
| 2555 | /* vec_mergel */ |
| 2556 | |
| 2557 | static vector signed char __ATTRS_o_ai |
| 2558 | vec_mergel(vector signed char a, vector signed char b) |
| 2559 | { |
| 2560 | return vec_perm(a, b, (vector unsigned char) |
| 2561 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2562 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2563 | } |
| 2564 | |
| 2565 | static vector unsigned char __ATTRS_o_ai |
| 2566 | vec_mergel(vector unsigned char a, vector unsigned char b) |
| 2567 | { |
| 2568 | return vec_perm(a, b, (vector unsigned char) |
| 2569 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2570 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2571 | } |
| 2572 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2573 | static vector bool char __ATTRS_o_ai |
| 2574 | vec_mergel(vector bool char a, vector bool char b) |
| 2575 | { |
| 2576 | return vec_perm(a, b, (vector unsigned char) |
| 2577 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2578 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2579 | } |
| 2580 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2581 | static vector short __ATTRS_o_ai |
| 2582 | vec_mergel(vector short a, vector short b) |
| 2583 | { |
| 2584 | return vec_perm(a, b, (vector unsigned char) |
| 2585 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2586 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2587 | } |
| 2588 | |
| 2589 | static vector unsigned short __ATTRS_o_ai |
| 2590 | vec_mergel(vector unsigned short a, vector unsigned short b) |
| 2591 | { |
| 2592 | return vec_perm(a, b, (vector unsigned char) |
| 2593 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2594 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2595 | } |
| 2596 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2597 | static vector bool short __ATTRS_o_ai |
| 2598 | vec_mergel(vector bool short a, vector bool short b) |
| 2599 | { |
| 2600 | return vec_perm(a, b, (vector unsigned char) |
| 2601 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2602 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2603 | } |
| 2604 | |
| 2605 | static vector pixel __ATTRS_o_ai |
| 2606 | vec_mergel(vector pixel a, vector pixel b) |
| 2607 | { |
| 2608 | return vec_perm(a, b, (vector unsigned char) |
| 2609 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2610 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2611 | } |
| 2612 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2613 | static vector int __ATTRS_o_ai |
| 2614 | vec_mergel(vector int a, vector int b) |
| 2615 | { |
| 2616 | return vec_perm(a, b, (vector unsigned char) |
| 2617 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2618 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2619 | } |
| 2620 | |
| 2621 | static vector unsigned int __ATTRS_o_ai |
| 2622 | vec_mergel(vector unsigned int a, vector unsigned int b) |
| 2623 | { |
| 2624 | return vec_perm(a, b, (vector unsigned char) |
| 2625 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2626 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2627 | } |
| 2628 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2629 | static vector bool int __ATTRS_o_ai |
| 2630 | vec_mergel(vector bool int a, vector bool int b) |
| 2631 | { |
| 2632 | return vec_perm(a, b, (vector unsigned char) |
| 2633 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2634 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2635 | } |
| 2636 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2637 | static vector float __ATTRS_o_ai |
| 2638 | vec_mergel(vector float a, vector float b) |
| 2639 | { |
| 2640 | return vec_perm(a, b, (vector unsigned char) |
| 2641 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2642 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2643 | } |
| 2644 | |
| 2645 | /* vec_vmrglb */ |
| 2646 | |
| 2647 | #define __builtin_altivec_vmrglb vec_vmrglb |
| 2648 | |
| 2649 | static vector signed char __ATTRS_o_ai |
| 2650 | vec_vmrglb(vector signed char a, vector signed char b) |
| 2651 | { |
| 2652 | return vec_perm(a, b, (vector unsigned char) |
| 2653 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2654 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2655 | } |
| 2656 | |
| 2657 | static vector unsigned char __ATTRS_o_ai |
| 2658 | vec_vmrglb(vector unsigned char a, vector unsigned char b) |
| 2659 | { |
| 2660 | return vec_perm(a, b, (vector unsigned char) |
| 2661 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2662 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2663 | } |
| 2664 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2665 | static vector bool char __ATTRS_o_ai |
| 2666 | vec_vmrglb(vector bool char a, vector bool char b) |
| 2667 | { |
| 2668 | return vec_perm(a, b, (vector unsigned char) |
| 2669 | (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, |
| 2670 | 0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F)); |
| 2671 | } |
| 2672 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2673 | /* vec_vmrglh */ |
| 2674 | |
| 2675 | #define __builtin_altivec_vmrglh vec_vmrglh |
| 2676 | |
| 2677 | static vector short __ATTRS_o_ai |
| 2678 | vec_vmrglh(vector short a, vector short b) |
| 2679 | { |
| 2680 | return vec_perm(a, b, (vector unsigned char) |
| 2681 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2682 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2683 | } |
| 2684 | |
| 2685 | static vector unsigned short __ATTRS_o_ai |
| 2686 | vec_vmrglh(vector unsigned short a, vector unsigned short b) |
| 2687 | { |
| 2688 | return vec_perm(a, b, (vector unsigned char) |
| 2689 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2690 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2691 | } |
| 2692 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2693 | static vector bool short __ATTRS_o_ai |
| 2694 | vec_vmrglh(vector bool short a, vector bool short b) |
| 2695 | { |
| 2696 | return vec_perm(a, b, (vector unsigned char) |
| 2697 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2698 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2699 | } |
| 2700 | |
| 2701 | static vector pixel __ATTRS_o_ai |
| 2702 | vec_vmrglh(vector pixel a, vector pixel b) |
| 2703 | { |
| 2704 | return vec_perm(a, b, (vector unsigned char) |
| 2705 | (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B, |
| 2706 | 0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F)); |
| 2707 | } |
| 2708 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2709 | /* vec_vmrglw */ |
| 2710 | |
| 2711 | #define __builtin_altivec_vmrglw vec_vmrglw |
| 2712 | |
| 2713 | static vector int __ATTRS_o_ai |
| 2714 | vec_vmrglw(vector int a, vector int b) |
| 2715 | { |
| 2716 | return vec_perm(a, b, (vector unsigned char) |
| 2717 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2718 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2719 | } |
| 2720 | |
| 2721 | static vector unsigned int __ATTRS_o_ai |
| 2722 | vec_vmrglw(vector unsigned int a, vector unsigned int b) |
| 2723 | { |
| 2724 | return vec_perm(a, b, (vector unsigned char) |
| 2725 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2726 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2727 | } |
| 2728 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 2729 | static vector bool int __ATTRS_o_ai |
| 2730 | vec_vmrglw(vector bool int a, vector bool int b) |
| 2731 | { |
| 2732 | return vec_perm(a, b, (vector unsigned char) |
| 2733 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2734 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2735 | } |
| 2736 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2737 | static vector float __ATTRS_o_ai |
| 2738 | vec_vmrglw(vector float a, vector float b) |
| 2739 | { |
| 2740 | return vec_perm(a, b, (vector unsigned char) |
| 2741 | (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, |
| 2742 | 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F)); |
| 2743 | } |
| 2744 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2745 | /* vec_mfvscr */ |
| 2746 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2747 | static vector unsigned short __attribute__((__always_inline__)) |
| 2748 | vec_mfvscr(void) |
| 2749 | { |
| 2750 | return __builtin_altivec_mfvscr(); |
| 2751 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2752 | |
| 2753 | /* vec_min */ |
| 2754 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2755 | static vector signed char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2756 | vec_min(vector signed char a, vector signed char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2757 | { |
| 2758 | return __builtin_altivec_vminsb(a, b); |
| 2759 | } |
| 2760 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2761 | static vector unsigned char __ATTRS_o_ai |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2762 | vec_min(vector unsigned char a, vector unsigned char b) |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2763 | { |
| 2764 | return __builtin_altivec_vminub(a, b); |
| 2765 | } |
| 2766 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2767 | static vector short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2768 | vec_min(vector short a, vector short b) |
| 2769 | { |
| 2770 | return __builtin_altivec_vminsh(a, b); |
| 2771 | } |
| 2772 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2773 | static vector unsigned short __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2774 | vec_min(vector unsigned short a, vector unsigned short b) |
| 2775 | { |
| 2776 | return __builtin_altivec_vminuh(a, b); |
| 2777 | } |
| 2778 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2779 | static vector int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2780 | vec_min(vector int a, vector int b) |
| 2781 | { |
| 2782 | return __builtin_altivec_vminsw(a, b); |
| 2783 | } |
| 2784 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2785 | static vector unsigned int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2786 | vec_min(vector unsigned int a, vector unsigned int b) |
| 2787 | { |
| 2788 | return __builtin_altivec_vminuw(a, b); |
| 2789 | } |
| 2790 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2791 | static vector float __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 2792 | vec_min(vector float a, vector float b) |
| 2793 | { |
| 2794 | return __builtin_altivec_vminfp(a, b); |
| 2795 | } |
| 2796 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2797 | /* vec_vminsb */ |
| 2798 | |
| 2799 | static vector signed char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2800 | vec_vminsb(vector signed char a, vector signed char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2801 | { |
| 2802 | return __builtin_altivec_vminsb(a, b); |
| 2803 | } |
| 2804 | |
| 2805 | /* vec_vminub */ |
| 2806 | |
| 2807 | static vector unsigned char __attribute__((__always_inline__)) |
Anton Yartsev | a816ec8 | 2010-08-12 18:51:55 +0000 | [diff] [blame] | 2808 | vec_vminub(vector unsigned char a, vector unsigned char b) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 2809 | { |
| 2810 | return __builtin_altivec_vminub(a, b); |
| 2811 | } |
| 2812 | |
| 2813 | /* vec_vminsh */ |
| 2814 | |
| 2815 | static vector short __attribute__((__always_inline__)) |
| 2816 | vec_vminsh(vector short a, vector short b) |
| 2817 | { |
| 2818 | return __builtin_altivec_vminsh(a, b); |
| 2819 | } |
| 2820 | |
| 2821 | /* vec_vminuh */ |
| 2822 | |
| 2823 | static vector unsigned short __attribute__((__always_inline__)) |
| 2824 | vec_vminuh(vector unsigned short a, vector unsigned short b) |
| 2825 | { |
| 2826 | return __builtin_altivec_vminuh(a, b); |
| 2827 | } |
| 2828 | |
| 2829 | /* vec_vminsw */ |
| 2830 | |
| 2831 | static vector int __attribute__((__always_inline__)) |
| 2832 | vec_vminsw(vector int a, vector int b) |
| 2833 | { |
| 2834 | return __builtin_altivec_vminsw(a, b); |
| 2835 | } |
| 2836 | |
| 2837 | /* vec_vminuw */ |
| 2838 | |
| 2839 | static vector unsigned int __attribute__((__always_inline__)) |
| 2840 | vec_vminuw(vector unsigned int a, vector unsigned int b) |
| 2841 | { |
| 2842 | return __builtin_altivec_vminuw(a, b); |
| 2843 | } |
| 2844 | |
| 2845 | /* vec_vminfp */ |
| 2846 | |
| 2847 | static vector float __attribute__((__always_inline__)) |
| 2848 | vec_vminfp(vector float a, vector float b) |
| 2849 | { |
| 2850 | return __builtin_altivec_vminfp(a, b); |
| 2851 | } |
| 2852 | |
| 2853 | /* vec_mladd */ |
| 2854 | |
| 2855 | #define __builtin_altivec_vmladduhm vec_mladd |
| 2856 | |
| 2857 | static vector short __ATTRS_o_ai |
| 2858 | vec_mladd(vector short a, vector short b, vector short c) |
| 2859 | { |
| 2860 | return a * b + c; |
| 2861 | } |
| 2862 | |
| 2863 | static vector short __ATTRS_o_ai |
| 2864 | vec_mladd(vector short a, vector unsigned short b, vector unsigned short c) |
| 2865 | { |
| 2866 | return a * (vector short)b + (vector short)c; |
| 2867 | } |
| 2868 | |
| 2869 | static vector short __ATTRS_o_ai |
| 2870 | vec_mladd(vector unsigned short a, vector short b, vector short c) |
| 2871 | { |
| 2872 | return (vector short)a * b + c; |
| 2873 | } |
| 2874 | |
| 2875 | static vector unsigned short __ATTRS_o_ai |
| 2876 | vec_mladd(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 2877 | { |
| 2878 | return a * b + c; |
| 2879 | } |
| 2880 | |
| 2881 | /* vec_vmladduhm */ |
| 2882 | |
| 2883 | static vector short __ATTRS_o_ai |
| 2884 | vec_vmladduhm(vector short a, vector short b, vector short c) |
| 2885 | { |
| 2886 | return a * b + c; |
| 2887 | } |
| 2888 | |
| 2889 | static vector short __ATTRS_o_ai |
| 2890 | vec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c) |
| 2891 | { |
| 2892 | return a * (vector short)b + (vector short)c; |
| 2893 | } |
| 2894 | |
| 2895 | static vector short __ATTRS_o_ai |
| 2896 | vec_vmladduhm(vector unsigned short a, vector short b, vector short c) |
| 2897 | { |
| 2898 | return (vector short)a * b + c; |
| 2899 | } |
| 2900 | |
| 2901 | static vector unsigned short __ATTRS_o_ai |
| 2902 | vec_vmladduhm(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 2903 | { |
| 2904 | return a * b + c; |
| 2905 | } |
| 2906 | |
| 2907 | /* vec_mradds */ |
| 2908 | |
| 2909 | static vector short __attribute__((__always_inline__)) |
| 2910 | vec_mradds(vector short a, vector short b, vector short c) |
| 2911 | { |
| 2912 | return __builtin_altivec_vmhraddshs(a, b, c); |
| 2913 | } |
| 2914 | |
| 2915 | /* vec_vmhraddshs */ |
| 2916 | |
| 2917 | static vector short __attribute__((__always_inline__)) |
| 2918 | vec_vmhraddshs(vector short a, vector short b, vector short c) |
| 2919 | { |
| 2920 | return __builtin_altivec_vmhraddshs(a, b, c); |
| 2921 | } |
| 2922 | |
| 2923 | /* vec_msum */ |
| 2924 | |
| 2925 | static vector int __ATTRS_o_ai |
| 2926 | vec_msum(vector signed char a, vector unsigned char b, vector int c) |
| 2927 | { |
| 2928 | return __builtin_altivec_vmsummbm(a, b, c); |
| 2929 | } |
| 2930 | |
| 2931 | static vector unsigned int __ATTRS_o_ai |
| 2932 | vec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c) |
| 2933 | { |
| 2934 | return __builtin_altivec_vmsumubm(a, b, c); |
| 2935 | } |
| 2936 | |
| 2937 | static vector int __ATTRS_o_ai |
| 2938 | vec_msum(vector short a, vector short b, vector int c) |
| 2939 | { |
| 2940 | return __builtin_altivec_vmsumshm(a, b, c); |
| 2941 | } |
| 2942 | |
| 2943 | static vector unsigned int __ATTRS_o_ai |
| 2944 | vec_msum(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2945 | { |
| 2946 | return __builtin_altivec_vmsumuhm(a, b, c); |
| 2947 | } |
| 2948 | |
| 2949 | /* vec_vmsummbm */ |
| 2950 | |
| 2951 | static vector int __attribute__((__always_inline__)) |
| 2952 | vec_vmsummbm(vector signed char a, vector unsigned char b, vector int c) |
| 2953 | { |
| 2954 | return __builtin_altivec_vmsummbm(a, b, c); |
| 2955 | } |
| 2956 | |
| 2957 | /* vec_vmsumubm */ |
| 2958 | |
| 2959 | static vector unsigned int __attribute__((__always_inline__)) |
| 2960 | vec_vmsumubm(vector unsigned char a, vector unsigned char b, vector unsigned int c) |
| 2961 | { |
| 2962 | return __builtin_altivec_vmsumubm(a, b, c); |
| 2963 | } |
| 2964 | |
| 2965 | /* vec_vmsumshm */ |
| 2966 | |
| 2967 | static vector int __attribute__((__always_inline__)) |
| 2968 | vec_vmsumshm(vector short a, vector short b, vector int c) |
| 2969 | { |
| 2970 | return __builtin_altivec_vmsumshm(a, b, c); |
| 2971 | } |
| 2972 | |
| 2973 | /* vec_vmsumuhm */ |
| 2974 | |
| 2975 | static vector unsigned int __attribute__((__always_inline__)) |
| 2976 | vec_vmsumuhm(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2977 | { |
| 2978 | return __builtin_altivec_vmsumuhm(a, b, c); |
| 2979 | } |
| 2980 | |
| 2981 | /* vec_msums */ |
| 2982 | |
| 2983 | static vector int __ATTRS_o_ai |
| 2984 | vec_msums(vector short a, vector short b, vector int c) |
| 2985 | { |
| 2986 | return __builtin_altivec_vmsumshs(a, b, c); |
| 2987 | } |
| 2988 | |
| 2989 | static vector unsigned int __ATTRS_o_ai |
| 2990 | vec_msums(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 2991 | { |
| 2992 | return __builtin_altivec_vmsumuhs(a, b, c); |
| 2993 | } |
| 2994 | |
| 2995 | /* vec_vmsumshs */ |
| 2996 | |
| 2997 | static vector int __attribute__((__always_inline__)) |
| 2998 | vec_vmsumshs(vector short a, vector short b, vector int c) |
| 2999 | { |
| 3000 | return __builtin_altivec_vmsumshs(a, b, c); |
| 3001 | } |
| 3002 | |
| 3003 | /* vec_vmsumuhs */ |
| 3004 | |
| 3005 | static vector unsigned int __attribute__((__always_inline__)) |
| 3006 | vec_vmsumuhs(vector unsigned short a, vector unsigned short b, vector unsigned int c) |
| 3007 | { |
| 3008 | return __builtin_altivec_vmsumuhs(a, b, c); |
| 3009 | } |
| 3010 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 3011 | /* vec_mtvscr */ |
| 3012 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3013 | static void __ATTRS_o_ai |
| 3014 | vec_mtvscr(vector signed char a) |
| 3015 | { |
| 3016 | __builtin_altivec_mtvscr((vector int)a); |
| 3017 | } |
| 3018 | |
| 3019 | static void __ATTRS_o_ai |
| 3020 | vec_mtvscr(vector unsigned char a) |
| 3021 | { |
| 3022 | __builtin_altivec_mtvscr((vector int)a); |
| 3023 | } |
| 3024 | |
| 3025 | static void __ATTRS_o_ai |
| 3026 | vec_mtvscr(vector short a) |
| 3027 | { |
| 3028 | __builtin_altivec_mtvscr((vector int)a); |
| 3029 | } |
| 3030 | |
| 3031 | static void __ATTRS_o_ai |
| 3032 | vec_mtvscr(vector unsigned short a) |
| 3033 | { |
| 3034 | __builtin_altivec_mtvscr((vector int)a); |
| 3035 | } |
| 3036 | |
| 3037 | static void __ATTRS_o_ai |
| 3038 | vec_mtvscr(vector int a) |
| 3039 | { |
| 3040 | __builtin_altivec_mtvscr((vector int)a); |
| 3041 | } |
| 3042 | |
| 3043 | static void __ATTRS_o_ai |
| 3044 | vec_mtvscr(vector unsigned int a) |
| 3045 | { |
| 3046 | __builtin_altivec_mtvscr((vector int)a); |
| 3047 | } |
| 3048 | |
| 3049 | static void __ATTRS_o_ai |
| 3050 | vec_mtvscr(vector float a) |
| 3051 | { |
| 3052 | __builtin_altivec_mtvscr((vector int)a); |
| 3053 | } |
| 3054 | |
| 3055 | /* vec_mule */ |
| 3056 | |
| 3057 | static vector short __ATTRS_o_ai |
| 3058 | vec_mule(vector signed char a, vector signed char b) |
| 3059 | { |
| 3060 | return __builtin_altivec_vmulesb(a, b); |
| 3061 | } |
| 3062 | |
| 3063 | static vector unsigned short __ATTRS_o_ai |
| 3064 | vec_mule(vector unsigned char a, vector unsigned char b) |
| 3065 | { |
| 3066 | return __builtin_altivec_vmuleub(a, b); |
| 3067 | } |
| 3068 | |
| 3069 | static vector int __ATTRS_o_ai |
| 3070 | vec_mule(vector short a, vector short b) |
| 3071 | { |
| 3072 | return __builtin_altivec_vmulesh(a, b); |
| 3073 | } |
| 3074 | |
| 3075 | static vector unsigned int __ATTRS_o_ai |
| 3076 | vec_mule(vector unsigned short a, vector unsigned short b) |
| 3077 | { |
| 3078 | return __builtin_altivec_vmuleuh(a, b); |
| 3079 | } |
| 3080 | |
| 3081 | /* vec_vmulesb */ |
| 3082 | |
| 3083 | static vector short __attribute__((__always_inline__)) |
| 3084 | vec_vmulesb(vector signed char a, vector signed char b) |
| 3085 | { |
| 3086 | return __builtin_altivec_vmulesb(a, b); |
| 3087 | } |
| 3088 | |
| 3089 | /* vec_vmuleub */ |
| 3090 | |
| 3091 | static vector unsigned short __attribute__((__always_inline__)) |
| 3092 | vec_vmuleub(vector unsigned char a, vector unsigned char b) |
| 3093 | { |
| 3094 | return __builtin_altivec_vmuleub(a, b); |
| 3095 | } |
| 3096 | |
| 3097 | /* vec_vmulesh */ |
| 3098 | |
| 3099 | static vector int __attribute__((__always_inline__)) |
| 3100 | vec_vmulesh(vector short a, vector short b) |
| 3101 | { |
| 3102 | return __builtin_altivec_vmulesh(a, b); |
| 3103 | } |
| 3104 | |
| 3105 | /* vec_vmuleuh */ |
| 3106 | |
| 3107 | static vector unsigned int __attribute__((__always_inline__)) |
| 3108 | vec_vmuleuh(vector unsigned short a, vector unsigned short b) |
| 3109 | { |
| 3110 | return __builtin_altivec_vmuleuh(a, b); |
| 3111 | } |
| 3112 | |
| 3113 | /* vec_mulo */ |
| 3114 | |
| 3115 | static vector short __ATTRS_o_ai |
| 3116 | vec_mulo(vector signed char a, vector signed char b) |
| 3117 | { |
| 3118 | return __builtin_altivec_vmulosb(a, b); |
| 3119 | } |
| 3120 | |
| 3121 | static vector unsigned short __ATTRS_o_ai |
| 3122 | vec_mulo(vector unsigned char a, vector unsigned char b) |
| 3123 | { |
| 3124 | return __builtin_altivec_vmuloub(a, b); |
| 3125 | } |
| 3126 | |
| 3127 | static vector int __ATTRS_o_ai |
| 3128 | vec_mulo(vector short a, vector short b) |
| 3129 | { |
| 3130 | return __builtin_altivec_vmulosh(a, b); |
| 3131 | } |
| 3132 | |
| 3133 | static vector unsigned int __ATTRS_o_ai |
| 3134 | vec_mulo(vector unsigned short a, vector unsigned short b) |
| 3135 | { |
| 3136 | return __builtin_altivec_vmulouh(a, b); |
| 3137 | } |
| 3138 | |
| 3139 | /* vec_vmulosb */ |
| 3140 | |
| 3141 | static vector short __attribute__((__always_inline__)) |
| 3142 | vec_vmulosb(vector signed char a, vector signed char b) |
| 3143 | { |
| 3144 | return __builtin_altivec_vmulosb(a, b); |
| 3145 | } |
| 3146 | |
| 3147 | /* vec_vmuloub */ |
| 3148 | |
| 3149 | static vector unsigned short __attribute__((__always_inline__)) |
| 3150 | vec_vmuloub(vector unsigned char a, vector unsigned char b) |
| 3151 | { |
| 3152 | return __builtin_altivec_vmuloub(a, b); |
| 3153 | } |
| 3154 | |
| 3155 | /* vec_vmulosh */ |
| 3156 | |
| 3157 | static vector int __attribute__((__always_inline__)) |
| 3158 | vec_vmulosh(vector short a, vector short b) |
| 3159 | { |
| 3160 | return __builtin_altivec_vmulosh(a, b); |
| 3161 | } |
| 3162 | |
| 3163 | /* vec_vmulouh */ |
| 3164 | |
| 3165 | static vector unsigned int __attribute__((__always_inline__)) |
| 3166 | vec_vmulouh(vector unsigned short a, vector unsigned short b) |
| 3167 | { |
| 3168 | return __builtin_altivec_vmulouh(a, b); |
| 3169 | } |
| 3170 | |
| 3171 | /* vec_nmsub */ |
| 3172 | |
| 3173 | static vector float __attribute__((__always_inline__)) |
| 3174 | vec_nmsub(vector float a, vector float b, vector float c) |
| 3175 | { |
| 3176 | return __builtin_altivec_vnmsubfp(a, b, c); |
| 3177 | } |
| 3178 | |
| 3179 | /* vec_vnmsubfp */ |
| 3180 | |
| 3181 | static vector float __attribute__((__always_inline__)) |
| 3182 | vec_vnmsubfp(vector float a, vector float b, vector float c) |
| 3183 | { |
| 3184 | return __builtin_altivec_vnmsubfp(a, b, c); |
| 3185 | } |
| 3186 | |
| 3187 | /* vec_nor */ |
| 3188 | |
| 3189 | #define __builtin_altivec_vnor vec_nor |
| 3190 | |
| 3191 | static vector signed char __ATTRS_o_ai |
| 3192 | vec_nor(vector signed char a, vector signed char b) |
| 3193 | { |
| 3194 | return ~(a | b); |
| 3195 | } |
| 3196 | |
| 3197 | static vector unsigned char __ATTRS_o_ai |
| 3198 | vec_nor(vector unsigned char a, vector unsigned char b) |
| 3199 | { |
| 3200 | return ~(a | b); |
| 3201 | } |
| 3202 | |
| 3203 | static vector short __ATTRS_o_ai |
| 3204 | vec_nor(vector short a, vector short b) |
| 3205 | { |
| 3206 | return ~(a | b); |
| 3207 | } |
| 3208 | |
| 3209 | static vector unsigned short __ATTRS_o_ai |
| 3210 | vec_nor(vector unsigned short a, vector unsigned short b) |
| 3211 | { |
| 3212 | return ~(a | b); |
| 3213 | } |
| 3214 | |
| 3215 | static vector int __ATTRS_o_ai |
| 3216 | vec_nor(vector int a, vector int b) |
| 3217 | { |
| 3218 | return ~(a | b); |
| 3219 | } |
| 3220 | |
| 3221 | static vector unsigned int __ATTRS_o_ai |
| 3222 | vec_nor(vector unsigned int a, vector unsigned int b) |
| 3223 | { |
| 3224 | return ~(a | b); |
| 3225 | } |
| 3226 | |
| 3227 | static vector float __ATTRS_o_ai |
| 3228 | vec_nor(vector float a, vector float b) |
| 3229 | { |
| 3230 | vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b); |
| 3231 | return (vector float)res; |
| 3232 | } |
| 3233 | |
| 3234 | /* vec_vnor */ |
| 3235 | |
| 3236 | static vector signed char __ATTRS_o_ai |
| 3237 | vec_vnor(vector signed char a, vector signed char b) |
| 3238 | { |
| 3239 | return ~(a | b); |
| 3240 | } |
| 3241 | |
| 3242 | static vector unsigned char __ATTRS_o_ai |
| 3243 | vec_vnor(vector unsigned char a, vector unsigned char b) |
| 3244 | { |
| 3245 | return ~(a | b); |
| 3246 | } |
| 3247 | |
| 3248 | static vector short __ATTRS_o_ai |
| 3249 | vec_vnor(vector short a, vector short b) |
| 3250 | { |
| 3251 | return ~(a | b); |
| 3252 | } |
| 3253 | |
| 3254 | static vector unsigned short __ATTRS_o_ai |
| 3255 | vec_vnor(vector unsigned short a, vector unsigned short b) |
| 3256 | { |
| 3257 | return ~(a | b); |
| 3258 | } |
| 3259 | |
| 3260 | static vector int __ATTRS_o_ai |
| 3261 | vec_vnor(vector int a, vector int b) |
| 3262 | { |
| 3263 | return ~(a | b); |
| 3264 | } |
| 3265 | |
| 3266 | static vector unsigned int __ATTRS_o_ai |
| 3267 | vec_vnor(vector unsigned int a, vector unsigned int b) |
| 3268 | { |
| 3269 | return ~(a | b); |
| 3270 | } |
| 3271 | |
| 3272 | static vector float __ATTRS_o_ai |
| 3273 | vec_vnor(vector float a, vector float b) |
| 3274 | { |
| 3275 | vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b); |
| 3276 | return (vector float)res; |
| 3277 | } |
| 3278 | |
| 3279 | /* vec_or */ |
| 3280 | |
| 3281 | #define __builtin_altivec_vor vec_or |
| 3282 | |
| 3283 | static vector signed char __ATTRS_o_ai |
| 3284 | vec_or(vector signed char a, vector signed char b) |
| 3285 | { |
| 3286 | return a | b; |
| 3287 | } |
| 3288 | |
| 3289 | static vector unsigned char __ATTRS_o_ai |
| 3290 | vec_or(vector unsigned char a, vector unsigned char b) |
| 3291 | { |
| 3292 | return a | b; |
| 3293 | } |
| 3294 | |
| 3295 | static vector short __ATTRS_o_ai |
| 3296 | vec_or(vector short a, vector short b) |
| 3297 | { |
| 3298 | return a | b; |
| 3299 | } |
| 3300 | |
| 3301 | static vector unsigned short __ATTRS_o_ai |
| 3302 | vec_or(vector unsigned short a, vector unsigned short b) |
| 3303 | { |
| 3304 | return a | b; |
| 3305 | } |
| 3306 | |
| 3307 | static vector int __ATTRS_o_ai |
| 3308 | vec_or(vector int a, vector int b) |
| 3309 | { |
| 3310 | return a | b; |
| 3311 | } |
| 3312 | |
| 3313 | static vector unsigned int __ATTRS_o_ai |
| 3314 | vec_or(vector unsigned int a, vector unsigned int b) |
| 3315 | { |
| 3316 | return a | b; |
| 3317 | } |
| 3318 | |
| 3319 | static vector float __ATTRS_o_ai |
| 3320 | vec_or(vector float a, vector float b) |
| 3321 | { |
| 3322 | vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b; |
| 3323 | return (vector float)res; |
| 3324 | } |
| 3325 | |
| 3326 | /* vec_vor */ |
| 3327 | |
| 3328 | static vector signed char __ATTRS_o_ai |
| 3329 | vec_vor(vector signed char a, vector signed char b) |
| 3330 | { |
| 3331 | return a | b; |
| 3332 | } |
| 3333 | |
| 3334 | static vector unsigned char __ATTRS_o_ai |
| 3335 | vec_vor(vector unsigned char a, vector unsigned char b) |
| 3336 | { |
| 3337 | return a | b; |
| 3338 | } |
| 3339 | |
| 3340 | static vector short __ATTRS_o_ai |
| 3341 | vec_vor(vector short a, vector short b) |
| 3342 | { |
| 3343 | return a | b; |
| 3344 | } |
| 3345 | |
| 3346 | static vector unsigned short __ATTRS_o_ai |
| 3347 | vec_vor(vector unsigned short a, vector unsigned short b) |
| 3348 | { |
| 3349 | return a | b; |
| 3350 | } |
| 3351 | |
| 3352 | static vector int __ATTRS_o_ai |
| 3353 | vec_vor(vector int a, vector int b) |
| 3354 | { |
| 3355 | return a | b; |
| 3356 | } |
| 3357 | |
| 3358 | static vector unsigned int __ATTRS_o_ai |
| 3359 | vec_vor(vector unsigned int a, vector unsigned int b) |
| 3360 | { |
| 3361 | return a | b; |
| 3362 | } |
| 3363 | |
| 3364 | static vector float __ATTRS_o_ai |
| 3365 | vec_vor(vector float a, vector float b) |
| 3366 | { |
| 3367 | vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b; |
| 3368 | return (vector float)res; |
| 3369 | } |
| 3370 | |
| 3371 | /* vec_pack */ |
| 3372 | |
| 3373 | static vector signed char __ATTRS_o_ai |
| 3374 | vec_pack(vector signed short a, vector signed short b) |
| 3375 | { |
| 3376 | return (vector signed char)vec_perm(a, b, (vector unsigned char) |
| 3377 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3378 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3379 | } |
| 3380 | |
| 3381 | static vector unsigned char __ATTRS_o_ai |
| 3382 | vec_pack(vector unsigned short a, vector unsigned short b) |
| 3383 | { |
| 3384 | return (vector unsigned char)vec_perm(a, b, (vector unsigned char) |
| 3385 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3386 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3387 | } |
| 3388 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3389 | static vector bool char __ATTRS_o_ai |
| 3390 | vec_pack(vector bool short a, vector bool short b) |
| 3391 | { |
| 3392 | return (vector bool char)vec_perm(a, b, (vector unsigned char) |
| 3393 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3394 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3395 | } |
| 3396 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3397 | static vector short __ATTRS_o_ai |
| 3398 | vec_pack(vector int a, vector int b) |
| 3399 | { |
| 3400 | return (vector short)vec_perm(a, b, (vector unsigned char) |
| 3401 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3402 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3403 | } |
| 3404 | |
| 3405 | static vector unsigned short __ATTRS_o_ai |
| 3406 | vec_pack(vector unsigned int a, vector unsigned int b) |
| 3407 | { |
| 3408 | return (vector unsigned short)vec_perm(a, b, (vector unsigned char) |
| 3409 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3410 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3411 | } |
| 3412 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3413 | static vector bool short __ATTRS_o_ai |
| 3414 | vec_pack(vector bool int a, vector bool int b) |
| 3415 | { |
| 3416 | return (vector bool short)vec_perm(a, b, (vector unsigned char) |
| 3417 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3418 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3419 | } |
| 3420 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3421 | /* vec_vpkuhum */ |
| 3422 | |
| 3423 | #define __builtin_altivec_vpkuhum vec_vpkuhum |
| 3424 | |
| 3425 | static vector signed char __ATTRS_o_ai |
| 3426 | vec_vpkuhum(vector signed short a, vector signed short b) |
| 3427 | { |
| 3428 | return (vector signed char)vec_perm(a, b, (vector unsigned char) |
| 3429 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3430 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3431 | } |
| 3432 | |
| 3433 | static vector unsigned char __ATTRS_o_ai |
| 3434 | vec_vpkuhum(vector unsigned short a, vector unsigned short b) |
| 3435 | { |
| 3436 | return (vector unsigned char)vec_perm(a, b, (vector unsigned char) |
| 3437 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3438 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3439 | } |
| 3440 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3441 | static vector bool char __ATTRS_o_ai |
| 3442 | vec_vpkuhum(vector bool short a, vector bool short b) |
| 3443 | { |
| 3444 | return (vector bool char)vec_perm(a, b, (vector unsigned char) |
| 3445 | (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, |
| 3446 | 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); |
| 3447 | } |
| 3448 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3449 | /* vec_vpkuwum */ |
| 3450 | |
| 3451 | #define __builtin_altivec_vpkuwum vec_vpkuwum |
| 3452 | |
| 3453 | static vector short __ATTRS_o_ai |
| 3454 | vec_vpkuwum(vector int a, vector int b) |
| 3455 | { |
| 3456 | return (vector short)vec_perm(a, b, (vector unsigned char) |
| 3457 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3458 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3459 | } |
| 3460 | |
| 3461 | static vector unsigned short __ATTRS_o_ai |
| 3462 | vec_vpkuwum(vector unsigned int a, vector unsigned int b) |
| 3463 | { |
| 3464 | return (vector unsigned short)vec_perm(a, b, (vector unsigned char) |
| 3465 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3466 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3467 | } |
| 3468 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3469 | static vector bool short __ATTRS_o_ai |
| 3470 | vec_vpkuwum(vector bool int a, vector bool int b) |
| 3471 | { |
| 3472 | return (vector bool short)vec_perm(a, b, (vector unsigned char) |
| 3473 | (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, |
| 3474 | 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); |
| 3475 | } |
| 3476 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3477 | /* vec_packpx */ |
| 3478 | |
| 3479 | static vector pixel __attribute__((__always_inline__)) |
| 3480 | vec_packpx(vector unsigned int a, vector unsigned int b) |
| 3481 | { |
| 3482 | return (vector pixel)__builtin_altivec_vpkpx(a, b); |
| 3483 | } |
| 3484 | |
| 3485 | /* vec_vpkpx */ |
| 3486 | |
| 3487 | static vector pixel __attribute__((__always_inline__)) |
| 3488 | vec_vpkpx(vector unsigned int a, vector unsigned int b) |
| 3489 | { |
| 3490 | return (vector pixel)__builtin_altivec_vpkpx(a, b); |
| 3491 | } |
| 3492 | |
| 3493 | /* vec_packs */ |
| 3494 | |
| 3495 | static vector signed char __ATTRS_o_ai |
| 3496 | vec_packs(vector short a, vector short b) |
| 3497 | { |
| 3498 | return __builtin_altivec_vpkshss(a, b); |
| 3499 | } |
| 3500 | |
| 3501 | static vector unsigned char __ATTRS_o_ai |
| 3502 | vec_packs(vector unsigned short a, vector unsigned short b) |
| 3503 | { |
| 3504 | return __builtin_altivec_vpkuhus(a, b); |
| 3505 | } |
| 3506 | |
| 3507 | static vector signed short __ATTRS_o_ai |
| 3508 | vec_packs(vector int a, vector int b) |
| 3509 | { |
| 3510 | return __builtin_altivec_vpkswss(a, b); |
| 3511 | } |
| 3512 | |
| 3513 | static vector unsigned short __ATTRS_o_ai |
| 3514 | vec_packs(vector unsigned int a, vector unsigned int b) |
| 3515 | { |
| 3516 | return __builtin_altivec_vpkuwus(a, b); |
| 3517 | } |
| 3518 | |
| 3519 | /* vec_vpkshss */ |
| 3520 | |
| 3521 | static vector signed char __attribute__((__always_inline__)) |
| 3522 | vec_vpkshss(vector short a, vector short b) |
| 3523 | { |
| 3524 | return __builtin_altivec_vpkshss(a, b); |
| 3525 | } |
| 3526 | |
| 3527 | /* vec_vpkuhus */ |
| 3528 | |
| 3529 | static vector unsigned char __attribute__((__always_inline__)) |
| 3530 | vec_vpkuhus(vector unsigned short a, vector unsigned short b) |
| 3531 | { |
| 3532 | return __builtin_altivec_vpkuhus(a, b); |
| 3533 | } |
| 3534 | |
| 3535 | /* vec_vpkswss */ |
| 3536 | |
| 3537 | static vector signed short __attribute__((__always_inline__)) |
| 3538 | vec_vpkswss(vector int a, vector int b) |
| 3539 | { |
| 3540 | return __builtin_altivec_vpkswss(a, b); |
| 3541 | } |
| 3542 | |
| 3543 | /* vec_vpkuwus */ |
| 3544 | |
| 3545 | static vector unsigned short __attribute__((__always_inline__)) |
| 3546 | vec_vpkuwus(vector unsigned int a, vector unsigned int b) |
| 3547 | { |
| 3548 | return __builtin_altivec_vpkuwus(a, b); |
| 3549 | } |
| 3550 | |
| 3551 | /* vec_packsu */ |
| 3552 | |
| 3553 | static vector unsigned char __ATTRS_o_ai |
| 3554 | vec_packsu(vector short a, vector short b) |
| 3555 | { |
| 3556 | return __builtin_altivec_vpkshus(a, b); |
| 3557 | } |
| 3558 | |
| 3559 | static vector unsigned char __ATTRS_o_ai |
| 3560 | vec_packsu(vector unsigned short a, vector unsigned short b) |
| 3561 | { |
| 3562 | return __builtin_altivec_vpkuhus(a, b); |
| 3563 | } |
| 3564 | |
| 3565 | static vector unsigned short __ATTRS_o_ai |
| 3566 | vec_packsu(vector int a, vector int b) |
| 3567 | { |
| 3568 | return __builtin_altivec_vpkswus(a, b); |
| 3569 | } |
| 3570 | |
| 3571 | static vector unsigned short __ATTRS_o_ai |
| 3572 | vec_packsu(vector unsigned int a, vector unsigned int b) |
| 3573 | { |
| 3574 | return __builtin_altivec_vpkuwus(a, b); |
| 3575 | } |
| 3576 | |
| 3577 | /* vec_vpkshus */ |
| 3578 | |
| 3579 | static vector unsigned char __ATTRS_o_ai |
| 3580 | vec_vpkshus(vector short a, vector short b) |
| 3581 | { |
| 3582 | return __builtin_altivec_vpkshus(a, b); |
| 3583 | } |
| 3584 | |
| 3585 | static vector unsigned char __ATTRS_o_ai |
| 3586 | vec_vpkshus(vector unsigned short a, vector unsigned short b) |
| 3587 | { |
| 3588 | return __builtin_altivec_vpkuhus(a, b); |
| 3589 | } |
| 3590 | |
| 3591 | /* vec_vpkswus */ |
| 3592 | |
| 3593 | static vector unsigned short __ATTRS_o_ai |
| 3594 | vec_vpkswus(vector int a, vector int b) |
| 3595 | { |
| 3596 | return __builtin_altivec_vpkswus(a, b); |
| 3597 | } |
| 3598 | |
| 3599 | static vector unsigned short __ATTRS_o_ai |
| 3600 | vec_vpkswus(vector unsigned int a, vector unsigned int b) |
| 3601 | { |
| 3602 | return __builtin_altivec_vpkuwus(a, b); |
| 3603 | } |
| 3604 | |
| 3605 | /* vec_perm */ |
| 3606 | |
| 3607 | vector signed char __ATTRS_o_ai |
| 3608 | vec_perm(vector signed char a, vector signed char b, vector unsigned char c) |
| 3609 | { |
| 3610 | return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3611 | } |
| 3612 | |
| 3613 | vector unsigned char __ATTRS_o_ai |
| 3614 | vec_perm(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3615 | { |
| 3616 | return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3617 | } |
| 3618 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3619 | vector bool char __ATTRS_o_ai |
| 3620 | vec_perm(vector bool char a, vector bool char b, vector unsigned char c) |
| 3621 | { |
| 3622 | return (vector bool char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3623 | } |
| 3624 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3625 | vector short __ATTRS_o_ai |
| 3626 | vec_perm(vector short a, vector short b, vector unsigned char c) |
| 3627 | { |
| 3628 | return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3629 | } |
| 3630 | |
| 3631 | vector unsigned short __ATTRS_o_ai |
| 3632 | vec_perm(vector unsigned short a, vector unsigned short b, vector unsigned char c) |
| 3633 | { |
| 3634 | return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3635 | } |
| 3636 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3637 | vector bool short __ATTRS_o_ai |
| 3638 | vec_perm(vector bool short a, vector bool short b, vector unsigned char c) |
| 3639 | { |
| 3640 | return (vector bool short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3641 | } |
| 3642 | |
| 3643 | vector pixel __ATTRS_o_ai |
| 3644 | vec_perm(vector pixel a, vector pixel b, vector unsigned char c) |
| 3645 | { |
| 3646 | return (vector pixel)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3647 | } |
| 3648 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3649 | vector int __ATTRS_o_ai |
| 3650 | vec_perm(vector int a, vector int b, vector unsigned char c) |
| 3651 | { |
| 3652 | return (vector int)__builtin_altivec_vperm_4si(a, b, c); |
| 3653 | } |
| 3654 | |
| 3655 | vector unsigned int __ATTRS_o_ai |
| 3656 | vec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c) |
| 3657 | { |
| 3658 | return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3659 | } |
| 3660 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3661 | vector bool int __ATTRS_o_ai |
| 3662 | vec_perm(vector bool int a, vector bool int b, vector unsigned char c) |
| 3663 | { |
| 3664 | return (vector bool int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3665 | } |
| 3666 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3667 | vector float __ATTRS_o_ai |
| 3668 | vec_perm(vector float a, vector float b, vector unsigned char c) |
| 3669 | { |
| 3670 | return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3671 | } |
| 3672 | |
| 3673 | /* vec_vperm */ |
| 3674 | |
| 3675 | vector signed char __ATTRS_o_ai |
| 3676 | vec_vperm(vector signed char a, vector signed char b, vector unsigned char c) |
| 3677 | { |
| 3678 | return (vector signed char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3679 | } |
| 3680 | |
| 3681 | vector unsigned char __ATTRS_o_ai |
| 3682 | vec_vperm(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3683 | { |
| 3684 | return (vector unsigned char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3685 | } |
| 3686 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3687 | vector bool char __ATTRS_o_ai |
| 3688 | vec_vperm(vector bool char a, vector bool char b, vector unsigned char c) |
| 3689 | { |
| 3690 | return (vector bool char)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3691 | } |
| 3692 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3693 | vector short __ATTRS_o_ai |
| 3694 | vec_vperm(vector short a, vector short b, vector unsigned char c) |
| 3695 | { |
| 3696 | return (vector short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3697 | } |
| 3698 | |
| 3699 | vector unsigned short __ATTRS_o_ai |
| 3700 | vec_vperm(vector unsigned short a, vector unsigned short b, vector unsigned char c) |
| 3701 | { |
| 3702 | return (vector unsigned short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3703 | } |
| 3704 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3705 | vector bool short __ATTRS_o_ai |
| 3706 | vec_vperm(vector bool short a, vector bool short b, vector unsigned char c) |
| 3707 | { |
| 3708 | return (vector bool short)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3709 | } |
| 3710 | |
| 3711 | vector pixel __ATTRS_o_ai |
| 3712 | vec_vperm(vector pixel a, vector pixel b, vector unsigned char c) |
| 3713 | { |
| 3714 | return (vector pixel)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3715 | } |
| 3716 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3717 | vector int __ATTRS_o_ai |
| 3718 | vec_vperm(vector int a, vector int b, vector unsigned char c) |
| 3719 | { |
| 3720 | return (vector int)__builtin_altivec_vperm_4si(a, b, c); |
| 3721 | } |
| 3722 | |
| 3723 | vector unsigned int __ATTRS_o_ai |
| 3724 | vec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c) |
| 3725 | { |
| 3726 | return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3727 | } |
| 3728 | |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 3729 | vector bool int __ATTRS_o_ai |
| 3730 | vec_vperm(vector bool int a, vector bool int b, vector unsigned char c) |
| 3731 | { |
| 3732 | return (vector bool int)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3733 | } |
| 3734 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 3735 | vector float __ATTRS_o_ai |
| 3736 | vec_vperm(vector float a, vector float b, vector unsigned char c) |
| 3737 | { |
| 3738 | return (vector float)__builtin_altivec_vperm_4si((vector int)a, (vector int)b, c); |
| 3739 | } |
| 3740 | |
| 3741 | /* vec_re */ |
| 3742 | |
| 3743 | vector float __attribute__((__always_inline__)) |
| 3744 | vec_re(vector float a) |
| 3745 | { |
| 3746 | return __builtin_altivec_vrefp(a); |
| 3747 | } |
| 3748 | |
| 3749 | /* vec_vrefp */ |
| 3750 | |
| 3751 | vector float __attribute__((__always_inline__)) |
| 3752 | vec_vrefp(vector float a) |
| 3753 | { |
| 3754 | return __builtin_altivec_vrefp(a); |
| 3755 | } |
| 3756 | |
| 3757 | /* vec_rl */ |
| 3758 | |
| 3759 | static vector signed char __ATTRS_o_ai |
| 3760 | vec_rl(vector signed char a, vector unsigned char b) |
| 3761 | { |
| 3762 | return (vector signed char)__builtin_altivec_vrlb((vector char)a, b); |
| 3763 | } |
| 3764 | |
| 3765 | static vector unsigned char __ATTRS_o_ai |
| 3766 | vec_rl(vector unsigned char a, vector unsigned char b) |
| 3767 | { |
| 3768 | return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b); |
| 3769 | } |
| 3770 | |
| 3771 | static vector short __ATTRS_o_ai |
| 3772 | vec_rl(vector short a, vector unsigned short b) |
| 3773 | { |
| 3774 | return __builtin_altivec_vrlh(a, b); |
| 3775 | } |
| 3776 | |
| 3777 | static vector unsigned short __ATTRS_o_ai |
| 3778 | vec_rl(vector unsigned short a, vector unsigned short b) |
| 3779 | { |
| 3780 | return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b); |
| 3781 | } |
| 3782 | |
| 3783 | static vector int __ATTRS_o_ai |
| 3784 | vec_rl(vector int a, vector unsigned int b) |
| 3785 | { |
| 3786 | return __builtin_altivec_vrlw(a, b); |
| 3787 | } |
| 3788 | |
| 3789 | static vector unsigned int __ATTRS_o_ai |
| 3790 | vec_rl(vector unsigned int a, vector unsigned int b) |
| 3791 | { |
| 3792 | return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b); |
| 3793 | } |
| 3794 | |
| 3795 | /* vec_vrlb */ |
| 3796 | |
| 3797 | static vector signed char __ATTRS_o_ai |
| 3798 | vec_vrlb(vector signed char a, vector unsigned char b) |
| 3799 | { |
| 3800 | return (vector signed char)__builtin_altivec_vrlb((vector char)a, b); |
| 3801 | } |
| 3802 | |
| 3803 | static vector unsigned char __ATTRS_o_ai |
| 3804 | vec_vrlb(vector unsigned char a, vector unsigned char b) |
| 3805 | { |
| 3806 | return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b); |
| 3807 | } |
| 3808 | |
| 3809 | /* vec_vrlh */ |
| 3810 | |
| 3811 | static vector short __ATTRS_o_ai |
| 3812 | vec_vrlh(vector short a, vector unsigned short b) |
| 3813 | { |
| 3814 | return __builtin_altivec_vrlh(a, b); |
| 3815 | } |
| 3816 | |
| 3817 | static vector unsigned short __ATTRS_o_ai |
| 3818 | vec_vrlh(vector unsigned short a, vector unsigned short b) |
| 3819 | { |
| 3820 | return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b); |
| 3821 | } |
| 3822 | |
| 3823 | /* vec_vrlw */ |
| 3824 | |
| 3825 | static vector int __ATTRS_o_ai |
| 3826 | vec_vrlw(vector int a, vector unsigned int b) |
| 3827 | { |
| 3828 | return __builtin_altivec_vrlw(a, b); |
| 3829 | } |
| 3830 | |
| 3831 | static vector unsigned int __ATTRS_o_ai |
| 3832 | vec_vrlw(vector unsigned int a, vector unsigned int b) |
| 3833 | { |
| 3834 | return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b); |
| 3835 | } |
| 3836 | |
| 3837 | /* vec_round */ |
| 3838 | |
| 3839 | static vector float __attribute__((__always_inline__)) |
| 3840 | vec_round(vector float a) |
| 3841 | { |
| 3842 | return __builtin_altivec_vrfin(a); |
| 3843 | } |
| 3844 | |
| 3845 | /* vec_vrfin */ |
| 3846 | |
| 3847 | static vector float __attribute__((__always_inline__)) |
| 3848 | vec_vrfin(vector float a) |
| 3849 | { |
| 3850 | return __builtin_altivec_vrfin(a); |
| 3851 | } |
| 3852 | |
| 3853 | /* vec_rsqrte */ |
| 3854 | |
| 3855 | static __vector float __attribute__((__always_inline__)) |
| 3856 | vec_rsqrte(vector float a) |
| 3857 | { |
| 3858 | return __builtin_altivec_vrsqrtefp(a); |
| 3859 | } |
| 3860 | |
| 3861 | /* vec_vrsqrtefp */ |
| 3862 | |
| 3863 | static __vector float __attribute__((__always_inline__)) |
| 3864 | vec_vrsqrtefp(vector float a) |
| 3865 | { |
| 3866 | return __builtin_altivec_vrsqrtefp(a); |
| 3867 | } |
| 3868 | |
| 3869 | /* vec_sel */ |
| 3870 | |
| 3871 | #define __builtin_altivec_vsel_4si vec_sel |
| 3872 | |
| 3873 | static vector signed char __ATTRS_o_ai |
| 3874 | vec_sel(vector signed char a, vector signed char b, vector unsigned char c) |
| 3875 | { |
| 3876 | return (a & ~(vector signed char)c) | (b & (vector signed char)c); |
| 3877 | } |
| 3878 | |
| 3879 | static vector unsigned char __ATTRS_o_ai |
| 3880 | vec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3881 | { |
| 3882 | return (a & ~c) | (b & c); |
| 3883 | } |
| 3884 | |
| 3885 | static vector short __ATTRS_o_ai |
| 3886 | vec_sel(vector short a, vector short b, vector unsigned short c) |
| 3887 | { |
| 3888 | return (a & ~(vector short)c) | (b & (vector short)c); |
| 3889 | } |
| 3890 | |
| 3891 | static vector unsigned short __ATTRS_o_ai |
| 3892 | vec_sel(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 3893 | { |
| 3894 | return (a & ~c) | (b & c); |
| 3895 | } |
| 3896 | |
| 3897 | static vector int __ATTRS_o_ai |
| 3898 | vec_sel(vector int a, vector int b, vector unsigned int c) |
| 3899 | { |
| 3900 | return (a & ~(vector int)c) | (b & (vector int)c); |
| 3901 | } |
| 3902 | |
| 3903 | static vector unsigned int __ATTRS_o_ai |
| 3904 | vec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c) |
| 3905 | { |
| 3906 | return (a & ~c) | (b & c); |
| 3907 | } |
| 3908 | |
| 3909 | static vector float __ATTRS_o_ai |
| 3910 | vec_sel(vector float a, vector float b, vector unsigned int c) |
| 3911 | { |
| 3912 | vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c); |
| 3913 | return (vector float)res; |
| 3914 | } |
| 3915 | |
| 3916 | /* vec_vsel */ |
| 3917 | |
| 3918 | static vector signed char __ATTRS_o_ai |
| 3919 | vec_vsel(vector signed char a, vector signed char b, vector unsigned char c) |
| 3920 | { |
| 3921 | return (a & ~(vector signed char)c) | (b & (vector signed char)c); |
| 3922 | } |
| 3923 | |
| 3924 | static vector unsigned char __ATTRS_o_ai |
| 3925 | vec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c) |
| 3926 | { |
| 3927 | return (a & ~c) | (b & c); |
| 3928 | } |
| 3929 | |
| 3930 | static vector short __ATTRS_o_ai |
| 3931 | vec_vsel(vector short a, vector short b, vector unsigned short c) |
| 3932 | { |
| 3933 | return (a & ~(vector short)c) | (b & (vector short)c); |
| 3934 | } |
| 3935 | |
| 3936 | static vector unsigned short __ATTRS_o_ai |
| 3937 | vec_vsel(vector unsigned short a, vector unsigned short b, vector unsigned short c) |
| 3938 | { |
| 3939 | return (a & ~c) | (b & c); |
| 3940 | } |
| 3941 | |
| 3942 | static vector int __ATTRS_o_ai |
| 3943 | vec_vsel(vector int a, vector int b, vector unsigned int c) |
| 3944 | { |
| 3945 | return (a & ~(vector int)c) | (b & (vector int)c); |
| 3946 | } |
| 3947 | |
| 3948 | static vector unsigned int __ATTRS_o_ai |
| 3949 | vec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c) |
| 3950 | { |
| 3951 | return (a & ~c) | (b & c); |
| 3952 | } |
| 3953 | |
| 3954 | static vector float __ATTRS_o_ai |
| 3955 | vec_vsel(vector float a, vector float b, vector unsigned int c) |
| 3956 | { |
| 3957 | vector int res = ((vector int)a & ~(vector int)c) | ((vector int)b & (vector int)c); |
| 3958 | return (vector float)res; |
| 3959 | } |
| 3960 | |
| 3961 | /* vec_sl */ |
| 3962 | |
| 3963 | static vector signed char __ATTRS_o_ai |
| 3964 | vec_sl(vector signed char a, vector unsigned char b) |
| 3965 | { |
| 3966 | return a << (vector signed char)b; |
| 3967 | } |
| 3968 | |
| 3969 | static vector unsigned char __ATTRS_o_ai |
| 3970 | vec_sl(vector unsigned char a, vector unsigned char b) |
| 3971 | { |
| 3972 | return a << b; |
| 3973 | } |
| 3974 | |
| 3975 | static vector short __ATTRS_o_ai |
| 3976 | vec_sl(vector short a, vector unsigned short b) |
| 3977 | { |
| 3978 | return a << (vector short)b; |
| 3979 | } |
| 3980 | |
| 3981 | static vector unsigned short __ATTRS_o_ai |
| 3982 | vec_sl(vector unsigned short a, vector unsigned short b) |
| 3983 | { |
| 3984 | return a << b; |
| 3985 | } |
| 3986 | |
| 3987 | static vector int __ATTRS_o_ai |
| 3988 | vec_sl(vector int a, vector unsigned int b) |
| 3989 | { |
| 3990 | return a << (vector int)b; |
| 3991 | } |
| 3992 | |
| 3993 | static vector unsigned int __ATTRS_o_ai |
| 3994 | vec_sl(vector unsigned int a, vector unsigned int b) |
| 3995 | { |
| 3996 | return a << b; |
| 3997 | } |
| 3998 | |
| 3999 | /* vec_vslb */ |
| 4000 | |
| 4001 | #define __builtin_altivec_vslb vec_vslb |
| 4002 | |
| 4003 | static vector signed char __ATTRS_o_ai |
| 4004 | vec_vslb(vector signed char a, vector unsigned char b) |
| 4005 | { |
| 4006 | return vec_sl(a, b); |
| 4007 | } |
| 4008 | |
| 4009 | static vector unsigned char __ATTRS_o_ai |
| 4010 | vec_vslb(vector unsigned char a, vector unsigned char b) |
| 4011 | { |
| 4012 | return vec_sl(a, b); |
| 4013 | } |
| 4014 | |
| 4015 | /* vec_vslh */ |
| 4016 | |
| 4017 | #define __builtin_altivec_vslh vec_vslh |
| 4018 | |
| 4019 | static vector short __ATTRS_o_ai |
| 4020 | vec_vslh(vector short a, vector unsigned short b) |
| 4021 | { |
| 4022 | return vec_sl(a, b); |
| 4023 | } |
| 4024 | |
| 4025 | static vector unsigned short __ATTRS_o_ai |
| 4026 | vec_vslh(vector unsigned short a, vector unsigned short b) |
| 4027 | { |
| 4028 | return vec_sl(a, b); |
| 4029 | } |
| 4030 | |
| 4031 | /* vec_vslw */ |
| 4032 | |
| 4033 | #define __builtin_altivec_vslw vec_vslw |
| 4034 | |
| 4035 | static vector int __ATTRS_o_ai |
| 4036 | vec_vslw(vector int a, vector unsigned int b) |
| 4037 | { |
| 4038 | return vec_sl(a, b); |
| 4039 | } |
| 4040 | |
| 4041 | static vector unsigned int __ATTRS_o_ai |
| 4042 | vec_vslw(vector unsigned int a, vector unsigned int b) |
| 4043 | { |
| 4044 | return vec_sl(a, b); |
| 4045 | } |
| 4046 | |
| 4047 | /* vec_sld */ |
| 4048 | |
| 4049 | #define __builtin_altivec_vsldoi_4si vec_sld |
| 4050 | |
| 4051 | static vector signed char __ATTRS_o_ai |
| 4052 | vec_sld(vector signed char a, vector signed char b, unsigned char c) |
| 4053 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4054 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4055 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4056 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4057 | } |
| 4058 | |
| 4059 | static vector unsigned char __ATTRS_o_ai |
| 4060 | vec_sld(vector unsigned char a, vector unsigned char b, unsigned char c) |
| 4061 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4062 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4063 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4064 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4065 | } |
| 4066 | |
| 4067 | static vector short __ATTRS_o_ai |
| 4068 | vec_sld(vector short a, vector short b, unsigned char c) |
| 4069 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4070 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4071 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4072 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4073 | } |
| 4074 | |
| 4075 | static vector unsigned short __ATTRS_o_ai |
| 4076 | vec_sld(vector unsigned short a, vector unsigned short b, unsigned char c) |
| 4077 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4078 | return vec_perm(a, b, (vector unsigned char) |
| 4079 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4080 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4081 | } |
| 4082 | |
| 4083 | static vector pixel __ATTRS_o_ai |
| 4084 | vec_sld(vector pixel a, vector pixel b, unsigned char c) |
| 4085 | { |
| 4086 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4087 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4088 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4089 | } |
| 4090 | |
| 4091 | static vector int __ATTRS_o_ai |
| 4092 | vec_sld(vector int a, vector int b, unsigned char c) |
| 4093 | { |
| 4094 | return vec_perm(a, b, (vector unsigned char) |
| 4095 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4096 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4097 | } |
| 4098 | |
| 4099 | static vector unsigned int __ATTRS_o_ai |
| 4100 | vec_sld(vector unsigned int a, vector unsigned int b, unsigned char c) |
| 4101 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4102 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4103 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4104 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4105 | } |
| 4106 | |
| 4107 | static vector float __ATTRS_o_ai |
| 4108 | vec_sld(vector float a, vector float b, unsigned char c) |
| 4109 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4110 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4111 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4112 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4113 | } |
| 4114 | |
| 4115 | /* vec_vsldoi */ |
| 4116 | |
| 4117 | static vector signed char __ATTRS_o_ai |
| 4118 | vec_vsldoi(vector signed char a, vector signed char b, unsigned char c) |
| 4119 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4120 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4121 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4122 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4123 | } |
| 4124 | |
| 4125 | static vector unsigned char __ATTRS_o_ai |
| 4126 | vec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c) |
| 4127 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4128 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4129 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4130 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4131 | } |
| 4132 | |
| 4133 | static vector short __ATTRS_o_ai |
| 4134 | vec_vsldoi(vector short a, vector short b, unsigned char c) |
| 4135 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4136 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4137 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4138 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4139 | } |
| 4140 | |
| 4141 | static vector unsigned short __ATTRS_o_ai |
| 4142 | vec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c) |
| 4143 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4144 | return vec_perm(a, b, (vector unsigned char) |
| 4145 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4146 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4147 | } |
| 4148 | |
| 4149 | static vector pixel __ATTRS_o_ai |
| 4150 | vec_vsldoi(vector pixel a, vector pixel b, unsigned char c) |
| 4151 | { |
| 4152 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4153 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4154 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4155 | } |
| 4156 | |
| 4157 | static vector int __ATTRS_o_ai |
| 4158 | vec_vsldoi(vector int a, vector int b, unsigned char c) |
| 4159 | { |
| 4160 | return vec_perm(a, b, (vector unsigned char) |
| 4161 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4162 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4163 | } |
| 4164 | |
| 4165 | static vector unsigned int __ATTRS_o_ai |
| 4166 | vec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c) |
| 4167 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4168 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4169 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4170 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4171 | } |
| 4172 | |
| 4173 | static vector float __ATTRS_o_ai |
| 4174 | vec_vsldoi(vector float a, vector float b, unsigned char c) |
| 4175 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4176 | return vec_perm(a, b, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4177 | (c, c+1, c+2, c+3, c+4, c+5, c+6, c+7, |
| 4178 | c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15)); |
| 4179 | } |
| 4180 | |
| 4181 | /* vec_sll */ |
| 4182 | |
| 4183 | static vector signed char __ATTRS_o_ai |
| 4184 | vec_sll(vector signed char a, vector unsigned char b) |
| 4185 | { |
| 4186 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4187 | } |
| 4188 | |
| 4189 | static vector signed char __ATTRS_o_ai |
| 4190 | vec_sll(vector signed char a, vector unsigned short b) |
| 4191 | { |
| 4192 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4193 | } |
| 4194 | |
| 4195 | static vector signed char __ATTRS_o_ai |
| 4196 | vec_sll(vector signed char a, vector unsigned int b) |
| 4197 | { |
| 4198 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4199 | } |
| 4200 | |
| 4201 | static vector unsigned char __ATTRS_o_ai |
| 4202 | vec_sll(vector unsigned char a, vector unsigned char b) |
| 4203 | { |
| 4204 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4205 | } |
| 4206 | |
| 4207 | static vector unsigned char __ATTRS_o_ai |
| 4208 | vec_sll(vector unsigned char a, vector unsigned short b) |
| 4209 | { |
| 4210 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4211 | } |
| 4212 | |
| 4213 | static vector unsigned char __ATTRS_o_ai |
| 4214 | vec_sll(vector unsigned char a, vector unsigned int b) |
| 4215 | { |
| 4216 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4217 | } |
| 4218 | |
| 4219 | static vector short __ATTRS_o_ai |
| 4220 | vec_sll(vector short a, vector unsigned char b) |
| 4221 | { |
| 4222 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4223 | } |
| 4224 | |
| 4225 | static vector short __ATTRS_o_ai |
| 4226 | vec_sll(vector short a, vector unsigned short b) |
| 4227 | { |
| 4228 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4229 | } |
| 4230 | |
| 4231 | static vector short __ATTRS_o_ai |
| 4232 | vec_sll(vector short a, vector unsigned int b) |
| 4233 | { |
| 4234 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4235 | } |
| 4236 | |
| 4237 | static vector unsigned short __ATTRS_o_ai |
| 4238 | vec_sll(vector unsigned short a, vector unsigned char b) |
| 4239 | { |
| 4240 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4241 | } |
| 4242 | |
| 4243 | static vector unsigned short __ATTRS_o_ai |
| 4244 | vec_sll(vector unsigned short a, vector unsigned short b) |
| 4245 | { |
| 4246 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4247 | } |
| 4248 | |
| 4249 | static vector unsigned short __ATTRS_o_ai |
| 4250 | vec_sll(vector unsigned short a, vector unsigned int b) |
| 4251 | { |
| 4252 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4253 | } |
| 4254 | |
| 4255 | static vector int __ATTRS_o_ai |
| 4256 | vec_sll(vector int a, vector unsigned char b) |
| 4257 | { |
| 4258 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4259 | } |
| 4260 | |
| 4261 | static vector int __ATTRS_o_ai |
| 4262 | vec_sll(vector int a, vector unsigned short b) |
| 4263 | { |
| 4264 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4265 | } |
| 4266 | |
| 4267 | static vector int __ATTRS_o_ai |
| 4268 | vec_sll(vector int a, vector unsigned int b) |
| 4269 | { |
| 4270 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4271 | } |
| 4272 | |
| 4273 | static vector unsigned int __ATTRS_o_ai |
| 4274 | vec_sll(vector unsigned int a, vector unsigned char b) |
| 4275 | { |
| 4276 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4277 | } |
| 4278 | |
| 4279 | static vector unsigned int __ATTRS_o_ai |
| 4280 | vec_sll(vector unsigned int a, vector unsigned short b) |
| 4281 | { |
| 4282 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4283 | } |
| 4284 | |
| 4285 | static vector unsigned int __ATTRS_o_ai |
| 4286 | vec_sll(vector unsigned int a, vector unsigned int b) |
| 4287 | { |
| 4288 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4289 | } |
| 4290 | |
| 4291 | /* vec_vsl */ |
| 4292 | |
| 4293 | static vector signed char __ATTRS_o_ai |
| 4294 | vec_vsl(vector signed char a, vector unsigned char b) |
| 4295 | { |
| 4296 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4297 | } |
| 4298 | |
| 4299 | static vector signed char __ATTRS_o_ai |
| 4300 | vec_vsl(vector signed char a, vector unsigned short b) |
| 4301 | { |
| 4302 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4303 | } |
| 4304 | |
| 4305 | static vector signed char __ATTRS_o_ai |
| 4306 | vec_vsl(vector signed char a, vector unsigned int b) |
| 4307 | { |
| 4308 | return (vector signed char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4309 | } |
| 4310 | |
| 4311 | static vector unsigned char __ATTRS_o_ai |
| 4312 | vec_vsl(vector unsigned char a, vector unsigned char b) |
| 4313 | { |
| 4314 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4315 | } |
| 4316 | |
| 4317 | static vector unsigned char __ATTRS_o_ai |
| 4318 | vec_vsl(vector unsigned char a, vector unsigned short b) |
| 4319 | { |
| 4320 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4321 | } |
| 4322 | |
| 4323 | static vector unsigned char __ATTRS_o_ai |
| 4324 | vec_vsl(vector unsigned char a, vector unsigned int b) |
| 4325 | { |
| 4326 | return (vector unsigned char)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4327 | } |
| 4328 | |
| 4329 | static vector short __ATTRS_o_ai |
| 4330 | vec_vsl(vector short a, vector unsigned char b) |
| 4331 | { |
| 4332 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4333 | } |
| 4334 | |
| 4335 | static vector short __ATTRS_o_ai |
| 4336 | vec_vsl(vector short a, vector unsigned short b) |
| 4337 | { |
| 4338 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4339 | } |
| 4340 | |
| 4341 | static vector short __ATTRS_o_ai |
| 4342 | vec_vsl(vector short a, vector unsigned int b) |
| 4343 | { |
| 4344 | return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4345 | } |
| 4346 | |
| 4347 | static vector unsigned short __ATTRS_o_ai |
| 4348 | vec_vsl(vector unsigned short a, vector unsigned char b) |
| 4349 | { |
| 4350 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4351 | } |
| 4352 | |
| 4353 | static vector unsigned short __ATTRS_o_ai |
| 4354 | vec_vsl(vector unsigned short a, vector unsigned short b) |
| 4355 | { |
| 4356 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4357 | } |
| 4358 | |
| 4359 | static vector unsigned short __ATTRS_o_ai |
| 4360 | vec_vsl(vector unsigned short a, vector unsigned int b) |
| 4361 | { |
| 4362 | return (vector unsigned short)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4363 | } |
| 4364 | |
| 4365 | static vector int __ATTRS_o_ai |
| 4366 | vec_vsl(vector int a, vector unsigned char b) |
| 4367 | { |
| 4368 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4369 | } |
| 4370 | |
| 4371 | static vector int __ATTRS_o_ai |
| 4372 | vec_vsl(vector int a, vector unsigned short b) |
| 4373 | { |
| 4374 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4375 | } |
| 4376 | |
| 4377 | static vector int __ATTRS_o_ai |
| 4378 | vec_vsl(vector int a, vector unsigned int b) |
| 4379 | { |
| 4380 | return (vector int)__builtin_altivec_vsl(a, (vector int)b); |
| 4381 | } |
| 4382 | |
| 4383 | static vector unsigned int __ATTRS_o_ai |
| 4384 | vec_vsl(vector unsigned int a, vector unsigned char b) |
| 4385 | { |
| 4386 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4387 | } |
| 4388 | |
| 4389 | static vector unsigned int __ATTRS_o_ai |
| 4390 | vec_vsl(vector unsigned int a, vector unsigned short b) |
| 4391 | { |
| 4392 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4393 | } |
| 4394 | |
| 4395 | static vector unsigned int __ATTRS_o_ai |
| 4396 | vec_vsl(vector unsigned int a, vector unsigned int b) |
| 4397 | { |
| 4398 | return (vector unsigned int)__builtin_altivec_vsl((vector int)a, (vector int)b); |
| 4399 | } |
| 4400 | |
| 4401 | /* vec_slo */ |
| 4402 | |
| 4403 | static vector signed char __ATTRS_o_ai |
| 4404 | vec_slo(vector signed char a, vector signed char b) |
| 4405 | { |
| 4406 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4407 | } |
| 4408 | |
| 4409 | static vector signed char __ATTRS_o_ai |
| 4410 | vec_slo(vector signed char a, vector unsigned char b) |
| 4411 | { |
| 4412 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4413 | } |
| 4414 | |
| 4415 | static vector unsigned char __ATTRS_o_ai |
| 4416 | vec_slo(vector unsigned char a, vector signed char b) |
| 4417 | { |
| 4418 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4419 | } |
| 4420 | |
| 4421 | static vector unsigned char __ATTRS_o_ai |
| 4422 | vec_slo(vector unsigned char a, vector unsigned char b) |
| 4423 | { |
| 4424 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4425 | } |
| 4426 | |
| 4427 | static vector short __ATTRS_o_ai |
| 4428 | vec_slo(vector short a, vector signed char b) |
| 4429 | { |
| 4430 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4431 | } |
| 4432 | |
| 4433 | static vector short __ATTRS_o_ai |
| 4434 | vec_slo(vector short a, vector unsigned char b) |
| 4435 | { |
| 4436 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4437 | } |
| 4438 | |
| 4439 | static vector unsigned short __ATTRS_o_ai |
| 4440 | vec_slo(vector unsigned short a, vector signed char b) |
| 4441 | { |
| 4442 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4443 | } |
| 4444 | |
| 4445 | static vector unsigned short __ATTRS_o_ai |
| 4446 | vec_slo(vector unsigned short a, vector unsigned char b) |
| 4447 | { |
| 4448 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4449 | } |
| 4450 | |
| 4451 | static vector int __ATTRS_o_ai |
| 4452 | vec_slo(vector int a, vector signed char b) |
| 4453 | { |
| 4454 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4455 | } |
| 4456 | |
| 4457 | static vector int __ATTRS_o_ai |
| 4458 | vec_slo(vector int a, vector unsigned char b) |
| 4459 | { |
| 4460 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4461 | } |
| 4462 | |
| 4463 | static vector unsigned int __ATTRS_o_ai |
| 4464 | vec_slo(vector unsigned int a, vector signed char b) |
| 4465 | { |
| 4466 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4467 | } |
| 4468 | |
| 4469 | static vector unsigned int __ATTRS_o_ai |
| 4470 | vec_slo(vector unsigned int a, vector unsigned char b) |
| 4471 | { |
| 4472 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4473 | } |
| 4474 | |
| 4475 | static vector float __ATTRS_o_ai |
| 4476 | vec_slo(vector float a, vector signed char b) |
| 4477 | { |
| 4478 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4479 | } |
| 4480 | |
| 4481 | static vector float __ATTRS_o_ai |
| 4482 | vec_slo(vector float a, vector unsigned char b) |
| 4483 | { |
| 4484 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4485 | } |
| 4486 | |
| 4487 | /* vec_vslo */ |
| 4488 | |
| 4489 | static vector signed char __ATTRS_o_ai |
| 4490 | vec_vslo(vector signed char a, vector signed char b) |
| 4491 | { |
| 4492 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4493 | } |
| 4494 | |
| 4495 | static vector signed char __ATTRS_o_ai |
| 4496 | vec_vslo(vector signed char a, vector unsigned char b) |
| 4497 | { |
| 4498 | return (vector signed char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4499 | } |
| 4500 | |
| 4501 | static vector unsigned char __ATTRS_o_ai |
| 4502 | vec_vslo(vector unsigned char a, vector signed char b) |
| 4503 | { |
| 4504 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4505 | } |
| 4506 | |
| 4507 | static vector unsigned char __ATTRS_o_ai |
| 4508 | vec_vslo(vector unsigned char a, vector unsigned char b) |
| 4509 | { |
| 4510 | return (vector unsigned char)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4511 | } |
| 4512 | |
| 4513 | static vector short __ATTRS_o_ai |
| 4514 | vec_vslo(vector short a, vector signed char b) |
| 4515 | { |
| 4516 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4517 | } |
| 4518 | |
| 4519 | static vector short __ATTRS_o_ai |
| 4520 | vec_vslo(vector short a, vector unsigned char b) |
| 4521 | { |
| 4522 | return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4523 | } |
| 4524 | |
| 4525 | static vector unsigned short __ATTRS_o_ai |
| 4526 | vec_vslo(vector unsigned short a, vector signed char b) |
| 4527 | { |
| 4528 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4529 | } |
| 4530 | |
| 4531 | static vector unsigned short __ATTRS_o_ai |
| 4532 | vec_vslo(vector unsigned short a, vector unsigned char b) |
| 4533 | { |
| 4534 | return (vector unsigned short)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4535 | } |
| 4536 | |
| 4537 | static vector int __ATTRS_o_ai |
| 4538 | vec_vslo(vector int a, vector signed char b) |
| 4539 | { |
| 4540 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4541 | } |
| 4542 | |
| 4543 | static vector int __ATTRS_o_ai |
| 4544 | vec_vslo(vector int a, vector unsigned char b) |
| 4545 | { |
| 4546 | return (vector int)__builtin_altivec_vslo(a, (vector int)b); |
| 4547 | } |
| 4548 | |
| 4549 | static vector unsigned int __ATTRS_o_ai |
| 4550 | vec_vslo(vector unsigned int a, vector signed char b) |
| 4551 | { |
| 4552 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4553 | } |
| 4554 | |
| 4555 | static vector unsigned int __ATTRS_o_ai |
| 4556 | vec_vslo(vector unsigned int a, vector unsigned char b) |
| 4557 | { |
| 4558 | return (vector unsigned int)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4559 | } |
| 4560 | |
| 4561 | static vector float __ATTRS_o_ai |
| 4562 | vec_vslo(vector float a, vector signed char b) |
| 4563 | { |
| 4564 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4565 | } |
| 4566 | |
| 4567 | static vector float __ATTRS_o_ai |
| 4568 | vec_vslo(vector float a, vector unsigned char b) |
| 4569 | { |
| 4570 | return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b); |
| 4571 | } |
| 4572 | |
| 4573 | /* vec_splat */ |
| 4574 | |
| 4575 | static vector signed char __ATTRS_o_ai |
| 4576 | vec_splat(vector signed char a, unsigned char b) |
| 4577 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4578 | return vec_perm(a, a, (vector unsigned char)(b)); |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4579 | } |
| 4580 | |
| 4581 | static vector unsigned char __ATTRS_o_ai |
| 4582 | vec_splat(vector unsigned char a, unsigned char b) |
| 4583 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4584 | return vec_perm(a, a, (vector unsigned char)(b)); |
| 4585 | } |
| 4586 | |
| 4587 | static vector bool char __ATTRS_o_ai |
| 4588 | vec_splat(vector bool char a, unsigned char b) |
| 4589 | { |
| 4590 | return vec_perm(a, a, (vector unsigned char)(b)); |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4591 | } |
| 4592 | |
| 4593 | static vector short __ATTRS_o_ai |
| 4594 | vec_splat(vector short a, unsigned char b) |
| 4595 | { |
| 4596 | b *= 2; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4597 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4598 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4599 | } |
| 4600 | |
| 4601 | static vector unsigned short __ATTRS_o_ai |
| 4602 | vec_splat(vector unsigned short a, unsigned char b) |
| 4603 | { |
| 4604 | b *= 2; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4605 | return vec_perm(a, a, (vector unsigned char) |
| 4606 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4607 | } |
| 4608 | |
| 4609 | static vector bool short __ATTRS_o_ai |
| 4610 | vec_splat(vector bool short a, unsigned char b) |
| 4611 | { |
| 4612 | b *= 2; |
| 4613 | return vec_perm(a, a, (vector unsigned char) |
| 4614 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4615 | } |
| 4616 | |
| 4617 | static vector pixel __ATTRS_o_ai |
| 4618 | vec_splat(vector pixel a, unsigned char b) |
| 4619 | { |
| 4620 | b *= 2; |
| 4621 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4622 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4623 | } |
| 4624 | |
| 4625 | static vector int __ATTRS_o_ai |
| 4626 | vec_splat(vector int a, unsigned char b) |
| 4627 | { |
| 4628 | b *= 4; |
| 4629 | return vec_perm(a, a, (vector unsigned char) |
| 4630 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4631 | } |
| 4632 | |
| 4633 | static vector unsigned int __ATTRS_o_ai |
| 4634 | vec_splat(vector unsigned int a, unsigned char b) |
| 4635 | { |
| 4636 | b *= 4; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4637 | return vec_perm(a, a, (vector unsigned char) |
| 4638 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4639 | } |
| 4640 | |
| 4641 | static vector bool int __ATTRS_o_ai |
| 4642 | vec_splat(vector bool int a, unsigned char b) |
| 4643 | { |
| 4644 | b *= 4; |
| 4645 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4646 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4647 | } |
| 4648 | |
| 4649 | static vector float __ATTRS_o_ai |
| 4650 | vec_splat(vector float a, unsigned char b) |
| 4651 | { |
| 4652 | b *= 4; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4653 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4654 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4655 | } |
| 4656 | |
| 4657 | /* vec_vspltb */ |
| 4658 | |
| 4659 | #define __builtin_altivec_vspltb vec_vspltb |
| 4660 | |
| 4661 | static vector signed char __ATTRS_o_ai |
| 4662 | vec_vspltb(vector signed char a, unsigned char b) |
| 4663 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4664 | return vec_perm(a, a, (vector unsigned char)(b)); |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4665 | } |
| 4666 | |
| 4667 | static vector unsigned char __ATTRS_o_ai |
| 4668 | vec_vspltb(vector unsigned char a, unsigned char b) |
| 4669 | { |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4670 | return vec_perm(a, a, (vector unsigned char)(b)); |
| 4671 | } |
| 4672 | |
| 4673 | static vector bool char __ATTRS_o_ai |
| 4674 | vec_vspltb(vector bool char a, unsigned char b) |
| 4675 | { |
| 4676 | return vec_perm(a, a, (vector unsigned char)(b)); |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4677 | } |
| 4678 | |
| 4679 | /* vec_vsplth */ |
| 4680 | |
| 4681 | #define __builtin_altivec_vsplth vec_vsplth |
| 4682 | |
| 4683 | static vector short __ATTRS_o_ai |
| 4684 | vec_vsplth(vector short a, unsigned char b) |
| 4685 | { |
| 4686 | b *= 2; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4687 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4688 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4689 | } |
| 4690 | |
| 4691 | static vector unsigned short __ATTRS_o_ai |
| 4692 | vec_vsplth(vector unsigned short a, unsigned char b) |
| 4693 | { |
| 4694 | b *= 2; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4695 | return vec_perm(a, a, (vector unsigned char) |
| 4696 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4697 | } |
| 4698 | |
| 4699 | static vector bool short __ATTRS_o_ai |
| 4700 | vec_vsplth(vector bool short a, unsigned char b) |
| 4701 | { |
| 4702 | b *= 2; |
| 4703 | return vec_perm(a, a, (vector unsigned char) |
| 4704 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4705 | } |
| 4706 | |
| 4707 | static vector pixel __ATTRS_o_ai |
| 4708 | vec_vsplth(vector pixel a, unsigned char b) |
| 4709 | { |
| 4710 | b *= 2; |
| 4711 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4712 | (b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1, b, b+1)); |
| 4713 | } |
| 4714 | |
| 4715 | /* vec_vspltw */ |
| 4716 | |
| 4717 | #define __builtin_altivec_vspltw vec_vspltw |
| 4718 | |
| 4719 | static vector int __ATTRS_o_ai |
| 4720 | vec_vspltw(vector int a, unsigned char b) |
| 4721 | { |
| 4722 | b *= 4; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4723 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4724 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4725 | } |
| 4726 | |
| 4727 | static vector unsigned int __ATTRS_o_ai |
| 4728 | vec_vspltw(vector unsigned int a, unsigned char b) |
| 4729 | { |
| 4730 | b *= 4; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4731 | return vec_perm(a, a, (vector unsigned char) |
| 4732 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4733 | } |
| 4734 | |
| 4735 | static vector bool int __ATTRS_o_ai |
| 4736 | vec_vspltw(vector bool int a, unsigned char b) |
| 4737 | { |
| 4738 | b *= 4; |
| 4739 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4740 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4741 | } |
| 4742 | |
| 4743 | static vector float __ATTRS_o_ai |
| 4744 | vec_vspltw(vector float a, unsigned char b) |
| 4745 | { |
| 4746 | b *= 4; |
Anton Yartsev | f54dbfd | 2010-08-19 03:00:09 +0000 | [diff] [blame] | 4747 | return vec_perm(a, a, (vector unsigned char) |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 4748 | (b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3, b, b+1, b+2, b+3)); |
| 4749 | } |
| 4750 | |
| 4751 | /* vec_splat_s8 */ |
| 4752 | |
| 4753 | #define __builtin_altivec_vspltisb vec_splat_s8 |
| 4754 | |
| 4755 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4756 | static vector signed char __ATTRS_o_ai |
| 4757 | vec_splat_s8(signed char a) |
| 4758 | { |
| 4759 | return (vector signed char)(a); |
| 4760 | } |
| 4761 | |
| 4762 | /* vec_vspltisb */ |
| 4763 | |
| 4764 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4765 | static vector signed char __ATTRS_o_ai |
| 4766 | vec_vspltisb(signed char a) |
| 4767 | { |
| 4768 | return (vector signed char)(a); |
| 4769 | } |
| 4770 | |
| 4771 | /* vec_splat_s16 */ |
| 4772 | |
| 4773 | #define __builtin_altivec_vspltish vec_splat_s16 |
| 4774 | |
| 4775 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4776 | static vector short __ATTRS_o_ai |
| 4777 | vec_splat_s16(signed char a) |
| 4778 | { |
| 4779 | return (vector short)(a); |
| 4780 | } |
| 4781 | |
| 4782 | /* vec_vspltish */ |
| 4783 | |
| 4784 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4785 | static vector short __ATTRS_o_ai |
| 4786 | vec_vspltish(signed char a) |
| 4787 | { |
| 4788 | return (vector short)(a); |
| 4789 | } |
| 4790 | |
| 4791 | /* vec_splat_s32 */ |
| 4792 | |
| 4793 | #define __builtin_altivec_vspltisw vec_splat_s32 |
| 4794 | |
| 4795 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4796 | static vector int __ATTRS_o_ai |
| 4797 | vec_splat_s32(signed char a) |
| 4798 | { |
| 4799 | return (vector int)(a); |
| 4800 | } |
| 4801 | |
| 4802 | /* vec_vspltisw */ |
| 4803 | |
| 4804 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4805 | static vector int __ATTRS_o_ai |
| 4806 | vec_vspltisw(signed char a) |
| 4807 | { |
| 4808 | return (vector int)(a); |
| 4809 | } |
| 4810 | |
| 4811 | /* vec_splat_u8 */ |
| 4812 | |
| 4813 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4814 | static vector unsigned char __ATTRS_o_ai |
| 4815 | vec_splat_u8(unsigned char a) |
| 4816 | { |
| 4817 | return (vector unsigned char)(a); |
| 4818 | } |
| 4819 | |
| 4820 | /* vec_splat_u16 */ |
| 4821 | |
| 4822 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4823 | static vector unsigned short __ATTRS_o_ai |
| 4824 | vec_splat_u16(signed char a) |
| 4825 | { |
| 4826 | return (vector unsigned short)(a); |
| 4827 | } |
| 4828 | |
| 4829 | /* vec_splat_u32 */ |
| 4830 | |
| 4831 | // FIXME: parameter should be treated as 5-bit signed literal |
| 4832 | static vector unsigned int __ATTRS_o_ai |
| 4833 | vec_splat_u32(signed char a) |
| 4834 | { |
| 4835 | return (vector unsigned int)(a); |
| 4836 | } |
| 4837 | |
| 4838 | /* vec_sr */ |
| 4839 | |
| 4840 | static vector signed char __ATTRS_o_ai |
| 4841 | vec_sr(vector signed char a, vector unsigned char b) |
| 4842 | { |
| 4843 | return a >> (vector signed char)b; |
| 4844 | } |
| 4845 | |
| 4846 | static vector unsigned char __ATTRS_o_ai |
| 4847 | vec_sr(vector unsigned char a, vector unsigned char b) |
| 4848 | { |
| 4849 | return a >> b; |
| 4850 | } |
| 4851 | |
| 4852 | static vector short __ATTRS_o_ai |
| 4853 | vec_sr(vector short a, vector unsigned short b) |
| 4854 | { |
| 4855 | return a >> (vector short)b; |
| 4856 | } |
| 4857 | |
| 4858 | static vector unsigned short __ATTRS_o_ai |
| 4859 | vec_sr(vector unsigned short a, vector unsigned short b) |
| 4860 | { |
| 4861 | return a >> b; |
| 4862 | } |
| 4863 | |
| 4864 | static vector int __ATTRS_o_ai |
| 4865 | vec_sr(vector int a, vector unsigned int b) |
| 4866 | { |
| 4867 | return a >> (vector int)b; |
| 4868 | } |
| 4869 | |
| 4870 | static vector unsigned int __ATTRS_o_ai |
| 4871 | vec_sr(vector unsigned int a, vector unsigned int b) |
| 4872 | { |
| 4873 | return a >> b; |
| 4874 | } |
| 4875 | |
| 4876 | /* vec_vsrb */ |
| 4877 | |
| 4878 | #define __builtin_altivec_vsrb vec_vsrb |
| 4879 | |
| 4880 | static vector signed char __ATTRS_o_ai |
| 4881 | vec_vsrb(vector signed char a, vector unsigned char b) |
| 4882 | { |
| 4883 | return a >> (vector signed char)b; |
| 4884 | } |
| 4885 | |
| 4886 | static vector unsigned char __ATTRS_o_ai |
| 4887 | vec_vsrb(vector unsigned char a, vector unsigned char b) |
| 4888 | { |
| 4889 | return a >> b; |
| 4890 | } |
| 4891 | |
| 4892 | /* vec_vsrh */ |
| 4893 | |
| 4894 | #define __builtin_altivec_vsrh vec_vsrh |
| 4895 | |
| 4896 | static vector short __ATTRS_o_ai |
| 4897 | vec_vsrh(vector short a, vector unsigned short b) |
| 4898 | { |
| 4899 | return a >> (vector short)b; |
| 4900 | } |
| 4901 | |
| 4902 | static vector unsigned short __ATTRS_o_ai |
| 4903 | vec_vsrh(vector unsigned short a, vector unsigned short b) |
| 4904 | { |
| 4905 | return a >> b; |
| 4906 | } |
| 4907 | |
| 4908 | /* vec_vsrw */ |
| 4909 | |
| 4910 | #define __builtin_altivec_vsrw vec_vsrw |
| 4911 | |
| 4912 | static vector int __ATTRS_o_ai |
| 4913 | vec_vsrw(vector int a, vector unsigned int b) |
| 4914 | { |
| 4915 | return a >> (vector int)b; |
| 4916 | } |
| 4917 | |
| 4918 | static vector unsigned int __ATTRS_o_ai |
| 4919 | vec_vsrw(vector unsigned int a, vector unsigned int b) |
| 4920 | { |
| 4921 | return a >> b; |
| 4922 | } |
| 4923 | |
| 4924 | /* vec_sra */ |
| 4925 | |
| 4926 | static vector signed char __ATTRS_o_ai |
| 4927 | vec_sra(vector signed char a, vector unsigned char b) |
| 4928 | { |
| 4929 | return (vector signed char)__builtin_altivec_vsrab((vector char)a, b); |
| 4930 | } |
| 4931 | |
| 4932 | static vector unsigned char __ATTRS_o_ai |
| 4933 | vec_sra(vector unsigned char a, vector unsigned char b) |
| 4934 | { |
| 4935 | return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b); |
| 4936 | } |
| 4937 | |
| 4938 | static vector short __ATTRS_o_ai |
| 4939 | vec_sra(vector short a, vector unsigned short b) |
| 4940 | { |
| 4941 | return __builtin_altivec_vsrah(a, (vector unsigned short)b); |
| 4942 | } |
| 4943 | |
| 4944 | static vector unsigned short __ATTRS_o_ai |
| 4945 | vec_sra(vector unsigned short a, vector unsigned short b) |
| 4946 | { |
| 4947 | return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b); |
| 4948 | } |
| 4949 | |
| 4950 | static vector int __ATTRS_o_ai |
| 4951 | vec_sra(vector int a, vector unsigned int b) |
| 4952 | { |
| 4953 | return __builtin_altivec_vsraw(a, b); |
| 4954 | } |
| 4955 | |
| 4956 | static vector unsigned int __ATTRS_o_ai |
| 4957 | vec_sra(vector unsigned int a, vector unsigned int b) |
| 4958 | { |
| 4959 | return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b); |
| 4960 | } |
| 4961 | |
| 4962 | /* vec_vsrab */ |
| 4963 | |
| 4964 | static vector signed char __ATTRS_o_ai |
| 4965 | vec_vsrab(vector signed char a, vector unsigned char b) |
| 4966 | { |
| 4967 | return (vector signed char)__builtin_altivec_vsrab((vector char)a, b); |
| 4968 | } |
| 4969 | |
| 4970 | static vector unsigned char __ATTRS_o_ai |
| 4971 | vec_vsrab(vector unsigned char a, vector unsigned char b) |
| 4972 | { |
| 4973 | return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b); |
| 4974 | } |
| 4975 | |
| 4976 | /* vec_vsrah */ |
| 4977 | |
| 4978 | static vector short __ATTRS_o_ai |
| 4979 | vec_vsrah(vector short a, vector unsigned short b) |
| 4980 | { |
| 4981 | return __builtin_altivec_vsrah(a, (vector unsigned short)b); |
| 4982 | } |
| 4983 | |
| 4984 | static vector unsigned short __ATTRS_o_ai |
| 4985 | vec_vsrah(vector unsigned short a, vector unsigned short b) |
| 4986 | { |
| 4987 | return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b); |
| 4988 | } |
| 4989 | |
| 4990 | /* vec_vsraw */ |
| 4991 | |
| 4992 | static vector int __ATTRS_o_ai |
| 4993 | vec_vsraw(vector int a, vector unsigned int b) |
| 4994 | { |
| 4995 | return __builtin_altivec_vsraw(a, b); |
| 4996 | } |
| 4997 | |
| 4998 | static vector unsigned int __ATTRS_o_ai |
| 4999 | vec_vsraw(vector unsigned int a, vector unsigned int b) |
| 5000 | { |
| 5001 | return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b); |
| 5002 | } |
| 5003 | |
| 5004 | /* vec_srl */ |
| 5005 | |
| 5006 | static vector signed char __ATTRS_o_ai |
| 5007 | vec_srl(vector signed char a, vector unsigned char b) |
| 5008 | { |
| 5009 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5010 | } |
| 5011 | |
| 5012 | static vector signed char __ATTRS_o_ai |
| 5013 | vec_srl(vector signed char a, vector unsigned short b) |
| 5014 | { |
| 5015 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5016 | } |
| 5017 | |
| 5018 | static vector signed char __ATTRS_o_ai |
| 5019 | vec_srl(vector signed char a, vector unsigned int b) |
| 5020 | { |
| 5021 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5022 | } |
| 5023 | |
| 5024 | static vector unsigned char __ATTRS_o_ai |
| 5025 | vec_srl(vector unsigned char a, vector unsigned char b) |
| 5026 | { |
| 5027 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5028 | } |
| 5029 | |
| 5030 | static vector unsigned char __ATTRS_o_ai |
| 5031 | vec_srl(vector unsigned char a, vector unsigned short b) |
| 5032 | { |
| 5033 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5034 | } |
| 5035 | |
| 5036 | static vector unsigned char __ATTRS_o_ai |
| 5037 | vec_srl(vector unsigned char a, vector unsigned int b) |
| 5038 | { |
| 5039 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5040 | } |
| 5041 | |
| 5042 | static vector short __ATTRS_o_ai |
| 5043 | vec_srl(vector short a, vector unsigned char b) |
| 5044 | { |
| 5045 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5046 | } |
| 5047 | |
| 5048 | static vector short __ATTRS_o_ai |
| 5049 | vec_srl(vector short a, vector unsigned short b) |
| 5050 | { |
| 5051 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5052 | } |
| 5053 | |
| 5054 | static vector short __ATTRS_o_ai |
| 5055 | vec_srl(vector short a, vector unsigned int b) |
| 5056 | { |
| 5057 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5058 | } |
| 5059 | |
| 5060 | static vector unsigned short __ATTRS_o_ai |
| 5061 | vec_srl(vector unsigned short a, vector unsigned char b) |
| 5062 | { |
| 5063 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5064 | } |
| 5065 | |
| 5066 | static vector unsigned short __ATTRS_o_ai |
| 5067 | vec_srl(vector unsigned short a, vector unsigned short b) |
| 5068 | { |
| 5069 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5070 | } |
| 5071 | |
| 5072 | static vector unsigned short __ATTRS_o_ai |
| 5073 | vec_srl(vector unsigned short a, vector unsigned int b) |
| 5074 | { |
| 5075 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5076 | } |
| 5077 | |
| 5078 | static vector int __ATTRS_o_ai |
| 5079 | vec_srl(vector int a, vector unsigned char b) |
| 5080 | { |
| 5081 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 5082 | } |
| 5083 | |
| 5084 | static vector int __ATTRS_o_ai |
| 5085 | vec_srl(vector int a, vector unsigned short b) |
| 5086 | { |
| 5087 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 5088 | } |
| 5089 | |
| 5090 | static vector int __ATTRS_o_ai |
| 5091 | vec_srl(vector int a, vector unsigned int b) |
| 5092 | { |
| 5093 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 5094 | } |
| 5095 | |
| 5096 | static vector unsigned int __ATTRS_o_ai |
| 5097 | vec_srl(vector unsigned int a, vector unsigned char b) |
| 5098 | { |
| 5099 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5100 | } |
| 5101 | |
| 5102 | static vector unsigned int __ATTRS_o_ai |
| 5103 | vec_srl(vector unsigned int a, vector unsigned short b) |
| 5104 | { |
| 5105 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5106 | } |
| 5107 | |
| 5108 | static vector unsigned int __ATTRS_o_ai |
| 5109 | vec_srl(vector unsigned int a, vector unsigned int b) |
| 5110 | { |
| 5111 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5112 | } |
| 5113 | |
| 5114 | /* vec_vsr */ |
| 5115 | |
| 5116 | static vector signed char __ATTRS_o_ai |
| 5117 | vec_vsr(vector signed char a, vector unsigned char b) |
| 5118 | { |
| 5119 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5120 | } |
| 5121 | |
| 5122 | static vector signed char __ATTRS_o_ai |
| 5123 | vec_vsr(vector signed char a, vector unsigned short b) |
| 5124 | { |
| 5125 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5126 | } |
| 5127 | |
| 5128 | static vector signed char __ATTRS_o_ai |
| 5129 | vec_vsr(vector signed char a, vector unsigned int b) |
| 5130 | { |
| 5131 | return (vector signed char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5132 | } |
| 5133 | |
| 5134 | static vector unsigned char __ATTRS_o_ai |
| 5135 | vec_vsr(vector unsigned char a, vector unsigned char b) |
| 5136 | { |
| 5137 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5138 | } |
| 5139 | |
| 5140 | static vector unsigned char __ATTRS_o_ai |
| 5141 | vec_vsr(vector unsigned char a, vector unsigned short b) |
| 5142 | { |
| 5143 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5144 | } |
| 5145 | |
| 5146 | static vector unsigned char __ATTRS_o_ai |
| 5147 | vec_vsr(vector unsigned char a, vector unsigned int b) |
| 5148 | { |
| 5149 | return (vector unsigned char)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5150 | } |
| 5151 | |
| 5152 | static vector short __ATTRS_o_ai |
| 5153 | vec_vsr(vector short a, vector unsigned char b) |
| 5154 | { |
| 5155 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5156 | } |
| 5157 | |
| 5158 | static vector short __ATTRS_o_ai |
| 5159 | vec_vsr(vector short a, vector unsigned short b) |
| 5160 | { |
| 5161 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5162 | } |
| 5163 | |
| 5164 | static vector short __ATTRS_o_ai |
| 5165 | vec_vsr(vector short a, vector unsigned int b) |
| 5166 | { |
| 5167 | return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5168 | } |
| 5169 | |
| 5170 | static vector unsigned short __ATTRS_o_ai |
| 5171 | vec_vsr(vector unsigned short a, vector unsigned char b) |
| 5172 | { |
| 5173 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5174 | } |
| 5175 | |
| 5176 | static vector unsigned short __ATTRS_o_ai |
| 5177 | vec_vsr(vector unsigned short a, vector unsigned short b) |
| 5178 | { |
| 5179 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5180 | } |
| 5181 | |
| 5182 | static vector unsigned short __ATTRS_o_ai |
| 5183 | vec_vsr(vector unsigned short a, vector unsigned int b) |
| 5184 | { |
| 5185 | return (vector unsigned short)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5186 | } |
| 5187 | |
| 5188 | static vector int __ATTRS_o_ai |
| 5189 | vec_vsr(vector int a, vector unsigned char b) |
| 5190 | { |
| 5191 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 5192 | } |
| 5193 | |
| 5194 | static vector int __ATTRS_o_ai |
| 5195 | vec_vsr(vector int a, vector unsigned short b) |
| 5196 | { |
| 5197 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 5198 | } |
| 5199 | |
| 5200 | static vector int __ATTRS_o_ai |
| 5201 | vec_vsr(vector int a, vector unsigned int b) |
| 5202 | { |
| 5203 | return (vector int)__builtin_altivec_vsr(a, (vector int)b); |
| 5204 | } |
| 5205 | |
| 5206 | static vector unsigned int __ATTRS_o_ai |
| 5207 | vec_vsr(vector unsigned int a, vector unsigned char b) |
| 5208 | { |
| 5209 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5210 | } |
| 5211 | |
| 5212 | static vector unsigned int __ATTRS_o_ai |
| 5213 | vec_vsr(vector unsigned int a, vector unsigned short b) |
| 5214 | { |
| 5215 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5216 | } |
| 5217 | |
| 5218 | static vector unsigned int __ATTRS_o_ai |
| 5219 | vec_vsr(vector unsigned int a, vector unsigned int b) |
| 5220 | { |
| 5221 | return (vector unsigned int)__builtin_altivec_vsr((vector int)a, (vector int)b); |
| 5222 | } |
| 5223 | |
| 5224 | /* vec_sro */ |
| 5225 | |
| 5226 | static vector signed char __ATTRS_o_ai |
| 5227 | vec_sro(vector signed char a, vector signed char b) |
| 5228 | { |
| 5229 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5230 | } |
| 5231 | |
| 5232 | static vector signed char __ATTRS_o_ai |
| 5233 | vec_sro(vector signed char a, vector unsigned char b) |
| 5234 | { |
| 5235 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5236 | } |
| 5237 | |
| 5238 | static vector unsigned char __ATTRS_o_ai |
| 5239 | vec_sro(vector unsigned char a, vector signed char b) |
| 5240 | { |
| 5241 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5242 | } |
| 5243 | |
| 5244 | static vector unsigned char __ATTRS_o_ai |
| 5245 | vec_sro(vector unsigned char a, vector unsigned char b) |
| 5246 | { |
| 5247 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5248 | } |
| 5249 | |
| 5250 | static vector short __ATTRS_o_ai |
| 5251 | vec_sro(vector short a, vector signed char b) |
| 5252 | { |
| 5253 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5254 | } |
| 5255 | |
| 5256 | static vector short __ATTRS_o_ai |
| 5257 | vec_sro(vector short a, vector unsigned char b) |
| 5258 | { |
| 5259 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5260 | } |
| 5261 | |
| 5262 | static vector unsigned short __ATTRS_o_ai |
| 5263 | vec_sro(vector unsigned short a, vector signed char b) |
| 5264 | { |
| 5265 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5266 | } |
| 5267 | |
| 5268 | static vector unsigned short __ATTRS_o_ai |
| 5269 | vec_sro(vector unsigned short a, vector unsigned char b) |
| 5270 | { |
| 5271 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5272 | } |
| 5273 | |
| 5274 | static vector int __ATTRS_o_ai |
| 5275 | vec_sro(vector int a, vector signed char b) |
| 5276 | { |
| 5277 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 5278 | } |
| 5279 | |
| 5280 | static vector int __ATTRS_o_ai |
| 5281 | vec_sro(vector int a, vector unsigned char b) |
| 5282 | { |
| 5283 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 5284 | } |
| 5285 | |
| 5286 | static vector unsigned int __ATTRS_o_ai |
| 5287 | vec_sro(vector unsigned int a, vector signed char b) |
| 5288 | { |
| 5289 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5290 | } |
| 5291 | |
| 5292 | static vector unsigned int __ATTRS_o_ai |
| 5293 | vec_sro(vector unsigned int a, vector unsigned char b) |
| 5294 | { |
| 5295 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5296 | } |
| 5297 | |
| 5298 | static vector float __ATTRS_o_ai |
| 5299 | vec_sro(vector float a, vector signed char b) |
| 5300 | { |
| 5301 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5302 | } |
| 5303 | |
| 5304 | static vector float __ATTRS_o_ai |
| 5305 | vec_sro(vector float a, vector unsigned char b) |
| 5306 | { |
| 5307 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5308 | } |
| 5309 | |
| 5310 | /* vec_vsro */ |
| 5311 | |
| 5312 | static vector signed char __ATTRS_o_ai |
| 5313 | vec_vsro(vector signed char a, vector signed char b) |
| 5314 | { |
| 5315 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5316 | } |
| 5317 | |
| 5318 | static vector signed char __ATTRS_o_ai |
| 5319 | vec_vsro(vector signed char a, vector unsigned char b) |
| 5320 | { |
| 5321 | return (vector signed char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5322 | } |
| 5323 | |
| 5324 | static vector unsigned char __ATTRS_o_ai |
| 5325 | vec_vsro(vector unsigned char a, vector signed char b) |
| 5326 | { |
| 5327 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5328 | } |
| 5329 | |
| 5330 | static vector unsigned char __ATTRS_o_ai |
| 5331 | vec_vsro(vector unsigned char a, vector unsigned char b) |
| 5332 | { |
| 5333 | return (vector unsigned char)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5334 | } |
| 5335 | |
| 5336 | static vector short __ATTRS_o_ai |
| 5337 | vec_vsro(vector short a, vector signed char b) |
| 5338 | { |
| 5339 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5340 | } |
| 5341 | |
| 5342 | static vector short __ATTRS_o_ai |
| 5343 | vec_vsro(vector short a, vector unsigned char b) |
| 5344 | { |
| 5345 | return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5346 | } |
| 5347 | |
| 5348 | static vector unsigned short __ATTRS_o_ai |
| 5349 | vec_vsro(vector unsigned short a, vector signed char b) |
| 5350 | { |
| 5351 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5352 | } |
| 5353 | |
| 5354 | static vector unsigned short __ATTRS_o_ai |
| 5355 | vec_vsro(vector unsigned short a, vector unsigned char b) |
| 5356 | { |
| 5357 | return (vector unsigned short)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5358 | } |
| 5359 | |
| 5360 | static vector int __ATTRS_o_ai |
| 5361 | vec_vsro(vector int a, vector signed char b) |
| 5362 | { |
| 5363 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 5364 | } |
| 5365 | |
| 5366 | static vector int __ATTRS_o_ai |
| 5367 | vec_vsro(vector int a, vector unsigned char b) |
| 5368 | { |
| 5369 | return (vector int)__builtin_altivec_vsro(a, (vector int)b); |
| 5370 | } |
| 5371 | |
| 5372 | static vector unsigned int __ATTRS_o_ai |
| 5373 | vec_vsro(vector unsigned int a, vector signed char b) |
| 5374 | { |
| 5375 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5376 | } |
| 5377 | |
| 5378 | static vector unsigned int __ATTRS_o_ai |
| 5379 | vec_vsro(vector unsigned int a, vector unsigned char b) |
| 5380 | { |
| 5381 | return (vector unsigned int)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5382 | } |
| 5383 | |
| 5384 | static vector float __ATTRS_o_ai |
| 5385 | vec_vsro(vector float a, vector signed char b) |
| 5386 | { |
| 5387 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5388 | } |
| 5389 | |
| 5390 | static vector float __ATTRS_o_ai |
| 5391 | vec_vsro(vector float a, vector unsigned char b) |
| 5392 | { |
| 5393 | return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b); |
| 5394 | } |
| 5395 | |
| 5396 | /* vec_st */ |
| 5397 | |
| 5398 | static void __ATTRS_o_ai |
| 5399 | vec_st(vector signed char a, int b, vector signed char *c) |
| 5400 | { |
| 5401 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5402 | } |
| 5403 | |
| 5404 | static void __ATTRS_o_ai |
| 5405 | vec_st(vector signed char a, int b, signed char *c) |
| 5406 | { |
| 5407 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5408 | } |
| 5409 | |
| 5410 | static void __ATTRS_o_ai |
| 5411 | vec_st(vector unsigned char a, int b, vector unsigned char *c) |
| 5412 | { |
| 5413 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5414 | } |
| 5415 | |
| 5416 | static void __ATTRS_o_ai |
| 5417 | vec_st(vector unsigned char a, int b, unsigned char *c) |
| 5418 | { |
| 5419 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5420 | } |
| 5421 | |
| 5422 | static void __ATTRS_o_ai |
| 5423 | vec_st(vector short a, int b, vector short *c) |
| 5424 | { |
| 5425 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5426 | } |
| 5427 | |
| 5428 | static void __ATTRS_o_ai |
| 5429 | vec_st(vector short a, int b, short *c) |
| 5430 | { |
| 5431 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5432 | } |
| 5433 | |
| 5434 | static void __ATTRS_o_ai |
| 5435 | vec_st(vector unsigned short a, int b, vector unsigned short *c) |
| 5436 | { |
| 5437 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5438 | } |
| 5439 | |
| 5440 | static void __ATTRS_o_ai |
| 5441 | vec_st(vector unsigned short a, int b, unsigned short *c) |
| 5442 | { |
| 5443 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5444 | } |
| 5445 | |
| 5446 | static void __ATTRS_o_ai |
| 5447 | vec_st(vector int a, int b, vector int *c) |
| 5448 | { |
| 5449 | __builtin_altivec_stvx(a, b, c); |
| 5450 | } |
| 5451 | |
| 5452 | static void __ATTRS_o_ai |
| 5453 | vec_st(vector int a, int b, int *c) |
| 5454 | { |
| 5455 | __builtin_altivec_stvx(a, b, c); |
| 5456 | } |
| 5457 | |
| 5458 | static void __ATTRS_o_ai |
| 5459 | vec_st(vector unsigned int a, int b, vector unsigned int *c) |
| 5460 | { |
| 5461 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5462 | } |
| 5463 | |
| 5464 | static void __ATTRS_o_ai |
| 5465 | vec_st(vector unsigned int a, int b, unsigned int *c) |
| 5466 | { |
| 5467 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5468 | } |
| 5469 | |
| 5470 | static void __ATTRS_o_ai |
| 5471 | vec_st(vector float a, int b, vector float *c) |
| 5472 | { |
| 5473 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5474 | } |
| 5475 | |
| 5476 | static void __ATTRS_o_ai |
| 5477 | vec_st(vector float a, int b, float *c) |
| 5478 | { |
| 5479 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5480 | } |
| 5481 | |
| 5482 | /* vec_stvx */ |
| 5483 | |
| 5484 | static void __ATTRS_o_ai |
| 5485 | vec_stvx(vector signed char a, int b, vector signed char *c) |
| 5486 | { |
| 5487 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5488 | } |
| 5489 | |
| 5490 | static void __ATTRS_o_ai |
| 5491 | vec_stvx(vector signed char a, int b, signed char *c) |
| 5492 | { |
| 5493 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5494 | } |
| 5495 | |
| 5496 | static void __ATTRS_o_ai |
| 5497 | vec_stvx(vector unsigned char a, int b, vector unsigned char *c) |
| 5498 | { |
| 5499 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5500 | } |
| 5501 | |
| 5502 | static void __ATTRS_o_ai |
| 5503 | vec_stvx(vector unsigned char a, int b, unsigned char *c) |
| 5504 | { |
| 5505 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5506 | } |
| 5507 | |
| 5508 | static void __ATTRS_o_ai |
| 5509 | vec_stvx(vector short a, int b, vector short *c) |
| 5510 | { |
| 5511 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5512 | } |
| 5513 | |
| 5514 | static void __ATTRS_o_ai |
| 5515 | vec_stvx(vector short a, int b, short *c) |
| 5516 | { |
| 5517 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5518 | } |
| 5519 | |
| 5520 | static void __ATTRS_o_ai |
| 5521 | vec_stvx(vector unsigned short a, int b, vector unsigned short *c) |
| 5522 | { |
| 5523 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5524 | } |
| 5525 | |
| 5526 | static void __ATTRS_o_ai |
| 5527 | vec_stvx(vector unsigned short a, int b, unsigned short *c) |
| 5528 | { |
| 5529 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5530 | } |
| 5531 | |
| 5532 | static void __ATTRS_o_ai |
| 5533 | vec_stvx(vector int a, int b, vector int *c) |
| 5534 | { |
| 5535 | __builtin_altivec_stvx(a, b, c); |
| 5536 | } |
| 5537 | |
| 5538 | static void __ATTRS_o_ai |
| 5539 | vec_stvx(vector int a, int b, int *c) |
| 5540 | { |
| 5541 | __builtin_altivec_stvx(a, b, c); |
| 5542 | } |
| 5543 | |
| 5544 | static void __ATTRS_o_ai |
| 5545 | vec_stvx(vector unsigned int a, int b, vector unsigned int *c) |
| 5546 | { |
| 5547 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5548 | } |
| 5549 | |
| 5550 | static void __ATTRS_o_ai |
| 5551 | vec_stvx(vector unsigned int a, int b, unsigned int *c) |
| 5552 | { |
| 5553 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5554 | } |
| 5555 | |
| 5556 | static void __ATTRS_o_ai |
| 5557 | vec_stvx(vector float a, int b, vector float *c) |
| 5558 | { |
| 5559 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5560 | } |
| 5561 | |
| 5562 | static void __ATTRS_o_ai |
| 5563 | vec_stvx(vector float a, int b, float *c) |
| 5564 | { |
| 5565 | __builtin_altivec_stvx((vector int)a, b, c); |
| 5566 | } |
| 5567 | |
| 5568 | /* vec_ste */ |
| 5569 | |
| 5570 | static void __ATTRS_o_ai |
| 5571 | vec_ste(vector signed char a, int b, signed char *c) |
| 5572 | { |
| 5573 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5574 | } |
| 5575 | |
| 5576 | static void __ATTRS_o_ai |
| 5577 | vec_ste(vector unsigned char a, int b, unsigned char *c) |
| 5578 | { |
| 5579 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5580 | } |
| 5581 | |
| 5582 | static void __ATTRS_o_ai |
| 5583 | vec_ste(vector short a, int b, short *c) |
| 5584 | { |
| 5585 | __builtin_altivec_stvehx(a, b, c); |
| 5586 | } |
| 5587 | |
| 5588 | static void __ATTRS_o_ai |
| 5589 | vec_ste(vector unsigned short a, int b, unsigned short *c) |
| 5590 | { |
| 5591 | __builtin_altivec_stvehx((vector short)a, b, c); |
| 5592 | } |
| 5593 | |
| 5594 | static void __ATTRS_o_ai |
| 5595 | vec_ste(vector int a, int b, int *c) |
| 5596 | { |
| 5597 | __builtin_altivec_stvewx(a, b, c); |
| 5598 | } |
| 5599 | |
| 5600 | static void __ATTRS_o_ai |
| 5601 | vec_ste(vector unsigned int a, int b, unsigned int *c) |
| 5602 | { |
| 5603 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5604 | } |
| 5605 | |
| 5606 | static void __ATTRS_o_ai |
| 5607 | vec_ste(vector float a, int b, float *c) |
| 5608 | { |
| 5609 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5610 | } |
| 5611 | |
| 5612 | /* vec_stvebx */ |
| 5613 | |
| 5614 | static void __ATTRS_o_ai |
| 5615 | vec_stvebx(vector signed char a, int b, signed char *c) |
| 5616 | { |
| 5617 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5618 | } |
| 5619 | |
| 5620 | static void __ATTRS_o_ai |
| 5621 | vec_stvebx(vector unsigned char a, int b, unsigned char *c) |
| 5622 | { |
| 5623 | __builtin_altivec_stvebx((vector char)a, b, c); |
| 5624 | } |
| 5625 | |
| 5626 | /* vec_stvehx */ |
| 5627 | |
| 5628 | static void __ATTRS_o_ai |
| 5629 | vec_stvehx(vector short a, int b, short *c) |
| 5630 | { |
| 5631 | __builtin_altivec_stvehx(a, b, c); |
| 5632 | } |
| 5633 | |
| 5634 | static void __ATTRS_o_ai |
| 5635 | vec_stvehx(vector unsigned short a, int b, unsigned short *c) |
| 5636 | { |
| 5637 | __builtin_altivec_stvehx((vector short)a, b, c); |
| 5638 | } |
| 5639 | |
| 5640 | /* vec_stvewx */ |
| 5641 | |
| 5642 | static void __ATTRS_o_ai |
| 5643 | vec_stvewx(vector int a, int b, int *c) |
| 5644 | { |
| 5645 | __builtin_altivec_stvewx(a, b, c); |
| 5646 | } |
| 5647 | |
| 5648 | static void __ATTRS_o_ai |
| 5649 | vec_stvewx(vector unsigned int a, int b, unsigned int *c) |
| 5650 | { |
| 5651 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5652 | } |
| 5653 | |
| 5654 | static void __ATTRS_o_ai |
| 5655 | vec_stvewx(vector float a, int b, float *c) |
| 5656 | { |
| 5657 | __builtin_altivec_stvewx((vector int)a, b, c); |
| 5658 | } |
| 5659 | |
| 5660 | /* vec_stl */ |
| 5661 | |
| 5662 | static void __ATTRS_o_ai |
| 5663 | vec_stl(vector signed char a, int b, vector signed char *c) |
| 5664 | { |
| 5665 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5666 | } |
| 5667 | |
| 5668 | static void __ATTRS_o_ai |
| 5669 | vec_stl(vector signed char a, int b, signed char *c) |
| 5670 | { |
| 5671 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5672 | } |
| 5673 | |
| 5674 | static void __ATTRS_o_ai |
| 5675 | vec_stl(vector unsigned char a, int b, vector unsigned char *c) |
| 5676 | { |
| 5677 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5678 | } |
| 5679 | |
| 5680 | static void __ATTRS_o_ai |
| 5681 | vec_stl(vector unsigned char a, int b, unsigned char *c) |
| 5682 | { |
| 5683 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5684 | } |
| 5685 | |
| 5686 | static void __ATTRS_o_ai |
| 5687 | vec_stl(vector short a, int b, vector short *c) |
| 5688 | { |
| 5689 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5690 | } |
| 5691 | |
| 5692 | static void __ATTRS_o_ai |
| 5693 | vec_stl(vector short a, int b, short *c) |
| 5694 | { |
| 5695 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5696 | } |
| 5697 | |
| 5698 | static void __ATTRS_o_ai |
| 5699 | vec_stl(vector unsigned short a, int b, vector unsigned short *c) |
| 5700 | { |
| 5701 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5702 | } |
| 5703 | |
| 5704 | static void __ATTRS_o_ai |
| 5705 | vec_stl(vector unsigned short a, int b, unsigned short *c) |
| 5706 | { |
| 5707 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5708 | } |
| 5709 | |
| 5710 | static void __ATTRS_o_ai |
| 5711 | vec_stl(vector int a, int b, vector int *c) |
| 5712 | { |
| 5713 | __builtin_altivec_stvxl(a, b, c); |
| 5714 | } |
| 5715 | |
| 5716 | static void __ATTRS_o_ai |
| 5717 | vec_stl(vector int a, int b, int *c) |
| 5718 | { |
| 5719 | __builtin_altivec_stvxl(a, b, c); |
| 5720 | } |
| 5721 | |
| 5722 | static void __ATTRS_o_ai |
| 5723 | vec_stl(vector unsigned int a, int b, vector unsigned int *c) |
| 5724 | { |
| 5725 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5726 | } |
| 5727 | |
| 5728 | static void __ATTRS_o_ai |
| 5729 | vec_stl(vector unsigned int a, int b, unsigned int *c) |
| 5730 | { |
| 5731 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5732 | } |
| 5733 | |
| 5734 | static void __ATTRS_o_ai |
| 5735 | vec_stl(vector float a, int b, vector float *c) |
| 5736 | { |
| 5737 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5738 | } |
| 5739 | |
| 5740 | static void __ATTRS_o_ai |
| 5741 | vec_stl(vector float a, int b, float *c) |
| 5742 | { |
| 5743 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5744 | } |
| 5745 | |
| 5746 | /* vec_stvxl */ |
| 5747 | |
| 5748 | static void __ATTRS_o_ai |
| 5749 | vec_stvxl(vector signed char a, int b, vector signed char *c) |
| 5750 | { |
| 5751 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5752 | } |
| 5753 | |
| 5754 | static void __ATTRS_o_ai |
| 5755 | vec_stvxl(vector signed char a, int b, signed char *c) |
| 5756 | { |
| 5757 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5758 | } |
| 5759 | |
| 5760 | static void __ATTRS_o_ai |
| 5761 | vec_stvxl(vector unsigned char a, int b, vector unsigned char *c) |
| 5762 | { |
| 5763 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5764 | } |
| 5765 | |
| 5766 | static void __ATTRS_o_ai |
| 5767 | vec_stvxl(vector unsigned char a, int b, unsigned char *c) |
| 5768 | { |
| 5769 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5770 | } |
| 5771 | |
| 5772 | static void __ATTRS_o_ai |
| 5773 | vec_stvxl(vector short a, int b, vector short *c) |
| 5774 | { |
| 5775 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5776 | } |
| 5777 | |
| 5778 | static void __ATTRS_o_ai |
| 5779 | vec_stvxl(vector short a, int b, short *c) |
| 5780 | { |
| 5781 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5782 | } |
| 5783 | |
| 5784 | static void __ATTRS_o_ai |
| 5785 | vec_stvxl(vector unsigned short a, int b, vector unsigned short *c) |
| 5786 | { |
| 5787 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5788 | } |
| 5789 | |
| 5790 | static void __ATTRS_o_ai |
| 5791 | vec_stvxl(vector unsigned short a, int b, unsigned short *c) |
| 5792 | { |
| 5793 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5794 | } |
| 5795 | |
| 5796 | static void __ATTRS_o_ai |
| 5797 | vec_stvxl(vector int a, int b, vector int *c) |
| 5798 | { |
| 5799 | __builtin_altivec_stvxl(a, b, c); |
| 5800 | } |
| 5801 | |
| 5802 | static void __ATTRS_o_ai |
| 5803 | vec_stvxl(vector int a, int b, int *c) |
| 5804 | { |
| 5805 | __builtin_altivec_stvxl(a, b, c); |
| 5806 | } |
| 5807 | |
| 5808 | static void __ATTRS_o_ai |
| 5809 | vec_stvxl(vector unsigned int a, int b, vector unsigned int *c) |
| 5810 | { |
| 5811 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5812 | } |
| 5813 | |
| 5814 | static void __ATTRS_o_ai |
| 5815 | vec_stvxl(vector unsigned int a, int b, unsigned int *c) |
| 5816 | { |
| 5817 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5818 | } |
| 5819 | |
| 5820 | static void __ATTRS_o_ai |
| 5821 | vec_stvxl(vector float a, int b, vector float *c) |
| 5822 | { |
| 5823 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5824 | } |
| 5825 | |
| 5826 | static void __ATTRS_o_ai |
| 5827 | vec_stvxl(vector float a, int b, float *c) |
| 5828 | { |
| 5829 | __builtin_altivec_stvxl((vector int)a, b, c); |
| 5830 | } |
| 5831 | |
| 5832 | /* vec_sub */ |
| 5833 | |
| 5834 | static vector signed char __ATTRS_o_ai |
| 5835 | vec_sub(vector signed char a, vector signed char b) |
| 5836 | { |
| 5837 | return a - b; |
| 5838 | } |
| 5839 | |
| 5840 | static vector unsigned char __ATTRS_o_ai |
| 5841 | vec_sub(vector unsigned char a, vector unsigned char b) |
| 5842 | { |
| 5843 | return a - b; |
| 5844 | } |
| 5845 | |
| 5846 | static vector short __ATTRS_o_ai |
| 5847 | vec_sub(vector short a, vector short b) |
| 5848 | { |
| 5849 | return a - b; |
| 5850 | } |
| 5851 | |
| 5852 | static vector unsigned short __ATTRS_o_ai |
| 5853 | vec_sub(vector unsigned short a, vector unsigned short b) |
| 5854 | { |
| 5855 | return a - b; |
| 5856 | } |
| 5857 | |
| 5858 | static vector int __ATTRS_o_ai |
| 5859 | vec_sub(vector int a, vector int b) |
| 5860 | { |
| 5861 | return a - b; |
| 5862 | } |
| 5863 | |
| 5864 | static vector unsigned int __ATTRS_o_ai |
| 5865 | vec_sub(vector unsigned int a, vector unsigned int b) |
| 5866 | { |
| 5867 | return a - b; |
| 5868 | } |
| 5869 | |
| 5870 | static vector float __ATTRS_o_ai |
| 5871 | vec_sub(vector float a, vector float b) |
| 5872 | { |
| 5873 | return a - b; |
| 5874 | } |
| 5875 | |
| 5876 | /* vec_vsububm */ |
| 5877 | |
| 5878 | #define __builtin_altivec_vsububm vec_vsububm |
| 5879 | |
| 5880 | static vector signed char __ATTRS_o_ai |
| 5881 | vec_vsububm(vector signed char a, vector signed char b) |
| 5882 | { |
| 5883 | return a - b; |
| 5884 | } |
| 5885 | |
| 5886 | static vector unsigned char __ATTRS_o_ai |
| 5887 | vec_vsububm(vector unsigned char a, vector unsigned char b) |
| 5888 | { |
| 5889 | return a - b; |
| 5890 | } |
| 5891 | |
| 5892 | /* vec_vsubuhm */ |
| 5893 | |
| 5894 | #define __builtin_altivec_vsubuhm vec_vsubuhm |
| 5895 | |
| 5896 | static vector short __ATTRS_o_ai |
| 5897 | vec_vsubuhm(vector short a, vector short b) |
| 5898 | { |
| 5899 | return a - b; |
| 5900 | } |
| 5901 | |
| 5902 | static vector unsigned short __ATTRS_o_ai |
| 5903 | vec_vsubuhm(vector unsigned short a, vector unsigned short b) |
| 5904 | { |
| 5905 | return a - b; |
| 5906 | } |
| 5907 | |
| 5908 | /* vec_vsubuwm */ |
| 5909 | |
| 5910 | #define __builtin_altivec_vsubuwm vec_vsubuwm |
| 5911 | |
| 5912 | static vector int __ATTRS_o_ai |
| 5913 | vec_vsubuwm(vector int a, vector int b) |
| 5914 | { |
| 5915 | return a - b; |
| 5916 | } |
| 5917 | |
| 5918 | static vector unsigned int __ATTRS_o_ai |
| 5919 | vec_vsubuwm(vector unsigned int a, vector unsigned int b) |
| 5920 | { |
| 5921 | return a - b; |
| 5922 | } |
| 5923 | |
| 5924 | /* vec_vsubfp */ |
| 5925 | |
| 5926 | #define __builtin_altivec_vsubfp vec_vsubfp |
| 5927 | |
| 5928 | static vector float __attribute__((__always_inline__)) |
| 5929 | vec_vsubfp(vector float a, vector float b) |
| 5930 | { |
| 5931 | return a - b; |
| 5932 | } |
| 5933 | |
| 5934 | /* vec_subc */ |
| 5935 | |
| 5936 | static vector unsigned int __attribute__((__always_inline__)) |
| 5937 | vec_subc(vector unsigned int a, vector unsigned int b) |
| 5938 | { |
| 5939 | return __builtin_altivec_vsubcuw(a, b); |
| 5940 | } |
| 5941 | |
| 5942 | /* vec_vsubcuw */ |
| 5943 | |
| 5944 | static vector unsigned int __attribute__((__always_inline__)) |
| 5945 | vec_vsubcuw(vector unsigned int a, vector unsigned int b) |
| 5946 | { |
| 5947 | return __builtin_altivec_vsubcuw(a, b); |
| 5948 | } |
| 5949 | |
| 5950 | /* vec_subs */ |
| 5951 | |
| 5952 | static vector signed char __ATTRS_o_ai |
| 5953 | vec_subs(vector signed char a, vector signed char b) |
| 5954 | { |
| 5955 | return __builtin_altivec_vsubsbs(a, b); |
| 5956 | } |
| 5957 | |
| 5958 | static vector unsigned char __ATTRS_o_ai |
| 5959 | vec_subs(vector unsigned char a, vector unsigned char b) |
| 5960 | { |
| 5961 | return __builtin_altivec_vsububs(a, b); |
| 5962 | } |
| 5963 | |
| 5964 | static vector short __ATTRS_o_ai |
| 5965 | vec_subs(vector short a, vector short b) |
| 5966 | { |
| 5967 | return __builtin_altivec_vsubshs(a, b); |
| 5968 | } |
| 5969 | |
| 5970 | static vector unsigned short __ATTRS_o_ai |
| 5971 | vec_subs(vector unsigned short a, vector unsigned short b) |
| 5972 | { |
| 5973 | return __builtin_altivec_vsubuhs(a, b); |
| 5974 | } |
| 5975 | |
| 5976 | static vector int __ATTRS_o_ai |
| 5977 | vec_subs(vector int a, vector int b) |
| 5978 | { |
| 5979 | return __builtin_altivec_vsubsws(a, b); |
| 5980 | } |
| 5981 | |
| 5982 | static vector unsigned int __ATTRS_o_ai |
| 5983 | vec_subs(vector unsigned int a, vector unsigned int b) |
| 5984 | { |
| 5985 | return __builtin_altivec_vsubuws(a, b); |
| 5986 | } |
| 5987 | |
| 5988 | /* vec_vsubsbs */ |
| 5989 | |
| 5990 | static vector signed char __attribute__((__always_inline__)) |
| 5991 | vec_vsubsbs(vector signed char a, vector signed char b) |
| 5992 | { |
| 5993 | return __builtin_altivec_vsubsbs(a, b); |
| 5994 | } |
| 5995 | |
| 5996 | /* vec_vsububs */ |
| 5997 | |
| 5998 | static vector unsigned char __attribute__((__always_inline__)) |
| 5999 | vec_vsububs(vector unsigned char a, vector unsigned char b) |
| 6000 | { |
| 6001 | return __builtin_altivec_vsububs(a, b); |
| 6002 | } |
| 6003 | |
| 6004 | /* vec_vsubshs */ |
| 6005 | |
| 6006 | static vector short __attribute__((__always_inline__)) |
| 6007 | vec_vsubshs(vector short a, vector short b) |
| 6008 | { |
| 6009 | return __builtin_altivec_vsubshs(a, b); |
| 6010 | } |
| 6011 | |
| 6012 | /* vec_vsubuhs */ |
| 6013 | |
| 6014 | static vector unsigned short __attribute__((__always_inline__)) |
| 6015 | vec_vsubuhs(vector unsigned short a, vector unsigned short b) |
| 6016 | { |
| 6017 | return __builtin_altivec_vsubuhs(a, b); |
| 6018 | } |
| 6019 | |
| 6020 | /* vec_vsubsws */ |
| 6021 | |
| 6022 | static vector int __attribute__((__always_inline__)) |
| 6023 | vec_vsubsws(vector int a, vector int b) |
| 6024 | { |
| 6025 | return __builtin_altivec_vsubsws(a, b); |
| 6026 | } |
| 6027 | |
| 6028 | /* vec_vsubuws */ |
| 6029 | |
| 6030 | static vector unsigned int __attribute__((__always_inline__)) |
| 6031 | vec_vsubuws(vector unsigned int a, vector unsigned int b) |
| 6032 | { |
| 6033 | return __builtin_altivec_vsubuws(a, b); |
| 6034 | } |
| 6035 | |
| 6036 | /* vec_sum4s */ |
| 6037 | |
| 6038 | static vector int __ATTRS_o_ai |
| 6039 | vec_sum4s(vector signed char a, vector int b) |
| 6040 | { |
| 6041 | return __builtin_altivec_vsum4sbs(a, b); |
| 6042 | } |
| 6043 | |
| 6044 | static vector unsigned int __ATTRS_o_ai |
| 6045 | vec_sum4s(vector unsigned char a, vector unsigned int b) |
| 6046 | { |
| 6047 | return __builtin_altivec_vsum4ubs(a, b); |
| 6048 | } |
| 6049 | |
| 6050 | static vector int __ATTRS_o_ai |
| 6051 | vec_sum4s(vector signed short a, vector int b) |
| 6052 | { |
| 6053 | return __builtin_altivec_vsum4shs(a, b); |
| 6054 | } |
| 6055 | |
| 6056 | /* vec_vsum4sbs */ |
| 6057 | |
| 6058 | static vector int __attribute__((__always_inline__)) |
| 6059 | vec_vsum4sbs(vector signed char a, vector int b) |
| 6060 | { |
| 6061 | return __builtin_altivec_vsum4sbs(a, b); |
| 6062 | } |
| 6063 | |
| 6064 | /* vec_vsum4ubs */ |
| 6065 | |
| 6066 | static vector unsigned int __attribute__((__always_inline__)) |
| 6067 | vec_vsum4ubs(vector unsigned char a, vector unsigned int b) |
| 6068 | { |
| 6069 | return __builtin_altivec_vsum4ubs(a, b); |
| 6070 | } |
| 6071 | |
| 6072 | /* vec_vsum4shs */ |
| 6073 | |
| 6074 | static vector int __attribute__((__always_inline__)) |
| 6075 | vec_vsum4shs(vector signed short a, vector int b) |
| 6076 | { |
| 6077 | return __builtin_altivec_vsum4shs(a, b); |
| 6078 | } |
| 6079 | |
| 6080 | /* vec_sum2s */ |
| 6081 | |
| 6082 | static vector signed int __attribute__((__always_inline__)) |
| 6083 | vec_sum2s(vector int a, vector int b) |
| 6084 | { |
| 6085 | return __builtin_altivec_vsum2sws(a, b); |
| 6086 | } |
| 6087 | |
| 6088 | /* vec_vsum2sws */ |
| 6089 | |
| 6090 | static vector signed int __attribute__((__always_inline__)) |
| 6091 | vec_vsum2sws(vector int a, vector int b) |
| 6092 | { |
| 6093 | return __builtin_altivec_vsum2sws(a, b); |
| 6094 | } |
| 6095 | |
| 6096 | /* vec_sums */ |
| 6097 | |
| 6098 | static vector signed int __attribute__((__always_inline__)) |
| 6099 | vec_sums(vector signed int a, vector signed int b) |
| 6100 | { |
| 6101 | return __builtin_altivec_vsumsws(a, b); |
| 6102 | } |
| 6103 | |
| 6104 | /* vec_vsumsws */ |
| 6105 | |
| 6106 | static vector signed int __attribute__((__always_inline__)) |
| 6107 | vec_vsumsws(vector signed int a, vector signed int b) |
| 6108 | { |
| 6109 | return __builtin_altivec_vsumsws(a, b); |
| 6110 | } |
| 6111 | |
| 6112 | /* vec_trunc */ |
| 6113 | |
| 6114 | static vector float __attribute__((__always_inline__)) |
| 6115 | vec_trunc(vector float a) |
| 6116 | { |
| 6117 | return __builtin_altivec_vrfiz(a); |
| 6118 | } |
| 6119 | |
| 6120 | /* vec_vrfiz */ |
| 6121 | |
| 6122 | static vector float __attribute__((__always_inline__)) |
| 6123 | vec_vrfiz(vector float a) |
| 6124 | { |
| 6125 | return __builtin_altivec_vrfiz(a); |
| 6126 | } |
| 6127 | |
| 6128 | /* vec_unpackh */ |
| 6129 | |
| 6130 | static vector short __ATTRS_o_ai |
| 6131 | vec_unpackh(vector signed char a) |
| 6132 | { |
| 6133 | return __builtin_altivec_vupkhsb((vector char)a); |
| 6134 | } |
| 6135 | |
| 6136 | static vector int __ATTRS_o_ai |
| 6137 | vec_unpackh(vector short a) |
| 6138 | { |
| 6139 | return __builtin_altivec_vupkhsh(a); |
| 6140 | } |
| 6141 | |
| 6142 | /* vec_vupkhsb */ |
| 6143 | |
| 6144 | static vector short __attribute__((__always_inline__)) |
| 6145 | vec_vupkhsb(vector signed char a) |
| 6146 | { |
| 6147 | return __builtin_altivec_vupkhsb((vector char)a); |
| 6148 | } |
| 6149 | |
| 6150 | /* vec_vupkhsh */ |
| 6151 | |
| 6152 | static vector int __attribute__((__always_inline__)) |
| 6153 | vec_vupkhsh(vector short a) |
| 6154 | { |
| 6155 | return __builtin_altivec_vupkhsh(a); |
| 6156 | } |
| 6157 | |
| 6158 | /* vec_unpackl */ |
| 6159 | |
| 6160 | static vector short __ATTRS_o_ai |
| 6161 | vec_unpackl(vector signed char a) |
| 6162 | { |
| 6163 | return __builtin_altivec_vupklsb((vector char)a); |
| 6164 | } |
| 6165 | |
| 6166 | static vector int __ATTRS_o_ai |
| 6167 | vec_unpackl(vector short a) |
| 6168 | { |
| 6169 | return __builtin_altivec_vupklsh(a); |
| 6170 | } |
| 6171 | |
| 6172 | /* vec_vupklsb */ |
| 6173 | |
| 6174 | static vector short __attribute__((__always_inline__)) |
| 6175 | vec_vupklsb(vector signed char a) |
| 6176 | { |
| 6177 | return __builtin_altivec_vupklsb((vector char)a); |
| 6178 | } |
| 6179 | |
| 6180 | /* vec_vupklsh */ |
| 6181 | |
| 6182 | static vector int __attribute__((__always_inline__)) |
| 6183 | vec_vupklsh(vector short a) |
| 6184 | { |
| 6185 | return __builtin_altivec_vupklsh(a); |
| 6186 | } |
| 6187 | |
| 6188 | /* vec_xor */ |
| 6189 | |
| 6190 | #define __builtin_altivec_vxor vec_xor |
| 6191 | |
| 6192 | static vector signed char __ATTRS_o_ai |
| 6193 | vec_xor(vector signed char a, vector signed char b) |
| 6194 | { |
| 6195 | return a ^ b; |
| 6196 | } |
| 6197 | |
| 6198 | static vector unsigned char __ATTRS_o_ai |
| 6199 | vec_xor(vector unsigned char a, vector unsigned char b) |
| 6200 | { |
| 6201 | return a ^ b; |
| 6202 | } |
| 6203 | |
| 6204 | static vector short __ATTRS_o_ai |
| 6205 | vec_xor(vector short a, vector short b) |
| 6206 | { |
| 6207 | return a ^ b; |
| 6208 | } |
| 6209 | |
| 6210 | static vector unsigned short __ATTRS_o_ai |
| 6211 | vec_xor(vector unsigned short a, vector unsigned short b) |
| 6212 | { |
| 6213 | return a ^ b; |
| 6214 | } |
| 6215 | |
| 6216 | static vector int __ATTRS_o_ai |
| 6217 | vec_xor(vector int a, vector int b) |
| 6218 | { |
| 6219 | return a ^ b; |
| 6220 | } |
| 6221 | |
| 6222 | static vector unsigned int __ATTRS_o_ai |
| 6223 | vec_xor(vector unsigned int a, vector unsigned int b) |
| 6224 | { |
| 6225 | return a ^ b; |
| 6226 | } |
| 6227 | |
| 6228 | static vector float __ATTRS_o_ai |
| 6229 | vec_xor(vector float a, vector float b) |
| 6230 | { |
| 6231 | vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b; |
| 6232 | return (vector float)res; |
| 6233 | } |
| 6234 | |
| 6235 | /* vec_vxor */ |
| 6236 | |
| 6237 | static vector signed char __ATTRS_o_ai |
| 6238 | vec_vxor(vector signed char a, vector signed char b) |
| 6239 | { |
| 6240 | return a ^ b; |
| 6241 | } |
| 6242 | |
| 6243 | static vector unsigned char __ATTRS_o_ai |
| 6244 | vec_vxor(vector unsigned char a, vector unsigned char b) |
| 6245 | { |
| 6246 | return a ^ b; |
| 6247 | } |
| 6248 | |
| 6249 | static vector short __ATTRS_o_ai |
| 6250 | vec_vxor(vector short a, vector short b) |
| 6251 | { |
| 6252 | return a ^ b; |
| 6253 | } |
| 6254 | |
| 6255 | static vector unsigned short __ATTRS_o_ai |
| 6256 | vec_vxor(vector unsigned short a, vector unsigned short b) |
| 6257 | { |
| 6258 | return a ^ b; |
| 6259 | } |
| 6260 | |
| 6261 | static vector int __ATTRS_o_ai |
| 6262 | vec_vxor(vector int a, vector int b) |
| 6263 | { |
| 6264 | return a ^ b; |
| 6265 | } |
| 6266 | |
| 6267 | static vector unsigned int __ATTRS_o_ai |
| 6268 | vec_vxor(vector unsigned int a, vector unsigned int b) |
| 6269 | { |
| 6270 | return a ^ b; |
| 6271 | } |
| 6272 | |
| 6273 | static vector float __ATTRS_o_ai |
| 6274 | vec_vxor(vector float a, vector float b) |
| 6275 | { |
| 6276 | vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b; |
| 6277 | return (vector float)res; |
| 6278 | } |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6279 | |
| 6280 | /* ------------------------------ predicates ------------------------------------ */ |
| 6281 | |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6282 | /* vec_all_eq */ |
| 6283 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6284 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6285 | vec_all_eq(vector signed char a, vector signed char b) |
| 6286 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6287 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6288 | } |
| 6289 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6290 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6291 | vec_all_eq(vector unsigned char a, vector unsigned char b) |
| 6292 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6293 | return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6294 | } |
| 6295 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6296 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6297 | vec_all_eq(vector short a, vector short b) |
| 6298 | { |
| 6299 | return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b); |
| 6300 | } |
| 6301 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6302 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6303 | vec_all_eq(vector unsigned short a, vector unsigned short b) |
| 6304 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6305 | return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6306 | } |
| 6307 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6308 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6309 | vec_all_eq(vector int a, vector int b) |
| 6310 | { |
| 6311 | return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b); |
| 6312 | } |
| 6313 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6314 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6315 | vec_all_eq(vector unsigned int a, vector unsigned int b) |
| 6316 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6317 | return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6318 | } |
| 6319 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6320 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6321 | vec_all_eq(vector float a, vector float b) |
| 6322 | { |
| 6323 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b); |
| 6324 | } |
| 6325 | |
| 6326 | /* vec_all_ge */ |
| 6327 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6328 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6329 | vec_all_ge(vector signed char a, vector signed char b) |
| 6330 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6331 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6332 | } |
| 6333 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6334 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6335 | vec_all_ge(vector unsigned char a, vector unsigned char b) |
| 6336 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6337 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6338 | } |
| 6339 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6340 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6341 | vec_all_ge(vector short a, vector short b) |
| 6342 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6343 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6344 | } |
| 6345 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6346 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6347 | vec_all_ge(vector unsigned short a, vector unsigned short b) |
| 6348 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6349 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6350 | } |
| 6351 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6352 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6353 | vec_all_ge(vector int a, vector int b) |
| 6354 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6355 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6356 | } |
| 6357 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6358 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6359 | vec_all_ge(vector unsigned int a, vector unsigned int b) |
| 6360 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6361 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6362 | } |
| 6363 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6364 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6365 | vec_all_ge(vector float a, vector float b) |
| 6366 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6367 | return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6368 | } |
| 6369 | |
| 6370 | /* vec_all_gt */ |
| 6371 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6372 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6373 | vec_all_gt(vector signed char a, vector signed char b) |
| 6374 | { |
| 6375 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b); |
| 6376 | } |
| 6377 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6378 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6379 | vec_all_gt(vector unsigned char a, vector unsigned char b) |
| 6380 | { |
| 6381 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b); |
| 6382 | } |
| 6383 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6384 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6385 | vec_all_gt(vector short a, vector short b) |
| 6386 | { |
| 6387 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b); |
| 6388 | } |
| 6389 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6390 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6391 | vec_all_gt(vector unsigned short a, vector unsigned short b) |
| 6392 | { |
| 6393 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b); |
| 6394 | } |
| 6395 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6396 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6397 | vec_all_gt(vector int a, vector int b) |
| 6398 | { |
| 6399 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b); |
| 6400 | } |
| 6401 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6402 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6403 | vec_all_gt(vector unsigned int a, vector unsigned int b) |
| 6404 | { |
| 6405 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b); |
| 6406 | } |
| 6407 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6408 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6409 | vec_all_gt(vector float a, vector float b) |
| 6410 | { |
| 6411 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b); |
| 6412 | } |
| 6413 | |
| 6414 | /* vec_all_in */ |
| 6415 | |
| 6416 | static int __attribute__((__always_inline__)) |
| 6417 | vec_all_in(vector float a, vector float b) |
| 6418 | { |
| 6419 | return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b); |
| 6420 | } |
| 6421 | |
| 6422 | /* vec_all_le */ |
| 6423 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6424 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6425 | vec_all_le(vector signed char a, vector signed char b) |
| 6426 | { |
| 6427 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b); |
| 6428 | } |
| 6429 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6430 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6431 | vec_all_le(vector unsigned char a, vector unsigned char b) |
| 6432 | { |
| 6433 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b); |
| 6434 | } |
| 6435 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6436 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6437 | vec_all_le(vector short a, vector short b) |
| 6438 | { |
| 6439 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b); |
| 6440 | } |
| 6441 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6442 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6443 | vec_all_le(vector unsigned short a, vector unsigned short b) |
| 6444 | { |
| 6445 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b); |
| 6446 | } |
| 6447 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6448 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6449 | vec_all_le(vector int a, vector int b) |
| 6450 | { |
| 6451 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b); |
| 6452 | } |
| 6453 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6454 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6455 | vec_all_le(vector unsigned int a, vector unsigned int b) |
| 6456 | { |
| 6457 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b); |
| 6458 | } |
| 6459 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6460 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6461 | vec_all_le(vector float a, vector float b) |
| 6462 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6463 | return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6464 | } |
| 6465 | |
| 6466 | /* vec_all_lt */ |
| 6467 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6468 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6469 | vec_all_lt(vector signed char a, vector signed char b) |
| 6470 | { |
| 6471 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a); |
| 6472 | } |
| 6473 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6474 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6475 | vec_all_lt(vector unsigned char a, vector unsigned char b) |
| 6476 | { |
| 6477 | return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a); |
| 6478 | } |
| 6479 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6480 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6481 | vec_all_lt(vector short a, vector short b) |
| 6482 | { |
| 6483 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a); |
| 6484 | } |
| 6485 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6486 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6487 | vec_all_lt(vector unsigned short a, vector unsigned short b) |
| 6488 | { |
| 6489 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a); |
| 6490 | } |
| 6491 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6492 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6493 | vec_all_lt(vector int a, vector int b) |
| 6494 | { |
| 6495 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a); |
| 6496 | } |
| 6497 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6498 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6499 | vec_all_lt(vector unsigned int a, vector unsigned int b) |
| 6500 | { |
| 6501 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a); |
| 6502 | } |
| 6503 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6504 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6505 | vec_all_lt(vector float a, vector float b) |
| 6506 | { |
| 6507 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a); |
| 6508 | } |
| 6509 | |
| 6510 | /* vec_all_nan */ |
| 6511 | |
| 6512 | static int __attribute__((__always_inline__)) |
| 6513 | vec_all_nan(vector float a) |
| 6514 | { |
| 6515 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a); |
| 6516 | } |
| 6517 | |
| 6518 | /* vec_all_ne */ |
| 6519 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6520 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6521 | vec_all_ne(vector signed char a, vector signed char b) |
| 6522 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6523 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6524 | } |
| 6525 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6526 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6527 | vec_all_ne(vector unsigned char a, vector unsigned char b) |
| 6528 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6529 | return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6530 | } |
| 6531 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6532 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6533 | vec_all_ne(vector short a, vector short b) |
| 6534 | { |
| 6535 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b); |
| 6536 | } |
| 6537 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6538 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6539 | vec_all_ne(vector unsigned short a, vector unsigned short b) |
| 6540 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6541 | return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6542 | } |
| 6543 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6544 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6545 | vec_all_ne(vector int a, vector int b) |
| 6546 | { |
| 6547 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b); |
| 6548 | } |
| 6549 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6550 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6551 | vec_all_ne(vector unsigned int a, vector unsigned int b) |
| 6552 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6553 | return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6554 | } |
| 6555 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6556 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6557 | vec_all_ne(vector float a, vector float b) |
| 6558 | { |
| 6559 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b); |
| 6560 | } |
| 6561 | |
| 6562 | /* vec_all_nge */ |
| 6563 | |
| 6564 | static int __attribute__((__always_inline__)) |
| 6565 | vec_all_nge(vector float a, vector float b) |
| 6566 | { |
| 6567 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b); |
| 6568 | } |
| 6569 | |
| 6570 | /* vec_all_ngt */ |
| 6571 | |
| 6572 | static int __attribute__((__always_inline__)) |
| 6573 | vec_all_ngt(vector float a, vector float b) |
| 6574 | { |
| 6575 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b); |
| 6576 | } |
| 6577 | |
| 6578 | /* vec_all_nle */ |
| 6579 | |
| 6580 | static int __attribute__((__always_inline__)) |
| 6581 | vec_all_nle(vector float a, vector float b) |
| 6582 | { |
| 6583 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a); |
| 6584 | } |
| 6585 | |
| 6586 | /* vec_all_nlt */ |
| 6587 | |
| 6588 | static int __attribute__((__always_inline__)) |
| 6589 | vec_all_nlt(vector float a, vector float b) |
| 6590 | { |
| 6591 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a); |
| 6592 | } |
| 6593 | |
| 6594 | /* vec_all_numeric */ |
| 6595 | |
| 6596 | static int __attribute__((__always_inline__)) |
| 6597 | vec_all_numeric(vector float a) |
| 6598 | { |
| 6599 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a); |
| 6600 | } |
| 6601 | |
| 6602 | /* vec_any_eq */ |
| 6603 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6604 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6605 | vec_any_eq(vector signed char a, vector signed char b) |
| 6606 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6607 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6608 | } |
| 6609 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6610 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6611 | vec_any_eq(vector unsigned char a, vector unsigned char b) |
| 6612 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6613 | return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6614 | } |
| 6615 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6616 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6617 | vec_any_eq(vector short a, vector short b) |
| 6618 | { |
| 6619 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b); |
| 6620 | } |
| 6621 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6622 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6623 | vec_any_eq(vector unsigned short a, vector unsigned short b) |
| 6624 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6625 | return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6626 | } |
| 6627 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6628 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6629 | vec_any_eq(vector int a, vector int b) |
| 6630 | { |
| 6631 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b); |
| 6632 | } |
| 6633 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6634 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6635 | vec_any_eq(vector unsigned int a, vector unsigned int b) |
| 6636 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6637 | return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6638 | } |
| 6639 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6640 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6641 | vec_any_eq(vector float a, vector float b) |
| 6642 | { |
| 6643 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b); |
| 6644 | } |
| 6645 | |
| 6646 | /* vec_any_ge */ |
| 6647 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6648 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6649 | vec_any_ge(vector signed char a, vector signed char b) |
| 6650 | { |
| 6651 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a); |
| 6652 | } |
| 6653 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6654 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6655 | vec_any_ge(vector unsigned char a, vector unsigned char b) |
| 6656 | { |
| 6657 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a); |
| 6658 | } |
| 6659 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6660 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6661 | vec_any_ge(vector short a, vector short b) |
| 6662 | { |
| 6663 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a); |
| 6664 | } |
| 6665 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6666 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6667 | vec_any_ge(vector unsigned short a, vector unsigned short b) |
| 6668 | { |
| 6669 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a); |
| 6670 | } |
| 6671 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6672 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6673 | vec_any_ge(vector int a, vector int b) |
| 6674 | { |
| 6675 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a); |
| 6676 | } |
| 6677 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6678 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6679 | vec_any_ge(vector unsigned int a, vector unsigned int b) |
| 6680 | { |
| 6681 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a); |
| 6682 | } |
| 6683 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6684 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6685 | vec_any_ge(vector float a, vector float b) |
| 6686 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6687 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6688 | } |
| 6689 | |
| 6690 | /* vec_any_gt */ |
| 6691 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6692 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6693 | vec_any_gt(vector signed char a, vector signed char b) |
| 6694 | { |
| 6695 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b); |
| 6696 | } |
| 6697 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6698 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6699 | vec_any_gt(vector unsigned char a, vector unsigned char b) |
| 6700 | { |
| 6701 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b); |
| 6702 | } |
| 6703 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6704 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6705 | vec_any_gt(vector short a, vector short b) |
| 6706 | { |
| 6707 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b); |
| 6708 | } |
| 6709 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6710 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6711 | vec_any_gt(vector unsigned short a, vector unsigned short b) |
| 6712 | { |
| 6713 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b); |
| 6714 | } |
| 6715 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6716 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6717 | vec_any_gt(vector int a, vector int b) |
| 6718 | { |
| 6719 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b); |
| 6720 | } |
| 6721 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6722 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6723 | vec_any_gt(vector unsigned int a, vector unsigned int b) |
| 6724 | { |
| 6725 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b); |
| 6726 | } |
| 6727 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6728 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6729 | vec_any_gt(vector float a, vector float b) |
| 6730 | { |
| 6731 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b); |
| 6732 | } |
| 6733 | |
| 6734 | /* vec_any_le */ |
| 6735 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6736 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6737 | vec_any_le(vector signed char a, vector signed char b) |
| 6738 | { |
| 6739 | return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b); |
| 6740 | } |
| 6741 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6742 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6743 | vec_any_le(vector unsigned char a, vector unsigned char b) |
| 6744 | { |
| 6745 | return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b); |
| 6746 | } |
| 6747 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6748 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6749 | vec_any_le(vector short a, vector short b) |
| 6750 | { |
| 6751 | return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b); |
| 6752 | } |
| 6753 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6754 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6755 | vec_any_le(vector unsigned short a, vector unsigned short b) |
| 6756 | { |
| 6757 | return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b); |
| 6758 | } |
| 6759 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6760 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6761 | vec_any_le(vector int a, vector int b) |
| 6762 | { |
| 6763 | return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b); |
| 6764 | } |
| 6765 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6766 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6767 | vec_any_le(vector unsigned int a, vector unsigned int b) |
| 6768 | { |
| 6769 | return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b); |
| 6770 | } |
| 6771 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6772 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6773 | vec_any_le(vector float a, vector float b) |
| 6774 | { |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6775 | return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6776 | } |
| 6777 | |
| 6778 | /* vec_any_lt */ |
| 6779 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6780 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6781 | vec_any_lt(vector signed char a, vector signed char b) |
| 6782 | { |
| 6783 | return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a); |
| 6784 | } |
| 6785 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6786 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6787 | vec_any_lt(vector unsigned char a, vector unsigned char b) |
| 6788 | { |
| 6789 | return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a); |
| 6790 | } |
| 6791 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6792 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6793 | vec_any_lt(vector short a, vector short b) |
| 6794 | { |
| 6795 | return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a); |
| 6796 | } |
| 6797 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6798 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6799 | vec_any_lt(vector unsigned short a, vector unsigned short b) |
| 6800 | { |
| 6801 | return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a); |
| 6802 | } |
| 6803 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6804 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6805 | vec_any_lt(vector int a, vector int b) |
| 6806 | { |
| 6807 | return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a); |
| 6808 | } |
| 6809 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6810 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6811 | vec_any_lt(vector unsigned int a, vector unsigned int b) |
| 6812 | { |
| 6813 | return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a); |
| 6814 | } |
| 6815 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6816 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6817 | vec_any_lt(vector float a, vector float b) |
| 6818 | { |
| 6819 | return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a); |
| 6820 | } |
| 6821 | |
| 6822 | /* vec_any_nan */ |
| 6823 | |
| 6824 | static int __attribute__((__always_inline__)) |
| 6825 | vec_any_nan(vector float a) |
| 6826 | { |
| 6827 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a); |
| 6828 | } |
| 6829 | |
| 6830 | /* vec_any_ne */ |
| 6831 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6832 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6833 | vec_any_ne(vector signed char a, vector signed char b) |
| 6834 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6835 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6836 | } |
| 6837 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6838 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6839 | vec_any_ne(vector unsigned char a, vector unsigned char b) |
| 6840 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6841 | return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6842 | } |
| 6843 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6844 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6845 | vec_any_ne(vector short a, vector short b) |
| 6846 | { |
| 6847 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b); |
| 6848 | } |
| 6849 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6850 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6851 | vec_any_ne(vector unsigned short a, vector unsigned short b) |
| 6852 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6853 | return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)a, (vector short)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6854 | } |
| 6855 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6856 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6857 | vec_any_ne(vector int a, vector int b) |
| 6858 | { |
| 6859 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b); |
| 6860 | } |
| 6861 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6862 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6863 | vec_any_ne(vector unsigned int a, vector unsigned int b) |
| 6864 | { |
Chris Lattner | ab866b4 | 2010-04-14 20:35:39 +0000 | [diff] [blame] | 6865 | return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b); |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6866 | } |
| 6867 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6868 | static int __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6869 | vec_any_ne(vector float a, vector float b) |
| 6870 | { |
| 6871 | return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b); |
| 6872 | } |
| 6873 | |
| 6874 | /* vec_any_nge */ |
| 6875 | |
| 6876 | static int __attribute__((__always_inline__)) |
| 6877 | vec_any_nge(vector float a, vector float b) |
| 6878 | { |
| 6879 | return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b); |
| 6880 | } |
| 6881 | |
| 6882 | /* vec_any_ngt */ |
| 6883 | |
| 6884 | static int __attribute__((__always_inline__)) |
| 6885 | vec_any_ngt(vector float a, vector float b) |
| 6886 | { |
| 6887 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b); |
| 6888 | } |
| 6889 | |
| 6890 | /* vec_any_nle */ |
| 6891 | |
| 6892 | static int __attribute__((__always_inline__)) |
| 6893 | vec_any_nle(vector float a, vector float b) |
| 6894 | { |
| 6895 | return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a); |
| 6896 | } |
| 6897 | |
| 6898 | /* vec_any_nlt */ |
| 6899 | |
| 6900 | static int __attribute__((__always_inline__)) |
| 6901 | vec_any_nlt(vector float a, vector float b) |
| 6902 | { |
| 6903 | return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a); |
| 6904 | } |
| 6905 | |
| 6906 | /* vec_any_numeric */ |
| 6907 | |
| 6908 | static int __attribute__((__always_inline__)) |
| 6909 | vec_any_numeric(vector float a) |
| 6910 | { |
| 6911 | return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a); |
| 6912 | } |
| 6913 | |
| 6914 | /* vec_any_out */ |
| 6915 | |
| 6916 | static int __attribute__((__always_inline__)) |
| 6917 | vec_any_out(vector float a, vector float b) |
| 6918 | { |
| 6919 | return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b); |
| 6920 | } |
| 6921 | |
Anton Korobeynikov | 4d3a7b0 | 2010-06-19 09:47:18 +0000 | [diff] [blame] | 6922 | #undef __ATTRS_o_ai |
Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 6923 | |
| 6924 | #endif /* __ALTIVEC_H */ |