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 23 #ifndef __ALTIVEC_H 24 #define __ALTIVEC_H 25 26 #ifndef __ALTIVEC__ 27 #error "AltiVec support not enabled" 28 #endif 29 30 /* Constants for mapping CR6 bits to predicate result. */ 31 32 #define __CR6_EQ 0 33 #define __CR6_EQ_REV 1 34 #define __CR6_LT 2 35 #define __CR6_LT_REV 3 36 37 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) 38 39 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 40 vector signed char __a, vector signed char __b, vector unsigned char __c); 41 42 static __inline__ vector unsigned char __ATTRS_o_ai 43 vec_perm(vector unsigned char __a, vector unsigned char __b, 44 vector unsigned char __c); 45 46 static __inline__ vector bool char __ATTRS_o_ai 47 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); 48 49 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 50 vector signed short __b, 51 vector unsigned char __c); 52 53 static __inline__ vector unsigned short __ATTRS_o_ai 54 vec_perm(vector unsigned short __a, vector unsigned short __b, 55 vector unsigned char __c); 56 57 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 58 vector bool short __a, vector bool short __b, vector unsigned char __c); 59 60 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 61 vector pixel __b, 62 vector unsigned char __c); 63 64 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 65 vector signed int __b, 66 vector unsigned char __c); 67 68 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( 69 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); 70 71 static __inline__ vector bool int __ATTRS_o_ai 72 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); 73 74 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 75 vector float __b, 76 vector unsigned char __c); 77 78 #ifdef __VSX__ 79 static __inline__ vector long long __ATTRS_o_ai 80 vec_perm(vector signed long long __a, vector signed long long __b, 81 vector unsigned char __c); 82 83 static __inline__ vector unsigned long long __ATTRS_o_ai 84 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 85 vector unsigned char __c); 86 87 static __inline__ vector bool long long __ATTRS_o_ai 88 vec_perm(vector bool long long __a, vector bool long long __b, 89 vector unsigned char __c); 90 91 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, 92 vector double __b, 93 vector unsigned char __c); 94 #endif 95 96 static __inline__ vector unsigned char __ATTRS_o_ai 97 vec_xor(vector unsigned char __a, vector unsigned char __b); 98 99 /* vec_abs */ 100 101 #define __builtin_altivec_abs_v16qi vec_abs 102 #define __builtin_altivec_abs_v8hi vec_abs 103 #define __builtin_altivec_abs_v4si vec_abs 104 105 static __inline__ vector signed char __ATTRS_o_ai 106 vec_abs(vector signed char __a) { 107 return __builtin_altivec_vmaxsb(__a, -__a); 108 } 109 110 static __inline__ vector signed short __ATTRS_o_ai 111 vec_abs(vector signed short __a) { 112 return __builtin_altivec_vmaxsh(__a, -__a); 113 } 114 115 static __inline__ vector signed int __ATTRS_o_ai 116 vec_abs(vector signed int __a) { 117 return __builtin_altivec_vmaxsw(__a, -__a); 118 } 119 120 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 121 static __inline__ vector signed long long __ATTRS_o_ai 122 vec_abs(vector signed long long __a) { 123 return __builtin_altivec_vmaxsd(__a, -__a); 124 } 125 #endif 126 127 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { 128 #ifdef __VSX__ 129 return __builtin_vsx_xvabssp(__a); 130 #else 131 vector unsigned int __res = 132 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); 133 return (vector float)__res; 134 #endif 135 } 136 137 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 138 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { 139 return __builtin_vsx_xvabsdp(__a); 140 } 141 #endif 142 143 /* vec_abss */ 144 #define __builtin_altivec_abss_v16qi vec_abss 145 #define __builtin_altivec_abss_v8hi vec_abss 146 #define __builtin_altivec_abss_v4si vec_abss 147 148 static __inline__ vector signed char __ATTRS_o_ai 149 vec_abss(vector signed char __a) { 150 return __builtin_altivec_vmaxsb( 151 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); 152 } 153 154 static __inline__ vector signed short __ATTRS_o_ai 155 vec_abss(vector signed short __a) { 156 return __builtin_altivec_vmaxsh( 157 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); 158 } 159 160 static __inline__ vector signed int __ATTRS_o_ai 161 vec_abss(vector signed int __a) { 162 return __builtin_altivec_vmaxsw( 163 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); 164 } 165 166 /* vec_add */ 167 168 static __inline__ vector signed char __ATTRS_o_ai 169 vec_add(vector signed char __a, vector signed char __b) { 170 return __a + __b; 171 } 172 173 static __inline__ vector signed char __ATTRS_o_ai 174 vec_add(vector bool char __a, vector signed char __b) { 175 return (vector signed char)__a + __b; 176 } 177 178 static __inline__ vector signed char __ATTRS_o_ai 179 vec_add(vector signed char __a, vector bool char __b) { 180 return __a + (vector signed char)__b; 181 } 182 183 static __inline__ vector unsigned char __ATTRS_o_ai 184 vec_add(vector unsigned char __a, vector unsigned char __b) { 185 return __a + __b; 186 } 187 188 static __inline__ vector unsigned char __ATTRS_o_ai 189 vec_add(vector bool char __a, vector unsigned char __b) { 190 return (vector unsigned char)__a + __b; 191 } 192 193 static __inline__ vector unsigned char __ATTRS_o_ai 194 vec_add(vector unsigned char __a, vector bool char __b) { 195 return __a + (vector unsigned char)__b; 196 } 197 198 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 199 vector short __b) { 200 return __a + __b; 201 } 202 203 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, 204 vector short __b) { 205 return (vector short)__a + __b; 206 } 207 208 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 209 vector bool short __b) { 210 return __a + (vector short)__b; 211 } 212 213 static __inline__ vector unsigned short __ATTRS_o_ai 214 vec_add(vector unsigned short __a, vector unsigned short __b) { 215 return __a + __b; 216 } 217 218 static __inline__ vector unsigned short __ATTRS_o_ai 219 vec_add(vector bool short __a, vector unsigned short __b) { 220 return (vector unsigned short)__a + __b; 221 } 222 223 static __inline__ vector unsigned short __ATTRS_o_ai 224 vec_add(vector unsigned short __a, vector bool short __b) { 225 return __a + (vector unsigned short)__b; 226 } 227 228 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 229 vector int __b) { 230 return __a + __b; 231 } 232 233 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, 234 vector int __b) { 235 return (vector int)__a + __b; 236 } 237 238 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 239 vector bool int __b) { 240 return __a + (vector int)__b; 241 } 242 243 static __inline__ vector unsigned int __ATTRS_o_ai 244 vec_add(vector unsigned int __a, vector unsigned int __b) { 245 return __a + __b; 246 } 247 248 static __inline__ vector unsigned int __ATTRS_o_ai 249 vec_add(vector bool int __a, vector unsigned int __b) { 250 return (vector unsigned int)__a + __b; 251 } 252 253 static __inline__ vector unsigned int __ATTRS_o_ai 254 vec_add(vector unsigned int __a, vector bool int __b) { 255 return __a + (vector unsigned int)__b; 256 } 257 258 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 259 static __inline__ vector signed long long __ATTRS_o_ai 260 vec_add(vector signed long long __a, vector signed long long __b) { 261 return __a + __b; 262 } 263 264 static __inline__ vector unsigned long long __ATTRS_o_ai 265 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 266 return __a + __b; 267 } 268 269 static __inline__ vector signed __int128 __ATTRS_o_ai 270 vec_add(vector signed __int128 __a, vector signed __int128 __b) { 271 return __a + __b; 272 } 273 274 static __inline__ vector unsigned __int128 __ATTRS_o_ai 275 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { 276 return __a + __b; 277 } 278 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 279 280 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 281 vector float __b) { 282 return __a + __b; 283 } 284 285 #ifdef __VSX__ 286 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 287 vector double __b) { 288 return __a + __b; 289 } 290 #endif // __VSX__ 291 292 /* vec_adde */ 293 294 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 295 static __inline__ vector signed __int128 __ATTRS_o_ai 296 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 297 vector signed __int128 __c) { 298 return __builtin_altivec_vaddeuqm(__a, __b, __c); 299 } 300 301 static __inline__ vector unsigned __int128 __ATTRS_o_ai 302 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 303 vector unsigned __int128 __c) { 304 return __builtin_altivec_vaddeuqm(__a, __b, __c); 305 } 306 #endif 307 308 /* vec_addec */ 309 310 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 311 static __inline__ vector signed __int128 __ATTRS_o_ai 312 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 313 vector signed __int128 __c) { 314 return __builtin_altivec_vaddecuq(__a, __b, __c); 315 } 316 317 static __inline__ vector unsigned __int128 __ATTRS_o_ai 318 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 319 vector unsigned __int128 __c) { 320 return __builtin_altivec_vaddecuq(__a, __b, __c); 321 } 322 #endif 323 324 /* vec_vaddubm */ 325 326 #define __builtin_altivec_vaddubm vec_vaddubm 327 328 static __inline__ vector signed char __ATTRS_o_ai 329 vec_vaddubm(vector signed char __a, vector signed char __b) { 330 return __a + __b; 331 } 332 333 static __inline__ vector signed char __ATTRS_o_ai 334 vec_vaddubm(vector bool char __a, vector signed char __b) { 335 return (vector signed char)__a + __b; 336 } 337 338 static __inline__ vector signed char __ATTRS_o_ai 339 vec_vaddubm(vector signed char __a, vector bool char __b) { 340 return __a + (vector signed char)__b; 341 } 342 343 static __inline__ vector unsigned char __ATTRS_o_ai 344 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 345 return __a + __b; 346 } 347 348 static __inline__ vector unsigned char __ATTRS_o_ai 349 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 350 return (vector unsigned char)__a + __b; 351 } 352 353 static __inline__ vector unsigned char __ATTRS_o_ai 354 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 355 return __a + (vector unsigned char)__b; 356 } 357 358 /* vec_vadduhm */ 359 360 #define __builtin_altivec_vadduhm vec_vadduhm 361 362 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 363 vector short __b) { 364 return __a + __b; 365 } 366 367 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 368 vector short __b) { 369 return (vector short)__a + __b; 370 } 371 372 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 373 vector bool short __b) { 374 return __a + (vector short)__b; 375 } 376 377 static __inline__ vector unsigned short __ATTRS_o_ai 378 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 379 return __a + __b; 380 } 381 382 static __inline__ vector unsigned short __ATTRS_o_ai 383 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 384 return (vector unsigned short)__a + __b; 385 } 386 387 static __inline__ vector unsigned short __ATTRS_o_ai 388 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 389 return __a + (vector unsigned short)__b; 390 } 391 392 /* vec_vadduwm */ 393 394 #define __builtin_altivec_vadduwm vec_vadduwm 395 396 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 397 vector int __b) { 398 return __a + __b; 399 } 400 401 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 402 vector int __b) { 403 return (vector int)__a + __b; 404 } 405 406 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 407 vector bool int __b) { 408 return __a + (vector int)__b; 409 } 410 411 static __inline__ vector unsigned int __ATTRS_o_ai 412 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 413 return __a + __b; 414 } 415 416 static __inline__ vector unsigned int __ATTRS_o_ai 417 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 418 return (vector unsigned int)__a + __b; 419 } 420 421 static __inline__ vector unsigned int __ATTRS_o_ai 422 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 423 return __a + (vector unsigned int)__b; 424 } 425 426 /* vec_vaddfp */ 427 428 #define __builtin_altivec_vaddfp vec_vaddfp 429 430 static __inline__ vector float __attribute__((__always_inline__)) 431 vec_vaddfp(vector float __a, vector float __b) { 432 return __a + __b; 433 } 434 435 /* vec_addc */ 436 437 static __inline__ vector signed int __ATTRS_o_ai 438 vec_addc(vector signed int __a, vector signed int __b) { 439 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 440 (vector unsigned int)__b); 441 } 442 443 static __inline__ vector unsigned int __ATTRS_o_ai 444 vec_addc(vector unsigned int __a, vector unsigned int __b) { 445 return __builtin_altivec_vaddcuw(__a, __b); 446 } 447 448 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 449 static __inline__ vector signed __int128 __ATTRS_o_ai 450 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 451 return (vector signed __int128)__builtin_altivec_vaddcuq( 452 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 453 } 454 455 static __inline__ vector unsigned __int128 __ATTRS_o_ai 456 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 457 return __builtin_altivec_vaddcuq(__a, __b); 458 } 459 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 460 461 /* vec_vaddcuw */ 462 463 static __inline__ vector unsigned int __attribute__((__always_inline__)) 464 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 465 return __builtin_altivec_vaddcuw(__a, __b); 466 } 467 468 /* vec_adds */ 469 470 static __inline__ vector signed char __ATTRS_o_ai 471 vec_adds(vector signed char __a, vector signed char __b) { 472 return __builtin_altivec_vaddsbs(__a, __b); 473 } 474 475 static __inline__ vector signed char __ATTRS_o_ai 476 vec_adds(vector bool char __a, vector signed char __b) { 477 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 478 } 479 480 static __inline__ vector signed char __ATTRS_o_ai 481 vec_adds(vector signed char __a, vector bool char __b) { 482 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 483 } 484 485 static __inline__ vector unsigned char __ATTRS_o_ai 486 vec_adds(vector unsigned char __a, vector unsigned char __b) { 487 return __builtin_altivec_vaddubs(__a, __b); 488 } 489 490 static __inline__ vector unsigned char __ATTRS_o_ai 491 vec_adds(vector bool char __a, vector unsigned char __b) { 492 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 493 } 494 495 static __inline__ vector unsigned char __ATTRS_o_ai 496 vec_adds(vector unsigned char __a, vector bool char __b) { 497 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 498 } 499 500 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 501 vector short __b) { 502 return __builtin_altivec_vaddshs(__a, __b); 503 } 504 505 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 506 vector short __b) { 507 return __builtin_altivec_vaddshs((vector short)__a, __b); 508 } 509 510 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 511 vector bool short __b) { 512 return __builtin_altivec_vaddshs(__a, (vector short)__b); 513 } 514 515 static __inline__ vector unsigned short __ATTRS_o_ai 516 vec_adds(vector unsigned short __a, vector unsigned short __b) { 517 return __builtin_altivec_vadduhs(__a, __b); 518 } 519 520 static __inline__ vector unsigned short __ATTRS_o_ai 521 vec_adds(vector bool short __a, vector unsigned short __b) { 522 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 523 } 524 525 static __inline__ vector unsigned short __ATTRS_o_ai 526 vec_adds(vector unsigned short __a, vector bool short __b) { 527 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 528 } 529 530 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 531 vector int __b) { 532 return __builtin_altivec_vaddsws(__a, __b); 533 } 534 535 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 536 vector int __b) { 537 return __builtin_altivec_vaddsws((vector int)__a, __b); 538 } 539 540 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 541 vector bool int __b) { 542 return __builtin_altivec_vaddsws(__a, (vector int)__b); 543 } 544 545 static __inline__ vector unsigned int __ATTRS_o_ai 546 vec_adds(vector unsigned int __a, vector unsigned int __b) { 547 return __builtin_altivec_vadduws(__a, __b); 548 } 549 550 static __inline__ vector unsigned int __ATTRS_o_ai 551 vec_adds(vector bool int __a, vector unsigned int __b) { 552 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 553 } 554 555 static __inline__ vector unsigned int __ATTRS_o_ai 556 vec_adds(vector unsigned int __a, vector bool int __b) { 557 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 558 } 559 560 /* vec_vaddsbs */ 561 562 static __inline__ vector signed char __ATTRS_o_ai 563 vec_vaddsbs(vector signed char __a, vector signed char __b) { 564 return __builtin_altivec_vaddsbs(__a, __b); 565 } 566 567 static __inline__ vector signed char __ATTRS_o_ai 568 vec_vaddsbs(vector bool char __a, vector signed char __b) { 569 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 570 } 571 572 static __inline__ vector signed char __ATTRS_o_ai 573 vec_vaddsbs(vector signed char __a, vector bool char __b) { 574 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 575 } 576 577 /* vec_vaddubs */ 578 579 static __inline__ vector unsigned char __ATTRS_o_ai 580 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 581 return __builtin_altivec_vaddubs(__a, __b); 582 } 583 584 static __inline__ vector unsigned char __ATTRS_o_ai 585 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 586 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 587 } 588 589 static __inline__ vector unsigned char __ATTRS_o_ai 590 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 591 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 592 } 593 594 /* vec_vaddshs */ 595 596 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 597 vector short __b) { 598 return __builtin_altivec_vaddshs(__a, __b); 599 } 600 601 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 602 vector short __b) { 603 return __builtin_altivec_vaddshs((vector short)__a, __b); 604 } 605 606 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 607 vector bool short __b) { 608 return __builtin_altivec_vaddshs(__a, (vector short)__b); 609 } 610 611 /* vec_vadduhs */ 612 613 static __inline__ vector unsigned short __ATTRS_o_ai 614 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 615 return __builtin_altivec_vadduhs(__a, __b); 616 } 617 618 static __inline__ vector unsigned short __ATTRS_o_ai 619 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 620 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 621 } 622 623 static __inline__ vector unsigned short __ATTRS_o_ai 624 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 625 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 626 } 627 628 /* vec_vaddsws */ 629 630 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 631 vector int __b) { 632 return __builtin_altivec_vaddsws(__a, __b); 633 } 634 635 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 636 vector int __b) { 637 return __builtin_altivec_vaddsws((vector int)__a, __b); 638 } 639 640 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 641 vector bool int __b) { 642 return __builtin_altivec_vaddsws(__a, (vector int)__b); 643 } 644 645 /* vec_vadduws */ 646 647 static __inline__ vector unsigned int __ATTRS_o_ai 648 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 649 return __builtin_altivec_vadduws(__a, __b); 650 } 651 652 static __inline__ vector unsigned int __ATTRS_o_ai 653 vec_vadduws(vector bool int __a, vector unsigned int __b) { 654 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 655 } 656 657 static __inline__ vector unsigned int __ATTRS_o_ai 658 vec_vadduws(vector unsigned int __a, vector bool int __b) { 659 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 660 } 661 662 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 663 /* vec_vadduqm */ 664 665 static __inline__ vector signed __int128 __ATTRS_o_ai 666 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 667 return __a + __b; 668 } 669 670 static __inline__ vector unsigned __int128 __ATTRS_o_ai 671 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 672 return __a + __b; 673 } 674 675 /* vec_vaddeuqm */ 676 677 static __inline__ vector signed __int128 __ATTRS_o_ai 678 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 679 vector signed __int128 __c) { 680 return __builtin_altivec_vaddeuqm(__a, __b, __c); 681 } 682 683 static __inline__ vector unsigned __int128 __ATTRS_o_ai 684 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 685 vector unsigned __int128 __c) { 686 return __builtin_altivec_vaddeuqm(__a, __b, __c); 687 } 688 689 /* vec_vaddcuq */ 690 691 static __inline__ vector signed __int128 __ATTRS_o_ai 692 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 693 return __builtin_altivec_vaddcuq(__a, __b); 694 } 695 696 static __inline__ vector unsigned __int128 __ATTRS_o_ai 697 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 698 return __builtin_altivec_vaddcuq(__a, __b); 699 } 700 701 /* vec_vaddecuq */ 702 703 static __inline__ vector signed __int128 __ATTRS_o_ai 704 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 705 vector signed __int128 __c) { 706 return __builtin_altivec_vaddecuq(__a, __b, __c); 707 } 708 709 static __inline__ vector unsigned __int128 __ATTRS_o_ai 710 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 711 vector unsigned __int128 __c) { 712 return __builtin_altivec_vaddecuq(__a, __b, __c); 713 } 714 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 715 716 /* vec_and */ 717 718 #define __builtin_altivec_vand vec_and 719 720 static __inline__ vector signed char __ATTRS_o_ai 721 vec_and(vector signed char __a, vector signed char __b) { 722 return __a & __b; 723 } 724 725 static __inline__ vector signed char __ATTRS_o_ai 726 vec_and(vector bool char __a, vector signed char __b) { 727 return (vector signed char)__a & __b; 728 } 729 730 static __inline__ vector signed char __ATTRS_o_ai 731 vec_and(vector signed char __a, vector bool char __b) { 732 return __a & (vector signed char)__b; 733 } 734 735 static __inline__ vector unsigned char __ATTRS_o_ai 736 vec_and(vector unsigned char __a, vector unsigned char __b) { 737 return __a & __b; 738 } 739 740 static __inline__ vector unsigned char __ATTRS_o_ai 741 vec_and(vector bool char __a, vector unsigned char __b) { 742 return (vector unsigned char)__a & __b; 743 } 744 745 static __inline__ vector unsigned char __ATTRS_o_ai 746 vec_and(vector unsigned char __a, vector bool char __b) { 747 return __a & (vector unsigned char)__b; 748 } 749 750 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 751 vector bool char __b) { 752 return __a & __b; 753 } 754 755 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 756 vector short __b) { 757 return __a & __b; 758 } 759 760 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 761 vector short __b) { 762 return (vector short)__a & __b; 763 } 764 765 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 766 vector bool short __b) { 767 return __a & (vector short)__b; 768 } 769 770 static __inline__ vector unsigned short __ATTRS_o_ai 771 vec_and(vector unsigned short __a, vector unsigned short __b) { 772 return __a & __b; 773 } 774 775 static __inline__ vector unsigned short __ATTRS_o_ai 776 vec_and(vector bool short __a, vector unsigned short __b) { 777 return (vector unsigned short)__a & __b; 778 } 779 780 static __inline__ vector unsigned short __ATTRS_o_ai 781 vec_and(vector unsigned short __a, vector bool short __b) { 782 return __a & (vector unsigned short)__b; 783 } 784 785 static __inline__ vector bool short __ATTRS_o_ai 786 vec_and(vector bool short __a, vector bool short __b) { 787 return __a & __b; 788 } 789 790 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 791 vector int __b) { 792 return __a & __b; 793 } 794 795 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 796 vector int __b) { 797 return (vector int)__a & __b; 798 } 799 800 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 801 vector bool int __b) { 802 return __a & (vector int)__b; 803 } 804 805 static __inline__ vector unsigned int __ATTRS_o_ai 806 vec_and(vector unsigned int __a, vector unsigned int __b) { 807 return __a & __b; 808 } 809 810 static __inline__ vector unsigned int __ATTRS_o_ai 811 vec_and(vector bool int __a, vector unsigned int __b) { 812 return (vector unsigned int)__a & __b; 813 } 814 815 static __inline__ vector unsigned int __ATTRS_o_ai 816 vec_and(vector unsigned int __a, vector bool int __b) { 817 return __a & (vector unsigned int)__b; 818 } 819 820 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 821 vector bool int __b) { 822 return __a & __b; 823 } 824 825 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 826 vector float __b) { 827 vector unsigned int __res = 828 (vector unsigned int)__a & (vector unsigned int)__b; 829 return (vector float)__res; 830 } 831 832 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 833 vector float __b) { 834 vector unsigned int __res = 835 (vector unsigned int)__a & (vector unsigned int)__b; 836 return (vector float)__res; 837 } 838 839 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 840 vector bool int __b) { 841 vector unsigned int __res = 842 (vector unsigned int)__a & (vector unsigned int)__b; 843 return (vector float)__res; 844 } 845 846 #ifdef __VSX__ 847 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 848 vector double __b) { 849 vector unsigned long long __res = 850 (vector unsigned long long)__a & (vector unsigned long long)__b; 851 return (vector double)__res; 852 } 853 854 static __inline__ vector double __ATTRS_o_ai 855 vec_and(vector double __a, vector bool long long __b) { 856 vector unsigned long long __res = 857 (vector unsigned long long)__a & (vector unsigned long long)__b; 858 return (vector double)__res; 859 } 860 861 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 862 vector double __b) { 863 vector unsigned long long __res = 864 (vector unsigned long long)__a & (vector unsigned long long)__b; 865 return (vector double)__res; 866 } 867 868 static __inline__ vector signed long long __ATTRS_o_ai 869 vec_and(vector signed long long __a, vector signed long long __b) { 870 return __a & __b; 871 } 872 873 static __inline__ vector signed long long __ATTRS_o_ai 874 vec_and(vector bool long long __a, vector signed long long __b) { 875 return (vector signed long long)__a & __b; 876 } 877 878 static __inline__ vector signed long long __ATTRS_o_ai 879 vec_and(vector signed long long __a, vector bool long long __b) { 880 return __a & (vector signed long long)__b; 881 } 882 883 static __inline__ vector unsigned long long __ATTRS_o_ai 884 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 885 return __a & __b; 886 } 887 888 static __inline__ vector unsigned long long __ATTRS_o_ai 889 vec_and(vector bool long long __a, vector unsigned long long __b) { 890 return (vector unsigned long long)__a & __b; 891 } 892 893 static __inline__ vector unsigned long long __ATTRS_o_ai 894 vec_and(vector unsigned long long __a, vector bool long long __b) { 895 return __a & (vector unsigned long long)__b; 896 } 897 898 static __inline__ vector bool long long __ATTRS_o_ai 899 vec_and(vector bool long long __a, vector bool long long __b) { 900 return __a & __b; 901 } 902 #endif 903 904 /* vec_vand */ 905 906 static __inline__ vector signed char __ATTRS_o_ai 907 vec_vand(vector signed char __a, vector signed char __b) { 908 return __a & __b; 909 } 910 911 static __inline__ vector signed char __ATTRS_o_ai 912 vec_vand(vector bool char __a, vector signed char __b) { 913 return (vector signed char)__a & __b; 914 } 915 916 static __inline__ vector signed char __ATTRS_o_ai 917 vec_vand(vector signed char __a, vector bool char __b) { 918 return __a & (vector signed char)__b; 919 } 920 921 static __inline__ vector unsigned char __ATTRS_o_ai 922 vec_vand(vector unsigned char __a, vector unsigned char __b) { 923 return __a & __b; 924 } 925 926 static __inline__ vector unsigned char __ATTRS_o_ai 927 vec_vand(vector bool char __a, vector unsigned char __b) { 928 return (vector unsigned char)__a & __b; 929 } 930 931 static __inline__ vector unsigned char __ATTRS_o_ai 932 vec_vand(vector unsigned char __a, vector bool char __b) { 933 return __a & (vector unsigned char)__b; 934 } 935 936 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 937 vector bool char __b) { 938 return __a & __b; 939 } 940 941 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 942 vector short __b) { 943 return __a & __b; 944 } 945 946 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 947 vector short __b) { 948 return (vector short)__a & __b; 949 } 950 951 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 952 vector bool short __b) { 953 return __a & (vector short)__b; 954 } 955 956 static __inline__ vector unsigned short __ATTRS_o_ai 957 vec_vand(vector unsigned short __a, vector unsigned short __b) { 958 return __a & __b; 959 } 960 961 static __inline__ vector unsigned short __ATTRS_o_ai 962 vec_vand(vector bool short __a, vector unsigned short __b) { 963 return (vector unsigned short)__a & __b; 964 } 965 966 static __inline__ vector unsigned short __ATTRS_o_ai 967 vec_vand(vector unsigned short __a, vector bool short __b) { 968 return __a & (vector unsigned short)__b; 969 } 970 971 static __inline__ vector bool short __ATTRS_o_ai 972 vec_vand(vector bool short __a, vector bool short __b) { 973 return __a & __b; 974 } 975 976 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 977 vector int __b) { 978 return __a & __b; 979 } 980 981 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 982 vector int __b) { 983 return (vector int)__a & __b; 984 } 985 986 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 987 vector bool int __b) { 988 return __a & (vector int)__b; 989 } 990 991 static __inline__ vector unsigned int __ATTRS_o_ai 992 vec_vand(vector unsigned int __a, vector unsigned int __b) { 993 return __a & __b; 994 } 995 996 static __inline__ vector unsigned int __ATTRS_o_ai 997 vec_vand(vector bool int __a, vector unsigned int __b) { 998 return (vector unsigned int)__a & __b; 999 } 1000 1001 static __inline__ vector unsigned int __ATTRS_o_ai 1002 vec_vand(vector unsigned int __a, vector bool int __b) { 1003 return __a & (vector unsigned int)__b; 1004 } 1005 1006 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1007 vector bool int __b) { 1008 return __a & __b; 1009 } 1010 1011 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1012 vector float __b) { 1013 vector unsigned int __res = 1014 (vector unsigned int)__a & (vector unsigned int)__b; 1015 return (vector float)__res; 1016 } 1017 1018 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1019 vector float __b) { 1020 vector unsigned int __res = 1021 (vector unsigned int)__a & (vector unsigned int)__b; 1022 return (vector float)__res; 1023 } 1024 1025 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1026 vector bool int __b) { 1027 vector unsigned int __res = 1028 (vector unsigned int)__a & (vector unsigned int)__b; 1029 return (vector float)__res; 1030 } 1031 1032 #ifdef __VSX__ 1033 static __inline__ vector signed long long __ATTRS_o_ai 1034 vec_vand(vector signed long long __a, vector signed long long __b) { 1035 return __a & __b; 1036 } 1037 1038 static __inline__ vector signed long long __ATTRS_o_ai 1039 vec_vand(vector bool long long __a, vector signed long long __b) { 1040 return (vector signed long long)__a & __b; 1041 } 1042 1043 static __inline__ vector signed long long __ATTRS_o_ai 1044 vec_vand(vector signed long long __a, vector bool long long __b) { 1045 return __a & (vector signed long long)__b; 1046 } 1047 1048 static __inline__ vector unsigned long long __ATTRS_o_ai 1049 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1050 return __a & __b; 1051 } 1052 1053 static __inline__ vector unsigned long long __ATTRS_o_ai 1054 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1055 return (vector unsigned long long)__a & __b; 1056 } 1057 1058 static __inline__ vector unsigned long long __ATTRS_o_ai 1059 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1060 return __a & (vector unsigned long long)__b; 1061 } 1062 1063 static __inline__ vector bool long long __ATTRS_o_ai 1064 vec_vand(vector bool long long __a, vector bool long long __b) { 1065 return __a & __b; 1066 } 1067 #endif 1068 1069 /* vec_andc */ 1070 1071 #define __builtin_altivec_vandc vec_andc 1072 1073 static __inline__ vector signed char __ATTRS_o_ai 1074 vec_andc(vector signed char __a, vector signed char __b) { 1075 return __a & ~__b; 1076 } 1077 1078 static __inline__ vector signed char __ATTRS_o_ai 1079 vec_andc(vector bool char __a, vector signed char __b) { 1080 return (vector signed char)__a & ~__b; 1081 } 1082 1083 static __inline__ vector signed char __ATTRS_o_ai 1084 vec_andc(vector signed char __a, vector bool char __b) { 1085 return __a & ~(vector signed char)__b; 1086 } 1087 1088 static __inline__ vector unsigned char __ATTRS_o_ai 1089 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1090 return __a & ~__b; 1091 } 1092 1093 static __inline__ vector unsigned char __ATTRS_o_ai 1094 vec_andc(vector bool char __a, vector unsigned char __b) { 1095 return (vector unsigned char)__a & ~__b; 1096 } 1097 1098 static __inline__ vector unsigned char __ATTRS_o_ai 1099 vec_andc(vector unsigned char __a, vector bool char __b) { 1100 return __a & ~(vector unsigned char)__b; 1101 } 1102 1103 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1104 vector bool char __b) { 1105 return __a & ~__b; 1106 } 1107 1108 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1109 vector short __b) { 1110 return __a & ~__b; 1111 } 1112 1113 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1114 vector short __b) { 1115 return (vector short)__a & ~__b; 1116 } 1117 1118 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1119 vector bool short __b) { 1120 return __a & ~(vector short)__b; 1121 } 1122 1123 static __inline__ vector unsigned short __ATTRS_o_ai 1124 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1125 return __a & ~__b; 1126 } 1127 1128 static __inline__ vector unsigned short __ATTRS_o_ai 1129 vec_andc(vector bool short __a, vector unsigned short __b) { 1130 return (vector unsigned short)__a & ~__b; 1131 } 1132 1133 static __inline__ vector unsigned short __ATTRS_o_ai 1134 vec_andc(vector unsigned short __a, vector bool short __b) { 1135 return __a & ~(vector unsigned short)__b; 1136 } 1137 1138 static __inline__ vector bool short __ATTRS_o_ai 1139 vec_andc(vector bool short __a, vector bool short __b) { 1140 return __a & ~__b; 1141 } 1142 1143 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1144 vector int __b) { 1145 return __a & ~__b; 1146 } 1147 1148 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1149 vector int __b) { 1150 return (vector int)__a & ~__b; 1151 } 1152 1153 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1154 vector bool int __b) { 1155 return __a & ~(vector int)__b; 1156 } 1157 1158 static __inline__ vector unsigned int __ATTRS_o_ai 1159 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1160 return __a & ~__b; 1161 } 1162 1163 static __inline__ vector unsigned int __ATTRS_o_ai 1164 vec_andc(vector bool int __a, vector unsigned int __b) { 1165 return (vector unsigned int)__a & ~__b; 1166 } 1167 1168 static __inline__ vector unsigned int __ATTRS_o_ai 1169 vec_andc(vector unsigned int __a, vector bool int __b) { 1170 return __a & ~(vector unsigned int)__b; 1171 } 1172 1173 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1174 vector bool int __b) { 1175 return __a & ~__b; 1176 } 1177 1178 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1179 vector float __b) { 1180 vector unsigned int __res = 1181 (vector unsigned int)__a & ~(vector unsigned int)__b; 1182 return (vector float)__res; 1183 } 1184 1185 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1186 vector float __b) { 1187 vector unsigned int __res = 1188 (vector unsigned int)__a & ~(vector unsigned int)__b; 1189 return (vector float)__res; 1190 } 1191 1192 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1193 vector bool int __b) { 1194 vector unsigned int __res = 1195 (vector unsigned int)__a & ~(vector unsigned int)__b; 1196 return (vector float)__res; 1197 } 1198 1199 #ifdef __VSX__ 1200 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1201 vector double __b) { 1202 vector unsigned long long __res = 1203 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1204 return (vector double)__res; 1205 } 1206 1207 static __inline__ vector double __ATTRS_o_ai 1208 vec_andc(vector double __a, vector bool long long __b) { 1209 vector unsigned long long __res = 1210 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1211 return (vector double)__res; 1212 } 1213 1214 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1215 vector double __b) { 1216 vector unsigned long long __res = 1217 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1218 return (vector double)__res; 1219 } 1220 1221 static __inline__ vector signed long long __ATTRS_o_ai 1222 vec_andc(vector signed long long __a, vector signed long long __b) { 1223 return __a & ~__b; 1224 } 1225 1226 static __inline__ vector signed long long __ATTRS_o_ai 1227 vec_andc(vector bool long long __a, vector signed long long __b) { 1228 return (vector signed long long)__a & ~__b; 1229 } 1230 1231 static __inline__ vector signed long long __ATTRS_o_ai 1232 vec_andc(vector signed long long __a, vector bool long long __b) { 1233 return __a & ~(vector signed long long)__b; 1234 } 1235 1236 static __inline__ vector unsigned long long __ATTRS_o_ai 1237 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1238 return __a & ~__b; 1239 } 1240 1241 static __inline__ vector unsigned long long __ATTRS_o_ai 1242 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1243 return (vector unsigned long long)__a & ~__b; 1244 } 1245 1246 static __inline__ vector unsigned long long __ATTRS_o_ai 1247 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1248 return __a & ~(vector unsigned long long)__b; 1249 } 1250 1251 static __inline__ vector bool long long __ATTRS_o_ai 1252 vec_andc(vector bool long long __a, vector bool long long __b) { 1253 return __a & ~__b; 1254 } 1255 #endif 1256 1257 /* vec_vandc */ 1258 1259 static __inline__ vector signed char __ATTRS_o_ai 1260 vec_vandc(vector signed char __a, vector signed char __b) { 1261 return __a & ~__b; 1262 } 1263 1264 static __inline__ vector signed char __ATTRS_o_ai 1265 vec_vandc(vector bool char __a, vector signed char __b) { 1266 return (vector signed char)__a & ~__b; 1267 } 1268 1269 static __inline__ vector signed char __ATTRS_o_ai 1270 vec_vandc(vector signed char __a, vector bool char __b) { 1271 return __a & ~(vector signed char)__b; 1272 } 1273 1274 static __inline__ vector unsigned char __ATTRS_o_ai 1275 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1276 return __a & ~__b; 1277 } 1278 1279 static __inline__ vector unsigned char __ATTRS_o_ai 1280 vec_vandc(vector bool char __a, vector unsigned char __b) { 1281 return (vector unsigned char)__a & ~__b; 1282 } 1283 1284 static __inline__ vector unsigned char __ATTRS_o_ai 1285 vec_vandc(vector unsigned char __a, vector bool char __b) { 1286 return __a & ~(vector unsigned char)__b; 1287 } 1288 1289 static __inline__ vector bool char __ATTRS_o_ai 1290 vec_vandc(vector bool char __a, vector bool char __b) { 1291 return __a & ~__b; 1292 } 1293 1294 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1295 vector short __b) { 1296 return __a & ~__b; 1297 } 1298 1299 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1300 vector short __b) { 1301 return (vector short)__a & ~__b; 1302 } 1303 1304 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1305 vector bool short __b) { 1306 return __a & ~(vector short)__b; 1307 } 1308 1309 static __inline__ vector unsigned short __ATTRS_o_ai 1310 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1311 return __a & ~__b; 1312 } 1313 1314 static __inline__ vector unsigned short __ATTRS_o_ai 1315 vec_vandc(vector bool short __a, vector unsigned short __b) { 1316 return (vector unsigned short)__a & ~__b; 1317 } 1318 1319 static __inline__ vector unsigned short __ATTRS_o_ai 1320 vec_vandc(vector unsigned short __a, vector bool short __b) { 1321 return __a & ~(vector unsigned short)__b; 1322 } 1323 1324 static __inline__ vector bool short __ATTRS_o_ai 1325 vec_vandc(vector bool short __a, vector bool short __b) { 1326 return __a & ~__b; 1327 } 1328 1329 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1330 vector int __b) { 1331 return __a & ~__b; 1332 } 1333 1334 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1335 vector int __b) { 1336 return (vector int)__a & ~__b; 1337 } 1338 1339 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1340 vector bool int __b) { 1341 return __a & ~(vector int)__b; 1342 } 1343 1344 static __inline__ vector unsigned int __ATTRS_o_ai 1345 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1346 return __a & ~__b; 1347 } 1348 1349 static __inline__ vector unsigned int __ATTRS_o_ai 1350 vec_vandc(vector bool int __a, vector unsigned int __b) { 1351 return (vector unsigned int)__a & ~__b; 1352 } 1353 1354 static __inline__ vector unsigned int __ATTRS_o_ai 1355 vec_vandc(vector unsigned int __a, vector bool int __b) { 1356 return __a & ~(vector unsigned int)__b; 1357 } 1358 1359 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1360 vector bool int __b) { 1361 return __a & ~__b; 1362 } 1363 1364 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1365 vector float __b) { 1366 vector unsigned int __res = 1367 (vector unsigned int)__a & ~(vector unsigned int)__b; 1368 return (vector float)__res; 1369 } 1370 1371 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1372 vector float __b) { 1373 vector unsigned int __res = 1374 (vector unsigned int)__a & ~(vector unsigned int)__b; 1375 return (vector float)__res; 1376 } 1377 1378 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1379 vector bool int __b) { 1380 vector unsigned int __res = 1381 (vector unsigned int)__a & ~(vector unsigned int)__b; 1382 return (vector float)__res; 1383 } 1384 1385 #ifdef __VSX__ 1386 static __inline__ vector signed long long __ATTRS_o_ai 1387 vec_vandc(vector signed long long __a, vector signed long long __b) { 1388 return __a & ~__b; 1389 } 1390 1391 static __inline__ vector signed long long __ATTRS_o_ai 1392 vec_vandc(vector bool long long __a, vector signed long long __b) { 1393 return (vector signed long long)__a & ~__b; 1394 } 1395 1396 static __inline__ vector signed long long __ATTRS_o_ai 1397 vec_vandc(vector signed long long __a, vector bool long long __b) { 1398 return __a & ~(vector signed long long)__b; 1399 } 1400 1401 static __inline__ vector unsigned long long __ATTRS_o_ai 1402 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1403 return __a & ~__b; 1404 } 1405 1406 static __inline__ vector unsigned long long __ATTRS_o_ai 1407 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1408 return (vector unsigned long long)__a & ~__b; 1409 } 1410 1411 static __inline__ vector unsigned long long __ATTRS_o_ai 1412 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1413 return __a & ~(vector unsigned long long)__b; 1414 } 1415 1416 static __inline__ vector bool long long __ATTRS_o_ai 1417 vec_vandc(vector bool long long __a, vector bool long long __b) { 1418 return __a & ~__b; 1419 } 1420 #endif 1421 1422 /* vec_avg */ 1423 1424 static __inline__ vector signed char __ATTRS_o_ai 1425 vec_avg(vector signed char __a, vector signed char __b) { 1426 return __builtin_altivec_vavgsb(__a, __b); 1427 } 1428 1429 static __inline__ vector unsigned char __ATTRS_o_ai 1430 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1431 return __builtin_altivec_vavgub(__a, __b); 1432 } 1433 1434 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1435 vector short __b) { 1436 return __builtin_altivec_vavgsh(__a, __b); 1437 } 1438 1439 static __inline__ vector unsigned short __ATTRS_o_ai 1440 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1441 return __builtin_altivec_vavguh(__a, __b); 1442 } 1443 1444 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1445 vector int __b) { 1446 return __builtin_altivec_vavgsw(__a, __b); 1447 } 1448 1449 static __inline__ vector unsigned int __ATTRS_o_ai 1450 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1451 return __builtin_altivec_vavguw(__a, __b); 1452 } 1453 1454 /* vec_vavgsb */ 1455 1456 static __inline__ vector signed char __attribute__((__always_inline__)) 1457 vec_vavgsb(vector signed char __a, vector signed char __b) { 1458 return __builtin_altivec_vavgsb(__a, __b); 1459 } 1460 1461 /* vec_vavgub */ 1462 1463 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1464 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1465 return __builtin_altivec_vavgub(__a, __b); 1466 } 1467 1468 /* vec_vavgsh */ 1469 1470 static __inline__ vector short __attribute__((__always_inline__)) 1471 vec_vavgsh(vector short __a, vector short __b) { 1472 return __builtin_altivec_vavgsh(__a, __b); 1473 } 1474 1475 /* vec_vavguh */ 1476 1477 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1478 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1479 return __builtin_altivec_vavguh(__a, __b); 1480 } 1481 1482 /* vec_vavgsw */ 1483 1484 static __inline__ vector int __attribute__((__always_inline__)) 1485 vec_vavgsw(vector int __a, vector int __b) { 1486 return __builtin_altivec_vavgsw(__a, __b); 1487 } 1488 1489 /* vec_vavguw */ 1490 1491 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1492 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1493 return __builtin_altivec_vavguw(__a, __b); 1494 } 1495 1496 /* vec_ceil */ 1497 1498 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1499 #ifdef __VSX__ 1500 return __builtin_vsx_xvrspip(__a); 1501 #else 1502 return __builtin_altivec_vrfip(__a); 1503 #endif 1504 } 1505 1506 #ifdef __VSX__ 1507 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1508 return __builtin_vsx_xvrdpip(__a); 1509 } 1510 #endif 1511 1512 /* vec_vrfip */ 1513 1514 static __inline__ vector float __attribute__((__always_inline__)) 1515 vec_vrfip(vector float __a) { 1516 return __builtin_altivec_vrfip(__a); 1517 } 1518 1519 /* vec_cmpb */ 1520 1521 static __inline__ vector int __attribute__((__always_inline__)) 1522 vec_cmpb(vector float __a, vector float __b) { 1523 return __builtin_altivec_vcmpbfp(__a, __b); 1524 } 1525 1526 /* vec_vcmpbfp */ 1527 1528 static __inline__ vector int __attribute__((__always_inline__)) 1529 vec_vcmpbfp(vector float __a, vector float __b) { 1530 return __builtin_altivec_vcmpbfp(__a, __b); 1531 } 1532 1533 /* vec_cmpeq */ 1534 1535 static __inline__ vector bool char __ATTRS_o_ai 1536 vec_cmpeq(vector signed char __a, vector signed char __b) { 1537 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1538 (vector char)__b); 1539 } 1540 1541 static __inline__ vector bool char __ATTRS_o_ai 1542 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1543 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1544 (vector char)__b); 1545 } 1546 1547 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1548 vector short __b) { 1549 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1550 } 1551 1552 static __inline__ vector bool short __ATTRS_o_ai 1553 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1554 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1555 (vector short)__b); 1556 } 1557 1558 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1559 vector int __b) { 1560 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1561 } 1562 1563 static __inline__ vector bool int __ATTRS_o_ai 1564 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1565 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1566 (vector int)__b); 1567 } 1568 1569 #ifdef __POWER8_VECTOR__ 1570 static __inline__ vector bool long long __ATTRS_o_ai 1571 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1572 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1573 } 1574 1575 static __inline__ vector bool long long __ATTRS_o_ai 1576 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1577 return (vector bool long long)__builtin_altivec_vcmpequd( 1578 (vector long long)__a, (vector long long)__b); 1579 } 1580 #endif 1581 1582 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1583 vector float __b) { 1584 #ifdef __VSX__ 1585 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1586 #else 1587 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1588 #endif 1589 } 1590 1591 #ifdef __VSX__ 1592 static __inline__ vector bool long long __ATTRS_o_ai 1593 vec_cmpeq(vector double __a, vector double __b) { 1594 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1595 } 1596 #endif 1597 1598 /* vec_cmpgt */ 1599 1600 static __inline__ vector bool char __ATTRS_o_ai 1601 vec_cmpgt(vector signed char __a, vector signed char __b) { 1602 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 1603 } 1604 1605 static __inline__ vector bool char __ATTRS_o_ai 1606 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 1607 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 1608 } 1609 1610 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 1611 vector short __b) { 1612 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 1613 } 1614 1615 static __inline__ vector bool short __ATTRS_o_ai 1616 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 1617 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 1618 } 1619 1620 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 1621 vector int __b) { 1622 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 1623 } 1624 1625 static __inline__ vector bool int __ATTRS_o_ai 1626 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 1627 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 1628 } 1629 1630 #ifdef __POWER8_VECTOR__ 1631 static __inline__ vector bool long long __ATTRS_o_ai 1632 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 1633 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 1634 } 1635 1636 static __inline__ vector bool long long __ATTRS_o_ai 1637 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 1638 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 1639 } 1640 #endif 1641 1642 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 1643 vector float __b) { 1644 #ifdef __VSX__ 1645 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 1646 #else 1647 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 1648 #endif 1649 } 1650 1651 #ifdef __VSX__ 1652 static __inline__ vector bool long long __ATTRS_o_ai 1653 vec_cmpgt(vector double __a, vector double __b) { 1654 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 1655 } 1656 #endif 1657 1658 /* vec_cmpge */ 1659 1660 static __inline__ vector bool char __ATTRS_o_ai 1661 vec_cmpge(vector signed char __a, vector signed char __b) { 1662 return ~(vec_cmpgt(__b, __a)); 1663 } 1664 1665 static __inline__ vector bool char __ATTRS_o_ai 1666 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 1667 return ~(vec_cmpgt(__b, __a)); 1668 } 1669 1670 static __inline__ vector bool short __ATTRS_o_ai 1671 vec_cmpge(vector signed short __a, vector signed short __b) { 1672 return ~(vec_cmpgt(__b, __a)); 1673 } 1674 1675 static __inline__ vector bool short __ATTRS_o_ai 1676 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 1677 return ~(vec_cmpgt(__b, __a)); 1678 } 1679 1680 static __inline__ vector bool int __ATTRS_o_ai 1681 vec_cmpge(vector signed int __a, vector signed int __b) { 1682 return ~(vec_cmpgt(__b, __a)); 1683 } 1684 1685 static __inline__ vector bool int __ATTRS_o_ai 1686 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 1687 return ~(vec_cmpgt(__b, __a)); 1688 } 1689 1690 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 1691 vector float __b) { 1692 #ifdef __VSX__ 1693 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 1694 #else 1695 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 1696 #endif 1697 } 1698 1699 #ifdef __VSX__ 1700 static __inline__ vector bool long long __ATTRS_o_ai 1701 vec_cmpge(vector double __a, vector double __b) { 1702 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 1703 } 1704 #endif 1705 1706 #ifdef __POWER8_VECTOR__ 1707 static __inline__ vector bool long long __ATTRS_o_ai 1708 vec_cmpge(vector signed long long __a, vector signed long long __b) { 1709 return ~(vec_cmpgt(__b, __a)); 1710 } 1711 1712 static __inline__ vector bool long long __ATTRS_o_ai 1713 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 1714 return ~(vec_cmpgt(__b, __a)); 1715 } 1716 #endif 1717 1718 /* vec_vcmpgefp */ 1719 1720 static __inline__ vector bool int __attribute__((__always_inline__)) 1721 vec_vcmpgefp(vector float __a, vector float __b) { 1722 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 1723 } 1724 1725 /* vec_vcmpgtsb */ 1726 1727 static __inline__ vector bool char __attribute__((__always_inline__)) 1728 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 1729 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 1730 } 1731 1732 /* vec_vcmpgtub */ 1733 1734 static __inline__ vector bool char __attribute__((__always_inline__)) 1735 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 1736 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 1737 } 1738 1739 /* vec_vcmpgtsh */ 1740 1741 static __inline__ vector bool short __attribute__((__always_inline__)) 1742 vec_vcmpgtsh(vector short __a, vector short __b) { 1743 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 1744 } 1745 1746 /* vec_vcmpgtuh */ 1747 1748 static __inline__ vector bool short __attribute__((__always_inline__)) 1749 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 1750 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 1751 } 1752 1753 /* vec_vcmpgtsw */ 1754 1755 static __inline__ vector bool int __attribute__((__always_inline__)) 1756 vec_vcmpgtsw(vector int __a, vector int __b) { 1757 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 1758 } 1759 1760 /* vec_vcmpgtuw */ 1761 1762 static __inline__ vector bool int __attribute__((__always_inline__)) 1763 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 1764 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 1765 } 1766 1767 /* vec_vcmpgtfp */ 1768 1769 static __inline__ vector bool int __attribute__((__always_inline__)) 1770 vec_vcmpgtfp(vector float __a, vector float __b) { 1771 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 1772 } 1773 1774 /* vec_cmple */ 1775 1776 static __inline__ vector bool char __ATTRS_o_ai 1777 vec_cmple(vector signed char __a, vector signed char __b) { 1778 return vec_cmpge(__b, __a); 1779 } 1780 1781 static __inline__ vector bool char __ATTRS_o_ai 1782 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 1783 return vec_cmpge(__b, __a); 1784 } 1785 1786 static __inline__ vector bool short __ATTRS_o_ai 1787 vec_cmple(vector signed short __a, vector signed short __b) { 1788 return vec_cmpge(__b, __a); 1789 } 1790 1791 static __inline__ vector bool short __ATTRS_o_ai 1792 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 1793 return vec_cmpge(__b, __a); 1794 } 1795 1796 static __inline__ vector bool int __ATTRS_o_ai 1797 vec_cmple(vector signed int __a, vector signed int __b) { 1798 return vec_cmpge(__b, __a); 1799 } 1800 1801 static __inline__ vector bool int __ATTRS_o_ai 1802 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 1803 return vec_cmpge(__b, __a); 1804 } 1805 1806 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 1807 vector float __b) { 1808 return vec_cmpge(__b, __a); 1809 } 1810 1811 #ifdef __VSX__ 1812 static __inline__ vector bool long long __ATTRS_o_ai 1813 vec_cmple(vector double __a, vector double __b) { 1814 return vec_cmpge(__b, __a); 1815 } 1816 #endif 1817 1818 #ifdef __POWER8_VECTOR__ 1819 static __inline__ vector bool long long __ATTRS_o_ai 1820 vec_cmple(vector signed long long __a, vector signed long long __b) { 1821 return vec_cmpge(__b, __a); 1822 } 1823 1824 static __inline__ vector bool long long __ATTRS_o_ai 1825 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 1826 return vec_cmpge(__b, __a); 1827 } 1828 #endif 1829 1830 /* vec_cmplt */ 1831 1832 static __inline__ vector bool char __ATTRS_o_ai 1833 vec_cmplt(vector signed char __a, vector signed char __b) { 1834 return vec_cmpgt(__b, __a); 1835 } 1836 1837 static __inline__ vector bool char __ATTRS_o_ai 1838 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 1839 return vec_cmpgt(__b, __a); 1840 } 1841 1842 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 1843 vector short __b) { 1844 return vec_cmpgt(__b, __a); 1845 } 1846 1847 static __inline__ vector bool short __ATTRS_o_ai 1848 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 1849 return vec_cmpgt(__b, __a); 1850 } 1851 1852 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 1853 vector int __b) { 1854 return vec_cmpgt(__b, __a); 1855 } 1856 1857 static __inline__ vector bool int __ATTRS_o_ai 1858 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 1859 return vec_cmpgt(__b, __a); 1860 } 1861 1862 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 1863 vector float __b) { 1864 return vec_cmpgt(__b, __a); 1865 } 1866 1867 #ifdef __VSX__ 1868 static __inline__ vector bool long long __ATTRS_o_ai 1869 vec_cmplt(vector double __a, vector double __b) { 1870 return vec_cmpgt(__b, __a); 1871 } 1872 #endif 1873 1874 #ifdef __POWER8_VECTOR__ 1875 static __inline__ vector bool long long __ATTRS_o_ai 1876 vec_cmplt(vector signed long long __a, vector signed long long __b) { 1877 return vec_cmpgt(__b, __a); 1878 } 1879 1880 static __inline__ vector bool long long __ATTRS_o_ai 1881 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 1882 return vec_cmpgt(__b, __a); 1883 } 1884 1885 /* vec_cntlz */ 1886 1887 static __inline__ vector signed char __ATTRS_o_ai 1888 vec_cntlz(vector signed char __a) { 1889 return __builtin_altivec_vclzb(__a); 1890 } 1891 static __inline__ vector unsigned char __ATTRS_o_ai 1892 vec_cntlz(vector unsigned char __a) { 1893 return __builtin_altivec_vclzb(__a); 1894 } 1895 static __inline__ vector signed short __ATTRS_o_ai 1896 vec_cntlz(vector signed short __a) { 1897 return __builtin_altivec_vclzh(__a); 1898 } 1899 static __inline__ vector unsigned short __ATTRS_o_ai 1900 vec_cntlz(vector unsigned short __a) { 1901 return __builtin_altivec_vclzh(__a); 1902 } 1903 static __inline__ vector signed int __ATTRS_o_ai 1904 vec_cntlz(vector signed int __a) { 1905 return __builtin_altivec_vclzw(__a); 1906 } 1907 static __inline__ vector unsigned int __ATTRS_o_ai 1908 vec_cntlz(vector unsigned int __a) { 1909 return __builtin_altivec_vclzw(__a); 1910 } 1911 static __inline__ vector signed long long __ATTRS_o_ai 1912 vec_cntlz(vector signed long long __a) { 1913 return __builtin_altivec_vclzd(__a); 1914 } 1915 static __inline__ vector unsigned long long __ATTRS_o_ai 1916 vec_cntlz(vector unsigned long long __a) { 1917 return __builtin_altivec_vclzd(__a); 1918 } 1919 #endif 1920 1921 /* vec_cpsgn */ 1922 1923 #ifdef __VSX__ 1924 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 1925 vector float __b) { 1926 return __builtin_vsx_xvcpsgnsp(__a, __b); 1927 } 1928 1929 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 1930 vector double __b) { 1931 return __builtin_vsx_xvcpsgndp(__a, __b); 1932 } 1933 #endif 1934 1935 /* vec_ctf */ 1936 1937 static __inline__ vector float __ATTRS_o_ai vec_ctf(vector int __a, int __b) { 1938 return __builtin_altivec_vcfsx(__a, __b); 1939 } 1940 1941 static __inline__ vector float __ATTRS_o_ai vec_ctf(vector unsigned int __a, 1942 int __b) { 1943 return __builtin_altivec_vcfux((vector int)__a, __b); 1944 } 1945 1946 #ifdef __VSX__ 1947 static __inline__ vector double __ATTRS_o_ai 1948 vec_ctf(vector unsigned long long __a, int __b) { 1949 vector double __ret = __builtin_convertvector(__a, vector double); 1950 __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52); 1951 return __ret; 1952 } 1953 1954 static __inline__ vector double __ATTRS_o_ai 1955 vec_ctf(vector signed long long __a, int __b) { 1956 vector double __ret = __builtin_convertvector(__a, vector double); 1957 __ret *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52); 1958 return __ret; 1959 } 1960 #endif 1961 1962 /* vec_vcfsx */ 1963 1964 static __inline__ vector float __attribute__((__always_inline__)) 1965 vec_vcfsx(vector int __a, int __b) { 1966 return __builtin_altivec_vcfsx(__a, __b); 1967 } 1968 1969 /* vec_vcfux */ 1970 1971 static __inline__ vector float __attribute__((__always_inline__)) 1972 vec_vcfux(vector unsigned int __a, int __b) { 1973 return __builtin_altivec_vcfux((vector int)__a, __b); 1974 } 1975 1976 /* vec_cts */ 1977 1978 static __inline__ vector int __ATTRS_o_ai vec_cts(vector float __a, int __b) { 1979 return __builtin_altivec_vctsxs(__a, __b); 1980 } 1981 1982 #ifdef __VSX__ 1983 static __inline__ vector signed long long __ATTRS_o_ai 1984 vec_cts(vector double __a, int __b) { 1985 __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52); 1986 return __builtin_convertvector(__a, vector signed long long); 1987 } 1988 #endif 1989 1990 /* vec_vctsxs */ 1991 1992 static __inline__ vector int __attribute__((__always_inline__)) 1993 vec_vctsxs(vector float __a, int __b) { 1994 return __builtin_altivec_vctsxs(__a, __b); 1995 } 1996 1997 /* vec_ctu */ 1998 1999 static __inline__ vector unsigned int __ATTRS_o_ai vec_ctu(vector float __a, 2000 int __b) { 2001 return __builtin_altivec_vctuxs(__a, __b); 2002 } 2003 2004 #ifdef __VSX__ 2005 static __inline__ vector unsigned long long __ATTRS_o_ai 2006 vec_ctu(vector double __a, int __b) { 2007 __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52); 2008 return __builtin_convertvector(__a, vector unsigned long long); 2009 } 2010 #endif 2011 2012 /* vec_vctuxs */ 2013 2014 static __inline__ vector unsigned int __attribute__((__always_inline__)) 2015 vec_vctuxs(vector float __a, int __b) { 2016 return __builtin_altivec_vctuxs(__a, __b); 2017 } 2018 2019 /* vec_double */ 2020 2021 #ifdef __VSX__ 2022 static __inline__ vector double __ATTRS_o_ai 2023 vec_double(vector signed long long __a) { 2024 vector double __ret = {__a[0], __a[1]}; 2025 return __ret; 2026 } 2027 2028 static __inline__ vector double __ATTRS_o_ai 2029 vec_double(vector unsigned long long __a) { 2030 vector double __ret = {__a[0], __a[1]}; 2031 return __ret; 2032 } 2033 #endif 2034 2035 /* vec_div */ 2036 2037 /* Integer vector divides (vectors are scalarized, elements divided 2038 and the vectors reassembled). 2039 */ 2040 static __inline__ vector signed char __ATTRS_o_ai 2041 vec_div(vector signed char __a, vector signed char __b) { 2042 return __a / __b; 2043 } 2044 2045 static __inline__ vector unsigned char __ATTRS_o_ai 2046 vec_div(vector unsigned char __a, vector unsigned char __b) { 2047 return __a / __b; 2048 } 2049 2050 static __inline__ vector signed short __ATTRS_o_ai 2051 vec_div(vector signed short __a, vector signed short __b) { 2052 return __a / __b; 2053 } 2054 2055 static __inline__ vector unsigned short __ATTRS_o_ai 2056 vec_div(vector unsigned short __a, vector unsigned short __b) { 2057 return __a / __b; 2058 } 2059 2060 static __inline__ vector signed int __ATTRS_o_ai 2061 vec_div(vector signed int __a, vector signed int __b) { 2062 return __a / __b; 2063 } 2064 2065 static __inline__ vector unsigned int __ATTRS_o_ai 2066 vec_div(vector unsigned int __a, vector unsigned int __b) { 2067 return __a / __b; 2068 } 2069 2070 #ifdef __VSX__ 2071 static __inline__ vector signed long long __ATTRS_o_ai 2072 vec_div(vector signed long long __a, vector signed long long __b) { 2073 return __a / __b; 2074 } 2075 2076 static __inline__ vector unsigned long long __ATTRS_o_ai 2077 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 2078 return __a / __b; 2079 } 2080 2081 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 2082 vector float __b) { 2083 return __a / __b; 2084 } 2085 2086 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 2087 vector double __b) { 2088 return __a / __b; 2089 } 2090 #endif 2091 2092 /* vec_dss */ 2093 2094 static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) { 2095 __builtin_altivec_dss(__a); 2096 } 2097 2098 /* vec_dssall */ 2099 2100 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 2101 __builtin_altivec_dssall(); 2102 } 2103 2104 /* vec_dst */ 2105 2106 static __inline__ void __attribute__((__always_inline__)) 2107 vec_dst(const void *__a, int __b, int __c) { 2108 __builtin_altivec_dst(__a, __b, __c); 2109 } 2110 2111 /* vec_dstst */ 2112 2113 static __inline__ void __attribute__((__always_inline__)) 2114 vec_dstst(const void *__a, int __b, int __c) { 2115 __builtin_altivec_dstst(__a, __b, __c); 2116 } 2117 2118 /* vec_dststt */ 2119 2120 static __inline__ void __attribute__((__always_inline__)) 2121 vec_dststt(const void *__a, int __b, int __c) { 2122 __builtin_altivec_dststt(__a, __b, __c); 2123 } 2124 2125 /* vec_dstt */ 2126 2127 static __inline__ void __attribute__((__always_inline__)) 2128 vec_dstt(const void *__a, int __b, int __c) { 2129 __builtin_altivec_dstt(__a, __b, __c); 2130 } 2131 2132 /* vec_eqv */ 2133 2134 #ifdef __POWER8_VECTOR__ 2135 static __inline__ vector signed char __ATTRS_o_ai 2136 vec_eqv(vector signed char __a, vector signed char __b) { 2137 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 2138 (vector unsigned int)__b); 2139 } 2140 2141 static __inline__ vector unsigned char __ATTRS_o_ai 2142 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 2143 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 2144 (vector unsigned int)__b); 2145 } 2146 2147 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 2148 vector bool char __b) { 2149 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 2150 (vector unsigned int)__b); 2151 } 2152 2153 static __inline__ vector signed short __ATTRS_o_ai 2154 vec_eqv(vector signed short __a, vector signed short __b) { 2155 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 2156 (vector unsigned int)__b); 2157 } 2158 2159 static __inline__ vector unsigned short __ATTRS_o_ai 2160 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 2161 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 2162 (vector unsigned int)__b); 2163 } 2164 2165 static __inline__ vector bool short __ATTRS_o_ai 2166 vec_eqv(vector bool short __a, vector bool short __b) { 2167 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 2168 (vector unsigned int)__b); 2169 } 2170 2171 static __inline__ vector signed int __ATTRS_o_ai 2172 vec_eqv(vector signed int __a, vector signed int __b) { 2173 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 2174 (vector unsigned int)__b); 2175 } 2176 2177 static __inline__ vector unsigned int __ATTRS_o_ai 2178 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 2179 return __builtin_vsx_xxleqv(__a, __b); 2180 } 2181 2182 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 2183 vector bool int __b) { 2184 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 2185 (vector unsigned int)__b); 2186 } 2187 2188 static __inline__ vector signed long long __ATTRS_o_ai 2189 vec_eqv(vector signed long long __a, vector signed long long __b) { 2190 return (vector signed long long)__builtin_vsx_xxleqv( 2191 (vector unsigned int)__a, (vector unsigned int)__b); 2192 } 2193 2194 static __inline__ vector unsigned long long __ATTRS_o_ai 2195 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 2196 return (vector unsigned long long)__builtin_vsx_xxleqv( 2197 (vector unsigned int)__a, (vector unsigned int)__b); 2198 } 2199 2200 static __inline__ vector bool long long __ATTRS_o_ai 2201 vec_eqv(vector bool long long __a, vector bool long long __b) { 2202 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 2203 (vector unsigned int)__b); 2204 } 2205 2206 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 2207 vector float __b) { 2208 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 2209 (vector unsigned int)__b); 2210 } 2211 2212 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 2213 vector double __b) { 2214 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 2215 (vector unsigned int)__b); 2216 } 2217 #endif 2218 2219 /* vec_expte */ 2220 2221 static __inline__ vector float __attribute__((__always_inline__)) 2222 vec_expte(vector float __a) { 2223 return __builtin_altivec_vexptefp(__a); 2224 } 2225 2226 /* vec_vexptefp */ 2227 2228 static __inline__ vector float __attribute__((__always_inline__)) 2229 vec_vexptefp(vector float __a) { 2230 return __builtin_altivec_vexptefp(__a); 2231 } 2232 2233 /* vec_floor */ 2234 2235 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 2236 #ifdef __VSX__ 2237 return __builtin_vsx_xvrspim(__a); 2238 #else 2239 return __builtin_altivec_vrfim(__a); 2240 #endif 2241 } 2242 2243 #ifdef __VSX__ 2244 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 2245 return __builtin_vsx_xvrdpim(__a); 2246 } 2247 #endif 2248 2249 /* vec_vrfim */ 2250 2251 static __inline__ vector float __attribute__((__always_inline__)) 2252 vec_vrfim(vector float __a) { 2253 return __builtin_altivec_vrfim(__a); 2254 } 2255 2256 /* vec_ld */ 2257 2258 static __inline__ vector signed char __ATTRS_o_ai 2259 vec_ld(int __a, const vector signed char *__b) { 2260 return (vector signed char)__builtin_altivec_lvx(__a, __b); 2261 } 2262 2263 static __inline__ vector signed char __ATTRS_o_ai 2264 vec_ld(int __a, const signed char *__b) { 2265 return (vector signed char)__builtin_altivec_lvx(__a, __b); 2266 } 2267 2268 static __inline__ vector unsigned char __ATTRS_o_ai 2269 vec_ld(int __a, const vector unsigned char *__b) { 2270 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 2271 } 2272 2273 static __inline__ vector unsigned char __ATTRS_o_ai 2274 vec_ld(int __a, const unsigned char *__b) { 2275 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 2276 } 2277 2278 static __inline__ vector bool char __ATTRS_o_ai 2279 vec_ld(int __a, const vector bool char *__b) { 2280 return (vector bool char)__builtin_altivec_lvx(__a, __b); 2281 } 2282 2283 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, 2284 const vector short *__b) { 2285 return (vector short)__builtin_altivec_lvx(__a, __b); 2286 } 2287 2288 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) { 2289 return (vector short)__builtin_altivec_lvx(__a, __b); 2290 } 2291 2292 static __inline__ vector unsigned short __ATTRS_o_ai 2293 vec_ld(int __a, const vector unsigned short *__b) { 2294 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 2295 } 2296 2297 static __inline__ vector unsigned short __ATTRS_o_ai 2298 vec_ld(int __a, const unsigned short *__b) { 2299 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 2300 } 2301 2302 static __inline__ vector bool short __ATTRS_o_ai 2303 vec_ld(int __a, const vector bool short *__b) { 2304 return (vector bool short)__builtin_altivec_lvx(__a, __b); 2305 } 2306 2307 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a, 2308 const vector pixel *__b) { 2309 return (vector pixel)__builtin_altivec_lvx(__a, __b); 2310 } 2311 2312 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, 2313 const vector int *__b) { 2314 return (vector int)__builtin_altivec_lvx(__a, __b); 2315 } 2316 2317 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) { 2318 return (vector int)__builtin_altivec_lvx(__a, __b); 2319 } 2320 2321 static __inline__ vector unsigned int __ATTRS_o_ai 2322 vec_ld(int __a, const vector unsigned int *__b) { 2323 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 2324 } 2325 2326 static __inline__ vector unsigned int __ATTRS_o_ai 2327 vec_ld(int __a, const unsigned int *__b) { 2328 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 2329 } 2330 2331 static __inline__ vector bool int __ATTRS_o_ai 2332 vec_ld(int __a, const vector bool int *__b) { 2333 return (vector bool int)__builtin_altivec_lvx(__a, __b); 2334 } 2335 2336 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, 2337 const vector float *__b) { 2338 return (vector float)__builtin_altivec_lvx(__a, __b); 2339 } 2340 2341 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) { 2342 return (vector float)__builtin_altivec_lvx(__a, __b); 2343 } 2344 2345 /* vec_lvx */ 2346 2347 static __inline__ vector signed char __ATTRS_o_ai 2348 vec_lvx(int __a, const vector signed char *__b) { 2349 return (vector signed char)__builtin_altivec_lvx(__a, __b); 2350 } 2351 2352 static __inline__ vector signed char __ATTRS_o_ai 2353 vec_lvx(int __a, const signed char *__b) { 2354 return (vector signed char)__builtin_altivec_lvx(__a, __b); 2355 } 2356 2357 static __inline__ vector unsigned char __ATTRS_o_ai 2358 vec_lvx(int __a, const vector unsigned char *__b) { 2359 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 2360 } 2361 2362 static __inline__ vector unsigned char __ATTRS_o_ai 2363 vec_lvx(int __a, const unsigned char *__b) { 2364 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 2365 } 2366 2367 static __inline__ vector bool char __ATTRS_o_ai 2368 vec_lvx(int __a, const vector bool char *__b) { 2369 return (vector bool char)__builtin_altivec_lvx(__a, __b); 2370 } 2371 2372 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, 2373 const vector short *__b) { 2374 return (vector short)__builtin_altivec_lvx(__a, __b); 2375 } 2376 2377 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) { 2378 return (vector short)__builtin_altivec_lvx(__a, __b); 2379 } 2380 2381 static __inline__ vector unsigned short __ATTRS_o_ai 2382 vec_lvx(int __a, const vector unsigned short *__b) { 2383 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 2384 } 2385 2386 static __inline__ vector unsigned short __ATTRS_o_ai 2387 vec_lvx(int __a, const unsigned short *__b) { 2388 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 2389 } 2390 2391 static __inline__ vector bool short __ATTRS_o_ai 2392 vec_lvx(int __a, const vector bool short *__b) { 2393 return (vector bool short)__builtin_altivec_lvx(__a, __b); 2394 } 2395 2396 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a, 2397 const vector pixel *__b) { 2398 return (vector pixel)__builtin_altivec_lvx(__a, __b); 2399 } 2400 2401 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, 2402 const vector int *__b) { 2403 return (vector int)__builtin_altivec_lvx(__a, __b); 2404 } 2405 2406 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) { 2407 return (vector int)__builtin_altivec_lvx(__a, __b); 2408 } 2409 2410 static __inline__ vector unsigned int __ATTRS_o_ai 2411 vec_lvx(int __a, const vector unsigned int *__b) { 2412 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 2413 } 2414 2415 static __inline__ vector unsigned int __ATTRS_o_ai 2416 vec_lvx(int __a, const unsigned int *__b) { 2417 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 2418 } 2419 2420 static __inline__ vector bool int __ATTRS_o_ai 2421 vec_lvx(int __a, const vector bool int *__b) { 2422 return (vector bool int)__builtin_altivec_lvx(__a, __b); 2423 } 2424 2425 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, 2426 const vector float *__b) { 2427 return (vector float)__builtin_altivec_lvx(__a, __b); 2428 } 2429 2430 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) { 2431 return (vector float)__builtin_altivec_lvx(__a, __b); 2432 } 2433 2434 /* vec_lde */ 2435 2436 static __inline__ vector signed char __ATTRS_o_ai 2437 vec_lde(int __a, const signed char *__b) { 2438 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 2439 } 2440 2441 static __inline__ vector unsigned char __ATTRS_o_ai 2442 vec_lde(int __a, const unsigned char *__b) { 2443 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 2444 } 2445 2446 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) { 2447 return (vector short)__builtin_altivec_lvehx(__a, __b); 2448 } 2449 2450 static __inline__ vector unsigned short __ATTRS_o_ai 2451 vec_lde(int __a, const unsigned short *__b) { 2452 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 2453 } 2454 2455 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) { 2456 return (vector int)__builtin_altivec_lvewx(__a, __b); 2457 } 2458 2459 static __inline__ vector unsigned int __ATTRS_o_ai 2460 vec_lde(int __a, const unsigned int *__b) { 2461 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 2462 } 2463 2464 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) { 2465 return (vector float)__builtin_altivec_lvewx(__a, __b); 2466 } 2467 2468 /* vec_lvebx */ 2469 2470 static __inline__ vector signed char __ATTRS_o_ai 2471 vec_lvebx(int __a, const signed char *__b) { 2472 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 2473 } 2474 2475 static __inline__ vector unsigned char __ATTRS_o_ai 2476 vec_lvebx(int __a, const unsigned char *__b) { 2477 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 2478 } 2479 2480 /* vec_lvehx */ 2481 2482 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a, 2483 const short *__b) { 2484 return (vector short)__builtin_altivec_lvehx(__a, __b); 2485 } 2486 2487 static __inline__ vector unsigned short __ATTRS_o_ai 2488 vec_lvehx(int __a, const unsigned short *__b) { 2489 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 2490 } 2491 2492 /* vec_lvewx */ 2493 2494 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) { 2495 return (vector int)__builtin_altivec_lvewx(__a, __b); 2496 } 2497 2498 static __inline__ vector unsigned int __ATTRS_o_ai 2499 vec_lvewx(int __a, const unsigned int *__b) { 2500 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 2501 } 2502 2503 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a, 2504 const float *__b) { 2505 return (vector float)__builtin_altivec_lvewx(__a, __b); 2506 } 2507 2508 /* vec_ldl */ 2509 2510 static __inline__ vector signed char __ATTRS_o_ai 2511 vec_ldl(int __a, const vector signed char *__b) { 2512 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 2513 } 2514 2515 static __inline__ vector signed char __ATTRS_o_ai 2516 vec_ldl(int __a, const signed char *__b) { 2517 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 2518 } 2519 2520 static __inline__ vector unsigned char __ATTRS_o_ai 2521 vec_ldl(int __a, const vector unsigned char *__b) { 2522 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 2523 } 2524 2525 static __inline__ vector unsigned char __ATTRS_o_ai 2526 vec_ldl(int __a, const unsigned char *__b) { 2527 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 2528 } 2529 2530 static __inline__ vector bool char __ATTRS_o_ai 2531 vec_ldl(int __a, const vector bool char *__b) { 2532 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 2533 } 2534 2535 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, 2536 const vector short *__b) { 2537 return (vector short)__builtin_altivec_lvxl(__a, __b); 2538 } 2539 2540 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) { 2541 return (vector short)__builtin_altivec_lvxl(__a, __b); 2542 } 2543 2544 static __inline__ vector unsigned short __ATTRS_o_ai 2545 vec_ldl(int __a, const vector unsigned short *__b) { 2546 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 2547 } 2548 2549 static __inline__ vector unsigned short __ATTRS_o_ai 2550 vec_ldl(int __a, const unsigned short *__b) { 2551 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 2552 } 2553 2554 static __inline__ vector bool short __ATTRS_o_ai 2555 vec_ldl(int __a, const vector bool short *__b) { 2556 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 2557 } 2558 2559 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a, 2560 const vector pixel *__b) { 2561 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 2562 } 2563 2564 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, 2565 const vector int *__b) { 2566 return (vector int)__builtin_altivec_lvxl(__a, __b); 2567 } 2568 2569 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) { 2570 return (vector int)__builtin_altivec_lvxl(__a, __b); 2571 } 2572 2573 static __inline__ vector unsigned int __ATTRS_o_ai 2574 vec_ldl(int __a, const vector unsigned int *__b) { 2575 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 2576 } 2577 2578 static __inline__ vector unsigned int __ATTRS_o_ai 2579 vec_ldl(int __a, const unsigned int *__b) { 2580 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 2581 } 2582 2583 static __inline__ vector bool int __ATTRS_o_ai 2584 vec_ldl(int __a, const vector bool int *__b) { 2585 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 2586 } 2587 2588 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, 2589 const vector float *__b) { 2590 return (vector float)__builtin_altivec_lvxl(__a, __b); 2591 } 2592 2593 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) { 2594 return (vector float)__builtin_altivec_lvxl(__a, __b); 2595 } 2596 2597 /* vec_lvxl */ 2598 2599 static __inline__ vector signed char __ATTRS_o_ai 2600 vec_lvxl(int __a, const vector signed char *__b) { 2601 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 2602 } 2603 2604 static __inline__ vector signed char __ATTRS_o_ai 2605 vec_lvxl(int __a, const signed char *__b) { 2606 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 2607 } 2608 2609 static __inline__ vector unsigned char __ATTRS_o_ai 2610 vec_lvxl(int __a, const vector unsigned char *__b) { 2611 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 2612 } 2613 2614 static __inline__ vector unsigned char __ATTRS_o_ai 2615 vec_lvxl(int __a, const unsigned char *__b) { 2616 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 2617 } 2618 2619 static __inline__ vector bool char __ATTRS_o_ai 2620 vec_lvxl(int __a, const vector bool char *__b) { 2621 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 2622 } 2623 2624 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 2625 const vector short *__b) { 2626 return (vector short)__builtin_altivec_lvxl(__a, __b); 2627 } 2628 2629 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 2630 const short *__b) { 2631 return (vector short)__builtin_altivec_lvxl(__a, __b); 2632 } 2633 2634 static __inline__ vector unsigned short __ATTRS_o_ai 2635 vec_lvxl(int __a, const vector unsigned short *__b) { 2636 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 2637 } 2638 2639 static __inline__ vector unsigned short __ATTRS_o_ai 2640 vec_lvxl(int __a, const unsigned short *__b) { 2641 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 2642 } 2643 2644 static __inline__ vector bool short __ATTRS_o_ai 2645 vec_lvxl(int __a, const vector bool short *__b) { 2646 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 2647 } 2648 2649 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a, 2650 const vector pixel *__b) { 2651 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 2652 } 2653 2654 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, 2655 const vector int *__b) { 2656 return (vector int)__builtin_altivec_lvxl(__a, __b); 2657 } 2658 2659 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) { 2660 return (vector int)__builtin_altivec_lvxl(__a, __b); 2661 } 2662 2663 static __inline__ vector unsigned int __ATTRS_o_ai 2664 vec_lvxl(int __a, const vector unsigned int *__b) { 2665 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 2666 } 2667 2668 static __inline__ vector unsigned int __ATTRS_o_ai 2669 vec_lvxl(int __a, const unsigned int *__b) { 2670 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 2671 } 2672 2673 static __inline__ vector bool int __ATTRS_o_ai 2674 vec_lvxl(int __a, const vector bool int *__b) { 2675 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 2676 } 2677 2678 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 2679 const vector float *__b) { 2680 return (vector float)__builtin_altivec_lvxl(__a, __b); 2681 } 2682 2683 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 2684 const float *__b) { 2685 return (vector float)__builtin_altivec_lvxl(__a, __b); 2686 } 2687 2688 /* vec_loge */ 2689 2690 static __inline__ vector float __attribute__((__always_inline__)) 2691 vec_loge(vector float __a) { 2692 return __builtin_altivec_vlogefp(__a); 2693 } 2694 2695 /* vec_vlogefp */ 2696 2697 static __inline__ vector float __attribute__((__always_inline__)) 2698 vec_vlogefp(vector float __a) { 2699 return __builtin_altivec_vlogefp(__a); 2700 } 2701 2702 /* vec_lvsl */ 2703 2704 #ifdef __LITTLE_ENDIAN__ 2705 static __inline__ vector unsigned char __ATTRS_o_ai 2706 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2707 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 2708 vector unsigned char mask = 2709 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2710 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2711 7, 6, 5, 4, 3, 2, 1, 0}; 2712 return vec_perm(mask, mask, reverse); 2713 } 2714 #else 2715 static __inline__ vector unsigned char __ATTRS_o_ai 2716 vec_lvsl(int __a, const signed char *__b) { 2717 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2718 } 2719 #endif 2720 2721 #ifdef __LITTLE_ENDIAN__ 2722 static __inline__ vector unsigned char __ATTRS_o_ai 2723 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2724 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 2725 vector unsigned char mask = 2726 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2727 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2728 7, 6, 5, 4, 3, 2, 1, 0}; 2729 return vec_perm(mask, mask, reverse); 2730 } 2731 #else 2732 static __inline__ vector unsigned char __ATTRS_o_ai 2733 vec_lvsl(int __a, const unsigned char *__b) { 2734 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2735 } 2736 #endif 2737 2738 #ifdef __LITTLE_ENDIAN__ 2739 static __inline__ vector unsigned char __ATTRS_o_ai 2740 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2741 loads/stores"))) vec_lvsl(int __a, const short *__b) { 2742 vector unsigned char mask = 2743 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2744 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2745 7, 6, 5, 4, 3, 2, 1, 0}; 2746 return vec_perm(mask, mask, reverse); 2747 } 2748 #else 2749 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 2750 const short *__b) { 2751 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2752 } 2753 #endif 2754 2755 #ifdef __LITTLE_ENDIAN__ 2756 static __inline__ vector unsigned char __ATTRS_o_ai 2757 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2758 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 2759 vector unsigned char mask = 2760 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2761 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2762 7, 6, 5, 4, 3, 2, 1, 0}; 2763 return vec_perm(mask, mask, reverse); 2764 } 2765 #else 2766 static __inline__ vector unsigned char __ATTRS_o_ai 2767 vec_lvsl(int __a, const unsigned short *__b) { 2768 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2769 } 2770 #endif 2771 2772 #ifdef __LITTLE_ENDIAN__ 2773 static __inline__ vector unsigned char __ATTRS_o_ai 2774 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2775 loads/stores"))) vec_lvsl(int __a, const int *__b) { 2776 vector unsigned char mask = 2777 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2778 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2779 7, 6, 5, 4, 3, 2, 1, 0}; 2780 return vec_perm(mask, mask, reverse); 2781 } 2782 #else 2783 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 2784 const int *__b) { 2785 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2786 } 2787 #endif 2788 2789 #ifdef __LITTLE_ENDIAN__ 2790 static __inline__ vector unsigned char __ATTRS_o_ai 2791 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2792 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 2793 vector unsigned char mask = 2794 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2795 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2796 7, 6, 5, 4, 3, 2, 1, 0}; 2797 return vec_perm(mask, mask, reverse); 2798 } 2799 #else 2800 static __inline__ vector unsigned char __ATTRS_o_ai 2801 vec_lvsl(int __a, const unsigned int *__b) { 2802 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2803 } 2804 #endif 2805 2806 #ifdef __LITTLE_ENDIAN__ 2807 static __inline__ vector unsigned char __ATTRS_o_ai 2808 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2809 loads/stores"))) vec_lvsl(int __a, const float *__b) { 2810 vector unsigned char mask = 2811 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2812 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2813 7, 6, 5, 4, 3, 2, 1, 0}; 2814 return vec_perm(mask, mask, reverse); 2815 } 2816 #else 2817 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 2818 const float *__b) { 2819 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 2820 } 2821 #endif 2822 2823 /* vec_lvsr */ 2824 2825 #ifdef __LITTLE_ENDIAN__ 2826 static __inline__ vector unsigned char __ATTRS_o_ai 2827 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2828 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 2829 vector unsigned char mask = 2830 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2831 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2832 7, 6, 5, 4, 3, 2, 1, 0}; 2833 return vec_perm(mask, mask, reverse); 2834 } 2835 #else 2836 static __inline__ vector unsigned char __ATTRS_o_ai 2837 vec_lvsr(int __a, const signed char *__b) { 2838 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2839 } 2840 #endif 2841 2842 #ifdef __LITTLE_ENDIAN__ 2843 static __inline__ vector unsigned char __ATTRS_o_ai 2844 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2845 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 2846 vector unsigned char mask = 2847 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2848 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2849 7, 6, 5, 4, 3, 2, 1, 0}; 2850 return vec_perm(mask, mask, reverse); 2851 } 2852 #else 2853 static __inline__ vector unsigned char __ATTRS_o_ai 2854 vec_lvsr(int __a, const unsigned char *__b) { 2855 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2856 } 2857 #endif 2858 2859 #ifdef __LITTLE_ENDIAN__ 2860 static __inline__ vector unsigned char __ATTRS_o_ai 2861 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2862 loads/stores"))) vec_lvsr(int __a, const short *__b) { 2863 vector unsigned char mask = 2864 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2865 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2866 7, 6, 5, 4, 3, 2, 1, 0}; 2867 return vec_perm(mask, mask, reverse); 2868 } 2869 #else 2870 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 2871 const short *__b) { 2872 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2873 } 2874 #endif 2875 2876 #ifdef __LITTLE_ENDIAN__ 2877 static __inline__ vector unsigned char __ATTRS_o_ai 2878 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2879 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 2880 vector unsigned char mask = 2881 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2882 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2883 7, 6, 5, 4, 3, 2, 1, 0}; 2884 return vec_perm(mask, mask, reverse); 2885 } 2886 #else 2887 static __inline__ vector unsigned char __ATTRS_o_ai 2888 vec_lvsr(int __a, const unsigned short *__b) { 2889 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2890 } 2891 #endif 2892 2893 #ifdef __LITTLE_ENDIAN__ 2894 static __inline__ vector unsigned char __ATTRS_o_ai 2895 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2896 loads/stores"))) vec_lvsr(int __a, const int *__b) { 2897 vector unsigned char mask = 2898 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2899 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2900 7, 6, 5, 4, 3, 2, 1, 0}; 2901 return vec_perm(mask, mask, reverse); 2902 } 2903 #else 2904 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 2905 const int *__b) { 2906 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2907 } 2908 #endif 2909 2910 #ifdef __LITTLE_ENDIAN__ 2911 static __inline__ vector unsigned char __ATTRS_o_ai 2912 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2913 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 2914 vector unsigned char mask = 2915 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2916 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2917 7, 6, 5, 4, 3, 2, 1, 0}; 2918 return vec_perm(mask, mask, reverse); 2919 } 2920 #else 2921 static __inline__ vector unsigned char __ATTRS_o_ai 2922 vec_lvsr(int __a, const unsigned int *__b) { 2923 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2924 } 2925 #endif 2926 2927 #ifdef __LITTLE_ENDIAN__ 2928 static __inline__ vector unsigned char __ATTRS_o_ai 2929 __attribute__((__deprecated__("use assignment for unaligned little endian \ 2930 loads/stores"))) vec_lvsr(int __a, const float *__b) { 2931 vector unsigned char mask = 2932 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2933 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 2934 7, 6, 5, 4, 3, 2, 1, 0}; 2935 return vec_perm(mask, mask, reverse); 2936 } 2937 #else 2938 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 2939 const float *__b) { 2940 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 2941 } 2942 #endif 2943 2944 /* vec_madd */ 2945 static __inline__ vector signed short __ATTRS_o_ai 2946 vec_mladd(vector signed short, vector signed short, vector signed short); 2947 static __inline__ vector signed short __ATTRS_o_ai 2948 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 2949 static __inline__ vector signed short __ATTRS_o_ai 2950 vec_mladd(vector unsigned short, vector signed short, vector signed short); 2951 static __inline__ vector unsigned short __ATTRS_o_ai 2952 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 2953 2954 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 2955 vector signed short __a, vector signed short __b, vector signed short __c) { 2956 return vec_mladd(__a, __b, __c); 2957 } 2958 2959 static __inline__ vector signed short __ATTRS_o_ai 2960 vec_madd(vector signed short __a, vector unsigned short __b, 2961 vector unsigned short __c) { 2962 return vec_mladd(__a, __b, __c); 2963 } 2964 2965 static __inline__ vector signed short __ATTRS_o_ai 2966 vec_madd(vector unsigned short __a, vector signed short __b, 2967 vector signed short __c) { 2968 return vec_mladd(__a, __b, __c); 2969 } 2970 2971 static __inline__ vector unsigned short __ATTRS_o_ai 2972 vec_madd(vector unsigned short __a, vector unsigned short __b, 2973 vector unsigned short __c) { 2974 return vec_mladd(__a, __b, __c); 2975 } 2976 2977 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 2978 vector float __b, 2979 vector float __c) { 2980 #ifdef __VSX__ 2981 return __builtin_vsx_xvmaddasp(__a, __b, __c); 2982 #else 2983 return __builtin_altivec_vmaddfp(__a, __b, __c); 2984 #endif 2985 } 2986 2987 #ifdef __VSX__ 2988 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 2989 vector double __b, 2990 vector double __c) { 2991 return __builtin_vsx_xvmaddadp(__a, __b, __c); 2992 } 2993 #endif 2994 2995 /* vec_vmaddfp */ 2996 2997 static __inline__ vector float __attribute__((__always_inline__)) 2998 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 2999 return __builtin_altivec_vmaddfp(__a, __b, __c); 3000 } 3001 3002 /* vec_madds */ 3003 3004 static __inline__ vector signed short __attribute__((__always_inline__)) 3005 vec_madds(vector signed short __a, vector signed short __b, 3006 vector signed short __c) { 3007 return __builtin_altivec_vmhaddshs(__a, __b, __c); 3008 } 3009 3010 /* vec_vmhaddshs */ 3011 static __inline__ vector signed short __attribute__((__always_inline__)) 3012 vec_vmhaddshs(vector signed short __a, vector signed short __b, 3013 vector signed short __c) { 3014 return __builtin_altivec_vmhaddshs(__a, __b, __c); 3015 } 3016 3017 /* vec_msub */ 3018 3019 #ifdef __VSX__ 3020 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 3021 vector float __b, 3022 vector float __c) { 3023 return __builtin_vsx_xvmsubasp(__a, __b, __c); 3024 } 3025 3026 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 3027 vector double __b, 3028 vector double __c) { 3029 return __builtin_vsx_xvmsubadp(__a, __b, __c); 3030 } 3031 #endif 3032 3033 /* vec_max */ 3034 3035 static __inline__ vector signed char __ATTRS_o_ai 3036 vec_max(vector signed char __a, vector signed char __b) { 3037 return __builtin_altivec_vmaxsb(__a, __b); 3038 } 3039 3040 static __inline__ vector signed char __ATTRS_o_ai 3041 vec_max(vector bool char __a, vector signed char __b) { 3042 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 3043 } 3044 3045 static __inline__ vector signed char __ATTRS_o_ai 3046 vec_max(vector signed char __a, vector bool char __b) { 3047 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 3048 } 3049 3050 static __inline__ vector unsigned char __ATTRS_o_ai 3051 vec_max(vector unsigned char __a, vector unsigned char __b) { 3052 return __builtin_altivec_vmaxub(__a, __b); 3053 } 3054 3055 static __inline__ vector unsigned char __ATTRS_o_ai 3056 vec_max(vector bool char __a, vector unsigned char __b) { 3057 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 3058 } 3059 3060 static __inline__ vector unsigned char __ATTRS_o_ai 3061 vec_max(vector unsigned char __a, vector bool char __b) { 3062 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 3063 } 3064 3065 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 3066 vector short __b) { 3067 return __builtin_altivec_vmaxsh(__a, __b); 3068 } 3069 3070 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 3071 vector short __b) { 3072 return __builtin_altivec_vmaxsh((vector short)__a, __b); 3073 } 3074 3075 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 3076 vector bool short __b) { 3077 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 3078 } 3079 3080 static __inline__ vector unsigned short __ATTRS_o_ai 3081 vec_max(vector unsigned short __a, vector unsigned short __b) { 3082 return __builtin_altivec_vmaxuh(__a, __b); 3083 } 3084 3085 static __inline__ vector unsigned short __ATTRS_o_ai 3086 vec_max(vector bool short __a, vector unsigned short __b) { 3087 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 3088 } 3089 3090 static __inline__ vector unsigned short __ATTRS_o_ai 3091 vec_max(vector unsigned short __a, vector bool short __b) { 3092 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 3093 } 3094 3095 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 3096 vector int __b) { 3097 return __builtin_altivec_vmaxsw(__a, __b); 3098 } 3099 3100 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 3101 vector int __b) { 3102 return __builtin_altivec_vmaxsw((vector int)__a, __b); 3103 } 3104 3105 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 3106 vector bool int __b) { 3107 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 3108 } 3109 3110 static __inline__ vector unsigned int __ATTRS_o_ai 3111 vec_max(vector unsigned int __a, vector unsigned int __b) { 3112 return __builtin_altivec_vmaxuw(__a, __b); 3113 } 3114 3115 static __inline__ vector unsigned int __ATTRS_o_ai 3116 vec_max(vector bool int __a, vector unsigned int __b) { 3117 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 3118 } 3119 3120 static __inline__ vector unsigned int __ATTRS_o_ai 3121 vec_max(vector unsigned int __a, vector bool int __b) { 3122 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 3123 } 3124 3125 #ifdef __POWER8_VECTOR__ 3126 static __inline__ vector signed long long __ATTRS_o_ai 3127 vec_max(vector signed long long __a, vector signed long long __b) { 3128 return __builtin_altivec_vmaxsd(__a, __b); 3129 } 3130 3131 static __inline__ vector signed long long __ATTRS_o_ai 3132 vec_max(vector bool long long __a, vector signed long long __b) { 3133 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 3134 } 3135 3136 static __inline__ vector signed long long __ATTRS_o_ai 3137 vec_max(vector signed long long __a, vector bool long long __b) { 3138 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 3139 } 3140 3141 static __inline__ vector unsigned long long __ATTRS_o_ai 3142 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 3143 return __builtin_altivec_vmaxud(__a, __b); 3144 } 3145 3146 static __inline__ vector unsigned long long __ATTRS_o_ai 3147 vec_max(vector bool long long __a, vector unsigned long long __b) { 3148 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 3149 } 3150 3151 static __inline__ vector unsigned long long __ATTRS_o_ai 3152 vec_max(vector unsigned long long __a, vector bool long long __b) { 3153 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 3154 } 3155 #endif 3156 3157 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 3158 vector float __b) { 3159 #ifdef __VSX__ 3160 return __builtin_vsx_xvmaxsp(__a, __b); 3161 #else 3162 return __builtin_altivec_vmaxfp(__a, __b); 3163 #endif 3164 } 3165 3166 #ifdef __VSX__ 3167 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 3168 vector double __b) { 3169 return __builtin_vsx_xvmaxdp(__a, __b); 3170 } 3171 #endif 3172 3173 /* vec_vmaxsb */ 3174 3175 static __inline__ vector signed char __ATTRS_o_ai 3176 vec_vmaxsb(vector signed char __a, vector signed char __b) { 3177 return __builtin_altivec_vmaxsb(__a, __b); 3178 } 3179 3180 static __inline__ vector signed char __ATTRS_o_ai 3181 vec_vmaxsb(vector bool char __a, vector signed char __b) { 3182 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 3183 } 3184 3185 static __inline__ vector signed char __ATTRS_o_ai 3186 vec_vmaxsb(vector signed char __a, vector bool char __b) { 3187 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 3188 } 3189 3190 /* vec_vmaxub */ 3191 3192 static __inline__ vector unsigned char __ATTRS_o_ai 3193 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 3194 return __builtin_altivec_vmaxub(__a, __b); 3195 } 3196 3197 static __inline__ vector unsigned char __ATTRS_o_ai 3198 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 3199 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 3200 } 3201 3202 static __inline__ vector unsigned char __ATTRS_o_ai 3203 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 3204 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 3205 } 3206 3207 /* vec_vmaxsh */ 3208 3209 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 3210 vector short __b) { 3211 return __builtin_altivec_vmaxsh(__a, __b); 3212 } 3213 3214 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 3215 vector short __b) { 3216 return __builtin_altivec_vmaxsh((vector short)__a, __b); 3217 } 3218 3219 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 3220 vector bool short __b) { 3221 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 3222 } 3223 3224 /* vec_vmaxuh */ 3225 3226 static __inline__ vector unsigned short __ATTRS_o_ai 3227 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 3228 return __builtin_altivec_vmaxuh(__a, __b); 3229 } 3230 3231 static __inline__ vector unsigned short __ATTRS_o_ai 3232 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 3233 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 3234 } 3235 3236 static __inline__ vector unsigned short __ATTRS_o_ai 3237 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 3238 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 3239 } 3240 3241 /* vec_vmaxsw */ 3242 3243 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 3244 vector int __b) { 3245 return __builtin_altivec_vmaxsw(__a, __b); 3246 } 3247 3248 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 3249 vector int __b) { 3250 return __builtin_altivec_vmaxsw((vector int)__a, __b); 3251 } 3252 3253 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 3254 vector bool int __b) { 3255 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 3256 } 3257 3258 /* vec_vmaxuw */ 3259 3260 static __inline__ vector unsigned int __ATTRS_o_ai 3261 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 3262 return __builtin_altivec_vmaxuw(__a, __b); 3263 } 3264 3265 static __inline__ vector unsigned int __ATTRS_o_ai 3266 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 3267 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 3268 } 3269 3270 static __inline__ vector unsigned int __ATTRS_o_ai 3271 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 3272 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 3273 } 3274 3275 /* vec_vmaxfp */ 3276 3277 static __inline__ vector float __attribute__((__always_inline__)) 3278 vec_vmaxfp(vector float __a, vector float __b) { 3279 #ifdef __VSX__ 3280 return __builtin_vsx_xvmaxsp(__a, __b); 3281 #else 3282 return __builtin_altivec_vmaxfp(__a, __b); 3283 #endif 3284 } 3285 3286 /* vec_mergeh */ 3287 3288 static __inline__ vector signed char __ATTRS_o_ai 3289 vec_mergeh(vector signed char __a, vector signed char __b) { 3290 return vec_perm(__a, __b, 3291 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 3292 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 3293 0x06, 0x16, 0x07, 0x17)); 3294 } 3295 3296 static __inline__ vector unsigned char __ATTRS_o_ai 3297 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 3298 return vec_perm(__a, __b, 3299 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 3300 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 3301 0x06, 0x16, 0x07, 0x17)); 3302 } 3303 3304 static __inline__ vector bool char __ATTRS_o_ai 3305 vec_mergeh(vector bool char __a, vector bool char __b) { 3306 return vec_perm(__a, __b, 3307 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 3308 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 3309 0x06, 0x16, 0x07, 0x17)); 3310 } 3311 3312 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 3313 vector short __b) { 3314 return vec_perm(__a, __b, 3315 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3316 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3317 0x06, 0x07, 0x16, 0x17)); 3318 } 3319 3320 static __inline__ vector unsigned short __ATTRS_o_ai 3321 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 3322 return vec_perm(__a, __b, 3323 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3324 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3325 0x06, 0x07, 0x16, 0x17)); 3326 } 3327 3328 static __inline__ vector bool short __ATTRS_o_ai 3329 vec_mergeh(vector bool short __a, vector bool short __b) { 3330 return vec_perm(__a, __b, 3331 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3332 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3333 0x06, 0x07, 0x16, 0x17)); 3334 } 3335 3336 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 3337 vector pixel __b) { 3338 return vec_perm(__a, __b, 3339 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3340 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3341 0x06, 0x07, 0x16, 0x17)); 3342 } 3343 3344 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 3345 vector int __b) { 3346 return vec_perm(__a, __b, 3347 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3348 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3349 0x14, 0x15, 0x16, 0x17)); 3350 } 3351 3352 static __inline__ vector unsigned int __ATTRS_o_ai 3353 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 3354 return vec_perm(__a, __b, 3355 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3356 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3357 0x14, 0x15, 0x16, 0x17)); 3358 } 3359 3360 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 3361 vector bool int __b) { 3362 return vec_perm(__a, __b, 3363 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3364 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3365 0x14, 0x15, 0x16, 0x17)); 3366 } 3367 3368 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 3369 vector float __b) { 3370 return vec_perm(__a, __b, 3371 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3372 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3373 0x14, 0x15, 0x16, 0x17)); 3374 } 3375 3376 #ifdef __VSX__ 3377 static __inline__ vector signed long long __ATTRS_o_ai 3378 vec_mergeh(vector signed long long __a, vector signed long long __b) { 3379 return vec_perm(__a, __b, 3380 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3381 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3382 0x14, 0x15, 0x16, 0x17)); 3383 } 3384 3385 static __inline__ vector signed long long __ATTRS_o_ai 3386 vec_mergeh(vector signed long long __a, vector bool long long __b) { 3387 return vec_perm(__a, (vector signed long long)__b, 3388 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3389 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3390 0x14, 0x15, 0x16, 0x17)); 3391 } 3392 3393 static __inline__ vector signed long long __ATTRS_o_ai 3394 vec_mergeh(vector bool long long __a, vector signed long long __b) { 3395 return vec_perm((vector signed long long)__a, __b, 3396 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3397 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3398 0x14, 0x15, 0x16, 0x17)); 3399 } 3400 3401 static __inline__ vector unsigned long long __ATTRS_o_ai 3402 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 3403 return vec_perm(__a, __b, 3404 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3405 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3406 0x14, 0x15, 0x16, 0x17)); 3407 } 3408 3409 static __inline__ vector unsigned long long __ATTRS_o_ai 3410 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 3411 return vec_perm(__a, (vector unsigned long long)__b, 3412 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3413 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3414 0x14, 0x15, 0x16, 0x17)); 3415 } 3416 3417 static __inline__ vector unsigned long long __ATTRS_o_ai 3418 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 3419 return vec_perm((vector unsigned long long)__a, __b, 3420 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3421 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3422 0x14, 0x15, 0x16, 0x17)); 3423 } 3424 3425 static __inline__ vector bool long long __ATTRS_o_ai 3426 vec_mergeh(vector bool long long __a, vector bool long long __b) { 3427 return vec_perm(__a, __b, 3428 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3429 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3430 0x14, 0x15, 0x16, 0x17)); 3431 } 3432 3433 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 3434 vector double __b) { 3435 return vec_perm(__a, __b, 3436 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3437 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3438 0x14, 0x15, 0x16, 0x17)); 3439 } 3440 static __inline__ vector double __ATTRS_o_ai 3441 vec_mergeh(vector double __a, vector bool long long __b) { 3442 return vec_perm(__a, (vector double)__b, 3443 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3444 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3445 0x14, 0x15, 0x16, 0x17)); 3446 } 3447 static __inline__ vector double __ATTRS_o_ai 3448 vec_mergeh(vector bool long long __a, vector double __b) { 3449 return vec_perm((vector double)__a, __b, 3450 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 3451 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 3452 0x14, 0x15, 0x16, 0x17)); 3453 } 3454 #endif 3455 3456 /* vec_vmrghb */ 3457 3458 #define __builtin_altivec_vmrghb vec_vmrghb 3459 3460 static __inline__ vector signed char __ATTRS_o_ai 3461 vec_vmrghb(vector signed char __a, vector signed char __b) { 3462 return vec_perm(__a, __b, 3463 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 3464 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 3465 0x06, 0x16, 0x07, 0x17)); 3466 } 3467 3468 static __inline__ vector unsigned char __ATTRS_o_ai 3469 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 3470 return vec_perm(__a, __b, 3471 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 3472 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 3473 0x06, 0x16, 0x07, 0x17)); 3474 } 3475 3476 static __inline__ vector bool char __ATTRS_o_ai 3477 vec_vmrghb(vector bool char __a, vector bool char __b) { 3478 return vec_perm(__a, __b, 3479 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 3480 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 3481 0x06, 0x16, 0x07, 0x17)); 3482 } 3483 3484 /* vec_vmrghh */ 3485 3486 #define __builtin_altivec_vmrghh vec_vmrghh 3487 3488 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 3489 vector short __b) { 3490 return vec_perm(__a, __b, 3491 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3492 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3493 0x06, 0x07, 0x16, 0x17)); 3494 } 3495 3496 static __inline__ vector unsigned short __ATTRS_o_ai 3497 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 3498 return vec_perm(__a, __b, 3499 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3500 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3501 0x06, 0x07, 0x16, 0x17)); 3502 } 3503 3504 static __inline__ vector bool short __ATTRS_o_ai 3505 vec_vmrghh(vector bool short __a, vector bool short __b) { 3506 return vec_perm(__a, __b, 3507 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3508 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3509 0x06, 0x07, 0x16, 0x17)); 3510 } 3511 3512 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 3513 vector pixel __b) { 3514 return vec_perm(__a, __b, 3515 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 3516 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 3517 0x06, 0x07, 0x16, 0x17)); 3518 } 3519 3520 /* vec_vmrghw */ 3521 3522 #define __builtin_altivec_vmrghw vec_vmrghw 3523 3524 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 3525 vector int __b) { 3526 return vec_perm(__a, __b, 3527 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3528 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3529 0x14, 0x15, 0x16, 0x17)); 3530 } 3531 3532 static __inline__ vector unsigned int __ATTRS_o_ai 3533 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 3534 return vec_perm(__a, __b, 3535 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3536 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3537 0x14, 0x15, 0x16, 0x17)); 3538 } 3539 3540 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 3541 vector bool int __b) { 3542 return vec_perm(__a, __b, 3543 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3544 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3545 0x14, 0x15, 0x16, 0x17)); 3546 } 3547 3548 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 3549 vector float __b) { 3550 return vec_perm(__a, __b, 3551 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3552 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 3553 0x14, 0x15, 0x16, 0x17)); 3554 } 3555 3556 /* vec_mergel */ 3557 3558 static __inline__ vector signed char __ATTRS_o_ai 3559 vec_mergel(vector signed char __a, vector signed char __b) { 3560 return vec_perm(__a, __b, 3561 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 3562 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 3563 0x0E, 0x1E, 0x0F, 0x1F)); 3564 } 3565 3566 static __inline__ vector unsigned char __ATTRS_o_ai 3567 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 3568 return vec_perm(__a, __b, 3569 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 3570 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 3571 0x0E, 0x1E, 0x0F, 0x1F)); 3572 } 3573 3574 static __inline__ vector bool char __ATTRS_o_ai 3575 vec_mergel(vector bool char __a, vector bool char __b) { 3576 return vec_perm(__a, __b, 3577 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 3578 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 3579 0x0E, 0x1E, 0x0F, 0x1F)); 3580 } 3581 3582 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 3583 vector short __b) { 3584 return vec_perm(__a, __b, 3585 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3586 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3587 0x0E, 0x0F, 0x1E, 0x1F)); 3588 } 3589 3590 static __inline__ vector unsigned short __ATTRS_o_ai 3591 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 3592 return vec_perm(__a, __b, 3593 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3594 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3595 0x0E, 0x0F, 0x1E, 0x1F)); 3596 } 3597 3598 static __inline__ vector bool short __ATTRS_o_ai 3599 vec_mergel(vector bool short __a, vector bool short __b) { 3600 return vec_perm(__a, __b, 3601 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3602 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3603 0x0E, 0x0F, 0x1E, 0x1F)); 3604 } 3605 3606 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 3607 vector pixel __b) { 3608 return vec_perm(__a, __b, 3609 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3610 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3611 0x0E, 0x0F, 0x1E, 0x1F)); 3612 } 3613 3614 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 3615 vector int __b) { 3616 return vec_perm(__a, __b, 3617 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3618 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3619 0x1C, 0x1D, 0x1E, 0x1F)); 3620 } 3621 3622 static __inline__ vector unsigned int __ATTRS_o_ai 3623 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 3624 return vec_perm(__a, __b, 3625 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3626 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3627 0x1C, 0x1D, 0x1E, 0x1F)); 3628 } 3629 3630 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 3631 vector bool int __b) { 3632 return vec_perm(__a, __b, 3633 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3634 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3635 0x1C, 0x1D, 0x1E, 0x1F)); 3636 } 3637 3638 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 3639 vector float __b) { 3640 return vec_perm(__a, __b, 3641 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3642 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3643 0x1C, 0x1D, 0x1E, 0x1F)); 3644 } 3645 3646 #ifdef __VSX__ 3647 static __inline__ vector signed long long __ATTRS_o_ai 3648 vec_mergel(vector signed long long __a, vector signed long long __b) { 3649 return vec_perm(__a, __b, 3650 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3651 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3652 0x1C, 0x1D, 0x1E, 0x1F)); 3653 } 3654 static __inline__ vector signed long long __ATTRS_o_ai 3655 vec_mergel(vector signed long long __a, vector bool long long __b) { 3656 return vec_perm(__a, (vector signed long long)__b, 3657 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3658 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3659 0x1C, 0x1D, 0x1E, 0x1F)); 3660 } 3661 static __inline__ vector signed long long __ATTRS_o_ai 3662 vec_mergel(vector bool long long __a, vector signed long long __b) { 3663 return vec_perm((vector signed long long)__a, __b, 3664 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3665 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3666 0x1C, 0x1D, 0x1E, 0x1F)); 3667 } 3668 static __inline__ vector unsigned long long __ATTRS_o_ai 3669 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 3670 return vec_perm(__a, __b, 3671 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3672 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3673 0x1C, 0x1D, 0x1E, 0x1F)); 3674 } 3675 static __inline__ vector unsigned long long __ATTRS_o_ai 3676 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 3677 return vec_perm(__a, (vector unsigned long long)__b, 3678 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3679 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3680 0x1C, 0x1D, 0x1E, 0x1F)); 3681 } 3682 static __inline__ vector unsigned long long __ATTRS_o_ai 3683 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 3684 return vec_perm((vector unsigned long long)__a, __b, 3685 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3686 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3687 0x1C, 0x1D, 0x1E, 0x1F)); 3688 } 3689 static __inline__ vector bool long long __ATTRS_o_ai 3690 vec_mergel(vector bool long long __a, vector bool long long __b) { 3691 return vec_perm(__a, __b, 3692 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3693 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3694 0x1C, 0x1D, 0x1E, 0x1F)); 3695 } 3696 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 3697 vector double __b) { 3698 return vec_perm(__a, __b, 3699 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3700 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3701 0x1C, 0x1D, 0x1E, 0x1F)); 3702 } 3703 static __inline__ vector double __ATTRS_o_ai 3704 vec_mergel(vector double __a, vector bool long long __b) { 3705 return vec_perm(__a, (vector double)__b, 3706 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3707 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3708 0x1C, 0x1D, 0x1E, 0x1F)); 3709 } 3710 static __inline__ vector double __ATTRS_o_ai 3711 vec_mergel(vector bool long long __a, vector double __b) { 3712 return vec_perm((vector double)__a, __b, 3713 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 3714 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 3715 0x1C, 0x1D, 0x1E, 0x1F)); 3716 } 3717 #endif 3718 3719 /* vec_vmrglb */ 3720 3721 #define __builtin_altivec_vmrglb vec_vmrglb 3722 3723 static __inline__ vector signed char __ATTRS_o_ai 3724 vec_vmrglb(vector signed char __a, vector signed char __b) { 3725 return vec_perm(__a, __b, 3726 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 3727 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 3728 0x0E, 0x1E, 0x0F, 0x1F)); 3729 } 3730 3731 static __inline__ vector unsigned char __ATTRS_o_ai 3732 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 3733 return vec_perm(__a, __b, 3734 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 3735 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 3736 0x0E, 0x1E, 0x0F, 0x1F)); 3737 } 3738 3739 static __inline__ vector bool char __ATTRS_o_ai 3740 vec_vmrglb(vector bool char __a, vector bool char __b) { 3741 return vec_perm(__a, __b, 3742 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 3743 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 3744 0x0E, 0x1E, 0x0F, 0x1F)); 3745 } 3746 3747 /* vec_vmrglh */ 3748 3749 #define __builtin_altivec_vmrglh vec_vmrglh 3750 3751 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 3752 vector short __b) { 3753 return vec_perm(__a, __b, 3754 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3755 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3756 0x0E, 0x0F, 0x1E, 0x1F)); 3757 } 3758 3759 static __inline__ vector unsigned short __ATTRS_o_ai 3760 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 3761 return vec_perm(__a, __b, 3762 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3763 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3764 0x0E, 0x0F, 0x1E, 0x1F)); 3765 } 3766 3767 static __inline__ vector bool short __ATTRS_o_ai 3768 vec_vmrglh(vector bool short __a, vector bool short __b) { 3769 return vec_perm(__a, __b, 3770 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3771 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3772 0x0E, 0x0F, 0x1E, 0x1F)); 3773 } 3774 3775 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 3776 vector pixel __b) { 3777 return vec_perm(__a, __b, 3778 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 3779 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 3780 0x0E, 0x0F, 0x1E, 0x1F)); 3781 } 3782 3783 /* vec_vmrglw */ 3784 3785 #define __builtin_altivec_vmrglw vec_vmrglw 3786 3787 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 3788 vector int __b) { 3789 return vec_perm(__a, __b, 3790 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3791 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3792 0x1C, 0x1D, 0x1E, 0x1F)); 3793 } 3794 3795 static __inline__ vector unsigned int __ATTRS_o_ai 3796 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 3797 return vec_perm(__a, __b, 3798 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3799 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3800 0x1C, 0x1D, 0x1E, 0x1F)); 3801 } 3802 3803 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 3804 vector bool int __b) { 3805 return vec_perm(__a, __b, 3806 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3807 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3808 0x1C, 0x1D, 0x1E, 0x1F)); 3809 } 3810 3811 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 3812 vector float __b) { 3813 return vec_perm(__a, __b, 3814 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 3815 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 3816 0x1C, 0x1D, 0x1E, 0x1F)); 3817 } 3818 3819 #ifdef __POWER8_VECTOR__ 3820 /* vec_mergee */ 3821 3822 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 3823 vector bool int __b) { 3824 return vec_perm(__a, __b, 3825 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3826 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 3827 0x18, 0x19, 0x1A, 0x1B)); 3828 } 3829 3830 static __inline__ vector signed int __ATTRS_o_ai 3831 vec_mergee(vector signed int __a, vector signed int __b) { 3832 return vec_perm(__a, __b, 3833 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3834 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 3835 0x18, 0x19, 0x1A, 0x1B)); 3836 } 3837 3838 static __inline__ vector unsigned int __ATTRS_o_ai 3839 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 3840 return vec_perm(__a, __b, 3841 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 3842 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 3843 0x18, 0x19, 0x1A, 0x1B)); 3844 } 3845 3846 /* vec_mergeo */ 3847 3848 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 3849 vector bool int __b) { 3850 return vec_perm(__a, __b, 3851 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 3852 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 3853 0x1C, 0x1D, 0x1E, 0x1F)); 3854 } 3855 3856 static __inline__ vector signed int __ATTRS_o_ai 3857 vec_mergeo(vector signed int __a, vector signed int __b) { 3858 return vec_perm(__a, __b, 3859 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 3860 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 3861 0x1C, 0x1D, 0x1E, 0x1F)); 3862 } 3863 3864 static __inline__ vector unsigned int __ATTRS_o_ai 3865 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 3866 return vec_perm(__a, __b, 3867 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 3868 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 3869 0x1C, 0x1D, 0x1E, 0x1F)); 3870 } 3871 3872 #endif 3873 3874 /* vec_mfvscr */ 3875 3876 static __inline__ vector unsigned short __attribute__((__always_inline__)) 3877 vec_mfvscr(void) { 3878 return __builtin_altivec_mfvscr(); 3879 } 3880 3881 /* vec_min */ 3882 3883 static __inline__ vector signed char __ATTRS_o_ai 3884 vec_min(vector signed char __a, vector signed char __b) { 3885 return __builtin_altivec_vminsb(__a, __b); 3886 } 3887 3888 static __inline__ vector signed char __ATTRS_o_ai 3889 vec_min(vector bool char __a, vector signed char __b) { 3890 return __builtin_altivec_vminsb((vector signed char)__a, __b); 3891 } 3892 3893 static __inline__ vector signed char __ATTRS_o_ai 3894 vec_min(vector signed char __a, vector bool char __b) { 3895 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 3896 } 3897 3898 static __inline__ vector unsigned char __ATTRS_o_ai 3899 vec_min(vector unsigned char __a, vector unsigned char __b) { 3900 return __builtin_altivec_vminub(__a, __b); 3901 } 3902 3903 static __inline__ vector unsigned char __ATTRS_o_ai 3904 vec_min(vector bool char __a, vector unsigned char __b) { 3905 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 3906 } 3907 3908 static __inline__ vector unsigned char __ATTRS_o_ai 3909 vec_min(vector unsigned char __a, vector bool char __b) { 3910 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 3911 } 3912 3913 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 3914 vector short __b) { 3915 return __builtin_altivec_vminsh(__a, __b); 3916 } 3917 3918 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 3919 vector short __b) { 3920 return __builtin_altivec_vminsh((vector short)__a, __b); 3921 } 3922 3923 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 3924 vector bool short __b) { 3925 return __builtin_altivec_vminsh(__a, (vector short)__b); 3926 } 3927 3928 static __inline__ vector unsigned short __ATTRS_o_ai 3929 vec_min(vector unsigned short __a, vector unsigned short __b) { 3930 return __builtin_altivec_vminuh(__a, __b); 3931 } 3932 3933 static __inline__ vector unsigned short __ATTRS_o_ai 3934 vec_min(vector bool short __a, vector unsigned short __b) { 3935 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 3936 } 3937 3938 static __inline__ vector unsigned short __ATTRS_o_ai 3939 vec_min(vector unsigned short __a, vector bool short __b) { 3940 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 3941 } 3942 3943 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 3944 vector int __b) { 3945 return __builtin_altivec_vminsw(__a, __b); 3946 } 3947 3948 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 3949 vector int __b) { 3950 return __builtin_altivec_vminsw((vector int)__a, __b); 3951 } 3952 3953 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 3954 vector bool int __b) { 3955 return __builtin_altivec_vminsw(__a, (vector int)__b); 3956 } 3957 3958 static __inline__ vector unsigned int __ATTRS_o_ai 3959 vec_min(vector unsigned int __a, vector unsigned int __b) { 3960 return __builtin_altivec_vminuw(__a, __b); 3961 } 3962 3963 static __inline__ vector unsigned int __ATTRS_o_ai 3964 vec_min(vector bool int __a, vector unsigned int __b) { 3965 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 3966 } 3967 3968 static __inline__ vector unsigned int __ATTRS_o_ai 3969 vec_min(vector unsigned int __a, vector bool int __b) { 3970 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 3971 } 3972 3973 #ifdef __POWER8_VECTOR__ 3974 static __inline__ vector signed long long __ATTRS_o_ai 3975 vec_min(vector signed long long __a, vector signed long long __b) { 3976 return __builtin_altivec_vminsd(__a, __b); 3977 } 3978 3979 static __inline__ vector signed long long __ATTRS_o_ai 3980 vec_min(vector bool long long __a, vector signed long long __b) { 3981 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 3982 } 3983 3984 static __inline__ vector signed long long __ATTRS_o_ai 3985 vec_min(vector signed long long __a, vector bool long long __b) { 3986 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 3987 } 3988 3989 static __inline__ vector unsigned long long __ATTRS_o_ai 3990 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 3991 return __builtin_altivec_vminud(__a, __b); 3992 } 3993 3994 static __inline__ vector unsigned long long __ATTRS_o_ai 3995 vec_min(vector bool long long __a, vector unsigned long long __b) { 3996 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 3997 } 3998 3999 static __inline__ vector unsigned long long __ATTRS_o_ai 4000 vec_min(vector unsigned long long __a, vector bool long long __b) { 4001 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 4002 } 4003 #endif 4004 4005 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 4006 vector float __b) { 4007 #ifdef __VSX__ 4008 return __builtin_vsx_xvminsp(__a, __b); 4009 #else 4010 return __builtin_altivec_vminfp(__a, __b); 4011 #endif 4012 } 4013 4014 #ifdef __VSX__ 4015 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 4016 vector double __b) { 4017 return __builtin_vsx_xvmindp(__a, __b); 4018 } 4019 #endif 4020 4021 /* vec_vminsb */ 4022 4023 static __inline__ vector signed char __ATTRS_o_ai 4024 vec_vminsb(vector signed char __a, vector signed char __b) { 4025 return __builtin_altivec_vminsb(__a, __b); 4026 } 4027 4028 static __inline__ vector signed char __ATTRS_o_ai 4029 vec_vminsb(vector bool char __a, vector signed char __b) { 4030 return __builtin_altivec_vminsb((vector signed char)__a, __b); 4031 } 4032 4033 static __inline__ vector signed char __ATTRS_o_ai 4034 vec_vminsb(vector signed char __a, vector bool char __b) { 4035 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 4036 } 4037 4038 /* vec_vminub */ 4039 4040 static __inline__ vector unsigned char __ATTRS_o_ai 4041 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 4042 return __builtin_altivec_vminub(__a, __b); 4043 } 4044 4045 static __inline__ vector unsigned char __ATTRS_o_ai 4046 vec_vminub(vector bool char __a, vector unsigned char __b) { 4047 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 4048 } 4049 4050 static __inline__ vector unsigned char __ATTRS_o_ai 4051 vec_vminub(vector unsigned char __a, vector bool char __b) { 4052 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 4053 } 4054 4055 /* vec_vminsh */ 4056 4057 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 4058 vector short __b) { 4059 return __builtin_altivec_vminsh(__a, __b); 4060 } 4061 4062 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 4063 vector short __b) { 4064 return __builtin_altivec_vminsh((vector short)__a, __b); 4065 } 4066 4067 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 4068 vector bool short __b) { 4069 return __builtin_altivec_vminsh(__a, (vector short)__b); 4070 } 4071 4072 /* vec_vminuh */ 4073 4074 static __inline__ vector unsigned short __ATTRS_o_ai 4075 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 4076 return __builtin_altivec_vminuh(__a, __b); 4077 } 4078 4079 static __inline__ vector unsigned short __ATTRS_o_ai 4080 vec_vminuh(vector bool short __a, vector unsigned short __b) { 4081 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 4082 } 4083 4084 static __inline__ vector unsigned short __ATTRS_o_ai 4085 vec_vminuh(vector unsigned short __a, vector bool short __b) { 4086 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 4087 } 4088 4089 /* vec_vminsw */ 4090 4091 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 4092 vector int __b) { 4093 return __builtin_altivec_vminsw(__a, __b); 4094 } 4095 4096 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 4097 vector int __b) { 4098 return __builtin_altivec_vminsw((vector int)__a, __b); 4099 } 4100 4101 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 4102 vector bool int __b) { 4103 return __builtin_altivec_vminsw(__a, (vector int)__b); 4104 } 4105 4106 /* vec_vminuw */ 4107 4108 static __inline__ vector unsigned int __ATTRS_o_ai 4109 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 4110 return __builtin_altivec_vminuw(__a, __b); 4111 } 4112 4113 static __inline__ vector unsigned int __ATTRS_o_ai 4114 vec_vminuw(vector bool int __a, vector unsigned int __b) { 4115 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 4116 } 4117 4118 static __inline__ vector unsigned int __ATTRS_o_ai 4119 vec_vminuw(vector unsigned int __a, vector bool int __b) { 4120 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 4121 } 4122 4123 /* vec_vminfp */ 4124 4125 static __inline__ vector float __attribute__((__always_inline__)) 4126 vec_vminfp(vector float __a, vector float __b) { 4127 #ifdef __VSX__ 4128 return __builtin_vsx_xvminsp(__a, __b); 4129 #else 4130 return __builtin_altivec_vminfp(__a, __b); 4131 #endif 4132 } 4133 4134 /* vec_mladd */ 4135 4136 #define __builtin_altivec_vmladduhm vec_mladd 4137 4138 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 4139 vector short __b, 4140 vector short __c) { 4141 return __a * __b + __c; 4142 } 4143 4144 static __inline__ vector short __ATTRS_o_ai vec_mladd( 4145 vector short __a, vector unsigned short __b, vector unsigned short __c) { 4146 return __a * (vector short)__b + (vector short)__c; 4147 } 4148 4149 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 4150 vector short __b, 4151 vector short __c) { 4152 return (vector short)__a * __b + __c; 4153 } 4154 4155 static __inline__ vector unsigned short __ATTRS_o_ai 4156 vec_mladd(vector unsigned short __a, vector unsigned short __b, 4157 vector unsigned short __c) { 4158 return __a * __b + __c; 4159 } 4160 4161 /* vec_vmladduhm */ 4162 4163 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 4164 vector short __b, 4165 vector short __c) { 4166 return __a * __b + __c; 4167 } 4168 4169 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 4170 vector short __a, vector unsigned short __b, vector unsigned short __c) { 4171 return __a * (vector short)__b + (vector short)__c; 4172 } 4173 4174 static __inline__ vector short __ATTRS_o_ai 4175 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 4176 return (vector short)__a * __b + __c; 4177 } 4178 4179 static __inline__ vector unsigned short __ATTRS_o_ai 4180 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 4181 vector unsigned short __c) { 4182 return __a * __b + __c; 4183 } 4184 4185 /* vec_mradds */ 4186 4187 static __inline__ vector short __attribute__((__always_inline__)) 4188 vec_mradds(vector short __a, vector short __b, vector short __c) { 4189 return __builtin_altivec_vmhraddshs(__a, __b, __c); 4190 } 4191 4192 /* vec_vmhraddshs */ 4193 4194 static __inline__ vector short __attribute__((__always_inline__)) 4195 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 4196 return __builtin_altivec_vmhraddshs(__a, __b, __c); 4197 } 4198 4199 /* vec_msum */ 4200 4201 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 4202 vector unsigned char __b, 4203 vector int __c) { 4204 return __builtin_altivec_vmsummbm(__a, __b, __c); 4205 } 4206 4207 static __inline__ vector unsigned int __ATTRS_o_ai 4208 vec_msum(vector unsigned char __a, vector unsigned char __b, 4209 vector unsigned int __c) { 4210 return __builtin_altivec_vmsumubm(__a, __b, __c); 4211 } 4212 4213 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 4214 vector short __b, 4215 vector int __c) { 4216 return __builtin_altivec_vmsumshm(__a, __b, __c); 4217 } 4218 4219 static __inline__ vector unsigned int __ATTRS_o_ai 4220 vec_msum(vector unsigned short __a, vector unsigned short __b, 4221 vector unsigned int __c) { 4222 return __builtin_altivec_vmsumuhm(__a, __b, __c); 4223 } 4224 4225 /* vec_vmsummbm */ 4226 4227 static __inline__ vector int __attribute__((__always_inline__)) 4228 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 4229 return __builtin_altivec_vmsummbm(__a, __b, __c); 4230 } 4231 4232 /* vec_vmsumubm */ 4233 4234 static __inline__ vector unsigned int __attribute__((__always_inline__)) 4235 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 4236 vector unsigned int __c) { 4237 return __builtin_altivec_vmsumubm(__a, __b, __c); 4238 } 4239 4240 /* vec_vmsumshm */ 4241 4242 static __inline__ vector int __attribute__((__always_inline__)) 4243 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 4244 return __builtin_altivec_vmsumshm(__a, __b, __c); 4245 } 4246 4247 /* vec_vmsumuhm */ 4248 4249 static __inline__ vector unsigned int __attribute__((__always_inline__)) 4250 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 4251 vector unsigned int __c) { 4252 return __builtin_altivec_vmsumuhm(__a, __b, __c); 4253 } 4254 4255 /* vec_msums */ 4256 4257 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 4258 vector short __b, 4259 vector int __c) { 4260 return __builtin_altivec_vmsumshs(__a, __b, __c); 4261 } 4262 4263 static __inline__ vector unsigned int __ATTRS_o_ai 4264 vec_msums(vector unsigned short __a, vector unsigned short __b, 4265 vector unsigned int __c) { 4266 return __builtin_altivec_vmsumuhs(__a, __b, __c); 4267 } 4268 4269 /* vec_vmsumshs */ 4270 4271 static __inline__ vector int __attribute__((__always_inline__)) 4272 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 4273 return __builtin_altivec_vmsumshs(__a, __b, __c); 4274 } 4275 4276 /* vec_vmsumuhs */ 4277 4278 static __inline__ vector unsigned int __attribute__((__always_inline__)) 4279 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 4280 vector unsigned int __c) { 4281 return __builtin_altivec_vmsumuhs(__a, __b, __c); 4282 } 4283 4284 /* vec_mtvscr */ 4285 4286 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 4287 __builtin_altivec_mtvscr((vector int)__a); 4288 } 4289 4290 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 4291 __builtin_altivec_mtvscr((vector int)__a); 4292 } 4293 4294 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 4295 __builtin_altivec_mtvscr((vector int)__a); 4296 } 4297 4298 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 4299 __builtin_altivec_mtvscr((vector int)__a); 4300 } 4301 4302 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 4303 __builtin_altivec_mtvscr((vector int)__a); 4304 } 4305 4306 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 4307 __builtin_altivec_mtvscr((vector int)__a); 4308 } 4309 4310 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 4311 __builtin_altivec_mtvscr((vector int)__a); 4312 } 4313 4314 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 4315 __builtin_altivec_mtvscr((vector int)__a); 4316 } 4317 4318 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 4319 __builtin_altivec_mtvscr((vector int)__a); 4320 } 4321 4322 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 4323 __builtin_altivec_mtvscr((vector int)__a); 4324 } 4325 4326 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 4327 __builtin_altivec_mtvscr((vector int)__a); 4328 } 4329 4330 /* vec_mul */ 4331 4332 /* Integer vector multiplication will involve multiplication of the odd/even 4333 elements separately, then truncating the results and moving to the 4334 result vector. 4335 */ 4336 static __inline__ vector signed char __ATTRS_o_ai 4337 vec_mul(vector signed char __a, vector signed char __b) { 4338 return __a * __b; 4339 } 4340 4341 static __inline__ vector unsigned char __ATTRS_o_ai 4342 vec_mul(vector unsigned char __a, vector unsigned char __b) { 4343 return __a * __b; 4344 } 4345 4346 static __inline__ vector signed short __ATTRS_o_ai 4347 vec_mul(vector signed short __a, vector signed short __b) { 4348 return __a * __b; 4349 } 4350 4351 static __inline__ vector unsigned short __ATTRS_o_ai 4352 vec_mul(vector unsigned short __a, vector unsigned short __b) { 4353 return __a * __b; 4354 } 4355 4356 static __inline__ vector signed int __ATTRS_o_ai 4357 vec_mul(vector signed int __a, vector signed int __b) { 4358 return __a * __b; 4359 } 4360 4361 static __inline__ vector unsigned int __ATTRS_o_ai 4362 vec_mul(vector unsigned int __a, vector unsigned int __b) { 4363 return __a * __b; 4364 } 4365 4366 #ifdef __VSX__ 4367 static __inline__ vector signed long long __ATTRS_o_ai 4368 vec_mul(vector signed long long __a, vector signed long long __b) { 4369 return __a * __b; 4370 } 4371 4372 static __inline__ vector unsigned long long __ATTRS_o_ai 4373 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 4374 return __a * __b; 4375 } 4376 #endif 4377 4378 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 4379 vector float __b) { 4380 return __a * __b; 4381 } 4382 4383 #ifdef __VSX__ 4384 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 4385 vector double __b) { 4386 return __a * __b; 4387 } 4388 #endif 4389 4390 /* The vmulos* and vmules* instructions have a big endian bias, so 4391 we must reverse the meaning of "even" and "odd" for little endian. */ 4392 4393 /* vec_mule */ 4394 4395 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 4396 vector signed char __b) { 4397 #ifdef __LITTLE_ENDIAN__ 4398 return __builtin_altivec_vmulosb(__a, __b); 4399 #else 4400 return __builtin_altivec_vmulesb(__a, __b); 4401 #endif 4402 } 4403 4404 static __inline__ vector unsigned short __ATTRS_o_ai 4405 vec_mule(vector unsigned char __a, vector unsigned char __b) { 4406 #ifdef __LITTLE_ENDIAN__ 4407 return __builtin_altivec_vmuloub(__a, __b); 4408 #else 4409 return __builtin_altivec_vmuleub(__a, __b); 4410 #endif 4411 } 4412 4413 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 4414 vector short __b) { 4415 #ifdef __LITTLE_ENDIAN__ 4416 return __builtin_altivec_vmulosh(__a, __b); 4417 #else 4418 return __builtin_altivec_vmulesh(__a, __b); 4419 #endif 4420 } 4421 4422 static __inline__ vector unsigned int __ATTRS_o_ai 4423 vec_mule(vector unsigned short __a, vector unsigned short __b) { 4424 #ifdef __LITTLE_ENDIAN__ 4425 return __builtin_altivec_vmulouh(__a, __b); 4426 #else 4427 return __builtin_altivec_vmuleuh(__a, __b); 4428 #endif 4429 } 4430 4431 #ifdef __POWER8_VECTOR__ 4432 static __inline__ vector signed long long __ATTRS_o_ai 4433 vec_mule(vector signed int __a, vector signed int __b) { 4434 #ifdef __LITTLE_ENDIAN__ 4435 return __builtin_altivec_vmulosw(__a, __b); 4436 #else 4437 return __builtin_altivec_vmulesw(__a, __b); 4438 #endif 4439 } 4440 4441 static __inline__ vector unsigned long long __ATTRS_o_ai 4442 vec_mule(vector unsigned int __a, vector unsigned int __b) { 4443 #ifdef __LITTLE_ENDIAN__ 4444 return __builtin_altivec_vmulouw(__a, __b); 4445 #else 4446 return __builtin_altivec_vmuleuw(__a, __b); 4447 #endif 4448 } 4449 #endif 4450 4451 /* vec_vmulesb */ 4452 4453 static __inline__ vector short __attribute__((__always_inline__)) 4454 vec_vmulesb(vector signed char __a, vector signed char __b) { 4455 #ifdef __LITTLE_ENDIAN__ 4456 return __builtin_altivec_vmulosb(__a, __b); 4457 #else 4458 return __builtin_altivec_vmulesb(__a, __b); 4459 #endif 4460 } 4461 4462 /* vec_vmuleub */ 4463 4464 static __inline__ vector unsigned short __attribute__((__always_inline__)) 4465 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 4466 #ifdef __LITTLE_ENDIAN__ 4467 return __builtin_altivec_vmuloub(__a, __b); 4468 #else 4469 return __builtin_altivec_vmuleub(__a, __b); 4470 #endif 4471 } 4472 4473 /* vec_vmulesh */ 4474 4475 static __inline__ vector int __attribute__((__always_inline__)) 4476 vec_vmulesh(vector short __a, vector short __b) { 4477 #ifdef __LITTLE_ENDIAN__ 4478 return __builtin_altivec_vmulosh(__a, __b); 4479 #else 4480 return __builtin_altivec_vmulesh(__a, __b); 4481 #endif 4482 } 4483 4484 /* vec_vmuleuh */ 4485 4486 static __inline__ vector unsigned int __attribute__((__always_inline__)) 4487 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 4488 #ifdef __LITTLE_ENDIAN__ 4489 return __builtin_altivec_vmulouh(__a, __b); 4490 #else 4491 return __builtin_altivec_vmuleuh(__a, __b); 4492 #endif 4493 } 4494 4495 /* vec_mulo */ 4496 4497 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 4498 vector signed char __b) { 4499 #ifdef __LITTLE_ENDIAN__ 4500 return __builtin_altivec_vmulesb(__a, __b); 4501 #else 4502 return __builtin_altivec_vmulosb(__a, __b); 4503 #endif 4504 } 4505 4506 static __inline__ vector unsigned short __ATTRS_o_ai 4507 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 4508 #ifdef __LITTLE_ENDIAN__ 4509 return __builtin_altivec_vmuleub(__a, __b); 4510 #else 4511 return __builtin_altivec_vmuloub(__a, __b); 4512 #endif 4513 } 4514 4515 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 4516 vector short __b) { 4517 #ifdef __LITTLE_ENDIAN__ 4518 return __builtin_altivec_vmulesh(__a, __b); 4519 #else 4520 return __builtin_altivec_vmulosh(__a, __b); 4521 #endif 4522 } 4523 4524 static __inline__ vector unsigned int __ATTRS_o_ai 4525 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 4526 #ifdef __LITTLE_ENDIAN__ 4527 return __builtin_altivec_vmuleuh(__a, __b); 4528 #else 4529 return __builtin_altivec_vmulouh(__a, __b); 4530 #endif 4531 } 4532 4533 #ifdef __POWER8_VECTOR__ 4534 static __inline__ vector signed long long __ATTRS_o_ai 4535 vec_mulo(vector signed int __a, vector signed int __b) { 4536 #ifdef __LITTLE_ENDIAN__ 4537 return __builtin_altivec_vmulesw(__a, __b); 4538 #else 4539 return __builtin_altivec_vmulosw(__a, __b); 4540 #endif 4541 } 4542 4543 static __inline__ vector unsigned long long __ATTRS_o_ai 4544 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 4545 #ifdef __LITTLE_ENDIAN__ 4546 return __builtin_altivec_vmuleuw(__a, __b); 4547 #else 4548 return __builtin_altivec_vmulouw(__a, __b); 4549 #endif 4550 } 4551 #endif 4552 4553 /* vec_vmulosb */ 4554 4555 static __inline__ vector short __attribute__((__always_inline__)) 4556 vec_vmulosb(vector signed char __a, vector signed char __b) { 4557 #ifdef __LITTLE_ENDIAN__ 4558 return __builtin_altivec_vmulesb(__a, __b); 4559 #else 4560 return __builtin_altivec_vmulosb(__a, __b); 4561 #endif 4562 } 4563 4564 /* vec_vmuloub */ 4565 4566 static __inline__ vector unsigned short __attribute__((__always_inline__)) 4567 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 4568 #ifdef __LITTLE_ENDIAN__ 4569 return __builtin_altivec_vmuleub(__a, __b); 4570 #else 4571 return __builtin_altivec_vmuloub(__a, __b); 4572 #endif 4573 } 4574 4575 /* vec_vmulosh */ 4576 4577 static __inline__ vector int __attribute__((__always_inline__)) 4578 vec_vmulosh(vector short __a, vector short __b) { 4579 #ifdef __LITTLE_ENDIAN__ 4580 return __builtin_altivec_vmulesh(__a, __b); 4581 #else 4582 return __builtin_altivec_vmulosh(__a, __b); 4583 #endif 4584 } 4585 4586 /* vec_vmulouh */ 4587 4588 static __inline__ vector unsigned int __attribute__((__always_inline__)) 4589 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 4590 #ifdef __LITTLE_ENDIAN__ 4591 return __builtin_altivec_vmuleuh(__a, __b); 4592 #else 4593 return __builtin_altivec_vmulouh(__a, __b); 4594 #endif 4595 } 4596 4597 /* vec_nand */ 4598 4599 #ifdef __POWER8_VECTOR__ 4600 static __inline__ vector signed char __ATTRS_o_ai 4601 vec_nand(vector signed char __a, vector signed char __b) { 4602 return ~(__a & __b); 4603 } 4604 4605 static __inline__ vector signed char __ATTRS_o_ai 4606 vec_nand(vector signed char __a, vector bool char __b) { 4607 return ~(__a & __b); 4608 } 4609 4610 static __inline__ vector signed char __ATTRS_o_ai 4611 vec_nand(vector bool char __a, vector signed char __b) { 4612 return ~(__a & __b); 4613 } 4614 4615 static __inline__ vector unsigned char __ATTRS_o_ai 4616 vec_nand(vector unsigned char __a, vector unsigned char __b) { 4617 return ~(__a & __b); 4618 } 4619 4620 static __inline__ vector unsigned char __ATTRS_o_ai 4621 vec_nand(vector unsigned char __a, vector bool char __b) { 4622 return ~(__a & __b); 4623 } 4624 4625 static __inline__ vector unsigned char __ATTRS_o_ai 4626 vec_nand(vector bool char __a, vector unsigned char __b) { 4627 return ~(__a & __b); 4628 } 4629 4630 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 4631 vector bool char __b) { 4632 return ~(__a & __b); 4633 } 4634 4635 static __inline__ vector signed short __ATTRS_o_ai 4636 vec_nand(vector signed short __a, vector signed short __b) { 4637 return ~(__a & __b); 4638 } 4639 4640 static __inline__ vector signed short __ATTRS_o_ai 4641 vec_nand(vector signed short __a, vector bool short __b) { 4642 return ~(__a & __b); 4643 } 4644 4645 static __inline__ vector signed short __ATTRS_o_ai 4646 vec_nand(vector bool short __a, vector signed short __b) { 4647 return ~(__a & __b); 4648 } 4649 4650 static __inline__ vector unsigned short __ATTRS_o_ai 4651 vec_nand(vector unsigned short __a, vector unsigned short __b) { 4652 return ~(__a & __b); 4653 } 4654 4655 static __inline__ vector unsigned short __ATTRS_o_ai 4656 vec_nand(vector unsigned short __a, vector bool short __b) { 4657 return ~(__a & __b); 4658 } 4659 4660 static __inline__ vector bool short __ATTRS_o_ai 4661 vec_nand(vector bool short __a, vector bool short __b) { 4662 return ~(__a & __b); 4663 } 4664 4665 static __inline__ vector signed int __ATTRS_o_ai 4666 vec_nand(vector signed int __a, vector signed int __b) { 4667 return ~(__a & __b); 4668 } 4669 4670 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 4671 vector bool int __b) { 4672 return ~(__a & __b); 4673 } 4674 4675 static __inline__ vector signed int __ATTRS_o_ai 4676 vec_nand(vector bool int __a, vector signed int __b) { 4677 return ~(__a & __b); 4678 } 4679 4680 static __inline__ vector unsigned int __ATTRS_o_ai 4681 vec_nand(vector unsigned int __a, vector unsigned int __b) { 4682 return ~(__a & __b); 4683 } 4684 4685 static __inline__ vector unsigned int __ATTRS_o_ai 4686 vec_nand(vector unsigned int __a, vector bool int __b) { 4687 return ~(__a & __b); 4688 } 4689 4690 static __inline__ vector unsigned int __ATTRS_o_ai 4691 vec_nand(vector bool int __a, vector unsigned int __b) { 4692 return ~(__a & __b); 4693 } 4694 4695 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 4696 vector bool int __b) { 4697 return ~(__a & __b); 4698 } 4699 4700 static __inline__ vector signed long long __ATTRS_o_ai 4701 vec_nand(vector signed long long __a, vector signed long long __b) { 4702 return ~(__a & __b); 4703 } 4704 4705 static __inline__ vector signed long long __ATTRS_o_ai 4706 vec_nand(vector signed long long __a, vector bool long long __b) { 4707 return ~(__a & __b); 4708 } 4709 4710 static __inline__ vector signed long long __ATTRS_o_ai 4711 vec_nand(vector bool long long __a, vector signed long long __b) { 4712 return ~(__a & __b); 4713 } 4714 4715 static __inline__ vector unsigned long long __ATTRS_o_ai 4716 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 4717 return ~(__a & __b); 4718 } 4719 4720 static __inline__ vector unsigned long long __ATTRS_o_ai 4721 vec_nand(vector unsigned long long __a, vector bool long long __b) { 4722 return ~(__a & __b); 4723 } 4724 4725 static __inline__ vector unsigned long long __ATTRS_o_ai 4726 vec_nand(vector bool long long __a, vector unsigned long long __b) { 4727 return ~(__a & __b); 4728 } 4729 4730 static __inline__ vector bool long long __ATTRS_o_ai 4731 vec_nand(vector bool long long __a, vector bool long long __b) { 4732 return ~(__a & __b); 4733 } 4734 4735 #endif 4736 4737 /* vec_nmadd */ 4738 4739 #ifdef __VSX__ 4740 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 4741 vector float __b, 4742 vector float __c) { 4743 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 4744 } 4745 4746 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 4747 vector double __b, 4748 vector double __c) { 4749 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 4750 } 4751 #endif 4752 4753 /* vec_nmsub */ 4754 4755 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 4756 vector float __b, 4757 vector float __c) { 4758 #ifdef __VSX__ 4759 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 4760 #else 4761 return __builtin_altivec_vnmsubfp(__a, __b, __c); 4762 #endif 4763 } 4764 4765 #ifdef __VSX__ 4766 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 4767 vector double __b, 4768 vector double __c) { 4769 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 4770 } 4771 #endif 4772 4773 /* vec_vnmsubfp */ 4774 4775 static __inline__ vector float __attribute__((__always_inline__)) 4776 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 4777 return __builtin_altivec_vnmsubfp(__a, __b, __c); 4778 } 4779 4780 /* vec_nor */ 4781 4782 #define __builtin_altivec_vnor vec_nor 4783 4784 static __inline__ vector signed char __ATTRS_o_ai 4785 vec_nor(vector signed char __a, vector signed char __b) { 4786 return ~(__a | __b); 4787 } 4788 4789 static __inline__ vector unsigned char __ATTRS_o_ai 4790 vec_nor(vector unsigned char __a, vector unsigned char __b) { 4791 return ~(__a | __b); 4792 } 4793 4794 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 4795 vector bool char __b) { 4796 return ~(__a | __b); 4797 } 4798 4799 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 4800 vector short __b) { 4801 return ~(__a | __b); 4802 } 4803 4804 static __inline__ vector unsigned short __ATTRS_o_ai 4805 vec_nor(vector unsigned short __a, vector unsigned short __b) { 4806 return ~(__a | __b); 4807 } 4808 4809 static __inline__ vector bool short __ATTRS_o_ai 4810 vec_nor(vector bool short __a, vector bool short __b) { 4811 return ~(__a | __b); 4812 } 4813 4814 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 4815 vector int __b) { 4816 return ~(__a | __b); 4817 } 4818 4819 static __inline__ vector unsigned int __ATTRS_o_ai 4820 vec_nor(vector unsigned int __a, vector unsigned int __b) { 4821 return ~(__a | __b); 4822 } 4823 4824 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 4825 vector bool int __b) { 4826 return ~(__a | __b); 4827 } 4828 4829 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 4830 vector float __b) { 4831 vector unsigned int __res = 4832 ~((vector unsigned int)__a | (vector unsigned int)__b); 4833 return (vector float)__res; 4834 } 4835 4836 #ifdef __VSX__ 4837 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 4838 vector double __b) { 4839 vector unsigned long long __res = 4840 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 4841 return (vector double)__res; 4842 } 4843 #endif 4844 4845 /* vec_vnor */ 4846 4847 static __inline__ vector signed char __ATTRS_o_ai 4848 vec_vnor(vector signed char __a, vector signed char __b) { 4849 return ~(__a | __b); 4850 } 4851 4852 static __inline__ vector unsigned char __ATTRS_o_ai 4853 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 4854 return ~(__a | __b); 4855 } 4856 4857 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 4858 vector bool char __b) { 4859 return ~(__a | __b); 4860 } 4861 4862 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 4863 vector short __b) { 4864 return ~(__a | __b); 4865 } 4866 4867 static __inline__ vector unsigned short __ATTRS_o_ai 4868 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 4869 return ~(__a | __b); 4870 } 4871 4872 static __inline__ vector bool short __ATTRS_o_ai 4873 vec_vnor(vector bool short __a, vector bool short __b) { 4874 return ~(__a | __b); 4875 } 4876 4877 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 4878 vector int __b) { 4879 return ~(__a | __b); 4880 } 4881 4882 static __inline__ vector unsigned int __ATTRS_o_ai 4883 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 4884 return ~(__a | __b); 4885 } 4886 4887 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 4888 vector bool int __b) { 4889 return ~(__a | __b); 4890 } 4891 4892 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 4893 vector float __b) { 4894 vector unsigned int __res = 4895 ~((vector unsigned int)__a | (vector unsigned int)__b); 4896 return (vector float)__res; 4897 } 4898 4899 #ifdef __VSX__ 4900 static __inline__ vector signed long long __ATTRS_o_ai 4901 vec_nor(vector signed long long __a, vector signed long long __b) { 4902 return ~(__a | __b); 4903 } 4904 4905 static __inline__ vector unsigned long long __ATTRS_o_ai 4906 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 4907 return ~(__a | __b); 4908 } 4909 4910 static __inline__ vector bool long long __ATTRS_o_ai 4911 vec_nor(vector bool long long __a, vector bool long long __b) { 4912 return ~(__a | __b); 4913 } 4914 #endif 4915 4916 /* vec_or */ 4917 4918 #define __builtin_altivec_vor vec_or 4919 4920 static __inline__ vector signed char __ATTRS_o_ai 4921 vec_or(vector signed char __a, vector signed char __b) { 4922 return __a | __b; 4923 } 4924 4925 static __inline__ vector signed char __ATTRS_o_ai 4926 vec_or(vector bool char __a, vector signed char __b) { 4927 return (vector signed char)__a | __b; 4928 } 4929 4930 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 4931 vector bool char __b) { 4932 return __a | (vector signed char)__b; 4933 } 4934 4935 static __inline__ vector unsigned char __ATTRS_o_ai 4936 vec_or(vector unsigned char __a, vector unsigned char __b) { 4937 return __a | __b; 4938 } 4939 4940 static __inline__ vector unsigned char __ATTRS_o_ai 4941 vec_or(vector bool char __a, vector unsigned char __b) { 4942 return (vector unsigned char)__a | __b; 4943 } 4944 4945 static __inline__ vector unsigned char __ATTRS_o_ai 4946 vec_or(vector unsigned char __a, vector bool char __b) { 4947 return __a | (vector unsigned char)__b; 4948 } 4949 4950 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 4951 vector bool char __b) { 4952 return __a | __b; 4953 } 4954 4955 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 4956 vector short __b) { 4957 return __a | __b; 4958 } 4959 4960 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 4961 vector short __b) { 4962 return (vector short)__a | __b; 4963 } 4964 4965 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 4966 vector bool short __b) { 4967 return __a | (vector short)__b; 4968 } 4969 4970 static __inline__ vector unsigned short __ATTRS_o_ai 4971 vec_or(vector unsigned short __a, vector unsigned short __b) { 4972 return __a | __b; 4973 } 4974 4975 static __inline__ vector unsigned short __ATTRS_o_ai 4976 vec_or(vector bool short __a, vector unsigned short __b) { 4977 return (vector unsigned short)__a | __b; 4978 } 4979 4980 static __inline__ vector unsigned short __ATTRS_o_ai 4981 vec_or(vector unsigned short __a, vector bool short __b) { 4982 return __a | (vector unsigned short)__b; 4983 } 4984 4985 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 4986 vector bool short __b) { 4987 return __a | __b; 4988 } 4989 4990 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 4991 vector int __b) { 4992 return __a | __b; 4993 } 4994 4995 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 4996 vector int __b) { 4997 return (vector int)__a | __b; 4998 } 4999 5000 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 5001 vector bool int __b) { 5002 return __a | (vector int)__b; 5003 } 5004 5005 static __inline__ vector unsigned int __ATTRS_o_ai 5006 vec_or(vector unsigned int __a, vector unsigned int __b) { 5007 return __a | __b; 5008 } 5009 5010 static __inline__ vector unsigned int __ATTRS_o_ai 5011 vec_or(vector bool int __a, vector unsigned int __b) { 5012 return (vector unsigned int)__a | __b; 5013 } 5014 5015 static __inline__ vector unsigned int __ATTRS_o_ai 5016 vec_or(vector unsigned int __a, vector bool int __b) { 5017 return __a | (vector unsigned int)__b; 5018 } 5019 5020 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 5021 vector bool int __b) { 5022 return __a | __b; 5023 } 5024 5025 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 5026 vector float __b) { 5027 vector unsigned int __res = 5028 (vector unsigned int)__a | (vector unsigned int)__b; 5029 return (vector float)__res; 5030 } 5031 5032 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 5033 vector float __b) { 5034 vector unsigned int __res = 5035 (vector unsigned int)__a | (vector unsigned int)__b; 5036 return (vector float)__res; 5037 } 5038 5039 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 5040 vector bool int __b) { 5041 vector unsigned int __res = 5042 (vector unsigned int)__a | (vector unsigned int)__b; 5043 return (vector float)__res; 5044 } 5045 5046 #ifdef __VSX__ 5047 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 5048 vector double __b) { 5049 return (vector unsigned long long)__a | (vector unsigned long long)__b; 5050 } 5051 5052 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 5053 vector bool long long __b) { 5054 return (vector unsigned long long)__a | (vector unsigned long long)__b; 5055 } 5056 5057 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 5058 vector double __b) { 5059 vector unsigned long long __res = 5060 (vector unsigned long long)__a | (vector unsigned long long)__b; 5061 return (vector double)__res; 5062 } 5063 5064 static __inline__ vector signed long long __ATTRS_o_ai 5065 vec_or(vector signed long long __a, vector signed long long __b) { 5066 return __a | __b; 5067 } 5068 5069 static __inline__ vector signed long long __ATTRS_o_ai 5070 vec_or(vector bool long long __a, vector signed long long __b) { 5071 return (vector signed long long)__a | __b; 5072 } 5073 5074 static __inline__ vector signed long long __ATTRS_o_ai 5075 vec_or(vector signed long long __a, vector bool long long __b) { 5076 return __a | (vector signed long long)__b; 5077 } 5078 5079 static __inline__ vector unsigned long long __ATTRS_o_ai 5080 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 5081 return __a | __b; 5082 } 5083 5084 static __inline__ vector unsigned long long __ATTRS_o_ai 5085 vec_or(vector bool long long __a, vector unsigned long long __b) { 5086 return (vector unsigned long long)__a | __b; 5087 } 5088 5089 static __inline__ vector unsigned long long __ATTRS_o_ai 5090 vec_or(vector unsigned long long __a, vector bool long long __b) { 5091 return __a | (vector unsigned long long)__b; 5092 } 5093 5094 static __inline__ vector bool long long __ATTRS_o_ai 5095 vec_or(vector bool long long __a, vector bool long long __b) { 5096 return __a | __b; 5097 } 5098 #endif 5099 5100 #ifdef __POWER8_VECTOR__ 5101 static __inline__ vector signed char __ATTRS_o_ai 5102 vec_orc(vector signed char __a, vector signed char __b) { 5103 return __a | ~__b; 5104 } 5105 5106 static __inline__ vector signed char __ATTRS_o_ai 5107 vec_orc(vector signed char __a, vector bool char __b) { 5108 return __a | ~__b; 5109 } 5110 5111 static __inline__ vector signed char __ATTRS_o_ai 5112 vec_orc(vector bool char __a, vector signed char __b) { 5113 return __a | ~__b; 5114 } 5115 5116 static __inline__ vector unsigned char __ATTRS_o_ai 5117 vec_orc(vector unsigned char __a, vector unsigned char __b) { 5118 return __a | ~__b; 5119 } 5120 5121 static __inline__ vector unsigned char __ATTRS_o_ai 5122 vec_orc(vector unsigned char __a, vector bool char __b) { 5123 return __a | ~__b; 5124 } 5125 5126 static __inline__ vector unsigned char __ATTRS_o_ai 5127 vec_orc(vector bool char __a, vector unsigned char __b) { 5128 return __a | ~__b; 5129 } 5130 5131 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 5132 vector bool char __b) { 5133 return __a | ~__b; 5134 } 5135 5136 static __inline__ vector signed short __ATTRS_o_ai 5137 vec_orc(vector signed short __a, vector signed short __b) { 5138 return __a | ~__b; 5139 } 5140 5141 static __inline__ vector signed short __ATTRS_o_ai 5142 vec_orc(vector signed short __a, vector bool short __b) { 5143 return __a | ~__b; 5144 } 5145 5146 static __inline__ vector signed short __ATTRS_o_ai 5147 vec_orc(vector bool short __a, vector signed short __b) { 5148 return __a | ~__b; 5149 } 5150 5151 static __inline__ vector unsigned short __ATTRS_o_ai 5152 vec_orc(vector unsigned short __a, vector unsigned short __b) { 5153 return __a | ~__b; 5154 } 5155 5156 static __inline__ vector unsigned short __ATTRS_o_ai 5157 vec_orc(vector unsigned short __a, vector bool short __b) { 5158 return __a | ~__b; 5159 } 5160 5161 static __inline__ vector unsigned short __ATTRS_o_ai 5162 vec_orc(vector bool short __a, vector unsigned short __b) { 5163 return __a | ~__b; 5164 } 5165 5166 static __inline__ vector bool short __ATTRS_o_ai 5167 vec_orc(vector bool short __a, vector bool short __b) { 5168 return __a | ~__b; 5169 } 5170 5171 static __inline__ vector signed int __ATTRS_o_ai 5172 vec_orc(vector signed int __a, vector signed int __b) { 5173 return __a | ~__b; 5174 } 5175 5176 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 5177 vector bool int __b) { 5178 return __a | ~__b; 5179 } 5180 5181 static __inline__ vector signed int __ATTRS_o_ai 5182 vec_orc(vector bool int __a, vector signed int __b) { 5183 return __a | ~__b; 5184 } 5185 5186 static __inline__ vector unsigned int __ATTRS_o_ai 5187 vec_orc(vector unsigned int __a, vector unsigned int __b) { 5188 return __a | ~__b; 5189 } 5190 5191 static __inline__ vector unsigned int __ATTRS_o_ai 5192 vec_orc(vector unsigned int __a, vector bool int __b) { 5193 return __a | ~__b; 5194 } 5195 5196 static __inline__ vector unsigned int __ATTRS_o_ai 5197 vec_orc(vector bool int __a, vector unsigned int __b) { 5198 return __a | ~__b; 5199 } 5200 5201 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 5202 vector bool int __b) { 5203 return __a | ~__b; 5204 } 5205 5206 static __inline__ vector signed long long __ATTRS_o_ai 5207 vec_orc(vector signed long long __a, vector signed long long __b) { 5208 return __a | ~__b; 5209 } 5210 5211 static __inline__ vector signed long long __ATTRS_o_ai 5212 vec_orc(vector signed long long __a, vector bool long long __b) { 5213 return __a | ~__b; 5214 } 5215 5216 static __inline__ vector signed long long __ATTRS_o_ai 5217 vec_orc(vector bool long long __a, vector signed long long __b) { 5218 return __a | ~__b; 5219 } 5220 5221 static __inline__ vector unsigned long long __ATTRS_o_ai 5222 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 5223 return __a | ~__b; 5224 } 5225 5226 static __inline__ vector unsigned long long __ATTRS_o_ai 5227 vec_orc(vector unsigned long long __a, vector bool long long __b) { 5228 return __a | ~__b; 5229 } 5230 5231 static __inline__ vector unsigned long long __ATTRS_o_ai 5232 vec_orc(vector bool long long __a, vector unsigned long long __b) { 5233 return __a | ~__b; 5234 } 5235 5236 static __inline__ vector bool long long __ATTRS_o_ai 5237 vec_orc(vector bool long long __a, vector bool long long __b) { 5238 return __a | ~__b; 5239 } 5240 #endif 5241 5242 /* vec_vor */ 5243 5244 static __inline__ vector signed char __ATTRS_o_ai 5245 vec_vor(vector signed char __a, vector signed char __b) { 5246 return __a | __b; 5247 } 5248 5249 static __inline__ vector signed char __ATTRS_o_ai 5250 vec_vor(vector bool char __a, vector signed char __b) { 5251 return (vector signed char)__a | __b; 5252 } 5253 5254 static __inline__ vector signed char __ATTRS_o_ai 5255 vec_vor(vector signed char __a, vector bool char __b) { 5256 return __a | (vector signed char)__b; 5257 } 5258 5259 static __inline__ vector unsigned char __ATTRS_o_ai 5260 vec_vor(vector unsigned char __a, vector unsigned char __b) { 5261 return __a | __b; 5262 } 5263 5264 static __inline__ vector unsigned char __ATTRS_o_ai 5265 vec_vor(vector bool char __a, vector unsigned char __b) { 5266 return (vector unsigned char)__a | __b; 5267 } 5268 5269 static __inline__ vector unsigned char __ATTRS_o_ai 5270 vec_vor(vector unsigned char __a, vector bool char __b) { 5271 return __a | (vector unsigned char)__b; 5272 } 5273 5274 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 5275 vector bool char __b) { 5276 return __a | __b; 5277 } 5278 5279 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 5280 vector short __b) { 5281 return __a | __b; 5282 } 5283 5284 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 5285 vector short __b) { 5286 return (vector short)__a | __b; 5287 } 5288 5289 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 5290 vector bool short __b) { 5291 return __a | (vector short)__b; 5292 } 5293 5294 static __inline__ vector unsigned short __ATTRS_o_ai 5295 vec_vor(vector unsigned short __a, vector unsigned short __b) { 5296 return __a | __b; 5297 } 5298 5299 static __inline__ vector unsigned short __ATTRS_o_ai 5300 vec_vor(vector bool short __a, vector unsigned short __b) { 5301 return (vector unsigned short)__a | __b; 5302 } 5303 5304 static __inline__ vector unsigned short __ATTRS_o_ai 5305 vec_vor(vector unsigned short __a, vector bool short __b) { 5306 return __a | (vector unsigned short)__b; 5307 } 5308 5309 static __inline__ vector bool short __ATTRS_o_ai 5310 vec_vor(vector bool short __a, vector bool short __b) { 5311 return __a | __b; 5312 } 5313 5314 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 5315 vector int __b) { 5316 return __a | __b; 5317 } 5318 5319 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 5320 vector int __b) { 5321 return (vector int)__a | __b; 5322 } 5323 5324 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 5325 vector bool int __b) { 5326 return __a | (vector int)__b; 5327 } 5328 5329 static __inline__ vector unsigned int __ATTRS_o_ai 5330 vec_vor(vector unsigned int __a, vector unsigned int __b) { 5331 return __a | __b; 5332 } 5333 5334 static __inline__ vector unsigned int __ATTRS_o_ai 5335 vec_vor(vector bool int __a, vector unsigned int __b) { 5336 return (vector unsigned int)__a | __b; 5337 } 5338 5339 static __inline__ vector unsigned int __ATTRS_o_ai 5340 vec_vor(vector unsigned int __a, vector bool int __b) { 5341 return __a | (vector unsigned int)__b; 5342 } 5343 5344 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 5345 vector bool int __b) { 5346 return __a | __b; 5347 } 5348 5349 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 5350 vector float __b) { 5351 vector unsigned int __res = 5352 (vector unsigned int)__a | (vector unsigned int)__b; 5353 return (vector float)__res; 5354 } 5355 5356 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 5357 vector float __b) { 5358 vector unsigned int __res = 5359 (vector unsigned int)__a | (vector unsigned int)__b; 5360 return (vector float)__res; 5361 } 5362 5363 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 5364 vector bool int __b) { 5365 vector unsigned int __res = 5366 (vector unsigned int)__a | (vector unsigned int)__b; 5367 return (vector float)__res; 5368 } 5369 5370 #ifdef __VSX__ 5371 static __inline__ vector signed long long __ATTRS_o_ai 5372 vec_vor(vector signed long long __a, vector signed long long __b) { 5373 return __a | __b; 5374 } 5375 5376 static __inline__ vector signed long long __ATTRS_o_ai 5377 vec_vor(vector bool long long __a, vector signed long long __b) { 5378 return (vector signed long long)__a | __b; 5379 } 5380 5381 static __inline__ vector signed long long __ATTRS_o_ai 5382 vec_vor(vector signed long long __a, vector bool long long __b) { 5383 return __a | (vector signed long long)__b; 5384 } 5385 5386 static __inline__ vector unsigned long long __ATTRS_o_ai 5387 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 5388 return __a | __b; 5389 } 5390 5391 static __inline__ vector unsigned long long __ATTRS_o_ai 5392 vec_vor(vector bool long long __a, vector unsigned long long __b) { 5393 return (vector unsigned long long)__a | __b; 5394 } 5395 5396 static __inline__ vector unsigned long long __ATTRS_o_ai 5397 vec_vor(vector unsigned long long __a, vector bool long long __b) { 5398 return __a | (vector unsigned long long)__b; 5399 } 5400 5401 static __inline__ vector bool long long __ATTRS_o_ai 5402 vec_vor(vector bool long long __a, vector bool long long __b) { 5403 return __a | __b; 5404 } 5405 #endif 5406 5407 /* vec_pack */ 5408 5409 /* The various vector pack instructions have a big-endian bias, so for 5410 little endian we must handle reversed element numbering. */ 5411 5412 static __inline__ vector signed char __ATTRS_o_ai 5413 vec_pack(vector signed short __a, vector signed short __b) { 5414 #ifdef __LITTLE_ENDIAN__ 5415 return (vector signed char)vec_perm( 5416 __a, __b, 5417 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 5418 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 5419 #else 5420 return (vector signed char)vec_perm( 5421 __a, __b, 5422 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 5423 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 5424 #endif 5425 } 5426 5427 static __inline__ vector unsigned char __ATTRS_o_ai 5428 vec_pack(vector unsigned short __a, vector unsigned short __b) { 5429 #ifdef __LITTLE_ENDIAN__ 5430 return (vector unsigned char)vec_perm( 5431 __a, __b, 5432 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 5433 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 5434 #else 5435 return (vector unsigned char)vec_perm( 5436 __a, __b, 5437 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 5438 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 5439 #endif 5440 } 5441 5442 static __inline__ vector bool char __ATTRS_o_ai 5443 vec_pack(vector bool short __a, vector bool short __b) { 5444 #ifdef __LITTLE_ENDIAN__ 5445 return (vector bool char)vec_perm( 5446 __a, __b, 5447 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 5448 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 5449 #else 5450 return (vector bool char)vec_perm( 5451 __a, __b, 5452 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 5453 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 5454 #endif 5455 } 5456 5457 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 5458 vector int __b) { 5459 #ifdef __LITTLE_ENDIAN__ 5460 return (vector short)vec_perm( 5461 __a, __b, 5462 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 5463 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 5464 #else 5465 return (vector short)vec_perm( 5466 __a, __b, 5467 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 5468 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 5469 #endif 5470 } 5471 5472 static __inline__ vector unsigned short __ATTRS_o_ai 5473 vec_pack(vector unsigned int __a, vector unsigned int __b) { 5474 #ifdef __LITTLE_ENDIAN__ 5475 return (vector unsigned short)vec_perm( 5476 __a, __b, 5477 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 5478 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 5479 #else 5480 return (vector unsigned short)vec_perm( 5481 __a, __b, 5482 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 5483 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 5484 #endif 5485 } 5486 5487 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 5488 vector bool int __b) { 5489 #ifdef __LITTLE_ENDIAN__ 5490 return (vector bool short)vec_perm( 5491 __a, __b, 5492 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 5493 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 5494 #else 5495 return (vector bool short)vec_perm( 5496 __a, __b, 5497 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 5498 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 5499 #endif 5500 } 5501 5502 #ifdef __VSX__ 5503 static __inline__ vector signed int __ATTRS_o_ai 5504 vec_pack(vector signed long long __a, vector signed long long __b) { 5505 #ifdef __LITTLE_ENDIAN__ 5506 return (vector signed int)vec_perm( 5507 __a, __b, 5508 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 5509 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 5510 #else 5511 return (vector signed int)vec_perm( 5512 __a, __b, 5513 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 5514 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 5515 #endif 5516 } 5517 static __inline__ vector unsigned int __ATTRS_o_ai 5518 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 5519 #ifdef __LITTLE_ENDIAN__ 5520 return (vector unsigned int)vec_perm( 5521 __a, __b, 5522 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 5523 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 5524 #else 5525 return (vector unsigned int)vec_perm( 5526 __a, __b, 5527 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 5528 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 5529 #endif 5530 } 5531 5532 static __inline__ vector bool int __ATTRS_o_ai 5533 vec_pack(vector bool long long __a, vector bool long long __b) { 5534 #ifdef __LITTLE_ENDIAN__ 5535 return (vector bool int)vec_perm( 5536 __a, __b, 5537 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 5538 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 5539 #else 5540 return (vector bool int)vec_perm( 5541 __a, __b, 5542 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 5543 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 5544 #endif 5545 } 5546 5547 #endif 5548 5549 /* vec_vpkuhum */ 5550 5551 #define __builtin_altivec_vpkuhum vec_vpkuhum 5552 5553 static __inline__ vector signed char __ATTRS_o_ai 5554 vec_vpkuhum(vector signed short __a, vector signed short __b) { 5555 #ifdef __LITTLE_ENDIAN__ 5556 return (vector signed char)vec_perm( 5557 __a, __b, 5558 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 5559 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 5560 #else 5561 return (vector signed char)vec_perm( 5562 __a, __b, 5563 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 5564 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 5565 #endif 5566 } 5567 5568 static __inline__ vector unsigned char __ATTRS_o_ai 5569 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 5570 #ifdef __LITTLE_ENDIAN__ 5571 return (vector unsigned char)vec_perm( 5572 __a, __b, 5573 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 5574 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 5575 #else 5576 return (vector unsigned char)vec_perm( 5577 __a, __b, 5578 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 5579 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 5580 #endif 5581 } 5582 5583 static __inline__ vector bool char __ATTRS_o_ai 5584 vec_vpkuhum(vector bool short __a, vector bool short __b) { 5585 #ifdef __LITTLE_ENDIAN__ 5586 return (vector bool char)vec_perm( 5587 __a, __b, 5588 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 5589 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 5590 #else 5591 return (vector bool char)vec_perm( 5592 __a, __b, 5593 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 5594 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 5595 #endif 5596 } 5597 5598 /* vec_vpkuwum */ 5599 5600 #define __builtin_altivec_vpkuwum vec_vpkuwum 5601 5602 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 5603 vector int __b) { 5604 #ifdef __LITTLE_ENDIAN__ 5605 return (vector short)vec_perm( 5606 __a, __b, 5607 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 5608 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 5609 #else 5610 return (vector short)vec_perm( 5611 __a, __b, 5612 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 5613 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 5614 #endif 5615 } 5616 5617 static __inline__ vector unsigned short __ATTRS_o_ai 5618 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 5619 #ifdef __LITTLE_ENDIAN__ 5620 return (vector unsigned short)vec_perm( 5621 __a, __b, 5622 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 5623 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 5624 #else 5625 return (vector unsigned short)vec_perm( 5626 __a, __b, 5627 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 5628 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 5629 #endif 5630 } 5631 5632 static __inline__ vector bool short __ATTRS_o_ai 5633 vec_vpkuwum(vector bool int __a, vector bool int __b) { 5634 #ifdef __LITTLE_ENDIAN__ 5635 return (vector bool short)vec_perm( 5636 __a, __b, 5637 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 5638 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 5639 #else 5640 return (vector bool short)vec_perm( 5641 __a, __b, 5642 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 5643 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 5644 #endif 5645 } 5646 5647 /* vec_vpkudum */ 5648 5649 #ifdef __POWER8_VECTOR__ 5650 #define __builtin_altivec_vpkudum vec_vpkudum 5651 5652 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 5653 vector long long __b) { 5654 #ifdef __LITTLE_ENDIAN__ 5655 return (vector int)vec_perm( 5656 __a, __b, 5657 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 5658 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 5659 #else 5660 return (vector int)vec_perm( 5661 __a, __b, 5662 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 5663 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 5664 #endif 5665 } 5666 5667 static __inline__ vector unsigned int __ATTRS_o_ai 5668 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 5669 #ifdef __LITTLE_ENDIAN__ 5670 return (vector unsigned int)vec_perm( 5671 __a, __b, 5672 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 5673 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 5674 #else 5675 return (vector unsigned int)vec_perm( 5676 __a, __b, 5677 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 5678 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 5679 #endif 5680 } 5681 5682 static __inline__ vector bool int __ATTRS_o_ai 5683 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 5684 #ifdef __LITTLE_ENDIAN__ 5685 return (vector bool int)vec_perm( 5686 (vector long long)__a, (vector long long)__b, 5687 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 5688 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 5689 #else 5690 return (vector bool int)vec_perm( 5691 (vector long long)__a, (vector long long)__b, 5692 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 5693 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 5694 #endif 5695 } 5696 #endif 5697 5698 /* vec_packpx */ 5699 5700 static __inline__ vector pixel __attribute__((__always_inline__)) 5701 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 5702 #ifdef __LITTLE_ENDIAN__ 5703 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 5704 #else 5705 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 5706 #endif 5707 } 5708 5709 /* vec_vpkpx */ 5710 5711 static __inline__ vector pixel __attribute__((__always_inline__)) 5712 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 5713 #ifdef __LITTLE_ENDIAN__ 5714 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 5715 #else 5716 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 5717 #endif 5718 } 5719 5720 /* vec_packs */ 5721 5722 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 5723 vector short __b) { 5724 #ifdef __LITTLE_ENDIAN__ 5725 return __builtin_altivec_vpkshss(__b, __a); 5726 #else 5727 return __builtin_altivec_vpkshss(__a, __b); 5728 #endif 5729 } 5730 5731 static __inline__ vector unsigned char __ATTRS_o_ai 5732 vec_packs(vector unsigned short __a, vector unsigned short __b) { 5733 #ifdef __LITTLE_ENDIAN__ 5734 return __builtin_altivec_vpkuhus(__b, __a); 5735 #else 5736 return __builtin_altivec_vpkuhus(__a, __b); 5737 #endif 5738 } 5739 5740 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 5741 vector int __b) { 5742 #ifdef __LITTLE_ENDIAN__ 5743 return __builtin_altivec_vpkswss(__b, __a); 5744 #else 5745 return __builtin_altivec_vpkswss(__a, __b); 5746 #endif 5747 } 5748 5749 static __inline__ vector unsigned short __ATTRS_o_ai 5750 vec_packs(vector unsigned int __a, vector unsigned int __b) { 5751 #ifdef __LITTLE_ENDIAN__ 5752 return __builtin_altivec_vpkuwus(__b, __a); 5753 #else 5754 return __builtin_altivec_vpkuwus(__a, __b); 5755 #endif 5756 } 5757 5758 #ifdef __POWER8_VECTOR__ 5759 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 5760 vector long long __b) { 5761 #ifdef __LITTLE_ENDIAN__ 5762 return __builtin_altivec_vpksdss(__b, __a); 5763 #else 5764 return __builtin_altivec_vpksdss(__a, __b); 5765 #endif 5766 } 5767 5768 static __inline__ vector unsigned int __ATTRS_o_ai 5769 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 5770 #ifdef __LITTLE_ENDIAN__ 5771 return __builtin_altivec_vpkudus(__b, __a); 5772 #else 5773 return __builtin_altivec_vpkudus(__a, __b); 5774 #endif 5775 } 5776 #endif 5777 5778 /* vec_vpkshss */ 5779 5780 static __inline__ vector signed char __attribute__((__always_inline__)) 5781 vec_vpkshss(vector short __a, vector short __b) { 5782 #ifdef __LITTLE_ENDIAN__ 5783 return __builtin_altivec_vpkshss(__b, __a); 5784 #else 5785 return __builtin_altivec_vpkshss(__a, __b); 5786 #endif 5787 } 5788 5789 /* vec_vpksdss */ 5790 5791 #ifdef __POWER8_VECTOR__ 5792 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 5793 vector long long __b) { 5794 #ifdef __LITTLE_ENDIAN__ 5795 return __builtin_altivec_vpksdss(__b, __a); 5796 #else 5797 return __builtin_altivec_vpksdss(__a, __b); 5798 #endif 5799 } 5800 #endif 5801 5802 /* vec_vpkuhus */ 5803 5804 static __inline__ vector unsigned char __attribute__((__always_inline__)) 5805 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 5806 #ifdef __LITTLE_ENDIAN__ 5807 return __builtin_altivec_vpkuhus(__b, __a); 5808 #else 5809 return __builtin_altivec_vpkuhus(__a, __b); 5810 #endif 5811 } 5812 5813 /* vec_vpkudus */ 5814 5815 #ifdef __POWER8_VECTOR__ 5816 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5817 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 5818 #ifdef __LITTLE_ENDIAN__ 5819 return __builtin_altivec_vpkudus(__b, __a); 5820 #else 5821 return __builtin_altivec_vpkudus(__a, __b); 5822 #endif 5823 } 5824 #endif 5825 5826 /* vec_vpkswss */ 5827 5828 static __inline__ vector signed short __attribute__((__always_inline__)) 5829 vec_vpkswss(vector int __a, vector int __b) { 5830 #ifdef __LITTLE_ENDIAN__ 5831 return __builtin_altivec_vpkswss(__b, __a); 5832 #else 5833 return __builtin_altivec_vpkswss(__a, __b); 5834 #endif 5835 } 5836 5837 /* vec_vpkuwus */ 5838 5839 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5840 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 5841 #ifdef __LITTLE_ENDIAN__ 5842 return __builtin_altivec_vpkuwus(__b, __a); 5843 #else 5844 return __builtin_altivec_vpkuwus(__a, __b); 5845 #endif 5846 } 5847 5848 /* vec_packsu */ 5849 5850 static __inline__ vector unsigned char __ATTRS_o_ai 5851 vec_packsu(vector short __a, vector short __b) { 5852 #ifdef __LITTLE_ENDIAN__ 5853 return __builtin_altivec_vpkshus(__b, __a); 5854 #else 5855 return __builtin_altivec_vpkshus(__a, __b); 5856 #endif 5857 } 5858 5859 static __inline__ vector unsigned char __ATTRS_o_ai 5860 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 5861 #ifdef __LITTLE_ENDIAN__ 5862 return __builtin_altivec_vpkuhus(__b, __a); 5863 #else 5864 return __builtin_altivec_vpkuhus(__a, __b); 5865 #endif 5866 } 5867 5868 static __inline__ vector unsigned short __ATTRS_o_ai 5869 vec_packsu(vector int __a, vector int __b) { 5870 #ifdef __LITTLE_ENDIAN__ 5871 return __builtin_altivec_vpkswus(__b, __a); 5872 #else 5873 return __builtin_altivec_vpkswus(__a, __b); 5874 #endif 5875 } 5876 5877 static __inline__ vector unsigned short __ATTRS_o_ai 5878 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 5879 #ifdef __LITTLE_ENDIAN__ 5880 return __builtin_altivec_vpkuwus(__b, __a); 5881 #else 5882 return __builtin_altivec_vpkuwus(__a, __b); 5883 #endif 5884 } 5885 5886 #ifdef __POWER8_VECTOR__ 5887 static __inline__ vector unsigned int __ATTRS_o_ai 5888 vec_packsu(vector long long __a, vector long long __b) { 5889 #ifdef __LITTLE_ENDIAN__ 5890 return __builtin_altivec_vpksdus(__b, __a); 5891 #else 5892 return __builtin_altivec_vpksdus(__a, __b); 5893 #endif 5894 } 5895 5896 static __inline__ vector unsigned int __ATTRS_o_ai 5897 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 5898 #ifdef __LITTLE_ENDIAN__ 5899 return __builtin_altivec_vpkudus(__b, __a); 5900 #else 5901 return __builtin_altivec_vpkudus(__a, __b); 5902 #endif 5903 } 5904 #endif 5905 5906 /* vec_vpkshus */ 5907 5908 static __inline__ vector unsigned char __ATTRS_o_ai 5909 vec_vpkshus(vector short __a, vector short __b) { 5910 #ifdef __LITTLE_ENDIAN__ 5911 return __builtin_altivec_vpkshus(__b, __a); 5912 #else 5913 return __builtin_altivec_vpkshus(__a, __b); 5914 #endif 5915 } 5916 5917 static __inline__ vector unsigned char __ATTRS_o_ai 5918 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 5919 #ifdef __LITTLE_ENDIAN__ 5920 return __builtin_altivec_vpkuhus(__b, __a); 5921 #else 5922 return __builtin_altivec_vpkuhus(__a, __b); 5923 #endif 5924 } 5925 5926 /* vec_vpkswus */ 5927 5928 static __inline__ vector unsigned short __ATTRS_o_ai 5929 vec_vpkswus(vector int __a, vector int __b) { 5930 #ifdef __LITTLE_ENDIAN__ 5931 return __builtin_altivec_vpkswus(__b, __a); 5932 #else 5933 return __builtin_altivec_vpkswus(__a, __b); 5934 #endif 5935 } 5936 5937 static __inline__ vector unsigned short __ATTRS_o_ai 5938 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 5939 #ifdef __LITTLE_ENDIAN__ 5940 return __builtin_altivec_vpkuwus(__b, __a); 5941 #else 5942 return __builtin_altivec_vpkuwus(__a, __b); 5943 #endif 5944 } 5945 5946 /* vec_vpksdus */ 5947 5948 #ifdef __POWER8_VECTOR__ 5949 static __inline__ vector unsigned int __ATTRS_o_ai 5950 vec_vpksdus(vector long long __a, vector long long __b) { 5951 #ifdef __LITTLE_ENDIAN__ 5952 return __builtin_altivec_vpksdus(__b, __a); 5953 #else 5954 return __builtin_altivec_vpksdus(__a, __b); 5955 #endif 5956 } 5957 #endif 5958 5959 /* vec_perm */ 5960 5961 // The vperm instruction is defined architecturally with a big-endian bias. 5962 // For little endian, we swap the input operands and invert the permute 5963 // control vector. Only the rightmost 5 bits matter, so we could use 5964 // a vector of all 31s instead of all 255s to perform the inversion. 5965 // However, when the PCV is not a constant, using 255 has an advantage 5966 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 5967 // later, possibly a vec_nand). 5968 5969 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 5970 vector signed char __a, vector signed char __b, vector unsigned char __c) { 5971 #ifdef __LITTLE_ENDIAN__ 5972 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 5973 255, 255, 255, 255, 255, 255, 255, 255}; 5974 __d = vec_xor(__c, __d); 5975 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 5976 (vector int)__a, __d); 5977 #else 5978 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 5979 (vector int)__b, __c); 5980 #endif 5981 } 5982 5983 static __inline__ vector unsigned char __ATTRS_o_ai 5984 vec_perm(vector unsigned char __a, vector unsigned char __b, 5985 vector unsigned char __c) { 5986 #ifdef __LITTLE_ENDIAN__ 5987 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 5988 255, 255, 255, 255, 255, 255, 255, 255}; 5989 __d = vec_xor(__c, __d); 5990 return (vector unsigned char)__builtin_altivec_vperm_4si( 5991 (vector int)__b, (vector int)__a, __d); 5992 #else 5993 return (vector unsigned char)__builtin_altivec_vperm_4si( 5994 (vector int)__a, (vector int)__b, __c); 5995 #endif 5996 } 5997 5998 static __inline__ vector bool char __ATTRS_o_ai 5999 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 6000 #ifdef __LITTLE_ENDIAN__ 6001 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6002 255, 255, 255, 255, 255, 255, 255, 255}; 6003 __d = vec_xor(__c, __d); 6004 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 6005 (vector int)__a, __d); 6006 #else 6007 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 6008 (vector int)__b, __c); 6009 #endif 6010 } 6011 6012 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 6013 vector signed short __b, 6014 vector unsigned char __c) { 6015 #ifdef __LITTLE_ENDIAN__ 6016 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6017 255, 255, 255, 255, 255, 255, 255, 255}; 6018 __d = vec_xor(__c, __d); 6019 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 6020 (vector int)__a, __d); 6021 #else 6022 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 6023 (vector int)__b, __c); 6024 #endif 6025 } 6026 6027 static __inline__ vector unsigned short __ATTRS_o_ai 6028 vec_perm(vector unsigned short __a, vector unsigned short __b, 6029 vector unsigned char __c) { 6030 #ifdef __LITTLE_ENDIAN__ 6031 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6032 255, 255, 255, 255, 255, 255, 255, 255}; 6033 __d = vec_xor(__c, __d); 6034 return (vector unsigned short)__builtin_altivec_vperm_4si( 6035 (vector int)__b, (vector int)__a, __d); 6036 #else 6037 return (vector unsigned short)__builtin_altivec_vperm_4si( 6038 (vector int)__a, (vector int)__b, __c); 6039 #endif 6040 } 6041 6042 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 6043 vector bool short __a, vector bool short __b, vector unsigned char __c) { 6044 #ifdef __LITTLE_ENDIAN__ 6045 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6046 255, 255, 255, 255, 255, 255, 255, 255}; 6047 __d = vec_xor(__c, __d); 6048 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 6049 (vector int)__a, __d); 6050 #else 6051 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 6052 (vector int)__b, __c); 6053 #endif 6054 } 6055 6056 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 6057 vector pixel __b, 6058 vector unsigned char __c) { 6059 #ifdef __LITTLE_ENDIAN__ 6060 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6061 255, 255, 255, 255, 255, 255, 255, 255}; 6062 __d = vec_xor(__c, __d); 6063 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 6064 (vector int)__a, __d); 6065 #else 6066 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 6067 (vector int)__b, __c); 6068 #endif 6069 } 6070 6071 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 6072 vector signed int __b, 6073 vector unsigned char __c) { 6074 #ifdef __LITTLE_ENDIAN__ 6075 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6076 255, 255, 255, 255, 255, 255, 255, 255}; 6077 __d = vec_xor(__c, __d); 6078 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 6079 #else 6080 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 6081 #endif 6082 } 6083 6084 static __inline__ vector unsigned int __ATTRS_o_ai 6085 vec_perm(vector unsigned int __a, vector unsigned int __b, 6086 vector unsigned char __c) { 6087 #ifdef __LITTLE_ENDIAN__ 6088 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6089 255, 255, 255, 255, 255, 255, 255, 255}; 6090 __d = vec_xor(__c, __d); 6091 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 6092 (vector int)__a, __d); 6093 #else 6094 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 6095 (vector int)__b, __c); 6096 #endif 6097 } 6098 6099 static __inline__ vector bool int __ATTRS_o_ai 6100 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 6101 #ifdef __LITTLE_ENDIAN__ 6102 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6103 255, 255, 255, 255, 255, 255, 255, 255}; 6104 __d = vec_xor(__c, __d); 6105 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 6106 (vector int)__a, __d); 6107 #else 6108 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 6109 (vector int)__b, __c); 6110 #endif 6111 } 6112 6113 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 6114 vector float __b, 6115 vector unsigned char __c) { 6116 #ifdef __LITTLE_ENDIAN__ 6117 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6118 255, 255, 255, 255, 255, 255, 255, 255}; 6119 __d = vec_xor(__c, __d); 6120 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 6121 (vector int)__a, __d); 6122 #else 6123 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 6124 (vector int)__b, __c); 6125 #endif 6126 } 6127 6128 #ifdef __VSX__ 6129 static __inline__ vector long long __ATTRS_o_ai 6130 vec_perm(vector signed long long __a, vector signed long long __b, 6131 vector unsigned char __c) { 6132 #ifdef __LITTLE_ENDIAN__ 6133 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6134 255, 255, 255, 255, 255, 255, 255, 255}; 6135 __d = vec_xor(__c, __d); 6136 return (vector signed long long)__builtin_altivec_vperm_4si( 6137 (vector int)__b, (vector int)__a, __d); 6138 #else 6139 return (vector signed long long)__builtin_altivec_vperm_4si( 6140 (vector int)__a, (vector int)__b, __c); 6141 #endif 6142 } 6143 6144 static __inline__ vector unsigned long long __ATTRS_o_ai 6145 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 6146 vector unsigned char __c) { 6147 #ifdef __LITTLE_ENDIAN__ 6148 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6149 255, 255, 255, 255, 255, 255, 255, 255}; 6150 __d = vec_xor(__c, __d); 6151 return (vector unsigned long long)__builtin_altivec_vperm_4si( 6152 (vector int)__b, (vector int)__a, __d); 6153 #else 6154 return (vector unsigned long long)__builtin_altivec_vperm_4si( 6155 (vector int)__a, (vector int)__b, __c); 6156 #endif 6157 } 6158 6159 static __inline__ vector bool long long __ATTRS_o_ai 6160 vec_perm(vector bool long long __a, vector bool long long __b, 6161 vector unsigned char __c) { 6162 #ifdef __LITTLE_ENDIAN__ 6163 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6164 255, 255, 255, 255, 255, 255, 255, 255}; 6165 __d = vec_xor(__c, __d); 6166 return (vector bool long long)__builtin_altivec_vperm_4si( 6167 (vector int)__b, (vector int)__a, __d); 6168 #else 6169 return (vector bool long long)__builtin_altivec_vperm_4si( 6170 (vector int)__a, (vector int)__b, __c); 6171 #endif 6172 } 6173 6174 static __inline__ vector double __ATTRS_o_ai 6175 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 6176 #ifdef __LITTLE_ENDIAN__ 6177 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 6178 255, 255, 255, 255, 255, 255, 255, 255}; 6179 __d = vec_xor(__c, __d); 6180 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 6181 (vector int)__a, __d); 6182 #else 6183 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 6184 (vector int)__b, __c); 6185 #endif 6186 } 6187 #endif 6188 6189 /* vec_vperm */ 6190 6191 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 6192 vector signed char __a, vector signed char __b, vector unsigned char __c) { 6193 return vec_perm(__a, __b, __c); 6194 } 6195 6196 static __inline__ vector unsigned char __ATTRS_o_ai 6197 vec_vperm(vector unsigned char __a, vector unsigned char __b, 6198 vector unsigned char __c) { 6199 return vec_perm(__a, __b, __c); 6200 } 6201 6202 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 6203 vector bool char __a, vector bool char __b, vector unsigned char __c) { 6204 return vec_perm(__a, __b, __c); 6205 } 6206 6207 static __inline__ vector short __ATTRS_o_ai 6208 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 6209 return vec_perm(__a, __b, __c); 6210 } 6211 6212 static __inline__ vector unsigned short __ATTRS_o_ai 6213 vec_vperm(vector unsigned short __a, vector unsigned short __b, 6214 vector unsigned char __c) { 6215 return vec_perm(__a, __b, __c); 6216 } 6217 6218 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 6219 vector bool short __a, vector bool short __b, vector unsigned char __c) { 6220 return vec_perm(__a, __b, __c); 6221 } 6222 6223 static __inline__ vector pixel __ATTRS_o_ai 6224 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 6225 return vec_perm(__a, __b, __c); 6226 } 6227 6228 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 6229 vector int __b, 6230 vector unsigned char __c) { 6231 return vec_perm(__a, __b, __c); 6232 } 6233 6234 static __inline__ vector unsigned int __ATTRS_o_ai 6235 vec_vperm(vector unsigned int __a, vector unsigned int __b, 6236 vector unsigned char __c) { 6237 return vec_perm(__a, __b, __c); 6238 } 6239 6240 static __inline__ vector bool int __ATTRS_o_ai 6241 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 6242 return vec_perm(__a, __b, __c); 6243 } 6244 6245 static __inline__ vector float __ATTRS_o_ai 6246 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 6247 return vec_perm(__a, __b, __c); 6248 } 6249 6250 #ifdef __VSX__ 6251 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 6252 vector long long __a, vector long long __b, vector unsigned char __c) { 6253 return vec_perm(__a, __b, __c); 6254 } 6255 6256 static __inline__ vector unsigned long long __ATTRS_o_ai 6257 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 6258 vector unsigned char __c) { 6259 return vec_perm(__a, __b, __c); 6260 } 6261 6262 static __inline__ vector double __ATTRS_o_ai 6263 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 6264 return vec_perm(__a, __b, __c); 6265 } 6266 #endif 6267 6268 /* vec_re */ 6269 6270 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 6271 #ifdef __VSX__ 6272 return __builtin_vsx_xvresp(__a); 6273 #else 6274 return __builtin_altivec_vrefp(__a); 6275 #endif 6276 } 6277 6278 #ifdef __VSX__ 6279 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 6280 return __builtin_vsx_xvredp(__a); 6281 } 6282 #endif 6283 6284 /* vec_vrefp */ 6285 6286 static __inline__ vector float __attribute__((__always_inline__)) 6287 vec_vrefp(vector float __a) { 6288 return __builtin_altivec_vrefp(__a); 6289 } 6290 6291 /* vec_rl */ 6292 6293 static __inline__ vector signed char __ATTRS_o_ai 6294 vec_rl(vector signed char __a, vector unsigned char __b) { 6295 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 6296 } 6297 6298 static __inline__ vector unsigned char __ATTRS_o_ai 6299 vec_rl(vector unsigned char __a, vector unsigned char __b) { 6300 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 6301 } 6302 6303 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 6304 vector unsigned short __b) { 6305 return __builtin_altivec_vrlh(__a, __b); 6306 } 6307 6308 static __inline__ vector unsigned short __ATTRS_o_ai 6309 vec_rl(vector unsigned short __a, vector unsigned short __b) { 6310 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 6311 } 6312 6313 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 6314 vector unsigned int __b) { 6315 return __builtin_altivec_vrlw(__a, __b); 6316 } 6317 6318 static __inline__ vector unsigned int __ATTRS_o_ai 6319 vec_rl(vector unsigned int __a, vector unsigned int __b) { 6320 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 6321 } 6322 6323 #ifdef __POWER8_VECTOR__ 6324 static __inline__ vector signed long long __ATTRS_o_ai 6325 vec_rl(vector signed long long __a, vector unsigned long long __b) { 6326 return __builtin_altivec_vrld(__a, __b); 6327 } 6328 6329 static __inline__ vector unsigned long long __ATTRS_o_ai 6330 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 6331 return __builtin_altivec_vrld(__a, __b); 6332 } 6333 #endif 6334 6335 /* vec_vrlb */ 6336 6337 static __inline__ vector signed char __ATTRS_o_ai 6338 vec_vrlb(vector signed char __a, vector unsigned char __b) { 6339 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 6340 } 6341 6342 static __inline__ vector unsigned char __ATTRS_o_ai 6343 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 6344 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 6345 } 6346 6347 /* vec_vrlh */ 6348 6349 static __inline__ vector short __ATTRS_o_ai 6350 vec_vrlh(vector short __a, vector unsigned short __b) { 6351 return __builtin_altivec_vrlh(__a, __b); 6352 } 6353 6354 static __inline__ vector unsigned short __ATTRS_o_ai 6355 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 6356 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 6357 } 6358 6359 /* vec_vrlw */ 6360 6361 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 6362 vector unsigned int __b) { 6363 return __builtin_altivec_vrlw(__a, __b); 6364 } 6365 6366 static __inline__ vector unsigned int __ATTRS_o_ai 6367 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 6368 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 6369 } 6370 6371 /* vec_round */ 6372 6373 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 6374 #ifdef __VSX__ 6375 return __builtin_vsx_xvrspi(__a); 6376 #else 6377 return __builtin_altivec_vrfin(__a); 6378 #endif 6379 } 6380 6381 #ifdef __VSX__ 6382 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 6383 return __builtin_vsx_xvrdpi(__a); 6384 } 6385 6386 /* vec_rint */ 6387 6388 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 6389 return __builtin_vsx_xvrspic(__a); 6390 } 6391 6392 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 6393 return __builtin_vsx_xvrdpic(__a); 6394 } 6395 6396 /* vec_nearbyint */ 6397 6398 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 6399 return __builtin_vsx_xvrspi(__a); 6400 } 6401 6402 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 6403 return __builtin_vsx_xvrdpi(__a); 6404 } 6405 #endif 6406 6407 /* vec_vrfin */ 6408 6409 static __inline__ vector float __attribute__((__always_inline__)) 6410 vec_vrfin(vector float __a) { 6411 return __builtin_altivec_vrfin(__a); 6412 } 6413 6414 /* vec_sqrt */ 6415 6416 #ifdef __VSX__ 6417 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 6418 return __builtin_vsx_xvsqrtsp(__a); 6419 } 6420 6421 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 6422 return __builtin_vsx_xvsqrtdp(__a); 6423 } 6424 #endif 6425 6426 /* vec_rsqrte */ 6427 6428 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 6429 #ifdef __VSX__ 6430 return __builtin_vsx_xvrsqrtesp(__a); 6431 #else 6432 return __builtin_altivec_vrsqrtefp(__a); 6433 #endif 6434 } 6435 6436 #ifdef __VSX__ 6437 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 6438 return __builtin_vsx_xvrsqrtedp(__a); 6439 } 6440 #endif 6441 6442 /* vec_vrsqrtefp */ 6443 6444 static __inline__ __vector float __attribute__((__always_inline__)) 6445 vec_vrsqrtefp(vector float __a) { 6446 return __builtin_altivec_vrsqrtefp(__a); 6447 } 6448 6449 /* vec_sel */ 6450 6451 #define __builtin_altivec_vsel_4si vec_sel 6452 6453 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 6454 vector signed char __a, vector signed char __b, vector unsigned char __c) { 6455 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 6456 } 6457 6458 static __inline__ vector signed char __ATTRS_o_ai 6459 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 6460 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 6461 } 6462 6463 static __inline__ vector unsigned char __ATTRS_o_ai 6464 vec_sel(vector unsigned char __a, vector unsigned char __b, 6465 vector unsigned char __c) { 6466 return (__a & ~__c) | (__b & __c); 6467 } 6468 6469 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 6470 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 6471 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 6472 } 6473 6474 static __inline__ vector bool char __ATTRS_o_ai 6475 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 6476 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 6477 } 6478 6479 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 6480 vector bool char __b, 6481 vector bool char __c) { 6482 return (__a & ~__c) | (__b & __c); 6483 } 6484 6485 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 6486 vector short __b, 6487 vector unsigned short __c) { 6488 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 6489 } 6490 6491 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 6492 vector short __b, 6493 vector bool short __c) { 6494 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 6495 } 6496 6497 static __inline__ vector unsigned short __ATTRS_o_ai 6498 vec_sel(vector unsigned short __a, vector unsigned short __b, 6499 vector unsigned short __c) { 6500 return (__a & ~__c) | (__b & __c); 6501 } 6502 6503 static __inline__ vector unsigned short __ATTRS_o_ai 6504 vec_sel(vector unsigned short __a, vector unsigned short __b, 6505 vector bool short __c) { 6506 return (__a & ~(vector unsigned short)__c) | 6507 (__b & (vector unsigned short)__c); 6508 } 6509 6510 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 6511 vector bool short __a, vector bool short __b, vector unsigned short __c) { 6512 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 6513 } 6514 6515 static __inline__ vector bool short __ATTRS_o_ai 6516 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 6517 return (__a & ~__c) | (__b & __c); 6518 } 6519 6520 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 6521 vector int __b, 6522 vector unsigned int __c) { 6523 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 6524 } 6525 6526 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 6527 vector int __b, 6528 vector bool int __c) { 6529 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 6530 } 6531 6532 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 6533 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 6534 return (__a & ~__c) | (__b & __c); 6535 } 6536 6537 static __inline__ vector unsigned int __ATTRS_o_ai 6538 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 6539 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 6540 } 6541 6542 static __inline__ vector bool int __ATTRS_o_ai 6543 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 6544 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 6545 } 6546 6547 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 6548 vector bool int __b, 6549 vector bool int __c) { 6550 return (__a & ~__c) | (__b & __c); 6551 } 6552 6553 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 6554 vector float __b, 6555 vector unsigned int __c) { 6556 vector int __res = ((vector int)__a & ~(vector int)__c) | 6557 ((vector int)__b & (vector int)__c); 6558 return (vector float)__res; 6559 } 6560 6561 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 6562 vector float __b, 6563 vector bool int __c) { 6564 vector int __res = ((vector int)__a & ~(vector int)__c) | 6565 ((vector int)__b & (vector int)__c); 6566 return (vector float)__res; 6567 } 6568 6569 #ifdef __VSX__ 6570 static __inline__ vector double __ATTRS_o_ai 6571 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 6572 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 6573 ((vector long long)__b & (vector long long)__c); 6574 return (vector double)__res; 6575 } 6576 6577 static __inline__ vector double __ATTRS_o_ai 6578 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 6579 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 6580 ((vector long long)__b & (vector long long)__c); 6581 return (vector double)__res; 6582 } 6583 #endif 6584 6585 /* vec_vsel */ 6586 6587 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 6588 vector signed char __a, vector signed char __b, vector unsigned char __c) { 6589 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 6590 } 6591 6592 static __inline__ vector signed char __ATTRS_o_ai 6593 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 6594 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 6595 } 6596 6597 static __inline__ vector unsigned char __ATTRS_o_ai 6598 vec_vsel(vector unsigned char __a, vector unsigned char __b, 6599 vector unsigned char __c) { 6600 return (__a & ~__c) | (__b & __c); 6601 } 6602 6603 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 6604 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 6605 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 6606 } 6607 6608 static __inline__ vector bool char __ATTRS_o_ai 6609 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 6610 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 6611 } 6612 6613 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 6614 vector bool char __b, 6615 vector bool char __c) { 6616 return (__a & ~__c) | (__b & __c); 6617 } 6618 6619 static __inline__ vector short __ATTRS_o_ai 6620 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 6621 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 6622 } 6623 6624 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 6625 vector short __b, 6626 vector bool short __c) { 6627 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 6628 } 6629 6630 static __inline__ vector unsigned short __ATTRS_o_ai 6631 vec_vsel(vector unsigned short __a, vector unsigned short __b, 6632 vector unsigned short __c) { 6633 return (__a & ~__c) | (__b & __c); 6634 } 6635 6636 static __inline__ vector unsigned short __ATTRS_o_ai 6637 vec_vsel(vector unsigned short __a, vector unsigned short __b, 6638 vector bool short __c) { 6639 return (__a & ~(vector unsigned short)__c) | 6640 (__b & (vector unsigned short)__c); 6641 } 6642 6643 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 6644 vector bool short __a, vector bool short __b, vector unsigned short __c) { 6645 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 6646 } 6647 6648 static __inline__ vector bool short __ATTRS_o_ai 6649 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 6650 return (__a & ~__c) | (__b & __c); 6651 } 6652 6653 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 6654 vector int __b, 6655 vector unsigned int __c) { 6656 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 6657 } 6658 6659 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 6660 vector int __b, 6661 vector bool int __c) { 6662 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 6663 } 6664 6665 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 6666 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 6667 return (__a & ~__c) | (__b & __c); 6668 } 6669 6670 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 6671 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 6672 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 6673 } 6674 6675 static __inline__ vector bool int __ATTRS_o_ai 6676 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 6677 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 6678 } 6679 6680 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 6681 vector bool int __b, 6682 vector bool int __c) { 6683 return (__a & ~__c) | (__b & __c); 6684 } 6685 6686 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 6687 vector float __b, 6688 vector unsigned int __c) { 6689 vector int __res = ((vector int)__a & ~(vector int)__c) | 6690 ((vector int)__b & (vector int)__c); 6691 return (vector float)__res; 6692 } 6693 6694 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 6695 vector float __b, 6696 vector bool int __c) { 6697 vector int __res = ((vector int)__a & ~(vector int)__c) | 6698 ((vector int)__b & (vector int)__c); 6699 return (vector float)__res; 6700 } 6701 6702 /* vec_sl */ 6703 6704 static __inline__ vector signed char __ATTRS_o_ai 6705 vec_sl(vector signed char __a, vector unsigned char __b) { 6706 return __a << (vector signed char)__b; 6707 } 6708 6709 static __inline__ vector unsigned char __ATTRS_o_ai 6710 vec_sl(vector unsigned char __a, vector unsigned char __b) { 6711 return __a << __b; 6712 } 6713 6714 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 6715 vector unsigned short __b) { 6716 return __a << (vector short)__b; 6717 } 6718 6719 static __inline__ vector unsigned short __ATTRS_o_ai 6720 vec_sl(vector unsigned short __a, vector unsigned short __b) { 6721 return __a << __b; 6722 } 6723 6724 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 6725 vector unsigned int __b) { 6726 return __a << (vector int)__b; 6727 } 6728 6729 static __inline__ vector unsigned int __ATTRS_o_ai 6730 vec_sl(vector unsigned int __a, vector unsigned int __b) { 6731 return __a << __b; 6732 } 6733 6734 #ifdef __POWER8_VECTOR__ 6735 static __inline__ vector signed long long __ATTRS_o_ai 6736 vec_sl(vector signed long long __a, vector unsigned long long __b) { 6737 return __a << (vector long long)__b; 6738 } 6739 6740 static __inline__ vector unsigned long long __ATTRS_o_ai 6741 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 6742 return __a << __b; 6743 } 6744 #endif 6745 6746 /* vec_vslb */ 6747 6748 #define __builtin_altivec_vslb vec_vslb 6749 6750 static __inline__ vector signed char __ATTRS_o_ai 6751 vec_vslb(vector signed char __a, vector unsigned char __b) { 6752 return vec_sl(__a, __b); 6753 } 6754 6755 static __inline__ vector unsigned char __ATTRS_o_ai 6756 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 6757 return vec_sl(__a, __b); 6758 } 6759 6760 /* vec_vslh */ 6761 6762 #define __builtin_altivec_vslh vec_vslh 6763 6764 static __inline__ vector short __ATTRS_o_ai 6765 vec_vslh(vector short __a, vector unsigned short __b) { 6766 return vec_sl(__a, __b); 6767 } 6768 6769 static __inline__ vector unsigned short __ATTRS_o_ai 6770 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 6771 return vec_sl(__a, __b); 6772 } 6773 6774 /* vec_vslw */ 6775 6776 #define __builtin_altivec_vslw vec_vslw 6777 6778 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 6779 vector unsigned int __b) { 6780 return vec_sl(__a, __b); 6781 } 6782 6783 static __inline__ vector unsigned int __ATTRS_o_ai 6784 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 6785 return vec_sl(__a, __b); 6786 } 6787 6788 /* vec_sld */ 6789 6790 #define __builtin_altivec_vsldoi_4si vec_sld 6791 6792 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 6793 vector signed char __a, vector signed char __b, unsigned const int __c) { 6794 unsigned char __d = __c & 0x0F; 6795 #ifdef __LITTLE_ENDIAN__ 6796 return vec_perm( 6797 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6798 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6799 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6800 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6801 #else 6802 return vec_perm( 6803 __a, __b, 6804 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6805 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6806 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6807 #endif 6808 } 6809 6810 static __inline__ vector unsigned char __ATTRS_o_ai 6811 vec_sld(vector unsigned char __a, vector unsigned char __b, 6812 unsigned const int __c) { 6813 unsigned char __d = __c & 0x0F; 6814 #ifdef __LITTLE_ENDIAN__ 6815 return vec_perm( 6816 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6817 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6818 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6819 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6820 #else 6821 return vec_perm( 6822 __a, __b, 6823 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6824 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6825 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6826 #endif 6827 } 6828 6829 static __inline__ vector bool char __ATTRS_o_ai 6830 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 6831 unsigned char __d = __c & 0x0F; 6832 #ifdef __LITTLE_ENDIAN__ 6833 return vec_perm( 6834 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6835 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6836 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6837 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6838 #else 6839 return vec_perm( 6840 __a, __b, 6841 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6842 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6843 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6844 #endif 6845 } 6846 6847 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 6848 vector signed short __a, vector signed short __b, unsigned const int __c) { 6849 unsigned char __d = __c & 0x0F; 6850 #ifdef __LITTLE_ENDIAN__ 6851 return vec_perm( 6852 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6853 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6854 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6855 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6856 #else 6857 return vec_perm( 6858 __a, __b, 6859 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6860 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6861 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6862 #endif 6863 } 6864 6865 static __inline__ vector unsigned short __ATTRS_o_ai 6866 vec_sld(vector unsigned short __a, vector unsigned short __b, 6867 unsigned const int __c) { 6868 unsigned char __d = __c & 0x0F; 6869 #ifdef __LITTLE_ENDIAN__ 6870 return vec_perm( 6871 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6872 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6873 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6874 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6875 #else 6876 return vec_perm( 6877 __a, __b, 6878 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6879 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6880 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6881 #endif 6882 } 6883 6884 static __inline__ vector bool short __ATTRS_o_ai 6885 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 6886 unsigned char __d = __c & 0x0F; 6887 #ifdef __LITTLE_ENDIAN__ 6888 return vec_perm( 6889 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6890 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6891 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6892 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6893 #else 6894 return vec_perm( 6895 __a, __b, 6896 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6897 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6898 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6899 #endif 6900 } 6901 6902 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 6903 vector pixel __b, 6904 unsigned const int __c) { 6905 unsigned char __d = __c & 0x0F; 6906 #ifdef __LITTLE_ENDIAN__ 6907 return vec_perm( 6908 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6909 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6910 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6911 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6912 #else 6913 return vec_perm( 6914 __a, __b, 6915 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6916 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6917 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6918 #endif 6919 } 6920 6921 static __inline__ vector signed int __ATTRS_o_ai 6922 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 6923 unsigned char __d = __c & 0x0F; 6924 #ifdef __LITTLE_ENDIAN__ 6925 return vec_perm( 6926 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6927 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6928 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6929 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6930 #else 6931 return vec_perm( 6932 __a, __b, 6933 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6934 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6935 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6936 #endif 6937 } 6938 6939 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 6940 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 6941 unsigned char __d = __c & 0x0F; 6942 #ifdef __LITTLE_ENDIAN__ 6943 return vec_perm( 6944 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6945 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6946 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6947 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6948 #else 6949 return vec_perm( 6950 __a, __b, 6951 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6952 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6953 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6954 #endif 6955 } 6956 6957 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 6958 vector bool int __b, 6959 unsigned const int __c) { 6960 unsigned char __d = __c & 0x0F; 6961 #ifdef __LITTLE_ENDIAN__ 6962 return vec_perm( 6963 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6964 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6965 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6966 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6967 #else 6968 return vec_perm( 6969 __a, __b, 6970 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6971 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6972 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6973 #endif 6974 } 6975 6976 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 6977 vector float __b, 6978 unsigned const int __c) { 6979 unsigned char __d = __c & 0x0F; 6980 #ifdef __LITTLE_ENDIAN__ 6981 return vec_perm( 6982 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 6983 20 - __d, 21 - __d, 22 - __d, 23 - __d, 6984 24 - __d, 25 - __d, 26 - __d, 27 - __d, 6985 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 6986 #else 6987 return vec_perm( 6988 __a, __b, 6989 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 6990 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 6991 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 6992 #endif 6993 } 6994 6995 /* vec_vsldoi */ 6996 6997 static __inline__ vector signed char __ATTRS_o_ai 6998 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 6999 unsigned char __d = __c & 0x0F; 7000 #ifdef __LITTLE_ENDIAN__ 7001 return vec_perm( 7002 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7003 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7004 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7005 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7006 #else 7007 return vec_perm( 7008 __a, __b, 7009 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7010 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7011 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7012 #endif 7013 } 7014 7015 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 7016 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 7017 unsigned char __d = __c & 0x0F; 7018 #ifdef __LITTLE_ENDIAN__ 7019 return vec_perm( 7020 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7021 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7022 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7023 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7024 #else 7025 return vec_perm( 7026 __a, __b, 7027 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7028 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7029 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7030 #endif 7031 } 7032 7033 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 7034 vector short __b, 7035 unsigned char __c) { 7036 unsigned char __d = __c & 0x0F; 7037 #ifdef __LITTLE_ENDIAN__ 7038 return vec_perm( 7039 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7040 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7041 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7042 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7043 #else 7044 return vec_perm( 7045 __a, __b, 7046 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7047 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7048 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7049 #endif 7050 } 7051 7052 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 7053 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 7054 unsigned char __d = __c & 0x0F; 7055 #ifdef __LITTLE_ENDIAN__ 7056 return vec_perm( 7057 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7058 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7059 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7060 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7061 #else 7062 return vec_perm( 7063 __a, __b, 7064 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7065 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7066 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7067 #endif 7068 } 7069 7070 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 7071 vector pixel __b, 7072 unsigned char __c) { 7073 unsigned char __d = __c & 0x0F; 7074 #ifdef __LITTLE_ENDIAN__ 7075 return vec_perm( 7076 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7077 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7078 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7079 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7080 #else 7081 return vec_perm( 7082 __a, __b, 7083 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7084 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7085 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7086 #endif 7087 } 7088 7089 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 7090 vector int __b, 7091 unsigned char __c) { 7092 unsigned char __d = __c & 0x0F; 7093 #ifdef __LITTLE_ENDIAN__ 7094 return vec_perm( 7095 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7096 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7097 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7098 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7099 #else 7100 return vec_perm( 7101 __a, __b, 7102 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7103 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7104 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7105 #endif 7106 } 7107 7108 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 7109 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 7110 unsigned char __d = __c & 0x0F; 7111 #ifdef __LITTLE_ENDIAN__ 7112 return vec_perm( 7113 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7114 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7115 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7116 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7117 #else 7118 return vec_perm( 7119 __a, __b, 7120 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7121 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7122 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7123 #endif 7124 } 7125 7126 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 7127 vector float __b, 7128 unsigned char __c) { 7129 unsigned char __d = __c & 0x0F; 7130 #ifdef __LITTLE_ENDIAN__ 7131 return vec_perm( 7132 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 7133 20 - __d, 21 - __d, 22 - __d, 23 - __d, 7134 24 - __d, 25 - __d, 26 - __d, 27 - __d, 7135 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 7136 #else 7137 return vec_perm( 7138 __a, __b, 7139 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 7140 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 7141 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 7142 #endif 7143 } 7144 7145 /* vec_sll */ 7146 7147 static __inline__ vector signed char __ATTRS_o_ai 7148 vec_sll(vector signed char __a, vector unsigned char __b) { 7149 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 7150 (vector int)__b); 7151 } 7152 7153 static __inline__ vector signed char __ATTRS_o_ai 7154 vec_sll(vector signed char __a, vector unsigned short __b) { 7155 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 7156 (vector int)__b); 7157 } 7158 7159 static __inline__ vector signed char __ATTRS_o_ai 7160 vec_sll(vector signed char __a, vector unsigned int __b) { 7161 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 7162 (vector int)__b); 7163 } 7164 7165 static __inline__ vector unsigned char __ATTRS_o_ai 7166 vec_sll(vector unsigned char __a, vector unsigned char __b) { 7167 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 7168 (vector int)__b); 7169 } 7170 7171 static __inline__ vector unsigned char __ATTRS_o_ai 7172 vec_sll(vector unsigned char __a, vector unsigned short __b) { 7173 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 7174 (vector int)__b); 7175 } 7176 7177 static __inline__ vector unsigned char __ATTRS_o_ai 7178 vec_sll(vector unsigned char __a, vector unsigned int __b) { 7179 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 7180 (vector int)__b); 7181 } 7182 7183 static __inline__ vector bool char __ATTRS_o_ai 7184 vec_sll(vector bool char __a, vector unsigned char __b) { 7185 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 7186 (vector int)__b); 7187 } 7188 7189 static __inline__ vector bool char __ATTRS_o_ai 7190 vec_sll(vector bool char __a, vector unsigned short __b) { 7191 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 7192 (vector int)__b); 7193 } 7194 7195 static __inline__ vector bool char __ATTRS_o_ai 7196 vec_sll(vector bool char __a, vector unsigned int __b) { 7197 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 7198 (vector int)__b); 7199 } 7200 7201 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 7202 vector unsigned char __b) { 7203 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7204 } 7205 7206 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 7207 vector unsigned short __b) { 7208 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7209 } 7210 7211 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 7212 vector unsigned int __b) { 7213 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7214 } 7215 7216 static __inline__ vector unsigned short __ATTRS_o_ai 7217 vec_sll(vector unsigned short __a, vector unsigned char __b) { 7218 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 7219 (vector int)__b); 7220 } 7221 7222 static __inline__ vector unsigned short __ATTRS_o_ai 7223 vec_sll(vector unsigned short __a, vector unsigned short __b) { 7224 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 7225 (vector int)__b); 7226 } 7227 7228 static __inline__ vector unsigned short __ATTRS_o_ai 7229 vec_sll(vector unsigned short __a, vector unsigned int __b) { 7230 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 7231 (vector int)__b); 7232 } 7233 7234 static __inline__ vector bool short __ATTRS_o_ai 7235 vec_sll(vector bool short __a, vector unsigned char __b) { 7236 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 7237 (vector int)__b); 7238 } 7239 7240 static __inline__ vector bool short __ATTRS_o_ai 7241 vec_sll(vector bool short __a, vector unsigned short __b) { 7242 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 7243 (vector int)__b); 7244 } 7245 7246 static __inline__ vector bool short __ATTRS_o_ai 7247 vec_sll(vector bool short __a, vector unsigned int __b) { 7248 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 7249 (vector int)__b); 7250 } 7251 7252 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 7253 vector unsigned char __b) { 7254 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7255 } 7256 7257 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 7258 vector unsigned short __b) { 7259 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7260 } 7261 7262 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 7263 vector unsigned int __b) { 7264 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7265 } 7266 7267 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 7268 vector unsigned char __b) { 7269 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 7270 } 7271 7272 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 7273 vector unsigned short __b) { 7274 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 7275 } 7276 7277 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 7278 vector unsigned int __b) { 7279 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 7280 } 7281 7282 static __inline__ vector unsigned int __ATTRS_o_ai 7283 vec_sll(vector unsigned int __a, vector unsigned char __b) { 7284 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 7285 (vector int)__b); 7286 } 7287 7288 static __inline__ vector unsigned int __ATTRS_o_ai 7289 vec_sll(vector unsigned int __a, vector unsigned short __b) { 7290 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 7291 (vector int)__b); 7292 } 7293 7294 static __inline__ vector unsigned int __ATTRS_o_ai 7295 vec_sll(vector unsigned int __a, vector unsigned int __b) { 7296 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 7297 (vector int)__b); 7298 } 7299 7300 static __inline__ vector bool int __ATTRS_o_ai 7301 vec_sll(vector bool int __a, vector unsigned char __b) { 7302 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 7303 (vector int)__b); 7304 } 7305 7306 static __inline__ vector bool int __ATTRS_o_ai 7307 vec_sll(vector bool int __a, vector unsigned short __b) { 7308 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 7309 (vector int)__b); 7310 } 7311 7312 static __inline__ vector bool int __ATTRS_o_ai 7313 vec_sll(vector bool int __a, vector unsigned int __b) { 7314 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 7315 (vector int)__b); 7316 } 7317 7318 /* vec_vsl */ 7319 7320 static __inline__ vector signed char __ATTRS_o_ai 7321 vec_vsl(vector signed char __a, vector unsigned char __b) { 7322 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 7323 (vector int)__b); 7324 } 7325 7326 static __inline__ vector signed char __ATTRS_o_ai 7327 vec_vsl(vector signed char __a, vector unsigned short __b) { 7328 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 7329 (vector int)__b); 7330 } 7331 7332 static __inline__ vector signed char __ATTRS_o_ai 7333 vec_vsl(vector signed char __a, vector unsigned int __b) { 7334 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 7335 (vector int)__b); 7336 } 7337 7338 static __inline__ vector unsigned char __ATTRS_o_ai 7339 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 7340 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 7341 (vector int)__b); 7342 } 7343 7344 static __inline__ vector unsigned char __ATTRS_o_ai 7345 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 7346 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 7347 (vector int)__b); 7348 } 7349 7350 static __inline__ vector unsigned char __ATTRS_o_ai 7351 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 7352 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 7353 (vector int)__b); 7354 } 7355 7356 static __inline__ vector bool char __ATTRS_o_ai 7357 vec_vsl(vector bool char __a, vector unsigned char __b) { 7358 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 7359 (vector int)__b); 7360 } 7361 7362 static __inline__ vector bool char __ATTRS_o_ai 7363 vec_vsl(vector bool char __a, vector unsigned short __b) { 7364 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 7365 (vector int)__b); 7366 } 7367 7368 static __inline__ vector bool char __ATTRS_o_ai 7369 vec_vsl(vector bool char __a, vector unsigned int __b) { 7370 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 7371 (vector int)__b); 7372 } 7373 7374 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 7375 vector unsigned char __b) { 7376 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7377 } 7378 7379 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 7380 vector unsigned short __b) { 7381 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7382 } 7383 7384 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 7385 vector unsigned int __b) { 7386 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7387 } 7388 7389 static __inline__ vector unsigned short __ATTRS_o_ai 7390 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 7391 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 7392 (vector int)__b); 7393 } 7394 7395 static __inline__ vector unsigned short __ATTRS_o_ai 7396 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 7397 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 7398 (vector int)__b); 7399 } 7400 7401 static __inline__ vector unsigned short __ATTRS_o_ai 7402 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 7403 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 7404 (vector int)__b); 7405 } 7406 7407 static __inline__ vector bool short __ATTRS_o_ai 7408 vec_vsl(vector bool short __a, vector unsigned char __b) { 7409 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 7410 (vector int)__b); 7411 } 7412 7413 static __inline__ vector bool short __ATTRS_o_ai 7414 vec_vsl(vector bool short __a, vector unsigned short __b) { 7415 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 7416 (vector int)__b); 7417 } 7418 7419 static __inline__ vector bool short __ATTRS_o_ai 7420 vec_vsl(vector bool short __a, vector unsigned int __b) { 7421 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 7422 (vector int)__b); 7423 } 7424 7425 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 7426 vector unsigned char __b) { 7427 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7428 } 7429 7430 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 7431 vector unsigned short __b) { 7432 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7433 } 7434 7435 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 7436 vector unsigned int __b) { 7437 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 7438 } 7439 7440 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 7441 vector unsigned char __b) { 7442 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 7443 } 7444 7445 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 7446 vector unsigned short __b) { 7447 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 7448 } 7449 7450 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 7451 vector unsigned int __b) { 7452 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 7453 } 7454 7455 static __inline__ vector unsigned int __ATTRS_o_ai 7456 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 7457 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 7458 (vector int)__b); 7459 } 7460 7461 static __inline__ vector unsigned int __ATTRS_o_ai 7462 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 7463 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 7464 (vector int)__b); 7465 } 7466 7467 static __inline__ vector unsigned int __ATTRS_o_ai 7468 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 7469 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 7470 (vector int)__b); 7471 } 7472 7473 static __inline__ vector bool int __ATTRS_o_ai 7474 vec_vsl(vector bool int __a, vector unsigned char __b) { 7475 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 7476 (vector int)__b); 7477 } 7478 7479 static __inline__ vector bool int __ATTRS_o_ai 7480 vec_vsl(vector bool int __a, vector unsigned short __b) { 7481 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 7482 (vector int)__b); 7483 } 7484 7485 static __inline__ vector bool int __ATTRS_o_ai 7486 vec_vsl(vector bool int __a, vector unsigned int __b) { 7487 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 7488 (vector int)__b); 7489 } 7490 7491 /* vec_slo */ 7492 7493 static __inline__ vector signed char __ATTRS_o_ai 7494 vec_slo(vector signed char __a, vector signed char __b) { 7495 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 7496 (vector int)__b); 7497 } 7498 7499 static __inline__ vector signed char __ATTRS_o_ai 7500 vec_slo(vector signed char __a, vector unsigned char __b) { 7501 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 7502 (vector int)__b); 7503 } 7504 7505 static __inline__ vector unsigned char __ATTRS_o_ai 7506 vec_slo(vector unsigned char __a, vector signed char __b) { 7507 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 7508 (vector int)__b); 7509 } 7510 7511 static __inline__ vector unsigned char __ATTRS_o_ai 7512 vec_slo(vector unsigned char __a, vector unsigned char __b) { 7513 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 7514 (vector int)__b); 7515 } 7516 7517 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 7518 vector signed char __b) { 7519 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7520 } 7521 7522 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 7523 vector unsigned char __b) { 7524 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7525 } 7526 7527 static __inline__ vector unsigned short __ATTRS_o_ai 7528 vec_slo(vector unsigned short __a, vector signed char __b) { 7529 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 7530 (vector int)__b); 7531 } 7532 7533 static __inline__ vector unsigned short __ATTRS_o_ai 7534 vec_slo(vector unsigned short __a, vector unsigned char __b) { 7535 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 7536 (vector int)__b); 7537 } 7538 7539 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 7540 vector signed char __b) { 7541 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7542 } 7543 7544 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 7545 vector unsigned char __b) { 7546 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7547 } 7548 7549 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 7550 vector signed char __b) { 7551 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 7552 } 7553 7554 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 7555 vector unsigned char __b) { 7556 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 7557 } 7558 7559 static __inline__ vector unsigned int __ATTRS_o_ai 7560 vec_slo(vector unsigned int __a, vector signed char __b) { 7561 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 7562 (vector int)__b); 7563 } 7564 7565 static __inline__ vector unsigned int __ATTRS_o_ai 7566 vec_slo(vector unsigned int __a, vector unsigned char __b) { 7567 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 7568 (vector int)__b); 7569 } 7570 7571 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 7572 vector signed char __b) { 7573 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7574 } 7575 7576 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 7577 vector unsigned char __b) { 7578 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7579 } 7580 7581 /* vec_vslo */ 7582 7583 static __inline__ vector signed char __ATTRS_o_ai 7584 vec_vslo(vector signed char __a, vector signed char __b) { 7585 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 7586 (vector int)__b); 7587 } 7588 7589 static __inline__ vector signed char __ATTRS_o_ai 7590 vec_vslo(vector signed char __a, vector unsigned char __b) { 7591 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 7592 (vector int)__b); 7593 } 7594 7595 static __inline__ vector unsigned char __ATTRS_o_ai 7596 vec_vslo(vector unsigned char __a, vector signed char __b) { 7597 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 7598 (vector int)__b); 7599 } 7600 7601 static __inline__ vector unsigned char __ATTRS_o_ai 7602 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 7603 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 7604 (vector int)__b); 7605 } 7606 7607 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 7608 vector signed char __b) { 7609 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7610 } 7611 7612 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 7613 vector unsigned char __b) { 7614 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7615 } 7616 7617 static __inline__ vector unsigned short __ATTRS_o_ai 7618 vec_vslo(vector unsigned short __a, vector signed char __b) { 7619 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 7620 (vector int)__b); 7621 } 7622 7623 static __inline__ vector unsigned short __ATTRS_o_ai 7624 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 7625 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 7626 (vector int)__b); 7627 } 7628 7629 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 7630 vector signed char __b) { 7631 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7632 } 7633 7634 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 7635 vector unsigned char __b) { 7636 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7637 } 7638 7639 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 7640 vector signed char __b) { 7641 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 7642 } 7643 7644 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 7645 vector unsigned char __b) { 7646 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 7647 } 7648 7649 static __inline__ vector unsigned int __ATTRS_o_ai 7650 vec_vslo(vector unsigned int __a, vector signed char __b) { 7651 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 7652 (vector int)__b); 7653 } 7654 7655 static __inline__ vector unsigned int __ATTRS_o_ai 7656 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 7657 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 7658 (vector int)__b); 7659 } 7660 7661 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 7662 vector signed char __b) { 7663 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7664 } 7665 7666 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 7667 vector unsigned char __b) { 7668 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 7669 } 7670 7671 /* vec_splat */ 7672 7673 static __inline__ vector signed char __ATTRS_o_ai 7674 vec_splat(vector signed char __a, unsigned const int __b) { 7675 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 7676 } 7677 7678 static __inline__ vector unsigned char __ATTRS_o_ai 7679 vec_splat(vector unsigned char __a, unsigned const int __b) { 7680 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 7681 } 7682 7683 static __inline__ vector bool char __ATTRS_o_ai 7684 vec_splat(vector bool char __a, unsigned const int __b) { 7685 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 7686 } 7687 7688 static __inline__ vector signed short __ATTRS_o_ai 7689 vec_splat(vector signed short __a, unsigned const int __b) { 7690 unsigned char b0 = (__b & 0x07) * 2; 7691 unsigned char b1 = b0 + 1; 7692 return vec_perm(__a, __a, 7693 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 7694 b0, b1, b0, b1, b0, b1)); 7695 } 7696 7697 static __inline__ vector unsigned short __ATTRS_o_ai 7698 vec_splat(vector unsigned short __a, unsigned const int __b) { 7699 unsigned char b0 = (__b & 0x07) * 2; 7700 unsigned char b1 = b0 + 1; 7701 return vec_perm(__a, __a, 7702 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 7703 b0, b1, b0, b1, b0, b1)); 7704 } 7705 7706 static __inline__ vector bool short __ATTRS_o_ai 7707 vec_splat(vector bool short __a, unsigned const int __b) { 7708 unsigned char b0 = (__b & 0x07) * 2; 7709 unsigned char b1 = b0 + 1; 7710 return vec_perm(__a, __a, 7711 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 7712 b0, b1, b0, b1, b0, b1)); 7713 } 7714 7715 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 7716 unsigned const int __b) { 7717 unsigned char b0 = (__b & 0x07) * 2; 7718 unsigned char b1 = b0 + 1; 7719 return vec_perm(__a, __a, 7720 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 7721 b0, b1, b0, b1, b0, b1)); 7722 } 7723 7724 static __inline__ vector signed int __ATTRS_o_ai 7725 vec_splat(vector signed int __a, unsigned const int __b) { 7726 unsigned char b0 = (__b & 0x03) * 4; 7727 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 7728 return vec_perm(__a, __a, 7729 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 7730 b2, b3, b0, b1, b2, b3)); 7731 } 7732 7733 static __inline__ vector unsigned int __ATTRS_o_ai 7734 vec_splat(vector unsigned int __a, unsigned const int __b) { 7735 unsigned char b0 = (__b & 0x03) * 4; 7736 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 7737 return vec_perm(__a, __a, 7738 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 7739 b2, b3, b0, b1, b2, b3)); 7740 } 7741 7742 static __inline__ vector bool int __ATTRS_o_ai 7743 vec_splat(vector bool int __a, unsigned const int __b) { 7744 unsigned char b0 = (__b & 0x03) * 4; 7745 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 7746 return vec_perm(__a, __a, 7747 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 7748 b2, b3, b0, b1, b2, b3)); 7749 } 7750 7751 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 7752 unsigned const int __b) { 7753 unsigned char b0 = (__b & 0x03) * 4; 7754 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 7755 return vec_perm(__a, __a, 7756 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 7757 b2, b3, b0, b1, b2, b3)); 7758 } 7759 7760 #ifdef __VSX__ 7761 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 7762 unsigned const int __b) { 7763 unsigned char b0 = (__b & 0x01) * 8; 7764 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 7765 b6 = b0 + 6, b7 = b0 + 7; 7766 return vec_perm(__a, __a, 7767 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 7768 b2, b3, b4, b5, b6, b7)); 7769 } 7770 static __inline__ vector bool long long __ATTRS_o_ai 7771 vec_splat(vector bool long long __a, unsigned const int __b) { 7772 unsigned char b0 = (__b & 0x01) * 8; 7773 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 7774 b6 = b0 + 6, b7 = b0 + 7; 7775 return vec_perm(__a, __a, 7776 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 7777 b2, b3, b4, b5, b6, b7)); 7778 } 7779 static __inline__ vector signed long long __ATTRS_o_ai 7780 vec_splat(vector signed long long __a, unsigned const int __b) { 7781 unsigned char b0 = (__b & 0x01) * 8; 7782 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 7783 b6 = b0 + 6, b7 = b0 + 7; 7784 return vec_perm(__a, __a, 7785 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 7786 b2, b3, b4, b5, b6, b7)); 7787 } 7788 static __inline__ vector unsigned long long __ATTRS_o_ai 7789 vec_splat(vector unsigned long long __a, unsigned const int __b) { 7790 unsigned char b0 = (__b & 0x01) * 8; 7791 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 7792 b6 = b0 + 6, b7 = b0 + 7; 7793 return vec_perm(__a, __a, 7794 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 7795 b2, b3, b4, b5, b6, b7)); 7796 } 7797 #endif 7798 7799 /* vec_vspltb */ 7800 7801 #define __builtin_altivec_vspltb vec_vspltb 7802 7803 static __inline__ vector signed char __ATTRS_o_ai 7804 vec_vspltb(vector signed char __a, unsigned char __b) { 7805 return vec_perm(__a, __a, (vector unsigned char)(__b)); 7806 } 7807 7808 static __inline__ vector unsigned char __ATTRS_o_ai 7809 vec_vspltb(vector unsigned char __a, unsigned char __b) { 7810 return vec_perm(__a, __a, (vector unsigned char)(__b)); 7811 } 7812 7813 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 7814 unsigned char __b) { 7815 return vec_perm(__a, __a, (vector unsigned char)(__b)); 7816 } 7817 7818 /* vec_vsplth */ 7819 7820 #define __builtin_altivec_vsplth vec_vsplth 7821 7822 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 7823 unsigned char __b) { 7824 __b *= 2; 7825 unsigned char b1 = __b + 1; 7826 return vec_perm(__a, __a, 7827 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 7828 __b, b1, __b, b1, __b, b1, __b, b1)); 7829 } 7830 7831 static __inline__ vector unsigned short __ATTRS_o_ai 7832 vec_vsplth(vector unsigned short __a, unsigned char __b) { 7833 __b *= 2; 7834 unsigned char b1 = __b + 1; 7835 return vec_perm(__a, __a, 7836 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 7837 __b, b1, __b, b1, __b, b1, __b, b1)); 7838 } 7839 7840 static __inline__ vector bool short __ATTRS_o_ai 7841 vec_vsplth(vector bool short __a, unsigned char __b) { 7842 __b *= 2; 7843 unsigned char b1 = __b + 1; 7844 return vec_perm(__a, __a, 7845 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 7846 __b, b1, __b, b1, __b, b1, __b, b1)); 7847 } 7848 7849 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 7850 unsigned char __b) { 7851 __b *= 2; 7852 unsigned char b1 = __b + 1; 7853 return vec_perm(__a, __a, 7854 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 7855 __b, b1, __b, b1, __b, b1, __b, b1)); 7856 } 7857 7858 /* vec_vspltw */ 7859 7860 #define __builtin_altivec_vspltw vec_vspltw 7861 7862 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 7863 unsigned char __b) { 7864 __b *= 4; 7865 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 7866 return vec_perm(__a, __a, 7867 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 7868 b1, b2, b3, __b, b1, b2, b3)); 7869 } 7870 7871 static __inline__ vector unsigned int __ATTRS_o_ai 7872 vec_vspltw(vector unsigned int __a, unsigned char __b) { 7873 __b *= 4; 7874 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 7875 return vec_perm(__a, __a, 7876 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 7877 b1, b2, b3, __b, b1, b2, b3)); 7878 } 7879 7880 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 7881 unsigned char __b) { 7882 __b *= 4; 7883 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 7884 return vec_perm(__a, __a, 7885 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 7886 b1, b2, b3, __b, b1, b2, b3)); 7887 } 7888 7889 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 7890 unsigned char __b) { 7891 __b *= 4; 7892 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 7893 return vec_perm(__a, __a, 7894 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 7895 b1, b2, b3, __b, b1, b2, b3)); 7896 } 7897 7898 /* vec_splat_s8 */ 7899 7900 #define __builtin_altivec_vspltisb vec_splat_s8 7901 7902 // FIXME: parameter should be treated as 5-bit signed literal 7903 static __inline__ vector signed char __ATTRS_o_ai 7904 vec_splat_s8(signed char __a) { 7905 return (vector signed char)(__a); 7906 } 7907 7908 /* vec_vspltisb */ 7909 7910 // FIXME: parameter should be treated as 5-bit signed literal 7911 static __inline__ vector signed char __ATTRS_o_ai 7912 vec_vspltisb(signed char __a) { 7913 return (vector signed char)(__a); 7914 } 7915 7916 /* vec_splat_s16 */ 7917 7918 #define __builtin_altivec_vspltish vec_splat_s16 7919 7920 // FIXME: parameter should be treated as 5-bit signed literal 7921 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 7922 return (vector short)(__a); 7923 } 7924 7925 /* vec_vspltish */ 7926 7927 // FIXME: parameter should be treated as 5-bit signed literal 7928 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 7929 return (vector short)(__a); 7930 } 7931 7932 /* vec_splat_s32 */ 7933 7934 #define __builtin_altivec_vspltisw vec_splat_s32 7935 7936 // FIXME: parameter should be treated as 5-bit signed literal 7937 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 7938 return (vector int)(__a); 7939 } 7940 7941 /* vec_vspltisw */ 7942 7943 // FIXME: parameter should be treated as 5-bit signed literal 7944 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 7945 return (vector int)(__a); 7946 } 7947 7948 /* vec_splat_u8 */ 7949 7950 // FIXME: parameter should be treated as 5-bit signed literal 7951 static __inline__ vector unsigned char __ATTRS_o_ai 7952 vec_splat_u8(unsigned char __a) { 7953 return (vector unsigned char)(__a); 7954 } 7955 7956 /* vec_splat_u16 */ 7957 7958 // FIXME: parameter should be treated as 5-bit signed literal 7959 static __inline__ vector unsigned short __ATTRS_o_ai 7960 vec_splat_u16(signed char __a) { 7961 return (vector unsigned short)(__a); 7962 } 7963 7964 /* vec_splat_u32 */ 7965 7966 // FIXME: parameter should be treated as 5-bit signed literal 7967 static __inline__ vector unsigned int __ATTRS_o_ai 7968 vec_splat_u32(signed char __a) { 7969 return (vector unsigned int)(__a); 7970 } 7971 7972 /* vec_sr */ 7973 7974 static __inline__ vector signed char __ATTRS_o_ai 7975 vec_sr(vector signed char __a, vector unsigned char __b) { 7976 vector unsigned char __res = (vector unsigned char)__a >> __b; 7977 return (vector signed char)__res; 7978 } 7979 7980 static __inline__ vector unsigned char __ATTRS_o_ai 7981 vec_sr(vector unsigned char __a, vector unsigned char __b) { 7982 return __a >> __b; 7983 } 7984 7985 static __inline__ vector signed short __ATTRS_o_ai 7986 vec_sr(vector signed short __a, vector unsigned short __b) { 7987 vector unsigned short __res = (vector unsigned short)__a >> __b; 7988 return (vector signed short)__res; 7989 } 7990 7991 static __inline__ vector unsigned short __ATTRS_o_ai 7992 vec_sr(vector unsigned short __a, vector unsigned short __b) { 7993 return __a >> __b; 7994 } 7995 7996 static __inline__ vector signed int __ATTRS_o_ai 7997 vec_sr(vector signed int __a, vector unsigned int __b) { 7998 vector unsigned int __res = (vector unsigned int)__a >> __b; 7999 return (vector signed int)__res; 8000 } 8001 8002 static __inline__ vector unsigned int __ATTRS_o_ai 8003 vec_sr(vector unsigned int __a, vector unsigned int __b) { 8004 return __a >> __b; 8005 } 8006 8007 #ifdef __POWER8_VECTOR__ 8008 static __inline__ vector signed long long __ATTRS_o_ai 8009 vec_sr(vector signed long long __a, vector unsigned long long __b) { 8010 vector unsigned long long __res = (vector unsigned long long)__a >> __b; 8011 return (vector signed long long)__res; 8012 } 8013 8014 static __inline__ vector unsigned long long __ATTRS_o_ai 8015 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 8016 return __a >> __b; 8017 } 8018 #endif 8019 8020 /* vec_vsrb */ 8021 8022 #define __builtin_altivec_vsrb vec_vsrb 8023 8024 static __inline__ vector signed char __ATTRS_o_ai 8025 vec_vsrb(vector signed char __a, vector unsigned char __b) { 8026 return __a >> (vector signed char)__b; 8027 } 8028 8029 static __inline__ vector unsigned char __ATTRS_o_ai 8030 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 8031 return __a >> __b; 8032 } 8033 8034 /* vec_vsrh */ 8035 8036 #define __builtin_altivec_vsrh vec_vsrh 8037 8038 static __inline__ vector short __ATTRS_o_ai 8039 vec_vsrh(vector short __a, vector unsigned short __b) { 8040 return __a >> (vector short)__b; 8041 } 8042 8043 static __inline__ vector unsigned short __ATTRS_o_ai 8044 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 8045 return __a >> __b; 8046 } 8047 8048 /* vec_vsrw */ 8049 8050 #define __builtin_altivec_vsrw vec_vsrw 8051 8052 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 8053 vector unsigned int __b) { 8054 return __a >> (vector int)__b; 8055 } 8056 8057 static __inline__ vector unsigned int __ATTRS_o_ai 8058 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 8059 return __a >> __b; 8060 } 8061 8062 /* vec_sra */ 8063 8064 static __inline__ vector signed char __ATTRS_o_ai 8065 vec_sra(vector signed char __a, vector unsigned char __b) { 8066 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 8067 } 8068 8069 static __inline__ vector unsigned char __ATTRS_o_ai 8070 vec_sra(vector unsigned char __a, vector unsigned char __b) { 8071 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 8072 } 8073 8074 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 8075 vector unsigned short __b) { 8076 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 8077 } 8078 8079 static __inline__ vector unsigned short __ATTRS_o_ai 8080 vec_sra(vector unsigned short __a, vector unsigned short __b) { 8081 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 8082 } 8083 8084 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 8085 vector unsigned int __b) { 8086 return __builtin_altivec_vsraw(__a, __b); 8087 } 8088 8089 static __inline__ vector unsigned int __ATTRS_o_ai 8090 vec_sra(vector unsigned int __a, vector unsigned int __b) { 8091 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 8092 } 8093 8094 #ifdef __POWER8_VECTOR__ 8095 static __inline__ vector signed long long __ATTRS_o_ai 8096 vec_sra(vector signed long long __a, vector unsigned long long __b) { 8097 return __a >> __b; 8098 } 8099 8100 static __inline__ vector unsigned long long __ATTRS_o_ai 8101 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 8102 return (vector unsigned long long)((vector signed long long)__a >> __b); 8103 } 8104 #endif 8105 8106 /* vec_vsrab */ 8107 8108 static __inline__ vector signed char __ATTRS_o_ai 8109 vec_vsrab(vector signed char __a, vector unsigned char __b) { 8110 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 8111 } 8112 8113 static __inline__ vector unsigned char __ATTRS_o_ai 8114 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 8115 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 8116 } 8117 8118 /* vec_vsrah */ 8119 8120 static __inline__ vector short __ATTRS_o_ai 8121 vec_vsrah(vector short __a, vector unsigned short __b) { 8122 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 8123 } 8124 8125 static __inline__ vector unsigned short __ATTRS_o_ai 8126 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 8127 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 8128 } 8129 8130 /* vec_vsraw */ 8131 8132 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 8133 vector unsigned int __b) { 8134 return __builtin_altivec_vsraw(__a, __b); 8135 } 8136 8137 static __inline__ vector unsigned int __ATTRS_o_ai 8138 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 8139 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 8140 } 8141 8142 /* vec_srl */ 8143 8144 static __inline__ vector signed char __ATTRS_o_ai 8145 vec_srl(vector signed char __a, vector unsigned char __b) { 8146 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 8147 (vector int)__b); 8148 } 8149 8150 static __inline__ vector signed char __ATTRS_o_ai 8151 vec_srl(vector signed char __a, vector unsigned short __b) { 8152 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 8153 (vector int)__b); 8154 } 8155 8156 static __inline__ vector signed char __ATTRS_o_ai 8157 vec_srl(vector signed char __a, vector unsigned int __b) { 8158 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 8159 (vector int)__b); 8160 } 8161 8162 static __inline__ vector unsigned char __ATTRS_o_ai 8163 vec_srl(vector unsigned char __a, vector unsigned char __b) { 8164 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 8165 (vector int)__b); 8166 } 8167 8168 static __inline__ vector unsigned char __ATTRS_o_ai 8169 vec_srl(vector unsigned char __a, vector unsigned short __b) { 8170 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 8171 (vector int)__b); 8172 } 8173 8174 static __inline__ vector unsigned char __ATTRS_o_ai 8175 vec_srl(vector unsigned char __a, vector unsigned int __b) { 8176 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 8177 (vector int)__b); 8178 } 8179 8180 static __inline__ vector bool char __ATTRS_o_ai 8181 vec_srl(vector bool char __a, vector unsigned char __b) { 8182 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 8183 (vector int)__b); 8184 } 8185 8186 static __inline__ vector bool char __ATTRS_o_ai 8187 vec_srl(vector bool char __a, vector unsigned short __b) { 8188 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 8189 (vector int)__b); 8190 } 8191 8192 static __inline__ vector bool char __ATTRS_o_ai 8193 vec_srl(vector bool char __a, vector unsigned int __b) { 8194 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 8195 (vector int)__b); 8196 } 8197 8198 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 8199 vector unsigned char __b) { 8200 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8201 } 8202 8203 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 8204 vector unsigned short __b) { 8205 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8206 } 8207 8208 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 8209 vector unsigned int __b) { 8210 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8211 } 8212 8213 static __inline__ vector unsigned short __ATTRS_o_ai 8214 vec_srl(vector unsigned short __a, vector unsigned char __b) { 8215 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 8216 (vector int)__b); 8217 } 8218 8219 static __inline__ vector unsigned short __ATTRS_o_ai 8220 vec_srl(vector unsigned short __a, vector unsigned short __b) { 8221 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 8222 (vector int)__b); 8223 } 8224 8225 static __inline__ vector unsigned short __ATTRS_o_ai 8226 vec_srl(vector unsigned short __a, vector unsigned int __b) { 8227 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 8228 (vector int)__b); 8229 } 8230 8231 static __inline__ vector bool short __ATTRS_o_ai 8232 vec_srl(vector bool short __a, vector unsigned char __b) { 8233 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 8234 (vector int)__b); 8235 } 8236 8237 static __inline__ vector bool short __ATTRS_o_ai 8238 vec_srl(vector bool short __a, vector unsigned short __b) { 8239 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 8240 (vector int)__b); 8241 } 8242 8243 static __inline__ vector bool short __ATTRS_o_ai 8244 vec_srl(vector bool short __a, vector unsigned int __b) { 8245 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 8246 (vector int)__b); 8247 } 8248 8249 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 8250 vector unsigned char __b) { 8251 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8252 } 8253 8254 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 8255 vector unsigned short __b) { 8256 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8257 } 8258 8259 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 8260 vector unsigned int __b) { 8261 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8262 } 8263 8264 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 8265 vector unsigned char __b) { 8266 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 8267 } 8268 8269 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 8270 vector unsigned short __b) { 8271 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 8272 } 8273 8274 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 8275 vector unsigned int __b) { 8276 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 8277 } 8278 8279 static __inline__ vector unsigned int __ATTRS_o_ai 8280 vec_srl(vector unsigned int __a, vector unsigned char __b) { 8281 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 8282 (vector int)__b); 8283 } 8284 8285 static __inline__ vector unsigned int __ATTRS_o_ai 8286 vec_srl(vector unsigned int __a, vector unsigned short __b) { 8287 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 8288 (vector int)__b); 8289 } 8290 8291 static __inline__ vector unsigned int __ATTRS_o_ai 8292 vec_srl(vector unsigned int __a, vector unsigned int __b) { 8293 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 8294 (vector int)__b); 8295 } 8296 8297 static __inline__ vector bool int __ATTRS_o_ai 8298 vec_srl(vector bool int __a, vector unsigned char __b) { 8299 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 8300 (vector int)__b); 8301 } 8302 8303 static __inline__ vector bool int __ATTRS_o_ai 8304 vec_srl(vector bool int __a, vector unsigned short __b) { 8305 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 8306 (vector int)__b); 8307 } 8308 8309 static __inline__ vector bool int __ATTRS_o_ai 8310 vec_srl(vector bool int __a, vector unsigned int __b) { 8311 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 8312 (vector int)__b); 8313 } 8314 8315 /* vec_vsr */ 8316 8317 static __inline__ vector signed char __ATTRS_o_ai 8318 vec_vsr(vector signed char __a, vector unsigned char __b) { 8319 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 8320 (vector int)__b); 8321 } 8322 8323 static __inline__ vector signed char __ATTRS_o_ai 8324 vec_vsr(vector signed char __a, vector unsigned short __b) { 8325 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 8326 (vector int)__b); 8327 } 8328 8329 static __inline__ vector signed char __ATTRS_o_ai 8330 vec_vsr(vector signed char __a, vector unsigned int __b) { 8331 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 8332 (vector int)__b); 8333 } 8334 8335 static __inline__ vector unsigned char __ATTRS_o_ai 8336 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 8337 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 8338 (vector int)__b); 8339 } 8340 8341 static __inline__ vector unsigned char __ATTRS_o_ai 8342 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 8343 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 8344 (vector int)__b); 8345 } 8346 8347 static __inline__ vector unsigned char __ATTRS_o_ai 8348 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 8349 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 8350 (vector int)__b); 8351 } 8352 8353 static __inline__ vector bool char __ATTRS_o_ai 8354 vec_vsr(vector bool char __a, vector unsigned char __b) { 8355 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 8356 (vector int)__b); 8357 } 8358 8359 static __inline__ vector bool char __ATTRS_o_ai 8360 vec_vsr(vector bool char __a, vector unsigned short __b) { 8361 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 8362 (vector int)__b); 8363 } 8364 8365 static __inline__ vector bool char __ATTRS_o_ai 8366 vec_vsr(vector bool char __a, vector unsigned int __b) { 8367 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 8368 (vector int)__b); 8369 } 8370 8371 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 8372 vector unsigned char __b) { 8373 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8374 } 8375 8376 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 8377 vector unsigned short __b) { 8378 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8379 } 8380 8381 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 8382 vector unsigned int __b) { 8383 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8384 } 8385 8386 static __inline__ vector unsigned short __ATTRS_o_ai 8387 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 8388 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 8389 (vector int)__b); 8390 } 8391 8392 static __inline__ vector unsigned short __ATTRS_o_ai 8393 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 8394 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 8395 (vector int)__b); 8396 } 8397 8398 static __inline__ vector unsigned short __ATTRS_o_ai 8399 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 8400 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 8401 (vector int)__b); 8402 } 8403 8404 static __inline__ vector bool short __ATTRS_o_ai 8405 vec_vsr(vector bool short __a, vector unsigned char __b) { 8406 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 8407 (vector int)__b); 8408 } 8409 8410 static __inline__ vector bool short __ATTRS_o_ai 8411 vec_vsr(vector bool short __a, vector unsigned short __b) { 8412 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 8413 (vector int)__b); 8414 } 8415 8416 static __inline__ vector bool short __ATTRS_o_ai 8417 vec_vsr(vector bool short __a, vector unsigned int __b) { 8418 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 8419 (vector int)__b); 8420 } 8421 8422 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 8423 vector unsigned char __b) { 8424 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8425 } 8426 8427 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 8428 vector unsigned short __b) { 8429 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8430 } 8431 8432 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 8433 vector unsigned int __b) { 8434 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 8435 } 8436 8437 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 8438 vector unsigned char __b) { 8439 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 8440 } 8441 8442 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 8443 vector unsigned short __b) { 8444 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 8445 } 8446 8447 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 8448 vector unsigned int __b) { 8449 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 8450 } 8451 8452 static __inline__ vector unsigned int __ATTRS_o_ai 8453 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 8454 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 8455 (vector int)__b); 8456 } 8457 8458 static __inline__ vector unsigned int __ATTRS_o_ai 8459 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 8460 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 8461 (vector int)__b); 8462 } 8463 8464 static __inline__ vector unsigned int __ATTRS_o_ai 8465 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 8466 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 8467 (vector int)__b); 8468 } 8469 8470 static __inline__ vector bool int __ATTRS_o_ai 8471 vec_vsr(vector bool int __a, vector unsigned char __b) { 8472 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 8473 (vector int)__b); 8474 } 8475 8476 static __inline__ vector bool int __ATTRS_o_ai 8477 vec_vsr(vector bool int __a, vector unsigned short __b) { 8478 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 8479 (vector int)__b); 8480 } 8481 8482 static __inline__ vector bool int __ATTRS_o_ai 8483 vec_vsr(vector bool int __a, vector unsigned int __b) { 8484 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 8485 (vector int)__b); 8486 } 8487 8488 /* vec_sro */ 8489 8490 static __inline__ vector signed char __ATTRS_o_ai 8491 vec_sro(vector signed char __a, vector signed char __b) { 8492 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 8493 (vector int)__b); 8494 } 8495 8496 static __inline__ vector signed char __ATTRS_o_ai 8497 vec_sro(vector signed char __a, vector unsigned char __b) { 8498 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 8499 (vector int)__b); 8500 } 8501 8502 static __inline__ vector unsigned char __ATTRS_o_ai 8503 vec_sro(vector unsigned char __a, vector signed char __b) { 8504 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 8505 (vector int)__b); 8506 } 8507 8508 static __inline__ vector unsigned char __ATTRS_o_ai 8509 vec_sro(vector unsigned char __a, vector unsigned char __b) { 8510 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 8511 (vector int)__b); 8512 } 8513 8514 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 8515 vector signed char __b) { 8516 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8517 } 8518 8519 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 8520 vector unsigned char __b) { 8521 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8522 } 8523 8524 static __inline__ vector unsigned short __ATTRS_o_ai 8525 vec_sro(vector unsigned short __a, vector signed char __b) { 8526 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 8527 (vector int)__b); 8528 } 8529 8530 static __inline__ vector unsigned short __ATTRS_o_ai 8531 vec_sro(vector unsigned short __a, vector unsigned char __b) { 8532 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 8533 (vector int)__b); 8534 } 8535 8536 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 8537 vector signed char __b) { 8538 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8539 } 8540 8541 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 8542 vector unsigned char __b) { 8543 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8544 } 8545 8546 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 8547 vector signed char __b) { 8548 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 8549 } 8550 8551 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 8552 vector unsigned char __b) { 8553 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 8554 } 8555 8556 static __inline__ vector unsigned int __ATTRS_o_ai 8557 vec_sro(vector unsigned int __a, vector signed char __b) { 8558 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 8559 (vector int)__b); 8560 } 8561 8562 static __inline__ vector unsigned int __ATTRS_o_ai 8563 vec_sro(vector unsigned int __a, vector unsigned char __b) { 8564 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 8565 (vector int)__b); 8566 } 8567 8568 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 8569 vector signed char __b) { 8570 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8571 } 8572 8573 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 8574 vector unsigned char __b) { 8575 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8576 } 8577 8578 /* vec_vsro */ 8579 8580 static __inline__ vector signed char __ATTRS_o_ai 8581 vec_vsro(vector signed char __a, vector signed char __b) { 8582 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 8583 (vector int)__b); 8584 } 8585 8586 static __inline__ vector signed char __ATTRS_o_ai 8587 vec_vsro(vector signed char __a, vector unsigned char __b) { 8588 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 8589 (vector int)__b); 8590 } 8591 8592 static __inline__ vector unsigned char __ATTRS_o_ai 8593 vec_vsro(vector unsigned char __a, vector signed char __b) { 8594 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 8595 (vector int)__b); 8596 } 8597 8598 static __inline__ vector unsigned char __ATTRS_o_ai 8599 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 8600 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 8601 (vector int)__b); 8602 } 8603 8604 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 8605 vector signed char __b) { 8606 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8607 } 8608 8609 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 8610 vector unsigned char __b) { 8611 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8612 } 8613 8614 static __inline__ vector unsigned short __ATTRS_o_ai 8615 vec_vsro(vector unsigned short __a, vector signed char __b) { 8616 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 8617 (vector int)__b); 8618 } 8619 8620 static __inline__ vector unsigned short __ATTRS_o_ai 8621 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 8622 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 8623 (vector int)__b); 8624 } 8625 8626 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 8627 vector signed char __b) { 8628 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8629 } 8630 8631 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 8632 vector unsigned char __b) { 8633 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8634 } 8635 8636 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 8637 vector signed char __b) { 8638 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 8639 } 8640 8641 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 8642 vector unsigned char __b) { 8643 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 8644 } 8645 8646 static __inline__ vector unsigned int __ATTRS_o_ai 8647 vec_vsro(vector unsigned int __a, vector signed char __b) { 8648 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 8649 (vector int)__b); 8650 } 8651 8652 static __inline__ vector unsigned int __ATTRS_o_ai 8653 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 8654 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 8655 (vector int)__b); 8656 } 8657 8658 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 8659 vector signed char __b) { 8660 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8661 } 8662 8663 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 8664 vector unsigned char __b) { 8665 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 8666 } 8667 8668 /* vec_st */ 8669 8670 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 8671 vector signed char *__c) { 8672 __builtin_altivec_stvx((vector int)__a, __b, __c); 8673 } 8674 8675 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 8676 signed char *__c) { 8677 __builtin_altivec_stvx((vector int)__a, __b, __c); 8678 } 8679 8680 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 8681 vector unsigned char *__c) { 8682 __builtin_altivec_stvx((vector int)__a, __b, __c); 8683 } 8684 8685 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 8686 unsigned char *__c) { 8687 __builtin_altivec_stvx((vector int)__a, __b, __c); 8688 } 8689 8690 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 8691 signed char *__c) { 8692 __builtin_altivec_stvx((vector int)__a, __b, __c); 8693 } 8694 8695 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 8696 unsigned char *__c) { 8697 __builtin_altivec_stvx((vector int)__a, __b, __c); 8698 } 8699 8700 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 8701 vector bool char *__c) { 8702 __builtin_altivec_stvx((vector int)__a, __b, __c); 8703 } 8704 8705 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 8706 vector short *__c) { 8707 __builtin_altivec_stvx((vector int)__a, __b, __c); 8708 } 8709 8710 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 8711 short *__c) { 8712 __builtin_altivec_stvx((vector int)__a, __b, __c); 8713 } 8714 8715 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 8716 vector unsigned short *__c) { 8717 __builtin_altivec_stvx((vector int)__a, __b, __c); 8718 } 8719 8720 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 8721 unsigned short *__c) { 8722 __builtin_altivec_stvx((vector int)__a, __b, __c); 8723 } 8724 8725 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 8726 short *__c) { 8727 __builtin_altivec_stvx((vector int)__a, __b, __c); 8728 } 8729 8730 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 8731 unsigned short *__c) { 8732 __builtin_altivec_stvx((vector int)__a, __b, __c); 8733 } 8734 8735 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 8736 vector bool short *__c) { 8737 __builtin_altivec_stvx((vector int)__a, __b, __c); 8738 } 8739 8740 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 8741 short *__c) { 8742 __builtin_altivec_stvx((vector int)__a, __b, __c); 8743 } 8744 8745 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 8746 unsigned short *__c) { 8747 __builtin_altivec_stvx((vector int)__a, __b, __c); 8748 } 8749 8750 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 8751 vector pixel *__c) { 8752 __builtin_altivec_stvx((vector int)__a, __b, __c); 8753 } 8754 8755 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, 8756 vector int *__c) { 8757 __builtin_altivec_stvx(__a, __b, __c); 8758 } 8759 8760 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) { 8761 __builtin_altivec_stvx(__a, __b, __c); 8762 } 8763 8764 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 8765 vector unsigned int *__c) { 8766 __builtin_altivec_stvx((vector int)__a, __b, __c); 8767 } 8768 8769 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 8770 unsigned int *__c) { 8771 __builtin_altivec_stvx((vector int)__a, __b, __c); 8772 } 8773 8774 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 8775 int *__c) { 8776 __builtin_altivec_stvx((vector int)__a, __b, __c); 8777 } 8778 8779 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 8780 unsigned int *__c) { 8781 __builtin_altivec_stvx((vector int)__a, __b, __c); 8782 } 8783 8784 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 8785 vector bool int *__c) { 8786 __builtin_altivec_stvx((vector int)__a, __b, __c); 8787 } 8788 8789 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 8790 vector float *__c) { 8791 __builtin_altivec_stvx((vector int)__a, __b, __c); 8792 } 8793 8794 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 8795 float *__c) { 8796 __builtin_altivec_stvx((vector int)__a, __b, __c); 8797 } 8798 8799 /* vec_stvx */ 8800 8801 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 8802 vector signed char *__c) { 8803 __builtin_altivec_stvx((vector int)__a, __b, __c); 8804 } 8805 8806 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 8807 signed char *__c) { 8808 __builtin_altivec_stvx((vector int)__a, __b, __c); 8809 } 8810 8811 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 8812 vector unsigned char *__c) { 8813 __builtin_altivec_stvx((vector int)__a, __b, __c); 8814 } 8815 8816 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 8817 unsigned char *__c) { 8818 __builtin_altivec_stvx((vector int)__a, __b, __c); 8819 } 8820 8821 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 8822 signed char *__c) { 8823 __builtin_altivec_stvx((vector int)__a, __b, __c); 8824 } 8825 8826 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 8827 unsigned char *__c) { 8828 __builtin_altivec_stvx((vector int)__a, __b, __c); 8829 } 8830 8831 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 8832 vector bool char *__c) { 8833 __builtin_altivec_stvx((vector int)__a, __b, __c); 8834 } 8835 8836 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 8837 vector short *__c) { 8838 __builtin_altivec_stvx((vector int)__a, __b, __c); 8839 } 8840 8841 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 8842 short *__c) { 8843 __builtin_altivec_stvx((vector int)__a, __b, __c); 8844 } 8845 8846 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 8847 vector unsigned short *__c) { 8848 __builtin_altivec_stvx((vector int)__a, __b, __c); 8849 } 8850 8851 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 8852 unsigned short *__c) { 8853 __builtin_altivec_stvx((vector int)__a, __b, __c); 8854 } 8855 8856 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 8857 short *__c) { 8858 __builtin_altivec_stvx((vector int)__a, __b, __c); 8859 } 8860 8861 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 8862 unsigned short *__c) { 8863 __builtin_altivec_stvx((vector int)__a, __b, __c); 8864 } 8865 8866 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 8867 vector bool short *__c) { 8868 __builtin_altivec_stvx((vector int)__a, __b, __c); 8869 } 8870 8871 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 8872 short *__c) { 8873 __builtin_altivec_stvx((vector int)__a, __b, __c); 8874 } 8875 8876 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 8877 unsigned short *__c) { 8878 __builtin_altivec_stvx((vector int)__a, __b, __c); 8879 } 8880 8881 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 8882 vector pixel *__c) { 8883 __builtin_altivec_stvx((vector int)__a, __b, __c); 8884 } 8885 8886 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 8887 vector int *__c) { 8888 __builtin_altivec_stvx(__a, __b, __c); 8889 } 8890 8891 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 8892 int *__c) { 8893 __builtin_altivec_stvx(__a, __b, __c); 8894 } 8895 8896 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 8897 vector unsigned int *__c) { 8898 __builtin_altivec_stvx((vector int)__a, __b, __c); 8899 } 8900 8901 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 8902 unsigned int *__c) { 8903 __builtin_altivec_stvx((vector int)__a, __b, __c); 8904 } 8905 8906 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 8907 int *__c) { 8908 __builtin_altivec_stvx((vector int)__a, __b, __c); 8909 } 8910 8911 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 8912 unsigned int *__c) { 8913 __builtin_altivec_stvx((vector int)__a, __b, __c); 8914 } 8915 8916 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 8917 vector bool int *__c) { 8918 __builtin_altivec_stvx((vector int)__a, __b, __c); 8919 } 8920 8921 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 8922 vector float *__c) { 8923 __builtin_altivec_stvx((vector int)__a, __b, __c); 8924 } 8925 8926 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 8927 float *__c) { 8928 __builtin_altivec_stvx((vector int)__a, __b, __c); 8929 } 8930 8931 /* vec_ste */ 8932 8933 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b, 8934 signed char *__c) { 8935 __builtin_altivec_stvebx((vector char)__a, __b, __c); 8936 } 8937 8938 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b, 8939 unsigned char *__c) { 8940 __builtin_altivec_stvebx((vector char)__a, __b, __c); 8941 } 8942 8943 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b, 8944 signed char *__c) { 8945 __builtin_altivec_stvebx((vector char)__a, __b, __c); 8946 } 8947 8948 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b, 8949 unsigned char *__c) { 8950 __builtin_altivec_stvebx((vector char)__a, __b, __c); 8951 } 8952 8953 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b, 8954 short *__c) { 8955 __builtin_altivec_stvehx(__a, __b, __c); 8956 } 8957 8958 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b, 8959 unsigned short *__c) { 8960 __builtin_altivec_stvehx((vector short)__a, __b, __c); 8961 } 8962 8963 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 8964 short *__c) { 8965 __builtin_altivec_stvehx((vector short)__a, __b, __c); 8966 } 8967 8968 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 8969 unsigned short *__c) { 8970 __builtin_altivec_stvehx((vector short)__a, __b, __c); 8971 } 8972 8973 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, 8974 short *__c) { 8975 __builtin_altivec_stvehx((vector short)__a, __b, __c); 8976 } 8977 8978 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, 8979 unsigned short *__c) { 8980 __builtin_altivec_stvehx((vector short)__a, __b, __c); 8981 } 8982 8983 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) { 8984 __builtin_altivec_stvewx(__a, __b, __c); 8985 } 8986 8987 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b, 8988 unsigned int *__c) { 8989 __builtin_altivec_stvewx((vector int)__a, __b, __c); 8990 } 8991 8992 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 8993 int *__c) { 8994 __builtin_altivec_stvewx((vector int)__a, __b, __c); 8995 } 8996 8997 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 8998 unsigned int *__c) { 8999 __builtin_altivec_stvewx((vector int)__a, __b, __c); 9000 } 9001 9002 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b, 9003 float *__c) { 9004 __builtin_altivec_stvewx((vector int)__a, __b, __c); 9005 } 9006 9007 /* vec_stvebx */ 9008 9009 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b, 9010 signed char *__c) { 9011 __builtin_altivec_stvebx((vector char)__a, __b, __c); 9012 } 9013 9014 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 9015 int __b, unsigned char *__c) { 9016 __builtin_altivec_stvebx((vector char)__a, __b, __c); 9017 } 9018 9019 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b, 9020 signed char *__c) { 9021 __builtin_altivec_stvebx((vector char)__a, __b, __c); 9022 } 9023 9024 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b, 9025 unsigned char *__c) { 9026 __builtin_altivec_stvebx((vector char)__a, __b, __c); 9027 } 9028 9029 /* vec_stvehx */ 9030 9031 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, 9032 short *__c) { 9033 __builtin_altivec_stvehx(__a, __b, __c); 9034 } 9035 9036 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 9037 int __b, unsigned short *__c) { 9038 __builtin_altivec_stvehx((vector short)__a, __b, __c); 9039 } 9040 9041 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 9042 short *__c) { 9043 __builtin_altivec_stvehx((vector short)__a, __b, __c); 9044 } 9045 9046 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 9047 unsigned short *__c) { 9048 __builtin_altivec_stvehx((vector short)__a, __b, __c); 9049 } 9050 9051 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, 9052 short *__c) { 9053 __builtin_altivec_stvehx((vector short)__a, __b, __c); 9054 } 9055 9056 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, 9057 unsigned short *__c) { 9058 __builtin_altivec_stvehx((vector short)__a, __b, __c); 9059 } 9060 9061 /* vec_stvewx */ 9062 9063 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, 9064 int *__c) { 9065 __builtin_altivec_stvewx(__a, __b, __c); 9066 } 9067 9068 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b, 9069 unsigned int *__c) { 9070 __builtin_altivec_stvewx((vector int)__a, __b, __c); 9071 } 9072 9073 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 9074 int *__c) { 9075 __builtin_altivec_stvewx((vector int)__a, __b, __c); 9076 } 9077 9078 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 9079 unsigned int *__c) { 9080 __builtin_altivec_stvewx((vector int)__a, __b, __c); 9081 } 9082 9083 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, 9084 float *__c) { 9085 __builtin_altivec_stvewx((vector int)__a, __b, __c); 9086 } 9087 9088 /* vec_stl */ 9089 9090 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 9091 vector signed char *__c) { 9092 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9093 } 9094 9095 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 9096 signed char *__c) { 9097 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9098 } 9099 9100 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 9101 vector unsigned char *__c) { 9102 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9103 } 9104 9105 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 9106 unsigned char *__c) { 9107 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9108 } 9109 9110 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 9111 signed char *__c) { 9112 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9113 } 9114 9115 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 9116 unsigned char *__c) { 9117 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9118 } 9119 9120 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 9121 vector bool char *__c) { 9122 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9123 } 9124 9125 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 9126 vector short *__c) { 9127 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9128 } 9129 9130 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 9131 short *__c) { 9132 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9133 } 9134 9135 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 9136 vector unsigned short *__c) { 9137 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9138 } 9139 9140 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 9141 unsigned short *__c) { 9142 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9143 } 9144 9145 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 9146 short *__c) { 9147 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9148 } 9149 9150 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 9151 unsigned short *__c) { 9152 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9153 } 9154 9155 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 9156 vector bool short *__c) { 9157 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9158 } 9159 9160 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 9161 short *__c) { 9162 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9163 } 9164 9165 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 9166 unsigned short *__c) { 9167 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9168 } 9169 9170 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 9171 vector pixel *__c) { 9172 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9173 } 9174 9175 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 9176 vector int *__c) { 9177 __builtin_altivec_stvxl(__a, __b, __c); 9178 } 9179 9180 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 9181 __builtin_altivec_stvxl(__a, __b, __c); 9182 } 9183 9184 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 9185 vector unsigned int *__c) { 9186 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9187 } 9188 9189 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 9190 unsigned int *__c) { 9191 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9192 } 9193 9194 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 9195 int *__c) { 9196 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9197 } 9198 9199 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 9200 unsigned int *__c) { 9201 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9202 } 9203 9204 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 9205 vector bool int *__c) { 9206 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9207 } 9208 9209 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 9210 vector float *__c) { 9211 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9212 } 9213 9214 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 9215 float *__c) { 9216 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9217 } 9218 9219 /* vec_stvxl */ 9220 9221 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 9222 vector signed char *__c) { 9223 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9224 } 9225 9226 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 9227 signed char *__c) { 9228 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9229 } 9230 9231 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 9232 vector unsigned char *__c) { 9233 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9234 } 9235 9236 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 9237 unsigned char *__c) { 9238 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9239 } 9240 9241 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 9242 signed char *__c) { 9243 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9244 } 9245 9246 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 9247 unsigned char *__c) { 9248 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9249 } 9250 9251 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 9252 vector bool char *__c) { 9253 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9254 } 9255 9256 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 9257 vector short *__c) { 9258 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9259 } 9260 9261 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 9262 short *__c) { 9263 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9264 } 9265 9266 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 9267 int __b, 9268 vector unsigned short *__c) { 9269 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9270 } 9271 9272 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 9273 int __b, unsigned short *__c) { 9274 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9275 } 9276 9277 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 9278 short *__c) { 9279 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9280 } 9281 9282 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 9283 unsigned short *__c) { 9284 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9285 } 9286 9287 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 9288 vector bool short *__c) { 9289 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9290 } 9291 9292 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 9293 short *__c) { 9294 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9295 } 9296 9297 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 9298 unsigned short *__c) { 9299 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9300 } 9301 9302 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 9303 vector pixel *__c) { 9304 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9305 } 9306 9307 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 9308 vector int *__c) { 9309 __builtin_altivec_stvxl(__a, __b, __c); 9310 } 9311 9312 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 9313 int *__c) { 9314 __builtin_altivec_stvxl(__a, __b, __c); 9315 } 9316 9317 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 9318 vector unsigned int *__c) { 9319 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9320 } 9321 9322 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 9323 unsigned int *__c) { 9324 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9325 } 9326 9327 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 9328 int *__c) { 9329 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9330 } 9331 9332 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 9333 unsigned int *__c) { 9334 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9335 } 9336 9337 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 9338 vector bool int *__c) { 9339 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9340 } 9341 9342 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 9343 vector float *__c) { 9344 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9345 } 9346 9347 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 9348 float *__c) { 9349 __builtin_altivec_stvxl((vector int)__a, __b, __c); 9350 } 9351 9352 /* vec_sub */ 9353 9354 static __inline__ vector signed char __ATTRS_o_ai 9355 vec_sub(vector signed char __a, vector signed char __b) { 9356 return __a - __b; 9357 } 9358 9359 static __inline__ vector signed char __ATTRS_o_ai 9360 vec_sub(vector bool char __a, vector signed char __b) { 9361 return (vector signed char)__a - __b; 9362 } 9363 9364 static __inline__ vector signed char __ATTRS_o_ai 9365 vec_sub(vector signed char __a, vector bool char __b) { 9366 return __a - (vector signed char)__b; 9367 } 9368 9369 static __inline__ vector unsigned char __ATTRS_o_ai 9370 vec_sub(vector unsigned char __a, vector unsigned char __b) { 9371 return __a - __b; 9372 } 9373 9374 static __inline__ vector unsigned char __ATTRS_o_ai 9375 vec_sub(vector bool char __a, vector unsigned char __b) { 9376 return (vector unsigned char)__a - __b; 9377 } 9378 9379 static __inline__ vector unsigned char __ATTRS_o_ai 9380 vec_sub(vector unsigned char __a, vector bool char __b) { 9381 return __a - (vector unsigned char)__b; 9382 } 9383 9384 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 9385 vector short __b) { 9386 return __a - __b; 9387 } 9388 9389 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 9390 vector short __b) { 9391 return (vector short)__a - __b; 9392 } 9393 9394 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 9395 vector bool short __b) { 9396 return __a - (vector short)__b; 9397 } 9398 9399 static __inline__ vector unsigned short __ATTRS_o_ai 9400 vec_sub(vector unsigned short __a, vector unsigned short __b) { 9401 return __a - __b; 9402 } 9403 9404 static __inline__ vector unsigned short __ATTRS_o_ai 9405 vec_sub(vector bool short __a, vector unsigned short __b) { 9406 return (vector unsigned short)__a - __b; 9407 } 9408 9409 static __inline__ vector unsigned short __ATTRS_o_ai 9410 vec_sub(vector unsigned short __a, vector bool short __b) { 9411 return __a - (vector unsigned short)__b; 9412 } 9413 9414 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 9415 vector int __b) { 9416 return __a - __b; 9417 } 9418 9419 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 9420 vector int __b) { 9421 return (vector int)__a - __b; 9422 } 9423 9424 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 9425 vector bool int __b) { 9426 return __a - (vector int)__b; 9427 } 9428 9429 static __inline__ vector unsigned int __ATTRS_o_ai 9430 vec_sub(vector unsigned int __a, vector unsigned int __b) { 9431 return __a - __b; 9432 } 9433 9434 static __inline__ vector unsigned int __ATTRS_o_ai 9435 vec_sub(vector bool int __a, vector unsigned int __b) { 9436 return (vector unsigned int)__a - __b; 9437 } 9438 9439 static __inline__ vector unsigned int __ATTRS_o_ai 9440 vec_sub(vector unsigned int __a, vector bool int __b) { 9441 return __a - (vector unsigned int)__b; 9442 } 9443 9444 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 9445 static __inline__ vector signed __int128 __ATTRS_o_ai 9446 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 9447 return __a - __b; 9448 } 9449 9450 static __inline__ vector unsigned __int128 __ATTRS_o_ai 9451 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 9452 return __a - __b; 9453 } 9454 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 9455 9456 #ifdef __VSX__ 9457 static __inline__ vector signed long long __ATTRS_o_ai 9458 vec_sub(vector signed long long __a, vector signed long long __b) { 9459 return __a - __b; 9460 } 9461 9462 static __inline__ vector unsigned long long __ATTRS_o_ai 9463 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 9464 return __a - __b; 9465 } 9466 9467 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 9468 vector double __b) { 9469 return __a - __b; 9470 } 9471 #endif 9472 9473 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 9474 vector float __b) { 9475 return __a - __b; 9476 } 9477 9478 /* vec_vsububm */ 9479 9480 #define __builtin_altivec_vsububm vec_vsububm 9481 9482 static __inline__ vector signed char __ATTRS_o_ai 9483 vec_vsububm(vector signed char __a, vector signed char __b) { 9484 return __a - __b; 9485 } 9486 9487 static __inline__ vector signed char __ATTRS_o_ai 9488 vec_vsububm(vector bool char __a, vector signed char __b) { 9489 return (vector signed char)__a - __b; 9490 } 9491 9492 static __inline__ vector signed char __ATTRS_o_ai 9493 vec_vsububm(vector signed char __a, vector bool char __b) { 9494 return __a - (vector signed char)__b; 9495 } 9496 9497 static __inline__ vector unsigned char __ATTRS_o_ai 9498 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 9499 return __a - __b; 9500 } 9501 9502 static __inline__ vector unsigned char __ATTRS_o_ai 9503 vec_vsububm(vector bool char __a, vector unsigned char __b) { 9504 return (vector unsigned char)__a - __b; 9505 } 9506 9507 static __inline__ vector unsigned char __ATTRS_o_ai 9508 vec_vsububm(vector unsigned char __a, vector bool char __b) { 9509 return __a - (vector unsigned char)__b; 9510 } 9511 9512 /* vec_vsubuhm */ 9513 9514 #define __builtin_altivec_vsubuhm vec_vsubuhm 9515 9516 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 9517 vector short __b) { 9518 return __a - __b; 9519 } 9520 9521 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 9522 vector short __b) { 9523 return (vector short)__a - __b; 9524 } 9525 9526 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 9527 vector bool short __b) { 9528 return __a - (vector short)__b; 9529 } 9530 9531 static __inline__ vector unsigned short __ATTRS_o_ai 9532 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 9533 return __a - __b; 9534 } 9535 9536 static __inline__ vector unsigned short __ATTRS_o_ai 9537 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 9538 return (vector unsigned short)__a - __b; 9539 } 9540 9541 static __inline__ vector unsigned short __ATTRS_o_ai 9542 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 9543 return __a - (vector unsigned short)__b; 9544 } 9545 9546 /* vec_vsubuwm */ 9547 9548 #define __builtin_altivec_vsubuwm vec_vsubuwm 9549 9550 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 9551 vector int __b) { 9552 return __a - __b; 9553 } 9554 9555 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 9556 vector int __b) { 9557 return (vector int)__a - __b; 9558 } 9559 9560 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 9561 vector bool int __b) { 9562 return __a - (vector int)__b; 9563 } 9564 9565 static __inline__ vector unsigned int __ATTRS_o_ai 9566 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 9567 return __a - __b; 9568 } 9569 9570 static __inline__ vector unsigned int __ATTRS_o_ai 9571 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 9572 return (vector unsigned int)__a - __b; 9573 } 9574 9575 static __inline__ vector unsigned int __ATTRS_o_ai 9576 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 9577 return __a - (vector unsigned int)__b; 9578 } 9579 9580 /* vec_vsubfp */ 9581 9582 #define __builtin_altivec_vsubfp vec_vsubfp 9583 9584 static __inline__ vector float __attribute__((__always_inline__)) 9585 vec_vsubfp(vector float __a, vector float __b) { 9586 return __a - __b; 9587 } 9588 9589 /* vec_subc */ 9590 9591 static __inline__ vector unsigned int __ATTRS_o_ai 9592 vec_subc(vector unsigned int __a, vector unsigned int __b) { 9593 return __builtin_altivec_vsubcuw(__a, __b); 9594 } 9595 9596 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 9597 static __inline__ vector unsigned __int128 __ATTRS_o_ai 9598 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 9599 return __builtin_altivec_vsubcuq(__a, __b); 9600 } 9601 9602 static __inline__ vector signed __int128 __ATTRS_o_ai 9603 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 9604 return __builtin_altivec_vsubcuq(__a, __b); 9605 } 9606 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 9607 9608 /* vec_vsubcuw */ 9609 9610 static __inline__ vector unsigned int __attribute__((__always_inline__)) 9611 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 9612 return __builtin_altivec_vsubcuw(__a, __b); 9613 } 9614 9615 /* vec_subs */ 9616 9617 static __inline__ vector signed char __ATTRS_o_ai 9618 vec_subs(vector signed char __a, vector signed char __b) { 9619 return __builtin_altivec_vsubsbs(__a, __b); 9620 } 9621 9622 static __inline__ vector signed char __ATTRS_o_ai 9623 vec_subs(vector bool char __a, vector signed char __b) { 9624 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 9625 } 9626 9627 static __inline__ vector signed char __ATTRS_o_ai 9628 vec_subs(vector signed char __a, vector bool char __b) { 9629 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 9630 } 9631 9632 static __inline__ vector unsigned char __ATTRS_o_ai 9633 vec_subs(vector unsigned char __a, vector unsigned char __b) { 9634 return __builtin_altivec_vsububs(__a, __b); 9635 } 9636 9637 static __inline__ vector unsigned char __ATTRS_o_ai 9638 vec_subs(vector bool char __a, vector unsigned char __b) { 9639 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 9640 } 9641 9642 static __inline__ vector unsigned char __ATTRS_o_ai 9643 vec_subs(vector unsigned char __a, vector bool char __b) { 9644 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 9645 } 9646 9647 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 9648 vector short __b) { 9649 return __builtin_altivec_vsubshs(__a, __b); 9650 } 9651 9652 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 9653 vector short __b) { 9654 return __builtin_altivec_vsubshs((vector short)__a, __b); 9655 } 9656 9657 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 9658 vector bool short __b) { 9659 return __builtin_altivec_vsubshs(__a, (vector short)__b); 9660 } 9661 9662 static __inline__ vector unsigned short __ATTRS_o_ai 9663 vec_subs(vector unsigned short __a, vector unsigned short __b) { 9664 return __builtin_altivec_vsubuhs(__a, __b); 9665 } 9666 9667 static __inline__ vector unsigned short __ATTRS_o_ai 9668 vec_subs(vector bool short __a, vector unsigned short __b) { 9669 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 9670 } 9671 9672 static __inline__ vector unsigned short __ATTRS_o_ai 9673 vec_subs(vector unsigned short __a, vector bool short __b) { 9674 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 9675 } 9676 9677 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 9678 vector int __b) { 9679 return __builtin_altivec_vsubsws(__a, __b); 9680 } 9681 9682 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 9683 vector int __b) { 9684 return __builtin_altivec_vsubsws((vector int)__a, __b); 9685 } 9686 9687 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 9688 vector bool int __b) { 9689 return __builtin_altivec_vsubsws(__a, (vector int)__b); 9690 } 9691 9692 static __inline__ vector unsigned int __ATTRS_o_ai 9693 vec_subs(vector unsigned int __a, vector unsigned int __b) { 9694 return __builtin_altivec_vsubuws(__a, __b); 9695 } 9696 9697 static __inline__ vector unsigned int __ATTRS_o_ai 9698 vec_subs(vector bool int __a, vector unsigned int __b) { 9699 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 9700 } 9701 9702 static __inline__ vector unsigned int __ATTRS_o_ai 9703 vec_subs(vector unsigned int __a, vector bool int __b) { 9704 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 9705 } 9706 9707 /* vec_vsubsbs */ 9708 9709 static __inline__ vector signed char __ATTRS_o_ai 9710 vec_vsubsbs(vector signed char __a, vector signed char __b) { 9711 return __builtin_altivec_vsubsbs(__a, __b); 9712 } 9713 9714 static __inline__ vector signed char __ATTRS_o_ai 9715 vec_vsubsbs(vector bool char __a, vector signed char __b) { 9716 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 9717 } 9718 9719 static __inline__ vector signed char __ATTRS_o_ai 9720 vec_vsubsbs(vector signed char __a, vector bool char __b) { 9721 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 9722 } 9723 9724 /* vec_vsububs */ 9725 9726 static __inline__ vector unsigned char __ATTRS_o_ai 9727 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 9728 return __builtin_altivec_vsububs(__a, __b); 9729 } 9730 9731 static __inline__ vector unsigned char __ATTRS_o_ai 9732 vec_vsububs(vector bool char __a, vector unsigned char __b) { 9733 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 9734 } 9735 9736 static __inline__ vector unsigned char __ATTRS_o_ai 9737 vec_vsububs(vector unsigned char __a, vector bool char __b) { 9738 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 9739 } 9740 9741 /* vec_vsubshs */ 9742 9743 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 9744 vector short __b) { 9745 return __builtin_altivec_vsubshs(__a, __b); 9746 } 9747 9748 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 9749 vector short __b) { 9750 return __builtin_altivec_vsubshs((vector short)__a, __b); 9751 } 9752 9753 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 9754 vector bool short __b) { 9755 return __builtin_altivec_vsubshs(__a, (vector short)__b); 9756 } 9757 9758 /* vec_vsubuhs */ 9759 9760 static __inline__ vector unsigned short __ATTRS_o_ai 9761 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 9762 return __builtin_altivec_vsubuhs(__a, __b); 9763 } 9764 9765 static __inline__ vector unsigned short __ATTRS_o_ai 9766 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 9767 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 9768 } 9769 9770 static __inline__ vector unsigned short __ATTRS_o_ai 9771 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 9772 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 9773 } 9774 9775 /* vec_vsubsws */ 9776 9777 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 9778 vector int __b) { 9779 return __builtin_altivec_vsubsws(__a, __b); 9780 } 9781 9782 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 9783 vector int __b) { 9784 return __builtin_altivec_vsubsws((vector int)__a, __b); 9785 } 9786 9787 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 9788 vector bool int __b) { 9789 return __builtin_altivec_vsubsws(__a, (vector int)__b); 9790 } 9791 9792 /* vec_vsubuws */ 9793 9794 static __inline__ vector unsigned int __ATTRS_o_ai 9795 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 9796 return __builtin_altivec_vsubuws(__a, __b); 9797 } 9798 9799 static __inline__ vector unsigned int __ATTRS_o_ai 9800 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 9801 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 9802 } 9803 9804 static __inline__ vector unsigned int __ATTRS_o_ai 9805 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 9806 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 9807 } 9808 9809 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 9810 /* vec_vsubuqm */ 9811 9812 static __inline__ vector signed __int128 __ATTRS_o_ai 9813 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 9814 return __a - __b; 9815 } 9816 9817 static __inline__ vector unsigned __int128 __ATTRS_o_ai 9818 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 9819 return __a - __b; 9820 } 9821 9822 /* vec_vsubeuqm */ 9823 9824 static __inline__ vector signed __int128 __ATTRS_o_ai 9825 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 9826 vector signed __int128 __c) { 9827 return __builtin_altivec_vsubeuqm(__a, __b, __c); 9828 } 9829 9830 static __inline__ vector unsigned __int128 __ATTRS_o_ai 9831 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 9832 vector unsigned __int128 __c) { 9833 return __builtin_altivec_vsubeuqm(__a, __b, __c); 9834 } 9835 9836 /* vec_vsubcuq */ 9837 9838 static __inline__ vector signed __int128 __ATTRS_o_ai 9839 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 9840 return __builtin_altivec_vsubcuq(__a, __b); 9841 } 9842 9843 static __inline__ vector unsigned __int128 __ATTRS_o_ai 9844 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 9845 return __builtin_altivec_vsubcuq(__a, __b); 9846 } 9847 9848 /* vec_vsubecuq */ 9849 9850 static __inline__ vector signed __int128 __ATTRS_o_ai 9851 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 9852 vector signed __int128 __c) { 9853 return __builtin_altivec_vsubecuq(__a, __b, __c); 9854 } 9855 9856 static __inline__ vector unsigned __int128 __ATTRS_o_ai 9857 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 9858 vector unsigned __int128 __c) { 9859 return __builtin_altivec_vsubecuq(__a, __b, __c); 9860 } 9861 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 9862 9863 /* vec_sum4s */ 9864 9865 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 9866 vector int __b) { 9867 return __builtin_altivec_vsum4sbs(__a, __b); 9868 } 9869 9870 static __inline__ vector unsigned int __ATTRS_o_ai 9871 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 9872 return __builtin_altivec_vsum4ubs(__a, __b); 9873 } 9874 9875 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 9876 vector int __b) { 9877 return __builtin_altivec_vsum4shs(__a, __b); 9878 } 9879 9880 /* vec_vsum4sbs */ 9881 9882 static __inline__ vector int __attribute__((__always_inline__)) 9883 vec_vsum4sbs(vector signed char __a, vector int __b) { 9884 return __builtin_altivec_vsum4sbs(__a, __b); 9885 } 9886 9887 /* vec_vsum4ubs */ 9888 9889 static __inline__ vector unsigned int __attribute__((__always_inline__)) 9890 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 9891 return __builtin_altivec_vsum4ubs(__a, __b); 9892 } 9893 9894 /* vec_vsum4shs */ 9895 9896 static __inline__ vector int __attribute__((__always_inline__)) 9897 vec_vsum4shs(vector signed short __a, vector int __b) { 9898 return __builtin_altivec_vsum4shs(__a, __b); 9899 } 9900 9901 /* vec_sum2s */ 9902 9903 /* The vsum2sws instruction has a big-endian bias, so that the second 9904 input vector and the result always reference big-endian elements 9905 1 and 3 (little-endian element 0 and 2). For ease of porting the 9906 programmer wants elements 1 and 3 in both cases, so for little 9907 endian we must perform some permutes. */ 9908 9909 static __inline__ vector signed int __attribute__((__always_inline__)) 9910 vec_sum2s(vector int __a, vector int __b) { 9911 #ifdef __LITTLE_ENDIAN__ 9912 vector int __c = (vector signed int)vec_perm( 9913 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 9914 8, 9, 10, 11)); 9915 __c = __builtin_altivec_vsum2sws(__a, __c); 9916 return (vector signed int)vec_perm( 9917 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 9918 8, 9, 10, 11)); 9919 #else 9920 return __builtin_altivec_vsum2sws(__a, __b); 9921 #endif 9922 } 9923 9924 /* vec_vsum2sws */ 9925 9926 static __inline__ vector signed int __attribute__((__always_inline__)) 9927 vec_vsum2sws(vector int __a, vector int __b) { 9928 #ifdef __LITTLE_ENDIAN__ 9929 vector int __c = (vector signed int)vec_perm( 9930 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 9931 8, 9, 10, 11)); 9932 __c = __builtin_altivec_vsum2sws(__a, __c); 9933 return (vector signed int)vec_perm( 9934 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 9935 8, 9, 10, 11)); 9936 #else 9937 return __builtin_altivec_vsum2sws(__a, __b); 9938 #endif 9939 } 9940 9941 /* vec_sums */ 9942 9943 /* The vsumsws instruction has a big-endian bias, so that the second 9944 input vector and the result always reference big-endian element 3 9945 (little-endian element 0). For ease of porting the programmer 9946 wants element 3 in both cases, so for little endian we must perform 9947 some permutes. */ 9948 9949 static __inline__ vector signed int __attribute__((__always_inline__)) 9950 vec_sums(vector signed int __a, vector signed int __b) { 9951 #ifdef __LITTLE_ENDIAN__ 9952 __b = (vector signed int)vec_splat(__b, 3); 9953 __b = __builtin_altivec_vsumsws(__a, __b); 9954 return (vector signed int)(0, 0, 0, __b[0]); 9955 #else 9956 return __builtin_altivec_vsumsws(__a, __b); 9957 #endif 9958 } 9959 9960 /* vec_vsumsws */ 9961 9962 static __inline__ vector signed int __attribute__((__always_inline__)) 9963 vec_vsumsws(vector signed int __a, vector signed int __b) { 9964 #ifdef __LITTLE_ENDIAN__ 9965 __b = (vector signed int)vec_splat(__b, 3); 9966 __b = __builtin_altivec_vsumsws(__a, __b); 9967 return (vector signed int)(0, 0, 0, __b[0]); 9968 #else 9969 return __builtin_altivec_vsumsws(__a, __b); 9970 #endif 9971 } 9972 9973 /* vec_trunc */ 9974 9975 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 9976 #ifdef __VSX__ 9977 return __builtin_vsx_xvrspiz(__a); 9978 #else 9979 return __builtin_altivec_vrfiz(__a); 9980 #endif 9981 } 9982 9983 #ifdef __VSX__ 9984 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 9985 return __builtin_vsx_xvrdpiz(__a); 9986 } 9987 #endif 9988 9989 /* vec_vrfiz */ 9990 9991 static __inline__ vector float __attribute__((__always_inline__)) 9992 vec_vrfiz(vector float __a) { 9993 return __builtin_altivec_vrfiz(__a); 9994 } 9995 9996 /* vec_unpackh */ 9997 9998 /* The vector unpack instructions all have a big-endian bias, so for 9999 little endian we must reverse the meanings of "high" and "low." */ 10000 10001 static __inline__ vector short __ATTRS_o_ai 10002 vec_unpackh(vector signed char __a) { 10003 #ifdef __LITTLE_ENDIAN__ 10004 return __builtin_altivec_vupklsb((vector char)__a); 10005 #else 10006 return __builtin_altivec_vupkhsb((vector char)__a); 10007 #endif 10008 } 10009 10010 static __inline__ vector bool short __ATTRS_o_ai 10011 vec_unpackh(vector bool char __a) { 10012 #ifdef __LITTLE_ENDIAN__ 10013 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 10014 #else 10015 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 10016 #endif 10017 } 10018 10019 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 10020 #ifdef __LITTLE_ENDIAN__ 10021 return __builtin_altivec_vupklsh(__a); 10022 #else 10023 return __builtin_altivec_vupkhsh(__a); 10024 #endif 10025 } 10026 10027 static __inline__ vector bool int __ATTRS_o_ai 10028 vec_unpackh(vector bool short __a) { 10029 #ifdef __LITTLE_ENDIAN__ 10030 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 10031 #else 10032 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 10033 #endif 10034 } 10035 10036 static __inline__ vector unsigned int __ATTRS_o_ai 10037 vec_unpackh(vector pixel __a) { 10038 #ifdef __LITTLE_ENDIAN__ 10039 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 10040 #else 10041 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 10042 #endif 10043 } 10044 10045 #ifdef __POWER8_VECTOR__ 10046 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 10047 #ifdef __LITTLE_ENDIAN__ 10048 return __builtin_altivec_vupklsw(__a); 10049 #else 10050 return __builtin_altivec_vupkhsw(__a); 10051 #endif 10052 } 10053 10054 static __inline__ vector bool long long __ATTRS_o_ai 10055 vec_unpackh(vector bool int __a) { 10056 #ifdef __LITTLE_ENDIAN__ 10057 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 10058 #else 10059 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 10060 #endif 10061 } 10062 #endif 10063 10064 /* vec_vupkhsb */ 10065 10066 static __inline__ vector short __ATTRS_o_ai 10067 vec_vupkhsb(vector signed char __a) { 10068 #ifdef __LITTLE_ENDIAN__ 10069 return __builtin_altivec_vupklsb((vector char)__a); 10070 #else 10071 return __builtin_altivec_vupkhsb((vector char)__a); 10072 #endif 10073 } 10074 10075 static __inline__ vector bool short __ATTRS_o_ai 10076 vec_vupkhsb(vector bool char __a) { 10077 #ifdef __LITTLE_ENDIAN__ 10078 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 10079 #else 10080 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 10081 #endif 10082 } 10083 10084 /* vec_vupkhsh */ 10085 10086 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 10087 #ifdef __LITTLE_ENDIAN__ 10088 return __builtin_altivec_vupklsh(__a); 10089 #else 10090 return __builtin_altivec_vupkhsh(__a); 10091 #endif 10092 } 10093 10094 static __inline__ vector bool int __ATTRS_o_ai 10095 vec_vupkhsh(vector bool short __a) { 10096 #ifdef __LITTLE_ENDIAN__ 10097 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 10098 #else 10099 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 10100 #endif 10101 } 10102 10103 static __inline__ vector unsigned int __ATTRS_o_ai 10104 vec_vupkhsh(vector pixel __a) { 10105 #ifdef __LITTLE_ENDIAN__ 10106 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 10107 #else 10108 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 10109 #endif 10110 } 10111 10112 /* vec_vupkhsw */ 10113 10114 #ifdef __POWER8_VECTOR__ 10115 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 10116 #ifdef __LITTLE_ENDIAN__ 10117 return __builtin_altivec_vupklsw(__a); 10118 #else 10119 return __builtin_altivec_vupkhsw(__a); 10120 #endif 10121 } 10122 10123 static __inline__ vector bool long long __ATTRS_o_ai 10124 vec_vupkhsw(vector bool int __a) { 10125 #ifdef __LITTLE_ENDIAN__ 10126 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 10127 #else 10128 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 10129 #endif 10130 } 10131 #endif 10132 10133 /* vec_unpackl */ 10134 10135 static __inline__ vector short __ATTRS_o_ai 10136 vec_unpackl(vector signed char __a) { 10137 #ifdef __LITTLE_ENDIAN__ 10138 return __builtin_altivec_vupkhsb((vector char)__a); 10139 #else 10140 return __builtin_altivec_vupklsb((vector char)__a); 10141 #endif 10142 } 10143 10144 static __inline__ vector bool short __ATTRS_o_ai 10145 vec_unpackl(vector bool char __a) { 10146 #ifdef __LITTLE_ENDIAN__ 10147 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 10148 #else 10149 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 10150 #endif 10151 } 10152 10153 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 10154 #ifdef __LITTLE_ENDIAN__ 10155 return __builtin_altivec_vupkhsh(__a); 10156 #else 10157 return __builtin_altivec_vupklsh(__a); 10158 #endif 10159 } 10160 10161 static __inline__ vector bool int __ATTRS_o_ai 10162 vec_unpackl(vector bool short __a) { 10163 #ifdef __LITTLE_ENDIAN__ 10164 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 10165 #else 10166 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 10167 #endif 10168 } 10169 10170 static __inline__ vector unsigned int __ATTRS_o_ai 10171 vec_unpackl(vector pixel __a) { 10172 #ifdef __LITTLE_ENDIAN__ 10173 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 10174 #else 10175 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 10176 #endif 10177 } 10178 10179 #ifdef __POWER8_VECTOR__ 10180 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 10181 #ifdef __LITTLE_ENDIAN__ 10182 return __builtin_altivec_vupkhsw(__a); 10183 #else 10184 return __builtin_altivec_vupklsw(__a); 10185 #endif 10186 } 10187 10188 static __inline__ vector bool long long __ATTRS_o_ai 10189 vec_unpackl(vector bool int __a) { 10190 #ifdef __LITTLE_ENDIAN__ 10191 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 10192 #else 10193 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 10194 #endif 10195 } 10196 #endif 10197 10198 /* vec_vupklsb */ 10199 10200 static __inline__ vector short __ATTRS_o_ai 10201 vec_vupklsb(vector signed char __a) { 10202 #ifdef __LITTLE_ENDIAN__ 10203 return __builtin_altivec_vupkhsb((vector char)__a); 10204 #else 10205 return __builtin_altivec_vupklsb((vector char)__a); 10206 #endif 10207 } 10208 10209 static __inline__ vector bool short __ATTRS_o_ai 10210 vec_vupklsb(vector bool char __a) { 10211 #ifdef __LITTLE_ENDIAN__ 10212 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 10213 #else 10214 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 10215 #endif 10216 } 10217 10218 /* vec_vupklsh */ 10219 10220 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 10221 #ifdef __LITTLE_ENDIAN__ 10222 return __builtin_altivec_vupkhsh(__a); 10223 #else 10224 return __builtin_altivec_vupklsh(__a); 10225 #endif 10226 } 10227 10228 static __inline__ vector bool int __ATTRS_o_ai 10229 vec_vupklsh(vector bool short __a) { 10230 #ifdef __LITTLE_ENDIAN__ 10231 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 10232 #else 10233 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 10234 #endif 10235 } 10236 10237 static __inline__ vector unsigned int __ATTRS_o_ai 10238 vec_vupklsh(vector pixel __a) { 10239 #ifdef __LITTLE_ENDIAN__ 10240 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 10241 #else 10242 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 10243 #endif 10244 } 10245 10246 /* vec_vupklsw */ 10247 10248 #ifdef __POWER8_VECTOR__ 10249 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 10250 #ifdef __LITTLE_ENDIAN__ 10251 return __builtin_altivec_vupkhsw(__a); 10252 #else 10253 return __builtin_altivec_vupklsw(__a); 10254 #endif 10255 } 10256 10257 static __inline__ vector bool long long __ATTRS_o_ai 10258 vec_vupklsw(vector bool int __a) { 10259 #ifdef __LITTLE_ENDIAN__ 10260 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 10261 #else 10262 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 10263 #endif 10264 } 10265 #endif 10266 10267 /* vec_vsx_ld */ 10268 10269 #ifdef __VSX__ 10270 10271 static __inline__ vector bool int __ATTRS_o_ai 10272 vec_vsx_ld(int __a, const vector bool int *__b) { 10273 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 10274 } 10275 10276 static __inline__ vector signed int __ATTRS_o_ai 10277 vec_vsx_ld(int __a, const vector signed int *__b) { 10278 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 10279 } 10280 10281 static __inline__ vector signed int __ATTRS_o_ai 10282 vec_vsx_ld(int __a, const signed int *__b) { 10283 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 10284 } 10285 10286 static __inline__ vector unsigned int __ATTRS_o_ai 10287 vec_vsx_ld(int __a, const vector unsigned int *__b) { 10288 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 10289 } 10290 10291 static __inline__ vector unsigned int __ATTRS_o_ai 10292 vec_vsx_ld(int __a, const unsigned int *__b) { 10293 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 10294 } 10295 10296 static __inline__ vector float __ATTRS_o_ai 10297 vec_vsx_ld(int __a, const vector float *__b) { 10298 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 10299 } 10300 10301 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 10302 const float *__b) { 10303 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 10304 } 10305 10306 static __inline__ vector signed long long __ATTRS_o_ai 10307 vec_vsx_ld(int __a, const vector signed long long *__b) { 10308 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 10309 } 10310 10311 static __inline__ vector unsigned long long __ATTRS_o_ai 10312 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 10313 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 10314 } 10315 10316 static __inline__ vector double __ATTRS_o_ai 10317 vec_vsx_ld(int __a, const vector double *__b) { 10318 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 10319 } 10320 10321 static __inline__ vector double __ATTRS_o_ai 10322 vec_vsx_ld(int __a, const double *__b) { 10323 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 10324 } 10325 10326 static __inline__ vector bool short __ATTRS_o_ai 10327 vec_vsx_ld(int __a, const vector bool short *__b) { 10328 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 10329 } 10330 10331 static __inline__ vector signed short __ATTRS_o_ai 10332 vec_vsx_ld(int __a, const vector signed short *__b) { 10333 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 10334 } 10335 10336 static __inline__ vector signed short __ATTRS_o_ai 10337 vec_vsx_ld(int __a, const signed short *__b) { 10338 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 10339 } 10340 10341 static __inline__ vector unsigned short __ATTRS_o_ai 10342 vec_vsx_ld(int __a, const vector unsigned short *__b) { 10343 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 10344 } 10345 10346 static __inline__ vector unsigned short __ATTRS_o_ai 10347 vec_vsx_ld(int __a, const unsigned short *__b) { 10348 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 10349 } 10350 10351 static __inline__ vector bool char __ATTRS_o_ai 10352 vec_vsx_ld(int __a, const vector bool char *__b) { 10353 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 10354 } 10355 10356 static __inline__ vector signed char __ATTRS_o_ai 10357 vec_vsx_ld(int __a, const vector signed char *__b) { 10358 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 10359 } 10360 10361 static __inline__ vector signed char __ATTRS_o_ai 10362 vec_vsx_ld(int __a, const signed char *__b) { 10363 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 10364 } 10365 10366 static __inline__ vector unsigned char __ATTRS_o_ai 10367 vec_vsx_ld(int __a, const vector unsigned char *__b) { 10368 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 10369 } 10370 10371 static __inline__ vector unsigned char __ATTRS_o_ai 10372 vec_vsx_ld(int __a, const unsigned char *__b) { 10373 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 10374 } 10375 10376 #endif 10377 10378 /* vec_vsx_st */ 10379 10380 #ifdef __VSX__ 10381 10382 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 10383 vector bool int *__c) { 10384 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10385 } 10386 10387 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 10388 signed int *__c) { 10389 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10390 } 10391 10392 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 10393 unsigned int *__c) { 10394 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10395 } 10396 10397 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 10398 vector signed int *__c) { 10399 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10400 } 10401 10402 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 10403 signed int *__c) { 10404 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10405 } 10406 10407 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 10408 vector unsigned int *__c) { 10409 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10410 } 10411 10412 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 10413 unsigned int *__c) { 10414 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10415 } 10416 10417 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 10418 vector float *__c) { 10419 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10420 } 10421 10422 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 10423 float *__c) { 10424 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10425 } 10426 10427 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 10428 int __b, 10429 vector signed long long *__c) { 10430 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 10431 } 10432 10433 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 10434 int __b, 10435 vector unsigned long long *__c) { 10436 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 10437 } 10438 10439 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 10440 vector double *__c) { 10441 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 10442 } 10443 10444 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 10445 double *__c) { 10446 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 10447 } 10448 10449 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 10450 vector bool short *__c) { 10451 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10452 } 10453 10454 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 10455 signed short *__c) { 10456 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10457 } 10458 10459 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 10460 unsigned short *__c) { 10461 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10462 } 10463 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 10464 vector signed short *__c) { 10465 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10466 } 10467 10468 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 10469 signed short *__c) { 10470 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10471 } 10472 10473 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 10474 int __b, 10475 vector unsigned short *__c) { 10476 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10477 } 10478 10479 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 10480 int __b, unsigned short *__c) { 10481 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10482 } 10483 10484 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 10485 vector bool char *__c) { 10486 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10487 } 10488 10489 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 10490 signed char *__c) { 10491 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10492 } 10493 10494 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 10495 unsigned char *__c) { 10496 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10497 } 10498 10499 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 10500 vector signed char *__c) { 10501 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10502 } 10503 10504 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 10505 signed char *__c) { 10506 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10507 } 10508 10509 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 10510 int __b, 10511 vector unsigned char *__c) { 10512 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10513 } 10514 10515 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 10516 int __b, unsigned char *__c) { 10517 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 10518 } 10519 10520 #endif 10521 10522 /* vec_xor */ 10523 10524 #define __builtin_altivec_vxor vec_xor 10525 10526 static __inline__ vector signed char __ATTRS_o_ai 10527 vec_xor(vector signed char __a, vector signed char __b) { 10528 return __a ^ __b; 10529 } 10530 10531 static __inline__ vector signed char __ATTRS_o_ai 10532 vec_xor(vector bool char __a, vector signed char __b) { 10533 return (vector signed char)__a ^ __b; 10534 } 10535 10536 static __inline__ vector signed char __ATTRS_o_ai 10537 vec_xor(vector signed char __a, vector bool char __b) { 10538 return __a ^ (vector signed char)__b; 10539 } 10540 10541 static __inline__ vector unsigned char __ATTRS_o_ai 10542 vec_xor(vector unsigned char __a, vector unsigned char __b) { 10543 return __a ^ __b; 10544 } 10545 10546 static __inline__ vector unsigned char __ATTRS_o_ai 10547 vec_xor(vector bool char __a, vector unsigned char __b) { 10548 return (vector unsigned char)__a ^ __b; 10549 } 10550 10551 static __inline__ vector unsigned char __ATTRS_o_ai 10552 vec_xor(vector unsigned char __a, vector bool char __b) { 10553 return __a ^ (vector unsigned char)__b; 10554 } 10555 10556 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 10557 vector bool char __b) { 10558 return __a ^ __b; 10559 } 10560 10561 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 10562 vector short __b) { 10563 return __a ^ __b; 10564 } 10565 10566 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 10567 vector short __b) { 10568 return (vector short)__a ^ __b; 10569 } 10570 10571 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 10572 vector bool short __b) { 10573 return __a ^ (vector short)__b; 10574 } 10575 10576 static __inline__ vector unsigned short __ATTRS_o_ai 10577 vec_xor(vector unsigned short __a, vector unsigned short __b) { 10578 return __a ^ __b; 10579 } 10580 10581 static __inline__ vector unsigned short __ATTRS_o_ai 10582 vec_xor(vector bool short __a, vector unsigned short __b) { 10583 return (vector unsigned short)__a ^ __b; 10584 } 10585 10586 static __inline__ vector unsigned short __ATTRS_o_ai 10587 vec_xor(vector unsigned short __a, vector bool short __b) { 10588 return __a ^ (vector unsigned short)__b; 10589 } 10590 10591 static __inline__ vector bool short __ATTRS_o_ai 10592 vec_xor(vector bool short __a, vector bool short __b) { 10593 return __a ^ __b; 10594 } 10595 10596 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 10597 vector int __b) { 10598 return __a ^ __b; 10599 } 10600 10601 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 10602 vector int __b) { 10603 return (vector int)__a ^ __b; 10604 } 10605 10606 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 10607 vector bool int __b) { 10608 return __a ^ (vector int)__b; 10609 } 10610 10611 static __inline__ vector unsigned int __ATTRS_o_ai 10612 vec_xor(vector unsigned int __a, vector unsigned int __b) { 10613 return __a ^ __b; 10614 } 10615 10616 static __inline__ vector unsigned int __ATTRS_o_ai 10617 vec_xor(vector bool int __a, vector unsigned int __b) { 10618 return (vector unsigned int)__a ^ __b; 10619 } 10620 10621 static __inline__ vector unsigned int __ATTRS_o_ai 10622 vec_xor(vector unsigned int __a, vector bool int __b) { 10623 return __a ^ (vector unsigned int)__b; 10624 } 10625 10626 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 10627 vector bool int __b) { 10628 return __a ^ __b; 10629 } 10630 10631 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 10632 vector float __b) { 10633 vector unsigned int __res = 10634 (vector unsigned int)__a ^ (vector unsigned int)__b; 10635 return (vector float)__res; 10636 } 10637 10638 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 10639 vector float __b) { 10640 vector unsigned int __res = 10641 (vector unsigned int)__a ^ (vector unsigned int)__b; 10642 return (vector float)__res; 10643 } 10644 10645 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 10646 vector bool int __b) { 10647 vector unsigned int __res = 10648 (vector unsigned int)__a ^ (vector unsigned int)__b; 10649 return (vector float)__res; 10650 } 10651 10652 #ifdef __VSX__ 10653 static __inline__ vector signed long long __ATTRS_o_ai 10654 vec_xor(vector signed long long __a, vector signed long long __b) { 10655 return __a ^ __b; 10656 } 10657 10658 static __inline__ vector signed long long __ATTRS_o_ai 10659 vec_xor(vector bool long long __a, vector signed long long __b) { 10660 return (vector signed long long)__a ^ __b; 10661 } 10662 10663 static __inline__ vector signed long long __ATTRS_o_ai 10664 vec_xor(vector signed long long __a, vector bool long long __b) { 10665 return __a ^ (vector signed long long)__b; 10666 } 10667 10668 static __inline__ vector unsigned long long __ATTRS_o_ai 10669 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 10670 return __a ^ __b; 10671 } 10672 10673 static __inline__ vector unsigned long long __ATTRS_o_ai 10674 vec_xor(vector bool long long __a, vector unsigned long long __b) { 10675 return (vector unsigned long long)__a ^ __b; 10676 } 10677 10678 static __inline__ vector unsigned long long __ATTRS_o_ai 10679 vec_xor(vector unsigned long long __a, vector bool long long __b) { 10680 return __a ^ (vector unsigned long long)__b; 10681 } 10682 10683 static __inline__ vector bool long long __ATTRS_o_ai 10684 vec_xor(vector bool long long __a, vector bool long long __b) { 10685 return __a ^ __b; 10686 } 10687 10688 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 10689 vector double __b) { 10690 return (vector double)((vector unsigned long long)__a ^ 10691 (vector unsigned long long)__b); 10692 } 10693 10694 static __inline__ vector double __ATTRS_o_ai 10695 vec_xor(vector double __a, vector bool long long __b) { 10696 return (vector double)((vector unsigned long long)__a ^ 10697 (vector unsigned long long)__b); 10698 } 10699 10700 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 10701 vector double __b) { 10702 return (vector double)((vector unsigned long long)__a ^ 10703 (vector unsigned long long)__b); 10704 } 10705 #endif 10706 10707 /* vec_vxor */ 10708 10709 static __inline__ vector signed char __ATTRS_o_ai 10710 vec_vxor(vector signed char __a, vector signed char __b) { 10711 return __a ^ __b; 10712 } 10713 10714 static __inline__ vector signed char __ATTRS_o_ai 10715 vec_vxor(vector bool char __a, vector signed char __b) { 10716 return (vector signed char)__a ^ __b; 10717 } 10718 10719 static __inline__ vector signed char __ATTRS_o_ai 10720 vec_vxor(vector signed char __a, vector bool char __b) { 10721 return __a ^ (vector signed char)__b; 10722 } 10723 10724 static __inline__ vector unsigned char __ATTRS_o_ai 10725 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 10726 return __a ^ __b; 10727 } 10728 10729 static __inline__ vector unsigned char __ATTRS_o_ai 10730 vec_vxor(vector bool char __a, vector unsigned char __b) { 10731 return (vector unsigned char)__a ^ __b; 10732 } 10733 10734 static __inline__ vector unsigned char __ATTRS_o_ai 10735 vec_vxor(vector unsigned char __a, vector bool char __b) { 10736 return __a ^ (vector unsigned char)__b; 10737 } 10738 10739 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 10740 vector bool char __b) { 10741 return __a ^ __b; 10742 } 10743 10744 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 10745 vector short __b) { 10746 return __a ^ __b; 10747 } 10748 10749 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 10750 vector short __b) { 10751 return (vector short)__a ^ __b; 10752 } 10753 10754 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 10755 vector bool short __b) { 10756 return __a ^ (vector short)__b; 10757 } 10758 10759 static __inline__ vector unsigned short __ATTRS_o_ai 10760 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 10761 return __a ^ __b; 10762 } 10763 10764 static __inline__ vector unsigned short __ATTRS_o_ai 10765 vec_vxor(vector bool short __a, vector unsigned short __b) { 10766 return (vector unsigned short)__a ^ __b; 10767 } 10768 10769 static __inline__ vector unsigned short __ATTRS_o_ai 10770 vec_vxor(vector unsigned short __a, vector bool short __b) { 10771 return __a ^ (vector unsigned short)__b; 10772 } 10773 10774 static __inline__ vector bool short __ATTRS_o_ai 10775 vec_vxor(vector bool short __a, vector bool short __b) { 10776 return __a ^ __b; 10777 } 10778 10779 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 10780 vector int __b) { 10781 return __a ^ __b; 10782 } 10783 10784 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 10785 vector int __b) { 10786 return (vector int)__a ^ __b; 10787 } 10788 10789 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 10790 vector bool int __b) { 10791 return __a ^ (vector int)__b; 10792 } 10793 10794 static __inline__ vector unsigned int __ATTRS_o_ai 10795 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 10796 return __a ^ __b; 10797 } 10798 10799 static __inline__ vector unsigned int __ATTRS_o_ai 10800 vec_vxor(vector bool int __a, vector unsigned int __b) { 10801 return (vector unsigned int)__a ^ __b; 10802 } 10803 10804 static __inline__ vector unsigned int __ATTRS_o_ai 10805 vec_vxor(vector unsigned int __a, vector bool int __b) { 10806 return __a ^ (vector unsigned int)__b; 10807 } 10808 10809 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 10810 vector bool int __b) { 10811 return __a ^ __b; 10812 } 10813 10814 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 10815 vector float __b) { 10816 vector unsigned int __res = 10817 (vector unsigned int)__a ^ (vector unsigned int)__b; 10818 return (vector float)__res; 10819 } 10820 10821 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 10822 vector float __b) { 10823 vector unsigned int __res = 10824 (vector unsigned int)__a ^ (vector unsigned int)__b; 10825 return (vector float)__res; 10826 } 10827 10828 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 10829 vector bool int __b) { 10830 vector unsigned int __res = 10831 (vector unsigned int)__a ^ (vector unsigned int)__b; 10832 return (vector float)__res; 10833 } 10834 10835 #ifdef __VSX__ 10836 static __inline__ vector signed long long __ATTRS_o_ai 10837 vec_vxor(vector signed long long __a, vector signed long long __b) { 10838 return __a ^ __b; 10839 } 10840 10841 static __inline__ vector signed long long __ATTRS_o_ai 10842 vec_vxor(vector bool long long __a, vector signed long long __b) { 10843 return (vector signed long long)__a ^ __b; 10844 } 10845 10846 static __inline__ vector signed long long __ATTRS_o_ai 10847 vec_vxor(vector signed long long __a, vector bool long long __b) { 10848 return __a ^ (vector signed long long)__b; 10849 } 10850 10851 static __inline__ vector unsigned long long __ATTRS_o_ai 10852 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 10853 return __a ^ __b; 10854 } 10855 10856 static __inline__ vector unsigned long long __ATTRS_o_ai 10857 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 10858 return (vector unsigned long long)__a ^ __b; 10859 } 10860 10861 static __inline__ vector unsigned long long __ATTRS_o_ai 10862 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 10863 return __a ^ (vector unsigned long long)__b; 10864 } 10865 10866 static __inline__ vector bool long long __ATTRS_o_ai 10867 vec_vxor(vector bool long long __a, vector bool long long __b) { 10868 return __a ^ __b; 10869 } 10870 #endif 10871 10872 /* ------------------------ extensions for CBEA ----------------------------- */ 10873 10874 /* vec_extract */ 10875 10876 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 10877 int __b) { 10878 return __a[__b]; 10879 } 10880 10881 static __inline__ unsigned char __ATTRS_o_ai 10882 vec_extract(vector unsigned char __a, int __b) { 10883 return __a[__b]; 10884 } 10885 10886 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 10887 int __b) { 10888 return __a[__b]; 10889 } 10890 10891 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 10892 int __b) { 10893 return __a[__b]; 10894 } 10895 10896 static __inline__ unsigned short __ATTRS_o_ai 10897 vec_extract(vector unsigned short __a, int __b) { 10898 return __a[__b]; 10899 } 10900 10901 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 10902 int __b) { 10903 return __a[__b]; 10904 } 10905 10906 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 10907 int __b) { 10908 return __a[__b]; 10909 } 10910 10911 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 10912 int __b) { 10913 return __a[__b]; 10914 } 10915 10916 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 10917 int __b) { 10918 return __a[__b]; 10919 } 10920 10921 #ifdef __VSX__ 10922 static __inline__ signed long long __ATTRS_o_ai 10923 vec_extract(vector signed long long __a, int __b) { 10924 return __a[__b]; 10925 } 10926 10927 static __inline__ unsigned long long __ATTRS_o_ai 10928 vec_extract(vector unsigned long long __a, int __b) { 10929 return __a[__b]; 10930 } 10931 10932 static __inline__ unsigned long long __ATTRS_o_ai 10933 vec_extract(vector bool long long __a, int __b) { 10934 return __a[__b]; 10935 } 10936 10937 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) { 10938 return __a[__b]; 10939 } 10940 #endif 10941 10942 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) { 10943 return __a[__b]; 10944 } 10945 10946 /* vec_insert */ 10947 10948 static __inline__ vector signed char __ATTRS_o_ai 10949 vec_insert(signed char __a, vector signed char __b, int __c) { 10950 __b[__c] = __a; 10951 return __b; 10952 } 10953 10954 static __inline__ vector unsigned char __ATTRS_o_ai 10955 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 10956 __b[__c] = __a; 10957 return __b; 10958 } 10959 10960 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 10961 vector bool char __b, 10962 int __c) { 10963 __b[__c] = __a; 10964 return __b; 10965 } 10966 10967 static __inline__ vector signed short __ATTRS_o_ai 10968 vec_insert(signed short __a, vector signed short __b, int __c) { 10969 __b[__c] = __a; 10970 return __b; 10971 } 10972 10973 static __inline__ vector unsigned short __ATTRS_o_ai 10974 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 10975 __b[__c] = __a; 10976 return __b; 10977 } 10978 10979 static __inline__ vector bool short __ATTRS_o_ai 10980 vec_insert(unsigned short __a, vector bool short __b, int __c) { 10981 __b[__c] = __a; 10982 return __b; 10983 } 10984 10985 static __inline__ vector signed int __ATTRS_o_ai 10986 vec_insert(signed int __a, vector signed int __b, int __c) { 10987 __b[__c] = __a; 10988 return __b; 10989 } 10990 10991 static __inline__ vector unsigned int __ATTRS_o_ai 10992 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 10993 __b[__c] = __a; 10994 return __b; 10995 } 10996 10997 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 10998 vector bool int __b, 10999 int __c) { 11000 __b[__c] = __a; 11001 return __b; 11002 } 11003 11004 #ifdef __VSX__ 11005 static __inline__ vector signed long long __ATTRS_o_ai 11006 vec_insert(signed long long __a, vector signed long long __b, int __c) { 11007 __b[__c] = __a; 11008 return __b; 11009 } 11010 11011 static __inline__ vector unsigned long long __ATTRS_o_ai 11012 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 11013 __b[__c] = __a; 11014 return __b; 11015 } 11016 11017 static __inline__ vector bool long long __ATTRS_o_ai 11018 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 11019 __b[__c] = __a; 11020 return __b; 11021 } 11022 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 11023 vector double __b, 11024 int __c) { 11025 __b[__c] = __a; 11026 return __b; 11027 } 11028 #endif 11029 11030 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 11031 vector float __b, 11032 int __c) { 11033 __b[__c] = __a; 11034 return __b; 11035 } 11036 11037 /* vec_lvlx */ 11038 11039 static __inline__ vector signed char __ATTRS_o_ai 11040 vec_lvlx(int __a, const signed char *__b) { 11041 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 11042 vec_lvsl(__a, __b)); 11043 } 11044 11045 static __inline__ vector signed char __ATTRS_o_ai 11046 vec_lvlx(int __a, const vector signed char *__b) { 11047 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 11048 vec_lvsl(__a, (unsigned char *)__b)); 11049 } 11050 11051 static __inline__ vector unsigned char __ATTRS_o_ai 11052 vec_lvlx(int __a, const unsigned char *__b) { 11053 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 11054 vec_lvsl(__a, __b)); 11055 } 11056 11057 static __inline__ vector unsigned char __ATTRS_o_ai 11058 vec_lvlx(int __a, const vector unsigned char *__b) { 11059 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 11060 vec_lvsl(__a, (unsigned char *)__b)); 11061 } 11062 11063 static __inline__ vector bool char __ATTRS_o_ai 11064 vec_lvlx(int __a, const vector bool char *__b) { 11065 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 11066 vec_lvsl(__a, (unsigned char *)__b)); 11067 } 11068 11069 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 11070 const short *__b) { 11071 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 11072 } 11073 11074 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 11075 const vector short *__b) { 11076 return vec_perm(vec_ld(__a, __b), (vector short)(0), 11077 vec_lvsl(__a, (unsigned char *)__b)); 11078 } 11079 11080 static __inline__ vector unsigned short __ATTRS_o_ai 11081 vec_lvlx(int __a, const unsigned short *__b) { 11082 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 11083 vec_lvsl(__a, __b)); 11084 } 11085 11086 static __inline__ vector unsigned short __ATTRS_o_ai 11087 vec_lvlx(int __a, const vector unsigned short *__b) { 11088 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 11089 vec_lvsl(__a, (unsigned char *)__b)); 11090 } 11091 11092 static __inline__ vector bool short __ATTRS_o_ai 11093 vec_lvlx(int __a, const vector bool short *__b) { 11094 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 11095 vec_lvsl(__a, (unsigned char *)__b)); 11096 } 11097 11098 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 11099 const vector pixel *__b) { 11100 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 11101 vec_lvsl(__a, (unsigned char *)__b)); 11102 } 11103 11104 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 11105 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 11106 } 11107 11108 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 11109 const vector int *__b) { 11110 return vec_perm(vec_ld(__a, __b), (vector int)(0), 11111 vec_lvsl(__a, (unsigned char *)__b)); 11112 } 11113 11114 static __inline__ vector unsigned int __ATTRS_o_ai 11115 vec_lvlx(int __a, const unsigned int *__b) { 11116 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 11117 vec_lvsl(__a, __b)); 11118 } 11119 11120 static __inline__ vector unsigned int __ATTRS_o_ai 11121 vec_lvlx(int __a, const vector unsigned int *__b) { 11122 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 11123 vec_lvsl(__a, (unsigned char *)__b)); 11124 } 11125 11126 static __inline__ vector bool int __ATTRS_o_ai 11127 vec_lvlx(int __a, const vector bool int *__b) { 11128 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 11129 vec_lvsl(__a, (unsigned char *)__b)); 11130 } 11131 11132 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 11133 const float *__b) { 11134 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 11135 } 11136 11137 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 11138 const vector float *__b) { 11139 return vec_perm(vec_ld(__a, __b), (vector float)(0), 11140 vec_lvsl(__a, (unsigned char *)__b)); 11141 } 11142 11143 /* vec_lvlxl */ 11144 11145 static __inline__ vector signed char __ATTRS_o_ai 11146 vec_lvlxl(int __a, const signed char *__b) { 11147 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 11148 vec_lvsl(__a, __b)); 11149 } 11150 11151 static __inline__ vector signed char __ATTRS_o_ai 11152 vec_lvlxl(int __a, const vector signed char *__b) { 11153 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 11154 vec_lvsl(__a, (unsigned char *)__b)); 11155 } 11156 11157 static __inline__ vector unsigned char __ATTRS_o_ai 11158 vec_lvlxl(int __a, const unsigned char *__b) { 11159 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 11160 vec_lvsl(__a, __b)); 11161 } 11162 11163 static __inline__ vector unsigned char __ATTRS_o_ai 11164 vec_lvlxl(int __a, const vector unsigned char *__b) { 11165 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 11166 vec_lvsl(__a, (unsigned char *)__b)); 11167 } 11168 11169 static __inline__ vector bool char __ATTRS_o_ai 11170 vec_lvlxl(int __a, const vector bool char *__b) { 11171 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 11172 vec_lvsl(__a, (unsigned char *)__b)); 11173 } 11174 11175 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 11176 const short *__b) { 11177 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 11178 } 11179 11180 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 11181 const vector short *__b) { 11182 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 11183 vec_lvsl(__a, (unsigned char *)__b)); 11184 } 11185 11186 static __inline__ vector unsigned short __ATTRS_o_ai 11187 vec_lvlxl(int __a, const unsigned short *__b) { 11188 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 11189 vec_lvsl(__a, __b)); 11190 } 11191 11192 static __inline__ vector unsigned short __ATTRS_o_ai 11193 vec_lvlxl(int __a, const vector unsigned short *__b) { 11194 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 11195 vec_lvsl(__a, (unsigned char *)__b)); 11196 } 11197 11198 static __inline__ vector bool short __ATTRS_o_ai 11199 vec_lvlxl(int __a, const vector bool short *__b) { 11200 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 11201 vec_lvsl(__a, (unsigned char *)__b)); 11202 } 11203 11204 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 11205 const vector pixel *__b) { 11206 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 11207 vec_lvsl(__a, (unsigned char *)__b)); 11208 } 11209 11210 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 11211 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 11212 } 11213 11214 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 11215 const vector int *__b) { 11216 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 11217 vec_lvsl(__a, (unsigned char *)__b)); 11218 } 11219 11220 static __inline__ vector unsigned int __ATTRS_o_ai 11221 vec_lvlxl(int __a, const unsigned int *__b) { 11222 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 11223 vec_lvsl(__a, __b)); 11224 } 11225 11226 static __inline__ vector unsigned int __ATTRS_o_ai 11227 vec_lvlxl(int __a, const vector unsigned int *__b) { 11228 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 11229 vec_lvsl(__a, (unsigned char *)__b)); 11230 } 11231 11232 static __inline__ vector bool int __ATTRS_o_ai 11233 vec_lvlxl(int __a, const vector bool int *__b) { 11234 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 11235 vec_lvsl(__a, (unsigned char *)__b)); 11236 } 11237 11238 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 11239 const float *__b) { 11240 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 11241 } 11242 11243 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 11244 vector float *__b) { 11245 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 11246 vec_lvsl(__a, (unsigned char *)__b)); 11247 } 11248 11249 /* vec_lvrx */ 11250 11251 static __inline__ vector signed char __ATTRS_o_ai 11252 vec_lvrx(int __a, const signed char *__b) { 11253 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 11254 vec_lvsl(__a, __b)); 11255 } 11256 11257 static __inline__ vector signed char __ATTRS_o_ai 11258 vec_lvrx(int __a, const vector signed char *__b) { 11259 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 11260 vec_lvsl(__a, (unsigned char *)__b)); 11261 } 11262 11263 static __inline__ vector unsigned char __ATTRS_o_ai 11264 vec_lvrx(int __a, const unsigned char *__b) { 11265 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 11266 vec_lvsl(__a, __b)); 11267 } 11268 11269 static __inline__ vector unsigned char __ATTRS_o_ai 11270 vec_lvrx(int __a, const vector unsigned char *__b) { 11271 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 11272 vec_lvsl(__a, (unsigned char *)__b)); 11273 } 11274 11275 static __inline__ vector bool char __ATTRS_o_ai 11276 vec_lvrx(int __a, const vector bool char *__b) { 11277 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 11278 vec_lvsl(__a, (unsigned char *)__b)); 11279 } 11280 11281 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 11282 const short *__b) { 11283 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 11284 } 11285 11286 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 11287 const vector short *__b) { 11288 return vec_perm((vector short)(0), vec_ld(__a, __b), 11289 vec_lvsl(__a, (unsigned char *)__b)); 11290 } 11291 11292 static __inline__ vector unsigned short __ATTRS_o_ai 11293 vec_lvrx(int __a, const unsigned short *__b) { 11294 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 11295 vec_lvsl(__a, __b)); 11296 } 11297 11298 static __inline__ vector unsigned short __ATTRS_o_ai 11299 vec_lvrx(int __a, const vector unsigned short *__b) { 11300 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 11301 vec_lvsl(__a, (unsigned char *)__b)); 11302 } 11303 11304 static __inline__ vector bool short __ATTRS_o_ai 11305 vec_lvrx(int __a, const vector bool short *__b) { 11306 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 11307 vec_lvsl(__a, (unsigned char *)__b)); 11308 } 11309 11310 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 11311 const vector pixel *__b) { 11312 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 11313 vec_lvsl(__a, (unsigned char *)__b)); 11314 } 11315 11316 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 11317 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 11318 } 11319 11320 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 11321 const vector int *__b) { 11322 return vec_perm((vector int)(0), vec_ld(__a, __b), 11323 vec_lvsl(__a, (unsigned char *)__b)); 11324 } 11325 11326 static __inline__ vector unsigned int __ATTRS_o_ai 11327 vec_lvrx(int __a, const unsigned int *__b) { 11328 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 11329 vec_lvsl(__a, __b)); 11330 } 11331 11332 static __inline__ vector unsigned int __ATTRS_o_ai 11333 vec_lvrx(int __a, const vector unsigned int *__b) { 11334 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 11335 vec_lvsl(__a, (unsigned char *)__b)); 11336 } 11337 11338 static __inline__ vector bool int __ATTRS_o_ai 11339 vec_lvrx(int __a, const vector bool int *__b) { 11340 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 11341 vec_lvsl(__a, (unsigned char *)__b)); 11342 } 11343 11344 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 11345 const float *__b) { 11346 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 11347 } 11348 11349 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 11350 const vector float *__b) { 11351 return vec_perm((vector float)(0), vec_ld(__a, __b), 11352 vec_lvsl(__a, (unsigned char *)__b)); 11353 } 11354 11355 /* vec_lvrxl */ 11356 11357 static __inline__ vector signed char __ATTRS_o_ai 11358 vec_lvrxl(int __a, const signed char *__b) { 11359 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 11360 vec_lvsl(__a, __b)); 11361 } 11362 11363 static __inline__ vector signed char __ATTRS_o_ai 11364 vec_lvrxl(int __a, const vector signed char *__b) { 11365 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 11366 vec_lvsl(__a, (unsigned char *)__b)); 11367 } 11368 11369 static __inline__ vector unsigned char __ATTRS_o_ai 11370 vec_lvrxl(int __a, const unsigned char *__b) { 11371 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 11372 vec_lvsl(__a, __b)); 11373 } 11374 11375 static __inline__ vector unsigned char __ATTRS_o_ai 11376 vec_lvrxl(int __a, const vector unsigned char *__b) { 11377 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 11378 vec_lvsl(__a, (unsigned char *)__b)); 11379 } 11380 11381 static __inline__ vector bool char __ATTRS_o_ai 11382 vec_lvrxl(int __a, const vector bool char *__b) { 11383 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 11384 vec_lvsl(__a, (unsigned char *)__b)); 11385 } 11386 11387 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 11388 const short *__b) { 11389 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 11390 } 11391 11392 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 11393 const vector short *__b) { 11394 return vec_perm((vector short)(0), vec_ldl(__a, __b), 11395 vec_lvsl(__a, (unsigned char *)__b)); 11396 } 11397 11398 static __inline__ vector unsigned short __ATTRS_o_ai 11399 vec_lvrxl(int __a, const unsigned short *__b) { 11400 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 11401 vec_lvsl(__a, __b)); 11402 } 11403 11404 static __inline__ vector unsigned short __ATTRS_o_ai 11405 vec_lvrxl(int __a, const vector unsigned short *__b) { 11406 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 11407 vec_lvsl(__a, (unsigned char *)__b)); 11408 } 11409 11410 static __inline__ vector bool short __ATTRS_o_ai 11411 vec_lvrxl(int __a, const vector bool short *__b) { 11412 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 11413 vec_lvsl(__a, (unsigned char *)__b)); 11414 } 11415 11416 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 11417 const vector pixel *__b) { 11418 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 11419 vec_lvsl(__a, (unsigned char *)__b)); 11420 } 11421 11422 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 11423 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 11424 } 11425 11426 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 11427 const vector int *__b) { 11428 return vec_perm((vector int)(0), vec_ldl(__a, __b), 11429 vec_lvsl(__a, (unsigned char *)__b)); 11430 } 11431 11432 static __inline__ vector unsigned int __ATTRS_o_ai 11433 vec_lvrxl(int __a, const unsigned int *__b) { 11434 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 11435 vec_lvsl(__a, __b)); 11436 } 11437 11438 static __inline__ vector unsigned int __ATTRS_o_ai 11439 vec_lvrxl(int __a, const vector unsigned int *__b) { 11440 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 11441 vec_lvsl(__a, (unsigned char *)__b)); 11442 } 11443 11444 static __inline__ vector bool int __ATTRS_o_ai 11445 vec_lvrxl(int __a, const vector bool int *__b) { 11446 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 11447 vec_lvsl(__a, (unsigned char *)__b)); 11448 } 11449 11450 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 11451 const float *__b) { 11452 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 11453 } 11454 11455 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 11456 const vector float *__b) { 11457 return vec_perm((vector float)(0), vec_ldl(__a, __b), 11458 vec_lvsl(__a, (unsigned char *)__b)); 11459 } 11460 11461 /* vec_stvlx */ 11462 11463 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 11464 signed char *__c) { 11465 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11466 __c); 11467 } 11468 11469 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 11470 vector signed char *__c) { 11471 return vec_st( 11472 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11473 __b, __c); 11474 } 11475 11476 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 11477 unsigned char *__c) { 11478 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11479 __c); 11480 } 11481 11482 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 11483 vector unsigned char *__c) { 11484 return vec_st( 11485 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11486 __b, __c); 11487 } 11488 11489 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 11490 vector bool char *__c) { 11491 return vec_st( 11492 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11493 __b, __c); 11494 } 11495 11496 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 11497 short *__c) { 11498 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11499 __c); 11500 } 11501 11502 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 11503 vector short *__c) { 11504 return vec_st( 11505 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11506 __b, __c); 11507 } 11508 11509 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 11510 int __b, unsigned short *__c) { 11511 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11512 __c); 11513 } 11514 11515 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 11516 int __b, 11517 vector unsigned short *__c) { 11518 return vec_st( 11519 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11520 __b, __c); 11521 } 11522 11523 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 11524 vector bool short *__c) { 11525 return vec_st( 11526 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11527 __b, __c); 11528 } 11529 11530 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 11531 vector pixel *__c) { 11532 return vec_st( 11533 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11534 __b, __c); 11535 } 11536 11537 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 11538 int *__c) { 11539 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11540 __c); 11541 } 11542 11543 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 11544 vector int *__c) { 11545 return vec_st( 11546 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11547 __b, __c); 11548 } 11549 11550 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 11551 unsigned int *__c) { 11552 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11553 __c); 11554 } 11555 11556 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 11557 vector unsigned int *__c) { 11558 return vec_st( 11559 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11560 __b, __c); 11561 } 11562 11563 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 11564 vector bool int *__c) { 11565 return vec_st( 11566 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11567 __b, __c); 11568 } 11569 11570 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 11571 vector float *__c) { 11572 return vec_st( 11573 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11574 __b, __c); 11575 } 11576 11577 /* vec_stvlxl */ 11578 11579 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 11580 signed char *__c) { 11581 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11582 __c); 11583 } 11584 11585 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 11586 vector signed char *__c) { 11587 return vec_stl( 11588 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11589 __b, __c); 11590 } 11591 11592 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 11593 int __b, unsigned char *__c) { 11594 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11595 __c); 11596 } 11597 11598 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 11599 int __b, 11600 vector unsigned char *__c) { 11601 return vec_stl( 11602 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11603 __b, __c); 11604 } 11605 11606 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 11607 vector bool char *__c) { 11608 return vec_stl( 11609 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11610 __b, __c); 11611 } 11612 11613 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 11614 short *__c) { 11615 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11616 __c); 11617 } 11618 11619 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 11620 vector short *__c) { 11621 return vec_stl( 11622 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11623 __b, __c); 11624 } 11625 11626 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 11627 int __b, unsigned short *__c) { 11628 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11629 __c); 11630 } 11631 11632 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 11633 int __b, 11634 vector unsigned short *__c) { 11635 return vec_stl( 11636 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11637 __b, __c); 11638 } 11639 11640 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 11641 vector bool short *__c) { 11642 return vec_stl( 11643 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11644 __b, __c); 11645 } 11646 11647 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 11648 vector pixel *__c) { 11649 return vec_stl( 11650 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11651 __b, __c); 11652 } 11653 11654 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 11655 int *__c) { 11656 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11657 __c); 11658 } 11659 11660 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 11661 vector int *__c) { 11662 return vec_stl( 11663 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11664 __b, __c); 11665 } 11666 11667 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 11668 unsigned int *__c) { 11669 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 11670 __c); 11671 } 11672 11673 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 11674 vector unsigned int *__c) { 11675 return vec_stl( 11676 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11677 __b, __c); 11678 } 11679 11680 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 11681 vector bool int *__c) { 11682 return vec_stl( 11683 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11684 __b, __c); 11685 } 11686 11687 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 11688 vector float *__c) { 11689 return vec_stl( 11690 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 11691 __b, __c); 11692 } 11693 11694 /* vec_stvrx */ 11695 11696 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 11697 signed char *__c) { 11698 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11699 __c); 11700 } 11701 11702 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 11703 vector signed char *__c) { 11704 return vec_st( 11705 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11706 __b, __c); 11707 } 11708 11709 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 11710 unsigned char *__c) { 11711 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11712 __c); 11713 } 11714 11715 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 11716 vector unsigned char *__c) { 11717 return vec_st( 11718 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11719 __b, __c); 11720 } 11721 11722 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 11723 vector bool char *__c) { 11724 return vec_st( 11725 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11726 __b, __c); 11727 } 11728 11729 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 11730 short *__c) { 11731 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11732 __c); 11733 } 11734 11735 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 11736 vector short *__c) { 11737 return vec_st( 11738 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11739 __b, __c); 11740 } 11741 11742 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 11743 int __b, unsigned short *__c) { 11744 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11745 __c); 11746 } 11747 11748 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 11749 int __b, 11750 vector unsigned short *__c) { 11751 return vec_st( 11752 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11753 __b, __c); 11754 } 11755 11756 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 11757 vector bool short *__c) { 11758 return vec_st( 11759 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11760 __b, __c); 11761 } 11762 11763 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 11764 vector pixel *__c) { 11765 return vec_st( 11766 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11767 __b, __c); 11768 } 11769 11770 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 11771 int *__c) { 11772 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11773 __c); 11774 } 11775 11776 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 11777 vector int *__c) { 11778 return vec_st( 11779 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11780 __b, __c); 11781 } 11782 11783 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 11784 unsigned int *__c) { 11785 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11786 __c); 11787 } 11788 11789 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 11790 vector unsigned int *__c) { 11791 return vec_st( 11792 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11793 __b, __c); 11794 } 11795 11796 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 11797 vector bool int *__c) { 11798 return vec_st( 11799 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11800 __b, __c); 11801 } 11802 11803 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 11804 vector float *__c) { 11805 return vec_st( 11806 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11807 __b, __c); 11808 } 11809 11810 /* vec_stvrxl */ 11811 11812 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 11813 signed char *__c) { 11814 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11815 __c); 11816 } 11817 11818 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 11819 vector signed char *__c) { 11820 return vec_stl( 11821 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11822 __b, __c); 11823 } 11824 11825 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 11826 int __b, unsigned char *__c) { 11827 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11828 __c); 11829 } 11830 11831 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 11832 int __b, 11833 vector unsigned char *__c) { 11834 return vec_stl( 11835 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11836 __b, __c); 11837 } 11838 11839 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 11840 vector bool char *__c) { 11841 return vec_stl( 11842 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11843 __b, __c); 11844 } 11845 11846 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 11847 short *__c) { 11848 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11849 __c); 11850 } 11851 11852 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 11853 vector short *__c) { 11854 return vec_stl( 11855 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11856 __b, __c); 11857 } 11858 11859 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 11860 int __b, unsigned short *__c) { 11861 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11862 __c); 11863 } 11864 11865 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 11866 int __b, 11867 vector unsigned short *__c) { 11868 return vec_stl( 11869 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11870 __b, __c); 11871 } 11872 11873 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 11874 vector bool short *__c) { 11875 return vec_stl( 11876 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11877 __b, __c); 11878 } 11879 11880 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 11881 vector pixel *__c) { 11882 return vec_stl( 11883 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11884 __b, __c); 11885 } 11886 11887 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 11888 int *__c) { 11889 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11890 __c); 11891 } 11892 11893 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 11894 vector int *__c) { 11895 return vec_stl( 11896 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11897 __b, __c); 11898 } 11899 11900 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 11901 unsigned int *__c) { 11902 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 11903 __c); 11904 } 11905 11906 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 11907 vector unsigned int *__c) { 11908 return vec_stl( 11909 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11910 __b, __c); 11911 } 11912 11913 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 11914 vector bool int *__c) { 11915 return vec_stl( 11916 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11917 __b, __c); 11918 } 11919 11920 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 11921 vector float *__c) { 11922 return vec_stl( 11923 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 11924 __b, __c); 11925 } 11926 11927 /* vec_promote */ 11928 11929 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 11930 int __b) { 11931 vector signed char __res = (vector signed char)(0); 11932 __res[__b] = __a; 11933 return __res; 11934 } 11935 11936 static __inline__ vector unsigned char __ATTRS_o_ai 11937 vec_promote(unsigned char __a, int __b) { 11938 vector unsigned char __res = (vector unsigned char)(0); 11939 __res[__b] = __a; 11940 return __res; 11941 } 11942 11943 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 11944 vector short __res = (vector short)(0); 11945 __res[__b] = __a; 11946 return __res; 11947 } 11948 11949 static __inline__ vector unsigned short __ATTRS_o_ai 11950 vec_promote(unsigned short __a, int __b) { 11951 vector unsigned short __res = (vector unsigned short)(0); 11952 __res[__b] = __a; 11953 return __res; 11954 } 11955 11956 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 11957 vector int __res = (vector int)(0); 11958 __res[__b] = __a; 11959 return __res; 11960 } 11961 11962 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 11963 int __b) { 11964 vector unsigned int __res = (vector unsigned int)(0); 11965 __res[__b] = __a; 11966 return __res; 11967 } 11968 11969 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 11970 vector float __res = (vector float)(0); 11971 __res[__b] = __a; 11972 return __res; 11973 } 11974 11975 /* vec_splats */ 11976 11977 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 11978 return (vector signed char)(__a); 11979 } 11980 11981 static __inline__ vector unsigned char __ATTRS_o_ai 11982 vec_splats(unsigned char __a) { 11983 return (vector unsigned char)(__a); 11984 } 11985 11986 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 11987 return (vector short)(__a); 11988 } 11989 11990 static __inline__ vector unsigned short __ATTRS_o_ai 11991 vec_splats(unsigned short __a) { 11992 return (vector unsigned short)(__a); 11993 } 11994 11995 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 11996 return (vector int)(__a); 11997 } 11998 11999 static __inline__ vector unsigned int __ATTRS_o_ai 12000 vec_splats(unsigned int __a) { 12001 return (vector unsigned int)(__a); 12002 } 12003 12004 #ifdef __VSX__ 12005 static __inline__ vector signed long long __ATTRS_o_ai 12006 vec_splats(signed long long __a) { 12007 return (vector signed long long)(__a); 12008 } 12009 12010 static __inline__ vector unsigned long long __ATTRS_o_ai 12011 vec_splats(unsigned long long __a) { 12012 return (vector unsigned long long)(__a); 12013 } 12014 12015 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 12016 static __inline__ vector signed __int128 __ATTRS_o_ai 12017 vec_splats(signed __int128 __a) { 12018 return (vector signed __int128)(__a); 12019 } 12020 12021 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12022 vec_splats(unsigned __int128 __a) { 12023 return (vector unsigned __int128)(__a); 12024 } 12025 12026 #endif 12027 12028 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 12029 return (vector double)(__a); 12030 } 12031 #endif 12032 12033 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 12034 return (vector float)(__a); 12035 } 12036 12037 /* ----------------------------- predicates --------------------------------- */ 12038 12039 /* vec_all_eq */ 12040 12041 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 12042 vector signed char __b) { 12043 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12044 (vector char)__b); 12045 } 12046 12047 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 12048 vector bool char __b) { 12049 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12050 (vector char)__b); 12051 } 12052 12053 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 12054 vector unsigned char __b) { 12055 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12056 (vector char)__b); 12057 } 12058 12059 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 12060 vector bool char __b) { 12061 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12062 (vector char)__b); 12063 } 12064 12065 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 12066 vector signed char __b) { 12067 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12068 (vector char)__b); 12069 } 12070 12071 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 12072 vector unsigned char __b) { 12073 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12074 (vector char)__b); 12075 } 12076 12077 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 12078 vector bool char __b) { 12079 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 12080 (vector char)__b); 12081 } 12082 12083 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 12084 vector short __b) { 12085 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 12086 } 12087 12088 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 12089 vector bool short __b) { 12090 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 12091 } 12092 12093 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 12094 vector unsigned short __b) { 12095 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 12096 (vector short)__b); 12097 } 12098 12099 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 12100 vector bool short __b) { 12101 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 12102 (vector short)__b); 12103 } 12104 12105 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 12106 vector short __b) { 12107 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 12108 (vector short)__b); 12109 } 12110 12111 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 12112 vector unsigned short __b) { 12113 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 12114 (vector short)__b); 12115 } 12116 12117 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 12118 vector bool short __b) { 12119 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 12120 (vector short)__b); 12121 } 12122 12123 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 12124 vector pixel __b) { 12125 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 12126 (vector short)__b); 12127 } 12128 12129 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 12130 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 12131 } 12132 12133 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 12134 vector bool int __b) { 12135 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 12136 } 12137 12138 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 12139 vector unsigned int __b) { 12140 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 12141 (vector int)__b); 12142 } 12143 12144 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 12145 vector bool int __b) { 12146 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 12147 (vector int)__b); 12148 } 12149 12150 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 12151 vector int __b) { 12152 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 12153 (vector int)__b); 12154 } 12155 12156 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 12157 vector unsigned int __b) { 12158 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 12159 (vector int)__b); 12160 } 12161 12162 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 12163 vector bool int __b) { 12164 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 12165 (vector int)__b); 12166 } 12167 12168 #ifdef __POWER8_VECTOR__ 12169 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 12170 vector signed long long __b) { 12171 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 12172 } 12173 12174 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 12175 vector bool long long __b) { 12176 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b); 12177 } 12178 12179 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 12180 vector unsigned long long __b) { 12181 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 12182 (vector long long)__b); 12183 } 12184 12185 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 12186 vector bool long long __b) { 12187 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 12188 (vector long long)__b); 12189 } 12190 12191 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 12192 vector long long __b) { 12193 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 12194 (vector long long)__b); 12195 } 12196 12197 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 12198 vector unsigned long long __b) { 12199 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 12200 (vector long long)__b); 12201 } 12202 12203 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 12204 vector bool long long __b) { 12205 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 12206 (vector long long)__b); 12207 } 12208 #endif 12209 12210 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 12211 vector float __b) { 12212 #ifdef __VSX__ 12213 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 12214 #else 12215 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 12216 #endif 12217 } 12218 12219 #ifdef __VSX__ 12220 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 12221 vector double __b) { 12222 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 12223 } 12224 #endif 12225 12226 /* vec_all_ge */ 12227 12228 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 12229 vector signed char __b) { 12230 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 12231 } 12232 12233 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 12234 vector bool char __b) { 12235 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 12236 } 12237 12238 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 12239 vector unsigned char __b) { 12240 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 12241 } 12242 12243 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 12244 vector bool char __b) { 12245 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 12246 } 12247 12248 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 12249 vector signed char __b) { 12250 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 12251 (vector unsigned char)__a); 12252 } 12253 12254 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 12255 vector unsigned char __b) { 12256 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 12257 } 12258 12259 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 12260 vector bool char __b) { 12261 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 12262 (vector unsigned char)__a); 12263 } 12264 12265 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 12266 vector short __b) { 12267 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 12268 } 12269 12270 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 12271 vector bool short __b) { 12272 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 12273 } 12274 12275 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 12276 vector unsigned short __b) { 12277 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 12278 } 12279 12280 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 12281 vector bool short __b) { 12282 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 12283 __a); 12284 } 12285 12286 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 12287 vector short __b) { 12288 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 12289 (vector unsigned short)__a); 12290 } 12291 12292 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 12293 vector unsigned short __b) { 12294 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 12295 (vector unsigned short)__a); 12296 } 12297 12298 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 12299 vector bool short __b) { 12300 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 12301 (vector unsigned short)__a); 12302 } 12303 12304 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 12305 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 12306 } 12307 12308 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 12309 vector bool int __b) { 12310 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 12311 } 12312 12313 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 12314 vector unsigned int __b) { 12315 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 12316 } 12317 12318 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 12319 vector bool int __b) { 12320 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 12321 } 12322 12323 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 12324 vector int __b) { 12325 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 12326 (vector unsigned int)__a); 12327 } 12328 12329 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 12330 vector unsigned int __b) { 12331 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 12332 } 12333 12334 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 12335 vector bool int __b) { 12336 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 12337 (vector unsigned int)__a); 12338 } 12339 12340 #ifdef __POWER8_VECTOR__ 12341 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 12342 vector signed long long __b) { 12343 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 12344 } 12345 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 12346 vector bool long long __b) { 12347 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 12348 __a); 12349 } 12350 12351 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 12352 vector unsigned long long __b) { 12353 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 12354 } 12355 12356 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 12357 vector bool long long __b) { 12358 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 12359 __a); 12360 } 12361 12362 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 12363 vector signed long long __b) { 12364 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 12365 (vector unsigned long long)__a); 12366 } 12367 12368 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 12369 vector unsigned long long __b) { 12370 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 12371 (vector unsigned long long)__a); 12372 } 12373 12374 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 12375 vector bool long long __b) { 12376 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 12377 (vector unsigned long long)__a); 12378 } 12379 #endif 12380 12381 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 12382 vector float __b) { 12383 #ifdef __VSX__ 12384 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 12385 #else 12386 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 12387 #endif 12388 } 12389 12390 #ifdef __VSX__ 12391 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 12392 vector double __b) { 12393 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 12394 } 12395 #endif 12396 12397 /* vec_all_gt */ 12398 12399 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 12400 vector signed char __b) { 12401 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 12402 } 12403 12404 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 12405 vector bool char __b) { 12406 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 12407 } 12408 12409 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 12410 vector unsigned char __b) { 12411 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 12412 } 12413 12414 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 12415 vector bool char __b) { 12416 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 12417 } 12418 12419 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 12420 vector signed char __b) { 12421 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 12422 (vector unsigned char)__b); 12423 } 12424 12425 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 12426 vector unsigned char __b) { 12427 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 12428 } 12429 12430 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 12431 vector bool char __b) { 12432 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 12433 (vector unsigned char)__b); 12434 } 12435 12436 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 12437 vector short __b) { 12438 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 12439 } 12440 12441 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 12442 vector bool short __b) { 12443 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 12444 } 12445 12446 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 12447 vector unsigned short __b) { 12448 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 12449 } 12450 12451 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 12452 vector bool short __b) { 12453 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 12454 (vector unsigned short)__b); 12455 } 12456 12457 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 12458 vector short __b) { 12459 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 12460 (vector unsigned short)__b); 12461 } 12462 12463 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 12464 vector unsigned short __b) { 12465 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 12466 __b); 12467 } 12468 12469 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 12470 vector bool short __b) { 12471 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 12472 (vector unsigned short)__b); 12473 } 12474 12475 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 12476 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 12477 } 12478 12479 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 12480 vector bool int __b) { 12481 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 12482 } 12483 12484 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 12485 vector unsigned int __b) { 12486 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 12487 } 12488 12489 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 12490 vector bool int __b) { 12491 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 12492 } 12493 12494 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 12495 vector int __b) { 12496 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 12497 (vector unsigned int)__b); 12498 } 12499 12500 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 12501 vector unsigned int __b) { 12502 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 12503 } 12504 12505 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 12506 vector bool int __b) { 12507 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 12508 (vector unsigned int)__b); 12509 } 12510 12511 #ifdef __POWER8_VECTOR__ 12512 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 12513 vector signed long long __b) { 12514 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 12515 } 12516 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 12517 vector bool long long __b) { 12518 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 12519 (vector signed long long)__b); 12520 } 12521 12522 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 12523 vector unsigned long long __b) { 12524 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 12525 } 12526 12527 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 12528 vector bool long long __b) { 12529 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 12530 (vector unsigned long long)__b); 12531 } 12532 12533 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 12534 vector signed long long __b) { 12535 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 12536 (vector unsigned long long)__b); 12537 } 12538 12539 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 12540 vector unsigned long long __b) { 12541 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 12542 __b); 12543 } 12544 12545 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 12546 vector bool long long __b) { 12547 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 12548 (vector unsigned long long)__b); 12549 } 12550 #endif 12551 12552 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 12553 vector float __b) { 12554 #ifdef __VSX__ 12555 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 12556 #else 12557 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 12558 #endif 12559 } 12560 12561 #ifdef __VSX__ 12562 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 12563 vector double __b) { 12564 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 12565 } 12566 #endif 12567 12568 /* vec_all_in */ 12569 12570 static __inline__ int __attribute__((__always_inline__)) 12571 vec_all_in(vector float __a, vector float __b) { 12572 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 12573 } 12574 12575 /* vec_all_le */ 12576 12577 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 12578 vector signed char __b) { 12579 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 12580 } 12581 12582 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 12583 vector bool char __b) { 12584 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 12585 } 12586 12587 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 12588 vector unsigned char __b) { 12589 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 12590 } 12591 12592 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 12593 vector bool char __b) { 12594 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 12595 } 12596 12597 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 12598 vector signed char __b) { 12599 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 12600 (vector unsigned char)__b); 12601 } 12602 12603 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 12604 vector unsigned char __b) { 12605 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 12606 } 12607 12608 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 12609 vector bool char __b) { 12610 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 12611 (vector unsigned char)__b); 12612 } 12613 12614 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 12615 vector short __b) { 12616 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 12617 } 12618 12619 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 12620 vector bool short __b) { 12621 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 12622 } 12623 12624 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 12625 vector unsigned short __b) { 12626 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 12627 } 12628 12629 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 12630 vector bool short __b) { 12631 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 12632 (vector unsigned short)__b); 12633 } 12634 12635 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 12636 vector short __b) { 12637 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 12638 (vector unsigned short)__b); 12639 } 12640 12641 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 12642 vector unsigned short __b) { 12643 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 12644 __b); 12645 } 12646 12647 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 12648 vector bool short __b) { 12649 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 12650 (vector unsigned short)__b); 12651 } 12652 12653 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 12654 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 12655 } 12656 12657 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 12658 vector bool int __b) { 12659 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 12660 } 12661 12662 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 12663 vector unsigned int __b) { 12664 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 12665 } 12666 12667 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 12668 vector bool int __b) { 12669 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 12670 } 12671 12672 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 12673 vector int __b) { 12674 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 12675 (vector unsigned int)__b); 12676 } 12677 12678 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 12679 vector unsigned int __b) { 12680 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 12681 } 12682 12683 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 12684 vector bool int __b) { 12685 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 12686 (vector unsigned int)__b); 12687 } 12688 12689 #ifdef __POWER8_VECTOR__ 12690 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 12691 vector signed long long __b) { 12692 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 12693 } 12694 12695 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 12696 vector unsigned long long __b) { 12697 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 12698 } 12699 12700 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 12701 vector bool long long __b) { 12702 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 12703 (vector signed long long)__b); 12704 } 12705 12706 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 12707 vector bool long long __b) { 12708 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 12709 (vector unsigned long long)__b); 12710 } 12711 12712 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 12713 vector signed long long __b) { 12714 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 12715 (vector unsigned long long)__b); 12716 } 12717 12718 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 12719 vector unsigned long long __b) { 12720 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 12721 __b); 12722 } 12723 12724 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 12725 vector bool long long __b) { 12726 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 12727 (vector unsigned long long)__b); 12728 } 12729 #endif 12730 12731 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 12732 vector float __b) { 12733 #ifdef __VSX__ 12734 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 12735 #else 12736 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 12737 #endif 12738 } 12739 12740 #ifdef __VSX__ 12741 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 12742 vector double __b) { 12743 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 12744 } 12745 #endif 12746 12747 /* vec_all_lt */ 12748 12749 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 12750 vector signed char __b) { 12751 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 12752 } 12753 12754 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 12755 vector bool char __b) { 12756 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 12757 } 12758 12759 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 12760 vector unsigned char __b) { 12761 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 12762 } 12763 12764 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 12765 vector bool char __b) { 12766 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 12767 } 12768 12769 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 12770 vector signed char __b) { 12771 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 12772 (vector unsigned char)__a); 12773 } 12774 12775 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 12776 vector unsigned char __b) { 12777 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 12778 } 12779 12780 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 12781 vector bool char __b) { 12782 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 12783 (vector unsigned char)__a); 12784 } 12785 12786 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 12787 vector short __b) { 12788 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 12789 } 12790 12791 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 12792 vector bool short __b) { 12793 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 12794 } 12795 12796 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 12797 vector unsigned short __b) { 12798 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 12799 } 12800 12801 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 12802 vector bool short __b) { 12803 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 12804 __a); 12805 } 12806 12807 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 12808 vector short __b) { 12809 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 12810 (vector unsigned short)__a); 12811 } 12812 12813 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 12814 vector unsigned short __b) { 12815 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 12816 (vector unsigned short)__a); 12817 } 12818 12819 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 12820 vector bool short __b) { 12821 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 12822 (vector unsigned short)__a); 12823 } 12824 12825 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 12826 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 12827 } 12828 12829 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 12830 vector bool int __b) { 12831 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 12832 } 12833 12834 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 12835 vector unsigned int __b) { 12836 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 12837 } 12838 12839 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 12840 vector bool int __b) { 12841 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 12842 } 12843 12844 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 12845 vector int __b) { 12846 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 12847 (vector unsigned int)__a); 12848 } 12849 12850 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 12851 vector unsigned int __b) { 12852 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 12853 } 12854 12855 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 12856 vector bool int __b) { 12857 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 12858 (vector unsigned int)__a); 12859 } 12860 12861 #ifdef __POWER8_VECTOR__ 12862 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 12863 vector signed long long __b) { 12864 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 12865 } 12866 12867 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 12868 vector unsigned long long __b) { 12869 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 12870 } 12871 12872 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 12873 vector bool long long __b) { 12874 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 12875 __a); 12876 } 12877 12878 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 12879 vector bool long long __b) { 12880 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 12881 __a); 12882 } 12883 12884 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 12885 vector signed long long __b) { 12886 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 12887 (vector unsigned long long)__a); 12888 } 12889 12890 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 12891 vector unsigned long long __b) { 12892 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 12893 (vector unsigned long long)__a); 12894 } 12895 12896 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 12897 vector bool long long __b) { 12898 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 12899 (vector unsigned long long)__a); 12900 } 12901 #endif 12902 12903 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 12904 vector float __b) { 12905 #ifdef __VSX__ 12906 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 12907 #else 12908 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 12909 #endif 12910 } 12911 12912 #ifdef __VSX__ 12913 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 12914 vector double __b) { 12915 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 12916 } 12917 #endif 12918 12919 /* vec_all_nan */ 12920 12921 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 12922 #ifdef __VSX__ 12923 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 12924 #else 12925 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 12926 #endif 12927 } 12928 12929 #ifdef __VSX__ 12930 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 12931 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 12932 } 12933 #endif 12934 12935 /* vec_all_ne */ 12936 12937 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 12938 vector signed char __b) { 12939 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12940 (vector char)__b); 12941 } 12942 12943 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 12944 vector bool char __b) { 12945 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12946 (vector char)__b); 12947 } 12948 12949 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 12950 vector unsigned char __b) { 12951 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12952 (vector char)__b); 12953 } 12954 12955 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 12956 vector bool char __b) { 12957 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12958 (vector char)__b); 12959 } 12960 12961 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 12962 vector signed char __b) { 12963 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12964 (vector char)__b); 12965 } 12966 12967 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 12968 vector unsigned char __b) { 12969 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12970 (vector char)__b); 12971 } 12972 12973 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 12974 vector bool char __b) { 12975 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 12976 (vector char)__b); 12977 } 12978 12979 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 12980 vector short __b) { 12981 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 12982 } 12983 12984 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 12985 vector bool short __b) { 12986 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 12987 } 12988 12989 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 12990 vector unsigned short __b) { 12991 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 12992 (vector short)__b); 12993 } 12994 12995 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 12996 vector bool short __b) { 12997 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 12998 (vector short)__b); 12999 } 13000 13001 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 13002 vector short __b) { 13003 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 13004 (vector short)__b); 13005 } 13006 13007 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 13008 vector unsigned short __b) { 13009 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 13010 (vector short)__b); 13011 } 13012 13013 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 13014 vector bool short __b) { 13015 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 13016 (vector short)__b); 13017 } 13018 13019 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 13020 vector pixel __b) { 13021 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 13022 (vector short)__b); 13023 } 13024 13025 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 13026 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 13027 } 13028 13029 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 13030 vector bool int __b) { 13031 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 13032 } 13033 13034 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 13035 vector unsigned int __b) { 13036 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 13037 (vector int)__b); 13038 } 13039 13040 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 13041 vector bool int __b) { 13042 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 13043 (vector int)__b); 13044 } 13045 13046 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 13047 vector int __b) { 13048 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 13049 (vector int)__b); 13050 } 13051 13052 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 13053 vector unsigned int __b) { 13054 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 13055 (vector int)__b); 13056 } 13057 13058 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 13059 vector bool int __b) { 13060 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 13061 (vector int)__b); 13062 } 13063 13064 #ifdef __POWER8_VECTOR__ 13065 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 13066 vector signed long long __b) { 13067 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 13068 } 13069 13070 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 13071 vector unsigned long long __b) { 13072 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 13073 (vector long long)__b); 13074 } 13075 13076 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 13077 vector bool long long __b) { 13078 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 13079 (vector signed long long)__b); 13080 } 13081 13082 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 13083 vector bool long long __b) { 13084 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 13085 (vector signed long long)__b); 13086 } 13087 13088 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 13089 vector signed long long __b) { 13090 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 13091 (vector signed long long)__b); 13092 } 13093 13094 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 13095 vector unsigned long long __b) { 13096 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 13097 (vector signed long long)__b); 13098 } 13099 13100 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 13101 vector bool long long __b) { 13102 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 13103 (vector signed long long)__b); 13104 } 13105 #endif 13106 13107 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 13108 vector float __b) { 13109 #ifdef __VSX__ 13110 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 13111 #else 13112 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 13113 #endif 13114 } 13115 13116 #ifdef __VSX__ 13117 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 13118 vector double __b) { 13119 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 13120 } 13121 #endif 13122 13123 /* vec_all_nge */ 13124 13125 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 13126 vector float __b) { 13127 #ifdef __VSX__ 13128 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 13129 #else 13130 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 13131 #endif 13132 } 13133 13134 #ifdef __VSX__ 13135 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 13136 vector double __b) { 13137 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 13138 } 13139 #endif 13140 13141 /* vec_all_ngt */ 13142 13143 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 13144 vector float __b) { 13145 #ifdef __VSX__ 13146 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 13147 #else 13148 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 13149 #endif 13150 } 13151 13152 #ifdef __VSX__ 13153 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 13154 vector double __b) { 13155 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 13156 } 13157 #endif 13158 13159 /* vec_all_nle */ 13160 13161 static __inline__ int __attribute__((__always_inline__)) 13162 vec_all_nle(vector float __a, vector float __b) { 13163 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 13164 } 13165 13166 /* vec_all_nlt */ 13167 13168 static __inline__ int __attribute__((__always_inline__)) 13169 vec_all_nlt(vector float __a, vector float __b) { 13170 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 13171 } 13172 13173 /* vec_all_numeric */ 13174 13175 static __inline__ int __attribute__((__always_inline__)) 13176 vec_all_numeric(vector float __a) { 13177 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 13178 } 13179 13180 /* vec_any_eq */ 13181 13182 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 13183 vector signed char __b) { 13184 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13185 (vector char)__b); 13186 } 13187 13188 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 13189 vector bool char __b) { 13190 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13191 (vector char)__b); 13192 } 13193 13194 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 13195 vector unsigned char __b) { 13196 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13197 (vector char)__b); 13198 } 13199 13200 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 13201 vector bool char __b) { 13202 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13203 (vector char)__b); 13204 } 13205 13206 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 13207 vector signed char __b) { 13208 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13209 (vector char)__b); 13210 } 13211 13212 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 13213 vector unsigned char __b) { 13214 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13215 (vector char)__b); 13216 } 13217 13218 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 13219 vector bool char __b) { 13220 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 13221 (vector char)__b); 13222 } 13223 13224 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 13225 vector short __b) { 13226 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 13227 } 13228 13229 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 13230 vector bool short __b) { 13231 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 13232 } 13233 13234 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 13235 vector unsigned short __b) { 13236 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 13237 (vector short)__b); 13238 } 13239 13240 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 13241 vector bool short __b) { 13242 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 13243 (vector short)__b); 13244 } 13245 13246 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 13247 vector short __b) { 13248 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 13249 (vector short)__b); 13250 } 13251 13252 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 13253 vector unsigned short __b) { 13254 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 13255 (vector short)__b); 13256 } 13257 13258 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 13259 vector bool short __b) { 13260 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 13261 (vector short)__b); 13262 } 13263 13264 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 13265 vector pixel __b) { 13266 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 13267 (vector short)__b); 13268 } 13269 13270 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 13271 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 13272 } 13273 13274 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 13275 vector bool int __b) { 13276 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 13277 } 13278 13279 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 13280 vector unsigned int __b) { 13281 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 13282 (vector int)__b); 13283 } 13284 13285 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 13286 vector bool int __b) { 13287 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 13288 (vector int)__b); 13289 } 13290 13291 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 13292 vector int __b) { 13293 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 13294 (vector int)__b); 13295 } 13296 13297 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 13298 vector unsigned int __b) { 13299 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 13300 (vector int)__b); 13301 } 13302 13303 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 13304 vector bool int __b) { 13305 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 13306 (vector int)__b); 13307 } 13308 13309 #ifdef __POWER8_VECTOR__ 13310 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 13311 vector signed long long __b) { 13312 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 13313 } 13314 13315 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 13316 vector unsigned long long __b) { 13317 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 13318 (vector long long)__b); 13319 } 13320 13321 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 13322 vector bool long long __b) { 13323 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 13324 (vector signed long long)__b); 13325 } 13326 13327 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 13328 vector bool long long __b) { 13329 return __builtin_altivec_vcmpequd_p( 13330 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 13331 } 13332 13333 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 13334 vector signed long long __b) { 13335 return __builtin_altivec_vcmpequd_p( 13336 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 13337 } 13338 13339 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 13340 vector unsigned long long __b) { 13341 return __builtin_altivec_vcmpequd_p( 13342 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 13343 } 13344 13345 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 13346 vector bool long long __b) { 13347 return __builtin_altivec_vcmpequd_p( 13348 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 13349 } 13350 #endif 13351 13352 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 13353 vector float __b) { 13354 #ifdef __VSX__ 13355 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 13356 #else 13357 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 13358 #endif 13359 } 13360 13361 #ifdef __VSX__ 13362 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 13363 vector double __b) { 13364 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 13365 } 13366 #endif 13367 13368 /* vec_any_ge */ 13369 13370 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 13371 vector signed char __b) { 13372 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 13373 } 13374 13375 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 13376 vector bool char __b) { 13377 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 13378 __a); 13379 } 13380 13381 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 13382 vector unsigned char __b) { 13383 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 13384 } 13385 13386 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 13387 vector bool char __b) { 13388 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 13389 __a); 13390 } 13391 13392 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 13393 vector signed char __b) { 13394 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 13395 (vector unsigned char)__a); 13396 } 13397 13398 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 13399 vector unsigned char __b) { 13400 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 13401 (vector unsigned char)__a); 13402 } 13403 13404 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 13405 vector bool char __b) { 13406 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 13407 (vector unsigned char)__a); 13408 } 13409 13410 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 13411 vector short __b) { 13412 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 13413 } 13414 13415 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 13416 vector bool short __b) { 13417 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 13418 } 13419 13420 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 13421 vector unsigned short __b) { 13422 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 13423 } 13424 13425 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 13426 vector bool short __b) { 13427 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 13428 __a); 13429 } 13430 13431 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 13432 vector short __b) { 13433 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 13434 (vector unsigned short)__a); 13435 } 13436 13437 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 13438 vector unsigned short __b) { 13439 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 13440 (vector unsigned short)__a); 13441 } 13442 13443 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 13444 vector bool short __b) { 13445 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 13446 (vector unsigned short)__a); 13447 } 13448 13449 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 13450 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 13451 } 13452 13453 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 13454 vector bool int __b) { 13455 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 13456 } 13457 13458 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 13459 vector unsigned int __b) { 13460 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 13461 } 13462 13463 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 13464 vector bool int __b) { 13465 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 13466 __a); 13467 } 13468 13469 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 13470 vector int __b) { 13471 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 13472 (vector unsigned int)__a); 13473 } 13474 13475 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 13476 vector unsigned int __b) { 13477 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 13478 (vector unsigned int)__a); 13479 } 13480 13481 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 13482 vector bool int __b) { 13483 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 13484 (vector unsigned int)__a); 13485 } 13486 13487 #ifdef __POWER8_VECTOR__ 13488 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 13489 vector signed long long __b) { 13490 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 13491 } 13492 13493 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 13494 vector unsigned long long __b) { 13495 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 13496 } 13497 13498 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 13499 vector bool long long __b) { 13500 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 13501 (vector signed long long)__b, __a); 13502 } 13503 13504 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 13505 vector bool long long __b) { 13506 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 13507 (vector unsigned long long)__b, __a); 13508 } 13509 13510 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 13511 vector signed long long __b) { 13512 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 13513 (vector unsigned long long)__b, 13514 (vector unsigned long long)__a); 13515 } 13516 13517 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 13518 vector unsigned long long __b) { 13519 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 13520 (vector unsigned long long)__a); 13521 } 13522 13523 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 13524 vector bool long long __b) { 13525 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 13526 (vector unsigned long long)__b, 13527 (vector unsigned long long)__a); 13528 } 13529 #endif 13530 13531 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 13532 vector float __b) { 13533 #ifdef __VSX__ 13534 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 13535 #else 13536 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 13537 #endif 13538 } 13539 13540 #ifdef __VSX__ 13541 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 13542 vector double __b) { 13543 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 13544 } 13545 #endif 13546 13547 /* vec_any_gt */ 13548 13549 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 13550 vector signed char __b) { 13551 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 13552 } 13553 13554 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 13555 vector bool char __b) { 13556 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 13557 (vector signed char)__b); 13558 } 13559 13560 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 13561 vector unsigned char __b) { 13562 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 13563 } 13564 13565 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 13566 vector bool char __b) { 13567 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 13568 (vector unsigned char)__b); 13569 } 13570 13571 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 13572 vector signed char __b) { 13573 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 13574 (vector unsigned char)__b); 13575 } 13576 13577 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 13578 vector unsigned char __b) { 13579 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 13580 __b); 13581 } 13582 13583 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 13584 vector bool char __b) { 13585 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 13586 (vector unsigned char)__b); 13587 } 13588 13589 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 13590 vector short __b) { 13591 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 13592 } 13593 13594 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 13595 vector bool short __b) { 13596 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 13597 } 13598 13599 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 13600 vector unsigned short __b) { 13601 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 13602 } 13603 13604 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 13605 vector bool short __b) { 13606 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 13607 (vector unsigned short)__b); 13608 } 13609 13610 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 13611 vector short __b) { 13612 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 13613 (vector unsigned short)__b); 13614 } 13615 13616 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 13617 vector unsigned short __b) { 13618 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 13619 __b); 13620 } 13621 13622 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 13623 vector bool short __b) { 13624 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 13625 (vector unsigned short)__b); 13626 } 13627 13628 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 13629 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 13630 } 13631 13632 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 13633 vector bool int __b) { 13634 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 13635 } 13636 13637 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 13638 vector unsigned int __b) { 13639 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 13640 } 13641 13642 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 13643 vector bool int __b) { 13644 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 13645 (vector unsigned int)__b); 13646 } 13647 13648 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 13649 vector int __b) { 13650 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 13651 (vector unsigned int)__b); 13652 } 13653 13654 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 13655 vector unsigned int __b) { 13656 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 13657 __b); 13658 } 13659 13660 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 13661 vector bool int __b) { 13662 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 13663 (vector unsigned int)__b); 13664 } 13665 13666 #ifdef __POWER8_VECTOR__ 13667 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 13668 vector signed long long __b) { 13669 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 13670 } 13671 13672 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 13673 vector unsigned long long __b) { 13674 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 13675 } 13676 13677 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 13678 vector bool long long __b) { 13679 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 13680 (vector signed long long)__b); 13681 } 13682 13683 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 13684 vector bool long long __b) { 13685 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 13686 (vector unsigned long long)__b); 13687 } 13688 13689 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 13690 vector signed long long __b) { 13691 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 13692 (vector unsigned long long)__a, 13693 (vector unsigned long long)__b); 13694 } 13695 13696 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 13697 vector unsigned long long __b) { 13698 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 13699 (vector unsigned long long)__a, __b); 13700 } 13701 13702 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 13703 vector bool long long __b) { 13704 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 13705 (vector unsigned long long)__a, 13706 (vector unsigned long long)__b); 13707 } 13708 #endif 13709 13710 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 13711 vector float __b) { 13712 #ifdef __VSX__ 13713 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 13714 #else 13715 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 13716 #endif 13717 } 13718 13719 #ifdef __VSX__ 13720 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 13721 vector double __b) { 13722 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 13723 } 13724 #endif 13725 13726 /* vec_any_le */ 13727 13728 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 13729 vector signed char __b) { 13730 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 13731 } 13732 13733 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 13734 vector bool char __b) { 13735 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 13736 (vector signed char)__b); 13737 } 13738 13739 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 13740 vector unsigned char __b) { 13741 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 13742 } 13743 13744 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 13745 vector bool char __b) { 13746 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 13747 (vector unsigned char)__b); 13748 } 13749 13750 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 13751 vector signed char __b) { 13752 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 13753 (vector unsigned char)__b); 13754 } 13755 13756 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 13757 vector unsigned char __b) { 13758 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 13759 __b); 13760 } 13761 13762 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 13763 vector bool char __b) { 13764 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 13765 (vector unsigned char)__b); 13766 } 13767 13768 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 13769 vector short __b) { 13770 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 13771 } 13772 13773 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 13774 vector bool short __b) { 13775 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 13776 } 13777 13778 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 13779 vector unsigned short __b) { 13780 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 13781 } 13782 13783 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 13784 vector bool short __b) { 13785 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 13786 (vector unsigned short)__b); 13787 } 13788 13789 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 13790 vector short __b) { 13791 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 13792 (vector unsigned short)__b); 13793 } 13794 13795 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 13796 vector unsigned short __b) { 13797 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 13798 __b); 13799 } 13800 13801 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 13802 vector bool short __b) { 13803 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 13804 (vector unsigned short)__b); 13805 } 13806 13807 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 13808 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 13809 } 13810 13811 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 13812 vector bool int __b) { 13813 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 13814 } 13815 13816 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 13817 vector unsigned int __b) { 13818 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 13819 } 13820 13821 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 13822 vector bool int __b) { 13823 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 13824 (vector unsigned int)__b); 13825 } 13826 13827 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 13828 vector int __b) { 13829 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 13830 (vector unsigned int)__b); 13831 } 13832 13833 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 13834 vector unsigned int __b) { 13835 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 13836 __b); 13837 } 13838 13839 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 13840 vector bool int __b) { 13841 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 13842 (vector unsigned int)__b); 13843 } 13844 13845 #ifdef __POWER8_VECTOR__ 13846 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 13847 vector signed long long __b) { 13848 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 13849 } 13850 13851 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 13852 vector unsigned long long __b) { 13853 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 13854 } 13855 13856 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 13857 vector bool long long __b) { 13858 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 13859 (vector signed long long)__b); 13860 } 13861 13862 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 13863 vector bool long long __b) { 13864 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 13865 (vector unsigned long long)__b); 13866 } 13867 13868 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 13869 vector signed long long __b) { 13870 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 13871 (vector unsigned long long)__a, 13872 (vector unsigned long long)__b); 13873 } 13874 13875 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 13876 vector unsigned long long __b) { 13877 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 13878 (vector unsigned long long)__a, __b); 13879 } 13880 13881 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 13882 vector bool long long __b) { 13883 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 13884 (vector unsigned long long)__a, 13885 (vector unsigned long long)__b); 13886 } 13887 #endif 13888 13889 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 13890 vector float __b) { 13891 #ifdef __VSX__ 13892 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 13893 #else 13894 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 13895 #endif 13896 } 13897 13898 #ifdef __VSX__ 13899 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 13900 vector double __b) { 13901 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 13902 } 13903 #endif 13904 13905 /* vec_any_lt */ 13906 13907 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 13908 vector signed char __b) { 13909 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 13910 } 13911 13912 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 13913 vector bool char __b) { 13914 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 13915 __a); 13916 } 13917 13918 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 13919 vector unsigned char __b) { 13920 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 13921 } 13922 13923 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 13924 vector bool char __b) { 13925 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 13926 __a); 13927 } 13928 13929 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 13930 vector signed char __b) { 13931 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 13932 (vector unsigned char)__a); 13933 } 13934 13935 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 13936 vector unsigned char __b) { 13937 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 13938 (vector unsigned char)__a); 13939 } 13940 13941 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 13942 vector bool char __b) { 13943 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 13944 (vector unsigned char)__a); 13945 } 13946 13947 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 13948 vector short __b) { 13949 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 13950 } 13951 13952 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 13953 vector bool short __b) { 13954 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 13955 } 13956 13957 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 13958 vector unsigned short __b) { 13959 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 13960 } 13961 13962 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 13963 vector bool short __b) { 13964 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 13965 __a); 13966 } 13967 13968 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 13969 vector short __b) { 13970 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 13971 (vector unsigned short)__a); 13972 } 13973 13974 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 13975 vector unsigned short __b) { 13976 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 13977 (vector unsigned short)__a); 13978 } 13979 13980 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 13981 vector bool short __b) { 13982 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 13983 (vector unsigned short)__a); 13984 } 13985 13986 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 13987 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 13988 } 13989 13990 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 13991 vector bool int __b) { 13992 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 13993 } 13994 13995 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 13996 vector unsigned int __b) { 13997 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 13998 } 13999 14000 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 14001 vector bool int __b) { 14002 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 14003 __a); 14004 } 14005 14006 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 14007 vector int __b) { 14008 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 14009 (vector unsigned int)__a); 14010 } 14011 14012 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 14013 vector unsigned int __b) { 14014 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 14015 (vector unsigned int)__a); 14016 } 14017 14018 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 14019 vector bool int __b) { 14020 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 14021 (vector unsigned int)__a); 14022 } 14023 14024 #ifdef __POWER8_VECTOR__ 14025 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 14026 vector signed long long __b) { 14027 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 14028 } 14029 14030 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 14031 vector unsigned long long __b) { 14032 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 14033 } 14034 14035 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 14036 vector bool long long __b) { 14037 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 14038 (vector signed long long)__b, __a); 14039 } 14040 14041 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 14042 vector bool long long __b) { 14043 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 14044 (vector unsigned long long)__b, __a); 14045 } 14046 14047 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 14048 vector signed long long __b) { 14049 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 14050 (vector unsigned long long)__b, 14051 (vector unsigned long long)__a); 14052 } 14053 14054 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 14055 vector unsigned long long __b) { 14056 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 14057 (vector unsigned long long)__a); 14058 } 14059 14060 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 14061 vector bool long long __b) { 14062 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 14063 (vector unsigned long long)__b, 14064 (vector unsigned long long)__a); 14065 } 14066 #endif 14067 14068 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 14069 vector float __b) { 14070 #ifdef __VSX__ 14071 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 14072 #else 14073 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 14074 #endif 14075 } 14076 14077 #ifdef __VSX__ 14078 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 14079 vector double __b) { 14080 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 14081 } 14082 #endif 14083 14084 /* vec_any_nan */ 14085 14086 static __inline__ int __attribute__((__always_inline__)) 14087 vec_any_nan(vector float __a) { 14088 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 14089 } 14090 14091 /* vec_any_ne */ 14092 14093 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 14094 vector signed char __b) { 14095 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14096 (vector char)__b); 14097 } 14098 14099 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 14100 vector bool char __b) { 14101 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14102 (vector char)__b); 14103 } 14104 14105 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 14106 vector unsigned char __b) { 14107 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14108 (vector char)__b); 14109 } 14110 14111 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 14112 vector bool char __b) { 14113 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14114 (vector char)__b); 14115 } 14116 14117 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 14118 vector signed char __b) { 14119 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14120 (vector char)__b); 14121 } 14122 14123 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 14124 vector unsigned char __b) { 14125 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14126 (vector char)__b); 14127 } 14128 14129 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 14130 vector bool char __b) { 14131 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 14132 (vector char)__b); 14133 } 14134 14135 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 14136 vector short __b) { 14137 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 14138 } 14139 14140 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 14141 vector bool short __b) { 14142 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 14143 } 14144 14145 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 14146 vector unsigned short __b) { 14147 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 14148 (vector short)__b); 14149 } 14150 14151 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 14152 vector bool short __b) { 14153 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 14154 (vector short)__b); 14155 } 14156 14157 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 14158 vector short __b) { 14159 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 14160 (vector short)__b); 14161 } 14162 14163 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 14164 vector unsigned short __b) { 14165 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 14166 (vector short)__b); 14167 } 14168 14169 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 14170 vector bool short __b) { 14171 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 14172 (vector short)__b); 14173 } 14174 14175 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 14176 vector pixel __b) { 14177 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 14178 (vector short)__b); 14179 } 14180 14181 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 14182 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 14183 } 14184 14185 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 14186 vector bool int __b) { 14187 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 14188 } 14189 14190 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 14191 vector unsigned int __b) { 14192 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 14193 (vector int)__b); 14194 } 14195 14196 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 14197 vector bool int __b) { 14198 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 14199 (vector int)__b); 14200 } 14201 14202 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 14203 vector int __b) { 14204 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 14205 (vector int)__b); 14206 } 14207 14208 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 14209 vector unsigned int __b) { 14210 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 14211 (vector int)__b); 14212 } 14213 14214 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 14215 vector bool int __b) { 14216 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 14217 (vector int)__b); 14218 } 14219 14220 #ifdef __POWER8_VECTOR__ 14221 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 14222 vector signed long long __b) { 14223 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 14224 } 14225 14226 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 14227 vector unsigned long long __b) { 14228 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, 14229 (vector long long)__b); 14230 } 14231 14232 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 14233 vector bool long long __b) { 14234 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, 14235 (vector signed long long)__b); 14236 } 14237 14238 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 14239 vector bool long long __b) { 14240 return __builtin_altivec_vcmpequd_p( 14241 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 14242 } 14243 14244 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 14245 vector signed long long __b) { 14246 return __builtin_altivec_vcmpequd_p( 14247 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 14248 } 14249 14250 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 14251 vector unsigned long long __b) { 14252 return __builtin_altivec_vcmpequd_p( 14253 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 14254 } 14255 14256 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 14257 vector bool long long __b) { 14258 return __builtin_altivec_vcmpequd_p( 14259 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 14260 } 14261 #endif 14262 14263 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 14264 vector float __b) { 14265 #ifdef __VSX__ 14266 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 14267 #else 14268 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 14269 #endif 14270 } 14271 14272 #ifdef __VSX__ 14273 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 14274 vector double __b) { 14275 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 14276 } 14277 #endif 14278 14279 /* vec_any_nge */ 14280 14281 static __inline__ int __attribute__((__always_inline__)) 14282 vec_any_nge(vector float __a, vector float __b) { 14283 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 14284 } 14285 14286 /* vec_any_ngt */ 14287 14288 static __inline__ int __attribute__((__always_inline__)) 14289 vec_any_ngt(vector float __a, vector float __b) { 14290 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 14291 } 14292 14293 /* vec_any_nle */ 14294 14295 static __inline__ int __attribute__((__always_inline__)) 14296 vec_any_nle(vector float __a, vector float __b) { 14297 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 14298 } 14299 14300 /* vec_any_nlt */ 14301 14302 static __inline__ int __attribute__((__always_inline__)) 14303 vec_any_nlt(vector float __a, vector float __b) { 14304 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 14305 } 14306 14307 /* vec_any_numeric */ 14308 14309 static __inline__ int __attribute__((__always_inline__)) 14310 vec_any_numeric(vector float __a) { 14311 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 14312 } 14313 14314 /* vec_any_out */ 14315 14316 static __inline__ int __attribute__((__always_inline__)) 14317 vec_any_out(vector float __a, vector float __b) { 14318 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 14319 } 14320 14321 /* Power 8 Crypto functions 14322 Note: We diverge from the current GCC implementation with regard 14323 to cryptography and related functions as follows: 14324 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 14325 - The remaining ones are only available on Power8 and up so 14326 require -mpower8-vector 14327 The justification for this is that export requirements require that 14328 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 14329 support). As a result, we need to be able to turn off support for those. 14330 The remaining ones (currently controlled by -mcrypto for GCC) still 14331 need to be provided on compliant hardware even if Vector.Crypto is not 14332 provided. 14333 */ 14334 #ifdef __CRYPTO__ 14335 #define vec_sbox_be __builtin_altivec_crypto_vsbox 14336 #define vec_cipher_be __builtin_altivec_crypto_vcipher 14337 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 14338 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 14339 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 14340 14341 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 14342 __builtin_crypto_vsbox(vector unsigned long long __a) { 14343 return __builtin_altivec_crypto_vsbox(__a); 14344 } 14345 14346 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 14347 __builtin_crypto_vcipher(vector unsigned long long __a, 14348 vector unsigned long long __b) { 14349 return __builtin_altivec_crypto_vcipher(__a, __b); 14350 } 14351 14352 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 14353 __builtin_crypto_vcipherlast(vector unsigned long long __a, 14354 vector unsigned long long __b) { 14355 return __builtin_altivec_crypto_vcipherlast(__a, __b); 14356 } 14357 14358 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 14359 __builtin_crypto_vncipher(vector unsigned long long __a, 14360 vector unsigned long long __b) { 14361 return __builtin_altivec_crypto_vncipher(__a, __b); 14362 } 14363 14364 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 14365 __builtin_crypto_vncipherlast(vector unsigned long long __a, 14366 vector unsigned long long __b) { 14367 return __builtin_altivec_crypto_vncipherlast(__a, __b); 14368 } 14369 14370 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 14371 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 14372 14373 #define vec_shasigma_be(X, Y, Z) \ 14374 _Generic((X), vector unsigned int \ 14375 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 14376 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 14377 #endif 14378 14379 #ifdef __POWER8_VECTOR__ 14380 static __inline__ vector unsigned char __ATTRS_o_ai 14381 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 14382 vector unsigned char __c) { 14383 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 14384 } 14385 14386 static __inline__ vector unsigned short __ATTRS_o_ai 14387 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 14388 vector unsigned short __c) { 14389 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 14390 (vector unsigned char)__a, (vector unsigned char)__b, 14391 (vector unsigned char)__c); 14392 } 14393 14394 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 14395 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 14396 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 14397 (vector unsigned char)__a, (vector unsigned char)__b, 14398 (vector unsigned char)__c); 14399 } 14400 14401 static __inline__ vector unsigned long long __ATTRS_o_ai 14402 __builtin_crypto_vpermxor(vector unsigned long long __a, 14403 vector unsigned long long __b, 14404 vector unsigned long long __c) { 14405 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 14406 (vector unsigned char)__a, (vector unsigned char)__b, 14407 (vector unsigned char)__c); 14408 } 14409 14410 static __inline__ vector unsigned char __ATTRS_o_ai 14411 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 14412 return __builtin_altivec_crypto_vpmsumb(__a, __b); 14413 } 14414 14415 static __inline__ vector unsigned short __ATTRS_o_ai 14416 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 14417 return __builtin_altivec_crypto_vpmsumh(__a, __b); 14418 } 14419 14420 static __inline__ vector unsigned int __ATTRS_o_ai 14421 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 14422 return __builtin_altivec_crypto_vpmsumw(__a, __b); 14423 } 14424 14425 static __inline__ vector unsigned long long __ATTRS_o_ai 14426 __builtin_crypto_vpmsumb(vector unsigned long long __a, 14427 vector unsigned long long __b) { 14428 return __builtin_altivec_crypto_vpmsumd(__a, __b); 14429 } 14430 14431 static __inline__ vector signed char __ATTRS_o_ai 14432 vec_vgbbd(vector signed char __a) { 14433 return __builtin_altivec_vgbbd((vector unsigned char)__a); 14434 } 14435 14436 #define vec_pmsum_be __builtin_crypto_vpmsumb 14437 #define vec_gb __builtin_altivec_vgbbd 14438 14439 static __inline__ vector unsigned char __ATTRS_o_ai 14440 vec_vgbbd(vector unsigned char __a) { 14441 return __builtin_altivec_vgbbd(__a); 14442 } 14443 14444 static __inline__ vector long long __ATTRS_o_ai 14445 vec_vbpermq(vector signed char __a, vector signed char __b) { 14446 return __builtin_altivec_vbpermq((vector unsigned char)__a, 14447 (vector unsigned char)__b); 14448 } 14449 14450 static __inline__ vector long long __ATTRS_o_ai 14451 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 14452 return __builtin_altivec_vbpermq(__a, __b); 14453 } 14454 14455 #ifdef __powerpc64__ 14456 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 14457 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 14458 return __builtin_altivec_vbpermq((vector unsigned char)__a, 14459 (vector unsigned char)__b); 14460 } 14461 #endif 14462 #endif 14463 14464 #undef __ATTRS_o_ai 14465 14466 #endif /* __ALTIVEC_H */ 14467