1 /*===---- altivec.h - Standard header for type generic math ---------------===*\ 2 * 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 * See https://llvm.org/LICENSE.txt for license information. 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 * 7 \*===----------------------------------------------------------------------===*/ 8 9 #ifndef __ALTIVEC_H 10 #define __ALTIVEC_H 11 12 #ifndef __ALTIVEC__ 13 #error "AltiVec support not enabled" 14 #endif 15 16 /* Constants for mapping CR6 bits to predicate result. */ 17 18 #define __CR6_EQ 0 19 #define __CR6_EQ_REV 1 20 #define __CR6_LT 2 21 #define __CR6_LT_REV 3 22 23 /* Constants for vec_test_data_class */ 24 #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0) 25 #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1) 26 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \ 27 __VEC_CLASS_FP_SUBNORMAL_N) 28 #define __VEC_CLASS_FP_ZERO_N (1<<2) 29 #define __VEC_CLASS_FP_ZERO_P (1<<3) 30 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \ 31 __VEC_CLASS_FP_ZERO_N) 32 #define __VEC_CLASS_FP_INFINITY_N (1<<4) 33 #define __VEC_CLASS_FP_INFINITY_P (1<<5) 34 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \ 35 __VEC_CLASS_FP_INFINITY_N) 36 #define __VEC_CLASS_FP_NAN (1<<6) 37 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \ 38 __VEC_CLASS_FP_SUBNORMAL | \ 39 __VEC_CLASS_FP_ZERO | \ 40 __VEC_CLASS_FP_INFINITY) 41 42 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) 43 44 #ifdef __POWER9_VECTOR__ 45 #include <stddef.h> 46 #endif 47 48 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 49 vector signed char __a, vector signed char __b, vector unsigned char __c); 50 51 static __inline__ vector unsigned char __ATTRS_o_ai 52 vec_perm(vector unsigned char __a, vector unsigned char __b, 53 vector unsigned char __c); 54 55 static __inline__ vector bool char __ATTRS_o_ai 56 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); 57 58 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 59 vector signed short __b, 60 vector unsigned char __c); 61 62 static __inline__ vector unsigned short __ATTRS_o_ai 63 vec_perm(vector unsigned short __a, vector unsigned short __b, 64 vector unsigned char __c); 65 66 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 67 vector bool short __a, vector bool short __b, vector unsigned char __c); 68 69 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 70 vector pixel __b, 71 vector unsigned char __c); 72 73 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 74 vector signed int __b, 75 vector unsigned char __c); 76 77 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( 78 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); 79 80 static __inline__ vector bool int __ATTRS_o_ai 81 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); 82 83 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 84 vector float __b, 85 vector unsigned char __c); 86 87 #ifdef __VSX__ 88 static __inline__ vector long long __ATTRS_o_ai 89 vec_perm(vector signed long long __a, vector signed long long __b, 90 vector unsigned char __c); 91 92 static __inline__ vector unsigned long long __ATTRS_o_ai 93 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 94 vector unsigned char __c); 95 96 static __inline__ vector bool long long __ATTRS_o_ai 97 vec_perm(vector bool long long __a, vector bool long long __b, 98 vector unsigned char __c); 99 100 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, 101 vector double __b, 102 vector unsigned char __c); 103 #endif 104 105 static __inline__ vector unsigned char __ATTRS_o_ai 106 vec_xor(vector unsigned char __a, vector unsigned char __b); 107 108 /* vec_abs */ 109 110 #define __builtin_altivec_abs_v16qi vec_abs 111 #define __builtin_altivec_abs_v8hi vec_abs 112 #define __builtin_altivec_abs_v4si vec_abs 113 114 static __inline__ vector signed char __ATTRS_o_ai 115 vec_abs(vector signed char __a) { 116 return __builtin_altivec_vmaxsb(__a, -__a); 117 } 118 119 static __inline__ vector signed short __ATTRS_o_ai 120 vec_abs(vector signed short __a) { 121 return __builtin_altivec_vmaxsh(__a, -__a); 122 } 123 124 static __inline__ vector signed int __ATTRS_o_ai 125 vec_abs(vector signed int __a) { 126 return __builtin_altivec_vmaxsw(__a, -__a); 127 } 128 129 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 130 static __inline__ vector signed long long __ATTRS_o_ai 131 vec_abs(vector signed long long __a) { 132 return __builtin_altivec_vmaxsd(__a, -__a); 133 } 134 #endif 135 136 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { 137 #ifdef __VSX__ 138 return __builtin_vsx_xvabssp(__a); 139 #else 140 vector unsigned int __res = 141 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); 142 return (vector float)__res; 143 #endif 144 } 145 146 #ifdef __VSX__ 147 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { 148 return __builtin_vsx_xvabsdp(__a); 149 } 150 #endif 151 152 /* vec_abss */ 153 #define __builtin_altivec_abss_v16qi vec_abss 154 #define __builtin_altivec_abss_v8hi vec_abss 155 #define __builtin_altivec_abss_v4si vec_abss 156 157 static __inline__ vector signed char __ATTRS_o_ai 158 vec_abss(vector signed char __a) { 159 return __builtin_altivec_vmaxsb( 160 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); 161 } 162 163 static __inline__ vector signed short __ATTRS_o_ai 164 vec_abss(vector signed short __a) { 165 return __builtin_altivec_vmaxsh( 166 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); 167 } 168 169 static __inline__ vector signed int __ATTRS_o_ai 170 vec_abss(vector signed int __a) { 171 return __builtin_altivec_vmaxsw( 172 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); 173 } 174 175 /* vec_absd */ 176 #if defined(__POWER9_VECTOR__) 177 178 static __inline__ vector unsigned char __ATTRS_o_ai 179 vec_absd(vector unsigned char __a, vector unsigned char __b) { 180 return __builtin_altivec_vabsdub(__a, __b); 181 } 182 183 static __inline__ vector unsigned short __ATTRS_o_ai 184 vec_absd(vector unsigned short __a, vector unsigned short __b) { 185 return __builtin_altivec_vabsduh(__a, __b); 186 } 187 188 static __inline__ vector unsigned int __ATTRS_o_ai 189 vec_absd(vector unsigned int __a, vector unsigned int __b) { 190 return __builtin_altivec_vabsduw(__a, __b); 191 } 192 193 #endif /* End __POWER9_VECTOR__ */ 194 195 /* vec_add */ 196 197 static __inline__ vector signed char __ATTRS_o_ai 198 vec_add(vector signed char __a, vector signed char __b) { 199 return __a + __b; 200 } 201 202 static __inline__ vector signed char __ATTRS_o_ai 203 vec_add(vector bool char __a, vector signed char __b) { 204 return (vector signed char)__a + __b; 205 } 206 207 static __inline__ vector signed char __ATTRS_o_ai 208 vec_add(vector signed char __a, vector bool char __b) { 209 return __a + (vector signed char)__b; 210 } 211 212 static __inline__ vector unsigned char __ATTRS_o_ai 213 vec_add(vector unsigned char __a, vector unsigned char __b) { 214 return __a + __b; 215 } 216 217 static __inline__ vector unsigned char __ATTRS_o_ai 218 vec_add(vector bool char __a, vector unsigned char __b) { 219 return (vector unsigned char)__a + __b; 220 } 221 222 static __inline__ vector unsigned char __ATTRS_o_ai 223 vec_add(vector unsigned char __a, vector bool char __b) { 224 return __a + (vector unsigned char)__b; 225 } 226 227 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 228 vector short __b) { 229 return __a + __b; 230 } 231 232 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, 233 vector short __b) { 234 return (vector short)__a + __b; 235 } 236 237 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 238 vector bool short __b) { 239 return __a + (vector short)__b; 240 } 241 242 static __inline__ vector unsigned short __ATTRS_o_ai 243 vec_add(vector unsigned short __a, vector unsigned short __b) { 244 return __a + __b; 245 } 246 247 static __inline__ vector unsigned short __ATTRS_o_ai 248 vec_add(vector bool short __a, vector unsigned short __b) { 249 return (vector unsigned short)__a + __b; 250 } 251 252 static __inline__ vector unsigned short __ATTRS_o_ai 253 vec_add(vector unsigned short __a, vector bool short __b) { 254 return __a + (vector unsigned short)__b; 255 } 256 257 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 258 vector int __b) { 259 return __a + __b; 260 } 261 262 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, 263 vector int __b) { 264 return (vector int)__a + __b; 265 } 266 267 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 268 vector bool int __b) { 269 return __a + (vector int)__b; 270 } 271 272 static __inline__ vector unsigned int __ATTRS_o_ai 273 vec_add(vector unsigned int __a, vector unsigned int __b) { 274 return __a + __b; 275 } 276 277 static __inline__ vector unsigned int __ATTRS_o_ai 278 vec_add(vector bool int __a, vector unsigned int __b) { 279 return (vector unsigned int)__a + __b; 280 } 281 282 static __inline__ vector unsigned int __ATTRS_o_ai 283 vec_add(vector unsigned int __a, vector bool int __b) { 284 return __a + (vector unsigned int)__b; 285 } 286 287 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 288 static __inline__ vector signed long long __ATTRS_o_ai 289 vec_add(vector signed long long __a, vector signed long long __b) { 290 return __a + __b; 291 } 292 293 static __inline__ vector unsigned long long __ATTRS_o_ai 294 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 295 return __a + __b; 296 } 297 298 static __inline__ vector signed __int128 __ATTRS_o_ai 299 vec_add(vector signed __int128 __a, vector signed __int128 __b) { 300 return __a + __b; 301 } 302 303 static __inline__ vector unsigned __int128 __ATTRS_o_ai 304 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { 305 return __a + __b; 306 } 307 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 308 309 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 310 vector float __b) { 311 return __a + __b; 312 } 313 314 #ifdef __VSX__ 315 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 316 vector double __b) { 317 return __a + __b; 318 } 319 #endif // __VSX__ 320 321 /* vec_adde */ 322 323 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 324 static __inline__ vector signed __int128 __ATTRS_o_ai 325 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 326 vector signed __int128 __c) { 327 return __builtin_altivec_vaddeuqm(__a, __b, __c); 328 } 329 330 static __inline__ vector unsigned __int128 __ATTRS_o_ai 331 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 332 vector unsigned __int128 __c) { 333 return __builtin_altivec_vaddeuqm(__a, __b, __c); 334 } 335 #endif 336 337 static __inline__ vector signed int __ATTRS_o_ai 338 vec_adde(vector signed int __a, vector signed int __b, 339 vector signed int __c) { 340 vector signed int __mask = {1, 1, 1, 1}; 341 vector signed int __carry = __c & __mask; 342 return vec_add(vec_add(__a, __b), __carry); 343 } 344 345 static __inline__ vector unsigned int __ATTRS_o_ai 346 vec_adde(vector unsigned int __a, vector unsigned int __b, 347 vector unsigned int __c) { 348 vector unsigned int __mask = {1, 1, 1, 1}; 349 vector unsigned int __carry = __c & __mask; 350 return vec_add(vec_add(__a, __b), __carry); 351 } 352 353 /* vec_addec */ 354 355 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 356 static __inline__ vector signed __int128 __ATTRS_o_ai 357 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 358 vector signed __int128 __c) { 359 return __builtin_altivec_vaddecuq(__a, __b, __c); 360 } 361 362 static __inline__ vector unsigned __int128 __ATTRS_o_ai 363 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 364 vector unsigned __int128 __c) { 365 return __builtin_altivec_vaddecuq(__a, __b, __c); 366 } 367 368 static __inline__ vector signed int __ATTRS_o_ai 369 vec_addec(vector signed int __a, vector signed int __b, 370 vector signed int __c) { 371 372 signed int __result[4]; 373 for (int i = 0; i < 4; i++) { 374 unsigned int __tempa = (unsigned int) __a[i]; 375 unsigned int __tempb = (unsigned int) __b[i]; 376 unsigned int __tempc = (unsigned int) __c[i]; 377 __tempc = __tempc & 0x00000001; 378 unsigned long long __longa = (unsigned long long) __tempa; 379 unsigned long long __longb = (unsigned long long) __tempb; 380 unsigned long long __longc = (unsigned long long) __tempc; 381 unsigned long long __sum = __longa + __longb + __longc; 382 unsigned long long __res = (__sum >> 32) & 0x01; 383 unsigned long long __tempres = (unsigned int) __res; 384 __result[i] = (signed int) __tempres; 385 } 386 387 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; 388 return ret; 389 } 390 391 static __inline__ vector unsigned int __ATTRS_o_ai 392 vec_addec(vector unsigned int __a, vector unsigned int __b, 393 vector unsigned int __c) { 394 395 unsigned int __result[4]; 396 for (int i = 0; i < 4; i++) { 397 unsigned int __tempc = __c[i] & 1; 398 unsigned long long __longa = (unsigned long long) __a[i]; 399 unsigned long long __longb = (unsigned long long) __b[i]; 400 unsigned long long __longc = (unsigned long long) __tempc; 401 unsigned long long __sum = __longa + __longb + __longc; 402 unsigned long long __res = (__sum >> 32) & 0x01; 403 unsigned long long __tempres = (unsigned int) __res; 404 __result[i] = (signed int) __tempres; 405 } 406 407 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; 408 return ret; 409 } 410 411 #endif 412 413 /* vec_vaddubm */ 414 415 #define __builtin_altivec_vaddubm vec_vaddubm 416 417 static __inline__ vector signed char __ATTRS_o_ai 418 vec_vaddubm(vector signed char __a, vector signed char __b) { 419 return __a + __b; 420 } 421 422 static __inline__ vector signed char __ATTRS_o_ai 423 vec_vaddubm(vector bool char __a, vector signed char __b) { 424 return (vector signed char)__a + __b; 425 } 426 427 static __inline__ vector signed char __ATTRS_o_ai 428 vec_vaddubm(vector signed char __a, vector bool char __b) { 429 return __a + (vector signed char)__b; 430 } 431 432 static __inline__ vector unsigned char __ATTRS_o_ai 433 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 434 return __a + __b; 435 } 436 437 static __inline__ vector unsigned char __ATTRS_o_ai 438 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 439 return (vector unsigned char)__a + __b; 440 } 441 442 static __inline__ vector unsigned char __ATTRS_o_ai 443 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 444 return __a + (vector unsigned char)__b; 445 } 446 447 /* vec_vadduhm */ 448 449 #define __builtin_altivec_vadduhm vec_vadduhm 450 451 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 452 vector short __b) { 453 return __a + __b; 454 } 455 456 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 457 vector short __b) { 458 return (vector short)__a + __b; 459 } 460 461 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 462 vector bool short __b) { 463 return __a + (vector short)__b; 464 } 465 466 static __inline__ vector unsigned short __ATTRS_o_ai 467 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 468 return __a + __b; 469 } 470 471 static __inline__ vector unsigned short __ATTRS_o_ai 472 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 473 return (vector unsigned short)__a + __b; 474 } 475 476 static __inline__ vector unsigned short __ATTRS_o_ai 477 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 478 return __a + (vector unsigned short)__b; 479 } 480 481 /* vec_vadduwm */ 482 483 #define __builtin_altivec_vadduwm vec_vadduwm 484 485 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 486 vector int __b) { 487 return __a + __b; 488 } 489 490 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 491 vector int __b) { 492 return (vector int)__a + __b; 493 } 494 495 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 496 vector bool int __b) { 497 return __a + (vector int)__b; 498 } 499 500 static __inline__ vector unsigned int __ATTRS_o_ai 501 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 502 return __a + __b; 503 } 504 505 static __inline__ vector unsigned int __ATTRS_o_ai 506 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 507 return (vector unsigned int)__a + __b; 508 } 509 510 static __inline__ vector unsigned int __ATTRS_o_ai 511 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 512 return __a + (vector unsigned int)__b; 513 } 514 515 /* vec_vaddfp */ 516 517 #define __builtin_altivec_vaddfp vec_vaddfp 518 519 static __inline__ vector float __attribute__((__always_inline__)) 520 vec_vaddfp(vector float __a, vector float __b) { 521 return __a + __b; 522 } 523 524 /* vec_addc */ 525 526 static __inline__ vector signed int __ATTRS_o_ai 527 vec_addc(vector signed int __a, vector signed int __b) { 528 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 529 (vector unsigned int)__b); 530 } 531 532 static __inline__ vector unsigned int __ATTRS_o_ai 533 vec_addc(vector unsigned int __a, vector unsigned int __b) { 534 return __builtin_altivec_vaddcuw(__a, __b); 535 } 536 537 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 538 static __inline__ vector signed __int128 __ATTRS_o_ai 539 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 540 return (vector signed __int128)__builtin_altivec_vaddcuq( 541 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 542 } 543 544 static __inline__ vector unsigned __int128 __ATTRS_o_ai 545 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 546 return __builtin_altivec_vaddcuq(__a, __b); 547 } 548 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 549 550 /* vec_vaddcuw */ 551 552 static __inline__ vector unsigned int __attribute__((__always_inline__)) 553 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 554 return __builtin_altivec_vaddcuw(__a, __b); 555 } 556 557 /* vec_adds */ 558 559 static __inline__ vector signed char __ATTRS_o_ai 560 vec_adds(vector signed char __a, vector signed char __b) { 561 return __builtin_altivec_vaddsbs(__a, __b); 562 } 563 564 static __inline__ vector signed char __ATTRS_o_ai 565 vec_adds(vector bool char __a, vector signed char __b) { 566 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 567 } 568 569 static __inline__ vector signed char __ATTRS_o_ai 570 vec_adds(vector signed char __a, vector bool char __b) { 571 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 572 } 573 574 static __inline__ vector unsigned char __ATTRS_o_ai 575 vec_adds(vector unsigned char __a, vector unsigned char __b) { 576 return __builtin_altivec_vaddubs(__a, __b); 577 } 578 579 static __inline__ vector unsigned char __ATTRS_o_ai 580 vec_adds(vector bool char __a, vector unsigned char __b) { 581 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 582 } 583 584 static __inline__ vector unsigned char __ATTRS_o_ai 585 vec_adds(vector unsigned char __a, vector bool char __b) { 586 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 587 } 588 589 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 590 vector short __b) { 591 return __builtin_altivec_vaddshs(__a, __b); 592 } 593 594 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 595 vector short __b) { 596 return __builtin_altivec_vaddshs((vector short)__a, __b); 597 } 598 599 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 600 vector bool short __b) { 601 return __builtin_altivec_vaddshs(__a, (vector short)__b); 602 } 603 604 static __inline__ vector unsigned short __ATTRS_o_ai 605 vec_adds(vector unsigned short __a, vector unsigned short __b) { 606 return __builtin_altivec_vadduhs(__a, __b); 607 } 608 609 static __inline__ vector unsigned short __ATTRS_o_ai 610 vec_adds(vector bool short __a, vector unsigned short __b) { 611 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 612 } 613 614 static __inline__ vector unsigned short __ATTRS_o_ai 615 vec_adds(vector unsigned short __a, vector bool short __b) { 616 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 617 } 618 619 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 620 vector int __b) { 621 return __builtin_altivec_vaddsws(__a, __b); 622 } 623 624 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 625 vector int __b) { 626 return __builtin_altivec_vaddsws((vector int)__a, __b); 627 } 628 629 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 630 vector bool int __b) { 631 return __builtin_altivec_vaddsws(__a, (vector int)__b); 632 } 633 634 static __inline__ vector unsigned int __ATTRS_o_ai 635 vec_adds(vector unsigned int __a, vector unsigned int __b) { 636 return __builtin_altivec_vadduws(__a, __b); 637 } 638 639 static __inline__ vector unsigned int __ATTRS_o_ai 640 vec_adds(vector bool int __a, vector unsigned int __b) { 641 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 642 } 643 644 static __inline__ vector unsigned int __ATTRS_o_ai 645 vec_adds(vector unsigned int __a, vector bool int __b) { 646 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 647 } 648 649 /* vec_vaddsbs */ 650 651 static __inline__ vector signed char __ATTRS_o_ai 652 vec_vaddsbs(vector signed char __a, vector signed char __b) { 653 return __builtin_altivec_vaddsbs(__a, __b); 654 } 655 656 static __inline__ vector signed char __ATTRS_o_ai 657 vec_vaddsbs(vector bool char __a, vector signed char __b) { 658 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 659 } 660 661 static __inline__ vector signed char __ATTRS_o_ai 662 vec_vaddsbs(vector signed char __a, vector bool char __b) { 663 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 664 } 665 666 /* vec_vaddubs */ 667 668 static __inline__ vector unsigned char __ATTRS_o_ai 669 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 670 return __builtin_altivec_vaddubs(__a, __b); 671 } 672 673 static __inline__ vector unsigned char __ATTRS_o_ai 674 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 675 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 676 } 677 678 static __inline__ vector unsigned char __ATTRS_o_ai 679 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 680 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 681 } 682 683 /* vec_vaddshs */ 684 685 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 686 vector short __b) { 687 return __builtin_altivec_vaddshs(__a, __b); 688 } 689 690 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 691 vector short __b) { 692 return __builtin_altivec_vaddshs((vector short)__a, __b); 693 } 694 695 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 696 vector bool short __b) { 697 return __builtin_altivec_vaddshs(__a, (vector short)__b); 698 } 699 700 /* vec_vadduhs */ 701 702 static __inline__ vector unsigned short __ATTRS_o_ai 703 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 704 return __builtin_altivec_vadduhs(__a, __b); 705 } 706 707 static __inline__ vector unsigned short __ATTRS_o_ai 708 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 709 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 710 } 711 712 static __inline__ vector unsigned short __ATTRS_o_ai 713 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 714 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 715 } 716 717 /* vec_vaddsws */ 718 719 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 720 vector int __b) { 721 return __builtin_altivec_vaddsws(__a, __b); 722 } 723 724 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 725 vector int __b) { 726 return __builtin_altivec_vaddsws((vector int)__a, __b); 727 } 728 729 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 730 vector bool int __b) { 731 return __builtin_altivec_vaddsws(__a, (vector int)__b); 732 } 733 734 /* vec_vadduws */ 735 736 static __inline__ vector unsigned int __ATTRS_o_ai 737 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 738 return __builtin_altivec_vadduws(__a, __b); 739 } 740 741 static __inline__ vector unsigned int __ATTRS_o_ai 742 vec_vadduws(vector bool int __a, vector unsigned int __b) { 743 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 744 } 745 746 static __inline__ vector unsigned int __ATTRS_o_ai 747 vec_vadduws(vector unsigned int __a, vector bool int __b) { 748 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 749 } 750 751 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 752 /* vec_vadduqm */ 753 754 static __inline__ vector signed __int128 __ATTRS_o_ai 755 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 756 return __a + __b; 757 } 758 759 static __inline__ vector unsigned __int128 __ATTRS_o_ai 760 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 761 return __a + __b; 762 } 763 764 /* vec_vaddeuqm */ 765 766 static __inline__ vector signed __int128 __ATTRS_o_ai 767 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 768 vector signed __int128 __c) { 769 return __builtin_altivec_vaddeuqm(__a, __b, __c); 770 } 771 772 static __inline__ vector unsigned __int128 __ATTRS_o_ai 773 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 774 vector unsigned __int128 __c) { 775 return __builtin_altivec_vaddeuqm(__a, __b, __c); 776 } 777 778 /* vec_vaddcuq */ 779 780 static __inline__ vector signed __int128 __ATTRS_o_ai 781 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 782 return __builtin_altivec_vaddcuq(__a, __b); 783 } 784 785 static __inline__ vector unsigned __int128 __ATTRS_o_ai 786 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 787 return __builtin_altivec_vaddcuq(__a, __b); 788 } 789 790 /* vec_vaddecuq */ 791 792 static __inline__ vector signed __int128 __ATTRS_o_ai 793 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 794 vector signed __int128 __c) { 795 return __builtin_altivec_vaddecuq(__a, __b, __c); 796 } 797 798 static __inline__ vector unsigned __int128 __ATTRS_o_ai 799 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 800 vector unsigned __int128 __c) { 801 return __builtin_altivec_vaddecuq(__a, __b, __c); 802 } 803 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 804 805 /* vec_and */ 806 807 #define __builtin_altivec_vand vec_and 808 809 static __inline__ vector signed char __ATTRS_o_ai 810 vec_and(vector signed char __a, vector signed char __b) { 811 return __a & __b; 812 } 813 814 static __inline__ vector signed char __ATTRS_o_ai 815 vec_and(vector bool char __a, vector signed char __b) { 816 return (vector signed char)__a & __b; 817 } 818 819 static __inline__ vector signed char __ATTRS_o_ai 820 vec_and(vector signed char __a, vector bool char __b) { 821 return __a & (vector signed char)__b; 822 } 823 824 static __inline__ vector unsigned char __ATTRS_o_ai 825 vec_and(vector unsigned char __a, vector unsigned char __b) { 826 return __a & __b; 827 } 828 829 static __inline__ vector unsigned char __ATTRS_o_ai 830 vec_and(vector bool char __a, vector unsigned char __b) { 831 return (vector unsigned char)__a & __b; 832 } 833 834 static __inline__ vector unsigned char __ATTRS_o_ai 835 vec_and(vector unsigned char __a, vector bool char __b) { 836 return __a & (vector unsigned char)__b; 837 } 838 839 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 840 vector bool char __b) { 841 return __a & __b; 842 } 843 844 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 845 vector short __b) { 846 return __a & __b; 847 } 848 849 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 850 vector short __b) { 851 return (vector short)__a & __b; 852 } 853 854 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 855 vector bool short __b) { 856 return __a & (vector short)__b; 857 } 858 859 static __inline__ vector unsigned short __ATTRS_o_ai 860 vec_and(vector unsigned short __a, vector unsigned short __b) { 861 return __a & __b; 862 } 863 864 static __inline__ vector unsigned short __ATTRS_o_ai 865 vec_and(vector bool short __a, vector unsigned short __b) { 866 return (vector unsigned short)__a & __b; 867 } 868 869 static __inline__ vector unsigned short __ATTRS_o_ai 870 vec_and(vector unsigned short __a, vector bool short __b) { 871 return __a & (vector unsigned short)__b; 872 } 873 874 static __inline__ vector bool short __ATTRS_o_ai 875 vec_and(vector bool short __a, vector bool short __b) { 876 return __a & __b; 877 } 878 879 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 880 vector int __b) { 881 return __a & __b; 882 } 883 884 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 885 vector int __b) { 886 return (vector int)__a & __b; 887 } 888 889 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 890 vector bool int __b) { 891 return __a & (vector int)__b; 892 } 893 894 static __inline__ vector unsigned int __ATTRS_o_ai 895 vec_and(vector unsigned int __a, vector unsigned int __b) { 896 return __a & __b; 897 } 898 899 static __inline__ vector unsigned int __ATTRS_o_ai 900 vec_and(vector bool int __a, vector unsigned int __b) { 901 return (vector unsigned int)__a & __b; 902 } 903 904 static __inline__ vector unsigned int __ATTRS_o_ai 905 vec_and(vector unsigned int __a, vector bool int __b) { 906 return __a & (vector unsigned int)__b; 907 } 908 909 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 910 vector bool int __b) { 911 return __a & __b; 912 } 913 914 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 915 vector float __b) { 916 vector unsigned int __res = 917 (vector unsigned int)__a & (vector unsigned int)__b; 918 return (vector float)__res; 919 } 920 921 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 922 vector float __b) { 923 vector unsigned int __res = 924 (vector unsigned int)__a & (vector unsigned int)__b; 925 return (vector float)__res; 926 } 927 928 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 929 vector bool int __b) { 930 vector unsigned int __res = 931 (vector unsigned int)__a & (vector unsigned int)__b; 932 return (vector float)__res; 933 } 934 935 #ifdef __VSX__ 936 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 937 vector double __b) { 938 vector unsigned long long __res = 939 (vector unsigned long long)__a & (vector unsigned long long)__b; 940 return (vector double)__res; 941 } 942 943 static __inline__ vector double __ATTRS_o_ai 944 vec_and(vector double __a, vector bool long long __b) { 945 vector unsigned long long __res = 946 (vector unsigned long long)__a & (vector unsigned long long)__b; 947 return (vector double)__res; 948 } 949 950 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 951 vector double __b) { 952 vector unsigned long long __res = 953 (vector unsigned long long)__a & (vector unsigned long long)__b; 954 return (vector double)__res; 955 } 956 957 static __inline__ vector signed long long __ATTRS_o_ai 958 vec_and(vector signed long long __a, vector signed long long __b) { 959 return __a & __b; 960 } 961 962 static __inline__ vector signed long long __ATTRS_o_ai 963 vec_and(vector bool long long __a, vector signed long long __b) { 964 return (vector signed long long)__a & __b; 965 } 966 967 static __inline__ vector signed long long __ATTRS_o_ai 968 vec_and(vector signed long long __a, vector bool long long __b) { 969 return __a & (vector signed long long)__b; 970 } 971 972 static __inline__ vector unsigned long long __ATTRS_o_ai 973 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 974 return __a & __b; 975 } 976 977 static __inline__ vector unsigned long long __ATTRS_o_ai 978 vec_and(vector bool long long __a, vector unsigned long long __b) { 979 return (vector unsigned long long)__a & __b; 980 } 981 982 static __inline__ vector unsigned long long __ATTRS_o_ai 983 vec_and(vector unsigned long long __a, vector bool long long __b) { 984 return __a & (vector unsigned long long)__b; 985 } 986 987 static __inline__ vector bool long long __ATTRS_o_ai 988 vec_and(vector bool long long __a, vector bool long long __b) { 989 return __a & __b; 990 } 991 #endif 992 993 /* vec_vand */ 994 995 static __inline__ vector signed char __ATTRS_o_ai 996 vec_vand(vector signed char __a, vector signed char __b) { 997 return __a & __b; 998 } 999 1000 static __inline__ vector signed char __ATTRS_o_ai 1001 vec_vand(vector bool char __a, vector signed char __b) { 1002 return (vector signed char)__a & __b; 1003 } 1004 1005 static __inline__ vector signed char __ATTRS_o_ai 1006 vec_vand(vector signed char __a, vector bool char __b) { 1007 return __a & (vector signed char)__b; 1008 } 1009 1010 static __inline__ vector unsigned char __ATTRS_o_ai 1011 vec_vand(vector unsigned char __a, vector unsigned char __b) { 1012 return __a & __b; 1013 } 1014 1015 static __inline__ vector unsigned char __ATTRS_o_ai 1016 vec_vand(vector bool char __a, vector unsigned char __b) { 1017 return (vector unsigned char)__a & __b; 1018 } 1019 1020 static __inline__ vector unsigned char __ATTRS_o_ai 1021 vec_vand(vector unsigned char __a, vector bool char __b) { 1022 return __a & (vector unsigned char)__b; 1023 } 1024 1025 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 1026 vector bool char __b) { 1027 return __a & __b; 1028 } 1029 1030 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1031 vector short __b) { 1032 return __a & __b; 1033 } 1034 1035 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 1036 vector short __b) { 1037 return (vector short)__a & __b; 1038 } 1039 1040 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1041 vector bool short __b) { 1042 return __a & (vector short)__b; 1043 } 1044 1045 static __inline__ vector unsigned short __ATTRS_o_ai 1046 vec_vand(vector unsigned short __a, vector unsigned short __b) { 1047 return __a & __b; 1048 } 1049 1050 static __inline__ vector unsigned short __ATTRS_o_ai 1051 vec_vand(vector bool short __a, vector unsigned short __b) { 1052 return (vector unsigned short)__a & __b; 1053 } 1054 1055 static __inline__ vector unsigned short __ATTRS_o_ai 1056 vec_vand(vector unsigned short __a, vector bool short __b) { 1057 return __a & (vector unsigned short)__b; 1058 } 1059 1060 static __inline__ vector bool short __ATTRS_o_ai 1061 vec_vand(vector bool short __a, vector bool short __b) { 1062 return __a & __b; 1063 } 1064 1065 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1066 vector int __b) { 1067 return __a & __b; 1068 } 1069 1070 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 1071 vector int __b) { 1072 return (vector int)__a & __b; 1073 } 1074 1075 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1076 vector bool int __b) { 1077 return __a & (vector int)__b; 1078 } 1079 1080 static __inline__ vector unsigned int __ATTRS_o_ai 1081 vec_vand(vector unsigned int __a, vector unsigned int __b) { 1082 return __a & __b; 1083 } 1084 1085 static __inline__ vector unsigned int __ATTRS_o_ai 1086 vec_vand(vector bool int __a, vector unsigned int __b) { 1087 return (vector unsigned int)__a & __b; 1088 } 1089 1090 static __inline__ vector unsigned int __ATTRS_o_ai 1091 vec_vand(vector unsigned int __a, vector bool int __b) { 1092 return __a & (vector unsigned int)__b; 1093 } 1094 1095 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1096 vector bool int __b) { 1097 return __a & __b; 1098 } 1099 1100 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1101 vector float __b) { 1102 vector unsigned int __res = 1103 (vector unsigned int)__a & (vector unsigned int)__b; 1104 return (vector float)__res; 1105 } 1106 1107 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1108 vector float __b) { 1109 vector unsigned int __res = 1110 (vector unsigned int)__a & (vector unsigned int)__b; 1111 return (vector float)__res; 1112 } 1113 1114 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1115 vector bool int __b) { 1116 vector unsigned int __res = 1117 (vector unsigned int)__a & (vector unsigned int)__b; 1118 return (vector float)__res; 1119 } 1120 1121 #ifdef __VSX__ 1122 static __inline__ vector signed long long __ATTRS_o_ai 1123 vec_vand(vector signed long long __a, vector signed long long __b) { 1124 return __a & __b; 1125 } 1126 1127 static __inline__ vector signed long long __ATTRS_o_ai 1128 vec_vand(vector bool long long __a, vector signed long long __b) { 1129 return (vector signed long long)__a & __b; 1130 } 1131 1132 static __inline__ vector signed long long __ATTRS_o_ai 1133 vec_vand(vector signed long long __a, vector bool long long __b) { 1134 return __a & (vector signed long long)__b; 1135 } 1136 1137 static __inline__ vector unsigned long long __ATTRS_o_ai 1138 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1139 return __a & __b; 1140 } 1141 1142 static __inline__ vector unsigned long long __ATTRS_o_ai 1143 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1144 return (vector unsigned long long)__a & __b; 1145 } 1146 1147 static __inline__ vector unsigned long long __ATTRS_o_ai 1148 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1149 return __a & (vector unsigned long long)__b; 1150 } 1151 1152 static __inline__ vector bool long long __ATTRS_o_ai 1153 vec_vand(vector bool long long __a, vector bool long long __b) { 1154 return __a & __b; 1155 } 1156 #endif 1157 1158 /* vec_andc */ 1159 1160 #define __builtin_altivec_vandc vec_andc 1161 1162 static __inline__ vector signed char __ATTRS_o_ai 1163 vec_andc(vector signed char __a, vector signed char __b) { 1164 return __a & ~__b; 1165 } 1166 1167 static __inline__ vector signed char __ATTRS_o_ai 1168 vec_andc(vector bool char __a, vector signed char __b) { 1169 return (vector signed char)__a & ~__b; 1170 } 1171 1172 static __inline__ vector signed char __ATTRS_o_ai 1173 vec_andc(vector signed char __a, vector bool char __b) { 1174 return __a & ~(vector signed char)__b; 1175 } 1176 1177 static __inline__ vector unsigned char __ATTRS_o_ai 1178 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1179 return __a & ~__b; 1180 } 1181 1182 static __inline__ vector unsigned char __ATTRS_o_ai 1183 vec_andc(vector bool char __a, vector unsigned char __b) { 1184 return (vector unsigned char)__a & ~__b; 1185 } 1186 1187 static __inline__ vector unsigned char __ATTRS_o_ai 1188 vec_andc(vector unsigned char __a, vector bool char __b) { 1189 return __a & ~(vector unsigned char)__b; 1190 } 1191 1192 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1193 vector bool char __b) { 1194 return __a & ~__b; 1195 } 1196 1197 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1198 vector short __b) { 1199 return __a & ~__b; 1200 } 1201 1202 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1203 vector short __b) { 1204 return (vector short)__a & ~__b; 1205 } 1206 1207 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1208 vector bool short __b) { 1209 return __a & ~(vector short)__b; 1210 } 1211 1212 static __inline__ vector unsigned short __ATTRS_o_ai 1213 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1214 return __a & ~__b; 1215 } 1216 1217 static __inline__ vector unsigned short __ATTRS_o_ai 1218 vec_andc(vector bool short __a, vector unsigned short __b) { 1219 return (vector unsigned short)__a & ~__b; 1220 } 1221 1222 static __inline__ vector unsigned short __ATTRS_o_ai 1223 vec_andc(vector unsigned short __a, vector bool short __b) { 1224 return __a & ~(vector unsigned short)__b; 1225 } 1226 1227 static __inline__ vector bool short __ATTRS_o_ai 1228 vec_andc(vector bool short __a, vector bool short __b) { 1229 return __a & ~__b; 1230 } 1231 1232 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1233 vector int __b) { 1234 return __a & ~__b; 1235 } 1236 1237 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1238 vector int __b) { 1239 return (vector int)__a & ~__b; 1240 } 1241 1242 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1243 vector bool int __b) { 1244 return __a & ~(vector int)__b; 1245 } 1246 1247 static __inline__ vector unsigned int __ATTRS_o_ai 1248 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1249 return __a & ~__b; 1250 } 1251 1252 static __inline__ vector unsigned int __ATTRS_o_ai 1253 vec_andc(vector bool int __a, vector unsigned int __b) { 1254 return (vector unsigned int)__a & ~__b; 1255 } 1256 1257 static __inline__ vector unsigned int __ATTRS_o_ai 1258 vec_andc(vector unsigned int __a, vector bool int __b) { 1259 return __a & ~(vector unsigned int)__b; 1260 } 1261 1262 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1263 vector bool int __b) { 1264 return __a & ~__b; 1265 } 1266 1267 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1268 vector float __b) { 1269 vector unsigned int __res = 1270 (vector unsigned int)__a & ~(vector unsigned int)__b; 1271 return (vector float)__res; 1272 } 1273 1274 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1275 vector float __b) { 1276 vector unsigned int __res = 1277 (vector unsigned int)__a & ~(vector unsigned int)__b; 1278 return (vector float)__res; 1279 } 1280 1281 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1282 vector bool int __b) { 1283 vector unsigned int __res = 1284 (vector unsigned int)__a & ~(vector unsigned int)__b; 1285 return (vector float)__res; 1286 } 1287 1288 #ifdef __VSX__ 1289 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1290 vector double __b) { 1291 vector unsigned long long __res = 1292 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1293 return (vector double)__res; 1294 } 1295 1296 static __inline__ vector double __ATTRS_o_ai 1297 vec_andc(vector double __a, vector bool long long __b) { 1298 vector unsigned long long __res = 1299 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1300 return (vector double)__res; 1301 } 1302 1303 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1304 vector double __b) { 1305 vector unsigned long long __res = 1306 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1307 return (vector double)__res; 1308 } 1309 1310 static __inline__ vector signed long long __ATTRS_o_ai 1311 vec_andc(vector signed long long __a, vector signed long long __b) { 1312 return __a & ~__b; 1313 } 1314 1315 static __inline__ vector signed long long __ATTRS_o_ai 1316 vec_andc(vector bool long long __a, vector signed long long __b) { 1317 return (vector signed long long)__a & ~__b; 1318 } 1319 1320 static __inline__ vector signed long long __ATTRS_o_ai 1321 vec_andc(vector signed long long __a, vector bool long long __b) { 1322 return __a & ~(vector signed long long)__b; 1323 } 1324 1325 static __inline__ vector unsigned long long __ATTRS_o_ai 1326 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1327 return __a & ~__b; 1328 } 1329 1330 static __inline__ vector unsigned long long __ATTRS_o_ai 1331 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1332 return (vector unsigned long long)__a & ~__b; 1333 } 1334 1335 static __inline__ vector unsigned long long __ATTRS_o_ai 1336 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1337 return __a & ~(vector unsigned long long)__b; 1338 } 1339 1340 static __inline__ vector bool long long __ATTRS_o_ai 1341 vec_andc(vector bool long long __a, vector bool long long __b) { 1342 return __a & ~__b; 1343 } 1344 #endif 1345 1346 /* vec_vandc */ 1347 1348 static __inline__ vector signed char __ATTRS_o_ai 1349 vec_vandc(vector signed char __a, vector signed char __b) { 1350 return __a & ~__b; 1351 } 1352 1353 static __inline__ vector signed char __ATTRS_o_ai 1354 vec_vandc(vector bool char __a, vector signed char __b) { 1355 return (vector signed char)__a & ~__b; 1356 } 1357 1358 static __inline__ vector signed char __ATTRS_o_ai 1359 vec_vandc(vector signed char __a, vector bool char __b) { 1360 return __a & ~(vector signed char)__b; 1361 } 1362 1363 static __inline__ vector unsigned char __ATTRS_o_ai 1364 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1365 return __a & ~__b; 1366 } 1367 1368 static __inline__ vector unsigned char __ATTRS_o_ai 1369 vec_vandc(vector bool char __a, vector unsigned char __b) { 1370 return (vector unsigned char)__a & ~__b; 1371 } 1372 1373 static __inline__ vector unsigned char __ATTRS_o_ai 1374 vec_vandc(vector unsigned char __a, vector bool char __b) { 1375 return __a & ~(vector unsigned char)__b; 1376 } 1377 1378 static __inline__ vector bool char __ATTRS_o_ai 1379 vec_vandc(vector bool char __a, vector bool char __b) { 1380 return __a & ~__b; 1381 } 1382 1383 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1384 vector short __b) { 1385 return __a & ~__b; 1386 } 1387 1388 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1389 vector short __b) { 1390 return (vector short)__a & ~__b; 1391 } 1392 1393 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1394 vector bool short __b) { 1395 return __a & ~(vector short)__b; 1396 } 1397 1398 static __inline__ vector unsigned short __ATTRS_o_ai 1399 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1400 return __a & ~__b; 1401 } 1402 1403 static __inline__ vector unsigned short __ATTRS_o_ai 1404 vec_vandc(vector bool short __a, vector unsigned short __b) { 1405 return (vector unsigned short)__a & ~__b; 1406 } 1407 1408 static __inline__ vector unsigned short __ATTRS_o_ai 1409 vec_vandc(vector unsigned short __a, vector bool short __b) { 1410 return __a & ~(vector unsigned short)__b; 1411 } 1412 1413 static __inline__ vector bool short __ATTRS_o_ai 1414 vec_vandc(vector bool short __a, vector bool short __b) { 1415 return __a & ~__b; 1416 } 1417 1418 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1419 vector int __b) { 1420 return __a & ~__b; 1421 } 1422 1423 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1424 vector int __b) { 1425 return (vector int)__a & ~__b; 1426 } 1427 1428 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1429 vector bool int __b) { 1430 return __a & ~(vector int)__b; 1431 } 1432 1433 static __inline__ vector unsigned int __ATTRS_o_ai 1434 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1435 return __a & ~__b; 1436 } 1437 1438 static __inline__ vector unsigned int __ATTRS_o_ai 1439 vec_vandc(vector bool int __a, vector unsigned int __b) { 1440 return (vector unsigned int)__a & ~__b; 1441 } 1442 1443 static __inline__ vector unsigned int __ATTRS_o_ai 1444 vec_vandc(vector unsigned int __a, vector bool int __b) { 1445 return __a & ~(vector unsigned int)__b; 1446 } 1447 1448 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1449 vector bool int __b) { 1450 return __a & ~__b; 1451 } 1452 1453 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1454 vector float __b) { 1455 vector unsigned int __res = 1456 (vector unsigned int)__a & ~(vector unsigned int)__b; 1457 return (vector float)__res; 1458 } 1459 1460 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1461 vector float __b) { 1462 vector unsigned int __res = 1463 (vector unsigned int)__a & ~(vector unsigned int)__b; 1464 return (vector float)__res; 1465 } 1466 1467 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1468 vector bool int __b) { 1469 vector unsigned int __res = 1470 (vector unsigned int)__a & ~(vector unsigned int)__b; 1471 return (vector float)__res; 1472 } 1473 1474 #ifdef __VSX__ 1475 static __inline__ vector signed long long __ATTRS_o_ai 1476 vec_vandc(vector signed long long __a, vector signed long long __b) { 1477 return __a & ~__b; 1478 } 1479 1480 static __inline__ vector signed long long __ATTRS_o_ai 1481 vec_vandc(vector bool long long __a, vector signed long long __b) { 1482 return (vector signed long long)__a & ~__b; 1483 } 1484 1485 static __inline__ vector signed long long __ATTRS_o_ai 1486 vec_vandc(vector signed long long __a, vector bool long long __b) { 1487 return __a & ~(vector signed long long)__b; 1488 } 1489 1490 static __inline__ vector unsigned long long __ATTRS_o_ai 1491 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1492 return __a & ~__b; 1493 } 1494 1495 static __inline__ vector unsigned long long __ATTRS_o_ai 1496 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1497 return (vector unsigned long long)__a & ~__b; 1498 } 1499 1500 static __inline__ vector unsigned long long __ATTRS_o_ai 1501 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1502 return __a & ~(vector unsigned long long)__b; 1503 } 1504 1505 static __inline__ vector bool long long __ATTRS_o_ai 1506 vec_vandc(vector bool long long __a, vector bool long long __b) { 1507 return __a & ~__b; 1508 } 1509 #endif 1510 1511 /* vec_avg */ 1512 1513 static __inline__ vector signed char __ATTRS_o_ai 1514 vec_avg(vector signed char __a, vector signed char __b) { 1515 return __builtin_altivec_vavgsb(__a, __b); 1516 } 1517 1518 static __inline__ vector unsigned char __ATTRS_o_ai 1519 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1520 return __builtin_altivec_vavgub(__a, __b); 1521 } 1522 1523 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1524 vector short __b) { 1525 return __builtin_altivec_vavgsh(__a, __b); 1526 } 1527 1528 static __inline__ vector unsigned short __ATTRS_o_ai 1529 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1530 return __builtin_altivec_vavguh(__a, __b); 1531 } 1532 1533 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1534 vector int __b) { 1535 return __builtin_altivec_vavgsw(__a, __b); 1536 } 1537 1538 static __inline__ vector unsigned int __ATTRS_o_ai 1539 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1540 return __builtin_altivec_vavguw(__a, __b); 1541 } 1542 1543 /* vec_vavgsb */ 1544 1545 static __inline__ vector signed char __attribute__((__always_inline__)) 1546 vec_vavgsb(vector signed char __a, vector signed char __b) { 1547 return __builtin_altivec_vavgsb(__a, __b); 1548 } 1549 1550 /* vec_vavgub */ 1551 1552 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1553 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1554 return __builtin_altivec_vavgub(__a, __b); 1555 } 1556 1557 /* vec_vavgsh */ 1558 1559 static __inline__ vector short __attribute__((__always_inline__)) 1560 vec_vavgsh(vector short __a, vector short __b) { 1561 return __builtin_altivec_vavgsh(__a, __b); 1562 } 1563 1564 /* vec_vavguh */ 1565 1566 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1567 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1568 return __builtin_altivec_vavguh(__a, __b); 1569 } 1570 1571 /* vec_vavgsw */ 1572 1573 static __inline__ vector int __attribute__((__always_inline__)) 1574 vec_vavgsw(vector int __a, vector int __b) { 1575 return __builtin_altivec_vavgsw(__a, __b); 1576 } 1577 1578 /* vec_vavguw */ 1579 1580 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1581 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1582 return __builtin_altivec_vavguw(__a, __b); 1583 } 1584 1585 /* vec_ceil */ 1586 1587 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1588 #ifdef __VSX__ 1589 return __builtin_vsx_xvrspip(__a); 1590 #else 1591 return __builtin_altivec_vrfip(__a); 1592 #endif 1593 } 1594 1595 #ifdef __VSX__ 1596 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1597 return __builtin_vsx_xvrdpip(__a); 1598 } 1599 #endif 1600 1601 /* vec_vrfip */ 1602 1603 static __inline__ vector float __attribute__((__always_inline__)) 1604 vec_vrfip(vector float __a) { 1605 return __builtin_altivec_vrfip(__a); 1606 } 1607 1608 /* vec_cmpb */ 1609 1610 static __inline__ vector int __attribute__((__always_inline__)) 1611 vec_cmpb(vector float __a, vector float __b) { 1612 return __builtin_altivec_vcmpbfp(__a, __b); 1613 } 1614 1615 /* vec_vcmpbfp */ 1616 1617 static __inline__ vector int __attribute__((__always_inline__)) 1618 vec_vcmpbfp(vector float __a, vector float __b) { 1619 return __builtin_altivec_vcmpbfp(__a, __b); 1620 } 1621 1622 /* vec_cmpeq */ 1623 1624 static __inline__ vector bool char __ATTRS_o_ai 1625 vec_cmpeq(vector signed char __a, vector signed char __b) { 1626 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1627 (vector char)__b); 1628 } 1629 1630 static __inline__ vector bool char __ATTRS_o_ai 1631 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1632 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1633 (vector char)__b); 1634 } 1635 1636 static __inline__ vector bool char __ATTRS_o_ai 1637 vec_cmpeq(vector bool char __a, vector bool char __b) { 1638 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1639 (vector char)__b); 1640 } 1641 1642 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1643 vector short __b) { 1644 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1645 } 1646 1647 static __inline__ vector bool short __ATTRS_o_ai 1648 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1649 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1650 (vector short)__b); 1651 } 1652 1653 static __inline__ vector bool short __ATTRS_o_ai 1654 vec_cmpeq(vector bool short __a, vector bool short __b) { 1655 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1656 (vector short)__b); 1657 } 1658 1659 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1660 vector int __b) { 1661 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1662 } 1663 1664 static __inline__ vector bool int __ATTRS_o_ai 1665 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1666 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1667 (vector int)__b); 1668 } 1669 1670 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, 1671 vector bool int __b) { 1672 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1673 (vector int)__b); 1674 } 1675 1676 #ifdef __POWER8_VECTOR__ 1677 static __inline__ vector bool long long __ATTRS_o_ai 1678 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1679 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1680 } 1681 1682 static __inline__ vector bool long long __ATTRS_o_ai 1683 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1684 return (vector bool long long)__builtin_altivec_vcmpequd( 1685 (vector long long)__a, (vector long long)__b); 1686 } 1687 1688 static __inline__ vector bool long long __ATTRS_o_ai 1689 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1690 return (vector bool long long)__builtin_altivec_vcmpequd( 1691 (vector long long)__a, (vector long long)__b); 1692 } 1693 1694 #endif 1695 1696 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1697 vector float __b) { 1698 #ifdef __VSX__ 1699 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1700 #else 1701 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1702 #endif 1703 } 1704 1705 #ifdef __VSX__ 1706 static __inline__ vector bool long long __ATTRS_o_ai 1707 vec_cmpeq(vector double __a, vector double __b) { 1708 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1709 } 1710 #endif 1711 1712 #ifdef __POWER9_VECTOR__ 1713 /* vec_cmpne */ 1714 1715 static __inline__ vector bool char __ATTRS_o_ai 1716 vec_cmpne(vector bool char __a, vector bool char __b) { 1717 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1718 (vector char)__b); 1719 } 1720 1721 static __inline__ vector bool char __ATTRS_o_ai 1722 vec_cmpne(vector signed char __a, vector signed char __b) { 1723 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1724 (vector char)__b); 1725 } 1726 1727 static __inline__ vector bool char __ATTRS_o_ai 1728 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1729 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1730 (vector char)__b); 1731 } 1732 1733 static __inline__ vector bool short __ATTRS_o_ai 1734 vec_cmpne(vector bool short __a, vector bool short __b) { 1735 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1736 (vector short)__b); 1737 } 1738 1739 static __inline__ vector bool short __ATTRS_o_ai 1740 vec_cmpne(vector signed short __a, vector signed short __b) { 1741 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1742 (vector short)__b); 1743 } 1744 1745 static __inline__ vector bool short __ATTRS_o_ai 1746 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1747 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1748 (vector short)__b); 1749 } 1750 1751 static __inline__ vector bool int __ATTRS_o_ai 1752 vec_cmpne(vector bool int __a, vector bool int __b) { 1753 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1754 (vector int)__b); 1755 } 1756 1757 static __inline__ vector bool int __ATTRS_o_ai 1758 vec_cmpne(vector signed int __a, vector signed int __b) { 1759 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1760 (vector int)__b); 1761 } 1762 1763 static __inline__ vector bool int __ATTRS_o_ai 1764 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1765 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1766 (vector int)__b); 1767 } 1768 1769 static __inline__ vector bool int __ATTRS_o_ai 1770 vec_cmpne(vector float __a, vector float __b) { 1771 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1772 (vector int)__b); 1773 } 1774 1775 /* vec_cmpnez */ 1776 1777 static __inline__ vector bool char __ATTRS_o_ai 1778 vec_cmpnez(vector signed char __a, vector signed char __b) { 1779 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1780 (vector char)__b); 1781 } 1782 1783 static __inline__ vector bool char __ATTRS_o_ai 1784 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1785 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1786 (vector char)__b); 1787 } 1788 1789 static __inline__ vector bool short __ATTRS_o_ai 1790 vec_cmpnez(vector signed short __a, vector signed short __b) { 1791 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1792 (vector short)__b); 1793 } 1794 1795 static __inline__ vector bool short __ATTRS_o_ai 1796 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1797 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1798 (vector short)__b); 1799 } 1800 1801 static __inline__ vector bool int __ATTRS_o_ai 1802 vec_cmpnez(vector signed int __a, vector signed int __b) { 1803 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1804 (vector int)__b); 1805 } 1806 1807 static __inline__ vector bool int __ATTRS_o_ai 1808 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1809 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1810 (vector int)__b); 1811 } 1812 1813 static __inline__ signed int __ATTRS_o_ai 1814 vec_cntlz_lsbb(vector signed char __a) { 1815 #ifdef __LITTLE_ENDIAN__ 1816 return __builtin_altivec_vctzlsbb(__a); 1817 #else 1818 return __builtin_altivec_vclzlsbb(__a); 1819 #endif 1820 } 1821 1822 static __inline__ signed int __ATTRS_o_ai 1823 vec_cntlz_lsbb(vector unsigned char __a) { 1824 #ifdef __LITTLE_ENDIAN__ 1825 return __builtin_altivec_vctzlsbb(__a); 1826 #else 1827 return __builtin_altivec_vclzlsbb(__a); 1828 #endif 1829 } 1830 1831 static __inline__ signed int __ATTRS_o_ai 1832 vec_cnttz_lsbb(vector signed char __a) { 1833 #ifdef __LITTLE_ENDIAN__ 1834 return __builtin_altivec_vclzlsbb(__a); 1835 #else 1836 return __builtin_altivec_vctzlsbb(__a); 1837 #endif 1838 } 1839 1840 static __inline__ signed int __ATTRS_o_ai 1841 vec_cnttz_lsbb(vector unsigned char __a) { 1842 #ifdef __LITTLE_ENDIAN__ 1843 return __builtin_altivec_vclzlsbb(__a); 1844 #else 1845 return __builtin_altivec_vctzlsbb(__a); 1846 #endif 1847 } 1848 1849 static __inline__ vector unsigned int __ATTRS_o_ai 1850 vec_parity_lsbb(vector unsigned int __a) { 1851 return __builtin_altivec_vprtybw(__a); 1852 } 1853 1854 static __inline__ vector unsigned int __ATTRS_o_ai 1855 vec_parity_lsbb(vector signed int __a) { 1856 return __builtin_altivec_vprtybw(__a); 1857 } 1858 1859 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1860 vec_parity_lsbb(vector unsigned __int128 __a) { 1861 return __builtin_altivec_vprtybq(__a); 1862 } 1863 1864 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1865 vec_parity_lsbb(vector signed __int128 __a) { 1866 return __builtin_altivec_vprtybq(__a); 1867 } 1868 1869 static __inline__ vector unsigned long long __ATTRS_o_ai 1870 vec_parity_lsbb(vector unsigned long long __a) { 1871 return __builtin_altivec_vprtybd(__a); 1872 } 1873 1874 static __inline__ vector unsigned long long __ATTRS_o_ai 1875 vec_parity_lsbb(vector signed long long __a) { 1876 return __builtin_altivec_vprtybd(__a); 1877 } 1878 1879 #else 1880 /* vec_cmpne */ 1881 1882 static __inline__ vector bool char __ATTRS_o_ai 1883 vec_cmpne(vector bool char __a, vector bool char __b) { 1884 return ~(vec_cmpeq(__a, __b)); 1885 } 1886 1887 static __inline__ vector bool char __ATTRS_o_ai 1888 vec_cmpne(vector signed char __a, vector signed char __b) { 1889 return ~(vec_cmpeq(__a, __b)); 1890 } 1891 1892 static __inline__ vector bool char __ATTRS_o_ai 1893 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1894 return ~(vec_cmpeq(__a, __b)); 1895 } 1896 1897 static __inline__ vector bool short __ATTRS_o_ai 1898 vec_cmpne(vector bool short __a, vector bool short __b) { 1899 return ~(vec_cmpeq(__a, __b)); 1900 } 1901 1902 static __inline__ vector bool short __ATTRS_o_ai 1903 vec_cmpne(vector signed short __a, vector signed short __b) { 1904 return ~(vec_cmpeq(__a, __b)); 1905 } 1906 1907 static __inline__ vector bool short __ATTRS_o_ai 1908 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1909 return ~(vec_cmpeq(__a, __b)); 1910 } 1911 1912 static __inline__ vector bool int __ATTRS_o_ai 1913 vec_cmpne(vector bool int __a, vector bool int __b) { 1914 return ~(vec_cmpeq(__a, __b)); 1915 } 1916 1917 static __inline__ vector bool int __ATTRS_o_ai 1918 vec_cmpne(vector signed int __a, vector signed int __b) { 1919 return ~(vec_cmpeq(__a, __b)); 1920 } 1921 1922 static __inline__ vector bool int __ATTRS_o_ai 1923 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1924 return ~(vec_cmpeq(__a, __b)); 1925 } 1926 1927 static __inline__ vector bool int __ATTRS_o_ai 1928 vec_cmpne(vector float __a, vector float __b) { 1929 return ~(vec_cmpeq(__a, __b)); 1930 } 1931 #endif 1932 1933 #ifdef __POWER8_VECTOR__ 1934 static __inline__ vector bool long long __ATTRS_o_ai 1935 vec_cmpne(vector bool long long __a, vector bool long long __b) { 1936 return (vector bool long long) 1937 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1938 } 1939 1940 static __inline__ vector bool long long __ATTRS_o_ai 1941 vec_cmpne(vector signed long long __a, vector signed long long __b) { 1942 return (vector bool long long) 1943 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1944 } 1945 1946 static __inline__ vector bool long long __ATTRS_o_ai 1947 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 1948 return (vector bool long long) 1949 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1950 } 1951 #endif 1952 1953 #ifdef __VSX__ 1954 static __inline__ vector bool long long __ATTRS_o_ai 1955 vec_cmpne(vector double __a, vector double __b) { 1956 return (vector bool long long) 1957 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1958 } 1959 #endif 1960 1961 /* vec_cmpgt */ 1962 1963 static __inline__ vector bool char __ATTRS_o_ai 1964 vec_cmpgt(vector signed char __a, vector signed char __b) { 1965 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 1966 } 1967 1968 static __inline__ vector bool char __ATTRS_o_ai 1969 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 1970 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 1971 } 1972 1973 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 1974 vector short __b) { 1975 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 1976 } 1977 1978 static __inline__ vector bool short __ATTRS_o_ai 1979 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 1980 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 1981 } 1982 1983 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 1984 vector int __b) { 1985 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 1986 } 1987 1988 static __inline__ vector bool int __ATTRS_o_ai 1989 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 1990 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 1991 } 1992 1993 #ifdef __POWER8_VECTOR__ 1994 static __inline__ vector bool long long __ATTRS_o_ai 1995 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 1996 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 1997 } 1998 1999 static __inline__ vector bool long long __ATTRS_o_ai 2000 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2001 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2002 } 2003 #endif 2004 2005 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2006 vector float __b) { 2007 #ifdef __VSX__ 2008 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2009 #else 2010 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2011 #endif 2012 } 2013 2014 #ifdef __VSX__ 2015 static __inline__ vector bool long long __ATTRS_o_ai 2016 vec_cmpgt(vector double __a, vector double __b) { 2017 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2018 } 2019 #endif 2020 2021 /* vec_cmpge */ 2022 2023 static __inline__ vector bool char __ATTRS_o_ai 2024 vec_cmpge(vector signed char __a, vector signed char __b) { 2025 return ~(vec_cmpgt(__b, __a)); 2026 } 2027 2028 static __inline__ vector bool char __ATTRS_o_ai 2029 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2030 return ~(vec_cmpgt(__b, __a)); 2031 } 2032 2033 static __inline__ vector bool short __ATTRS_o_ai 2034 vec_cmpge(vector signed short __a, vector signed short __b) { 2035 return ~(vec_cmpgt(__b, __a)); 2036 } 2037 2038 static __inline__ vector bool short __ATTRS_o_ai 2039 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2040 return ~(vec_cmpgt(__b, __a)); 2041 } 2042 2043 static __inline__ vector bool int __ATTRS_o_ai 2044 vec_cmpge(vector signed int __a, vector signed int __b) { 2045 return ~(vec_cmpgt(__b, __a)); 2046 } 2047 2048 static __inline__ vector bool int __ATTRS_o_ai 2049 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2050 return ~(vec_cmpgt(__b, __a)); 2051 } 2052 2053 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2054 vector float __b) { 2055 #ifdef __VSX__ 2056 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2057 #else 2058 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2059 #endif 2060 } 2061 2062 #ifdef __VSX__ 2063 static __inline__ vector bool long long __ATTRS_o_ai 2064 vec_cmpge(vector double __a, vector double __b) { 2065 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2066 } 2067 #endif 2068 2069 #ifdef __POWER8_VECTOR__ 2070 static __inline__ vector bool long long __ATTRS_o_ai 2071 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2072 return ~(vec_cmpgt(__b, __a)); 2073 } 2074 2075 static __inline__ vector bool long long __ATTRS_o_ai 2076 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2077 return ~(vec_cmpgt(__b, __a)); 2078 } 2079 #endif 2080 2081 /* vec_vcmpgefp */ 2082 2083 static __inline__ vector bool int __attribute__((__always_inline__)) 2084 vec_vcmpgefp(vector float __a, vector float __b) { 2085 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2086 } 2087 2088 /* vec_vcmpgtsb */ 2089 2090 static __inline__ vector bool char __attribute__((__always_inline__)) 2091 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2092 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2093 } 2094 2095 /* vec_vcmpgtub */ 2096 2097 static __inline__ vector bool char __attribute__((__always_inline__)) 2098 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2099 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2100 } 2101 2102 /* vec_vcmpgtsh */ 2103 2104 static __inline__ vector bool short __attribute__((__always_inline__)) 2105 vec_vcmpgtsh(vector short __a, vector short __b) { 2106 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2107 } 2108 2109 /* vec_vcmpgtuh */ 2110 2111 static __inline__ vector bool short __attribute__((__always_inline__)) 2112 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2113 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2114 } 2115 2116 /* vec_vcmpgtsw */ 2117 2118 static __inline__ vector bool int __attribute__((__always_inline__)) 2119 vec_vcmpgtsw(vector int __a, vector int __b) { 2120 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2121 } 2122 2123 /* vec_vcmpgtuw */ 2124 2125 static __inline__ vector bool int __attribute__((__always_inline__)) 2126 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2127 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2128 } 2129 2130 /* vec_vcmpgtfp */ 2131 2132 static __inline__ vector bool int __attribute__((__always_inline__)) 2133 vec_vcmpgtfp(vector float __a, vector float __b) { 2134 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2135 } 2136 2137 /* vec_cmple */ 2138 2139 static __inline__ vector bool char __ATTRS_o_ai 2140 vec_cmple(vector signed char __a, vector signed char __b) { 2141 return vec_cmpge(__b, __a); 2142 } 2143 2144 static __inline__ vector bool char __ATTRS_o_ai 2145 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2146 return vec_cmpge(__b, __a); 2147 } 2148 2149 static __inline__ vector bool short __ATTRS_o_ai 2150 vec_cmple(vector signed short __a, vector signed short __b) { 2151 return vec_cmpge(__b, __a); 2152 } 2153 2154 static __inline__ vector bool short __ATTRS_o_ai 2155 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2156 return vec_cmpge(__b, __a); 2157 } 2158 2159 static __inline__ vector bool int __ATTRS_o_ai 2160 vec_cmple(vector signed int __a, vector signed int __b) { 2161 return vec_cmpge(__b, __a); 2162 } 2163 2164 static __inline__ vector bool int __ATTRS_o_ai 2165 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2166 return vec_cmpge(__b, __a); 2167 } 2168 2169 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2170 vector float __b) { 2171 return vec_cmpge(__b, __a); 2172 } 2173 2174 #ifdef __VSX__ 2175 static __inline__ vector bool long long __ATTRS_o_ai 2176 vec_cmple(vector double __a, vector double __b) { 2177 return vec_cmpge(__b, __a); 2178 } 2179 #endif 2180 2181 #ifdef __POWER8_VECTOR__ 2182 static __inline__ vector bool long long __ATTRS_o_ai 2183 vec_cmple(vector signed long long __a, vector signed long long __b) { 2184 return vec_cmpge(__b, __a); 2185 } 2186 2187 static __inline__ vector bool long long __ATTRS_o_ai 2188 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2189 return vec_cmpge(__b, __a); 2190 } 2191 #endif 2192 2193 /* vec_cmplt */ 2194 2195 static __inline__ vector bool char __ATTRS_o_ai 2196 vec_cmplt(vector signed char __a, vector signed char __b) { 2197 return vec_cmpgt(__b, __a); 2198 } 2199 2200 static __inline__ vector bool char __ATTRS_o_ai 2201 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2202 return vec_cmpgt(__b, __a); 2203 } 2204 2205 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2206 vector short __b) { 2207 return vec_cmpgt(__b, __a); 2208 } 2209 2210 static __inline__ vector bool short __ATTRS_o_ai 2211 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2212 return vec_cmpgt(__b, __a); 2213 } 2214 2215 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2216 vector int __b) { 2217 return vec_cmpgt(__b, __a); 2218 } 2219 2220 static __inline__ vector bool int __ATTRS_o_ai 2221 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2222 return vec_cmpgt(__b, __a); 2223 } 2224 2225 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2226 vector float __b) { 2227 return vec_cmpgt(__b, __a); 2228 } 2229 2230 #ifdef __VSX__ 2231 static __inline__ vector bool long long __ATTRS_o_ai 2232 vec_cmplt(vector double __a, vector double __b) { 2233 return vec_cmpgt(__b, __a); 2234 } 2235 #endif 2236 2237 #ifdef __POWER8_VECTOR__ 2238 static __inline__ vector bool long long __ATTRS_o_ai 2239 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2240 return vec_cmpgt(__b, __a); 2241 } 2242 2243 static __inline__ vector bool long long __ATTRS_o_ai 2244 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2245 return vec_cmpgt(__b, __a); 2246 } 2247 2248 /* vec_popcnt */ 2249 2250 static __inline__ vector signed char __ATTRS_o_ai 2251 vec_popcnt(vector signed char __a) { 2252 return __builtin_altivec_vpopcntb(__a); 2253 } 2254 static __inline__ vector unsigned char __ATTRS_o_ai 2255 vec_popcnt(vector unsigned char __a) { 2256 return __builtin_altivec_vpopcntb(__a); 2257 } 2258 static __inline__ vector signed short __ATTRS_o_ai 2259 vec_popcnt(vector signed short __a) { 2260 return __builtin_altivec_vpopcnth(__a); 2261 } 2262 static __inline__ vector unsigned short __ATTRS_o_ai 2263 vec_popcnt(vector unsigned short __a) { 2264 return __builtin_altivec_vpopcnth(__a); 2265 } 2266 static __inline__ vector signed int __ATTRS_o_ai 2267 vec_popcnt(vector signed int __a) { 2268 return __builtin_altivec_vpopcntw(__a); 2269 } 2270 static __inline__ vector unsigned int __ATTRS_o_ai 2271 vec_popcnt(vector unsigned int __a) { 2272 return __builtin_altivec_vpopcntw(__a); 2273 } 2274 static __inline__ vector signed long long __ATTRS_o_ai 2275 vec_popcnt(vector signed long long __a) { 2276 return __builtin_altivec_vpopcntd(__a); 2277 } 2278 static __inline__ vector unsigned long long __ATTRS_o_ai 2279 vec_popcnt(vector unsigned long long __a) { 2280 return __builtin_altivec_vpopcntd(__a); 2281 } 2282 2283 /* vec_cntlz */ 2284 2285 static __inline__ vector signed char __ATTRS_o_ai 2286 vec_cntlz(vector signed char __a) { 2287 return __builtin_altivec_vclzb(__a); 2288 } 2289 static __inline__ vector unsigned char __ATTRS_o_ai 2290 vec_cntlz(vector unsigned char __a) { 2291 return __builtin_altivec_vclzb(__a); 2292 } 2293 static __inline__ vector signed short __ATTRS_o_ai 2294 vec_cntlz(vector signed short __a) { 2295 return __builtin_altivec_vclzh(__a); 2296 } 2297 static __inline__ vector unsigned short __ATTRS_o_ai 2298 vec_cntlz(vector unsigned short __a) { 2299 return __builtin_altivec_vclzh(__a); 2300 } 2301 static __inline__ vector signed int __ATTRS_o_ai 2302 vec_cntlz(vector signed int __a) { 2303 return __builtin_altivec_vclzw(__a); 2304 } 2305 static __inline__ vector unsigned int __ATTRS_o_ai 2306 vec_cntlz(vector unsigned int __a) { 2307 return __builtin_altivec_vclzw(__a); 2308 } 2309 static __inline__ vector signed long long __ATTRS_o_ai 2310 vec_cntlz(vector signed long long __a) { 2311 return __builtin_altivec_vclzd(__a); 2312 } 2313 static __inline__ vector unsigned long long __ATTRS_o_ai 2314 vec_cntlz(vector unsigned long long __a) { 2315 return __builtin_altivec_vclzd(__a); 2316 } 2317 #endif 2318 2319 #ifdef __POWER9_VECTOR__ 2320 2321 /* vec_cnttz */ 2322 2323 static __inline__ vector signed char __ATTRS_o_ai 2324 vec_cnttz(vector signed char __a) { 2325 return __builtin_altivec_vctzb(__a); 2326 } 2327 static __inline__ vector unsigned char __ATTRS_o_ai 2328 vec_cnttz(vector unsigned char __a) { 2329 return __builtin_altivec_vctzb(__a); 2330 } 2331 static __inline__ vector signed short __ATTRS_o_ai 2332 vec_cnttz(vector signed short __a) { 2333 return __builtin_altivec_vctzh(__a); 2334 } 2335 static __inline__ vector unsigned short __ATTRS_o_ai 2336 vec_cnttz(vector unsigned short __a) { 2337 return __builtin_altivec_vctzh(__a); 2338 } 2339 static __inline__ vector signed int __ATTRS_o_ai 2340 vec_cnttz(vector signed int __a) { 2341 return __builtin_altivec_vctzw(__a); 2342 } 2343 static __inline__ vector unsigned int __ATTRS_o_ai 2344 vec_cnttz(vector unsigned int __a) { 2345 return __builtin_altivec_vctzw(__a); 2346 } 2347 static __inline__ vector signed long long __ATTRS_o_ai 2348 vec_cnttz(vector signed long long __a) { 2349 return __builtin_altivec_vctzd(__a); 2350 } 2351 static __inline__ vector unsigned long long __ATTRS_o_ai 2352 vec_cnttz(vector unsigned long long __a) { 2353 return __builtin_altivec_vctzd(__a); 2354 } 2355 2356 /* vec_first_match_index */ 2357 2358 static __inline__ unsigned __ATTRS_o_ai 2359 vec_first_match_index(vector signed char __a, vector signed char __b) { 2360 vector unsigned long long __res = 2361 #ifdef __LITTLE_ENDIAN__ 2362 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2363 #else 2364 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2365 #endif 2366 if (__res[0] == 64) { 2367 return (__res[1] + 64) >> 3; 2368 } 2369 return __res[0] >> 3; 2370 } 2371 2372 static __inline__ unsigned __ATTRS_o_ai 2373 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2374 vector unsigned long long __res = 2375 #ifdef __LITTLE_ENDIAN__ 2376 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2377 #else 2378 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2379 #endif 2380 if (__res[0] == 64) { 2381 return (__res[1] + 64) >> 3; 2382 } 2383 return __res[0] >> 3; 2384 } 2385 2386 static __inline__ unsigned __ATTRS_o_ai 2387 vec_first_match_index(vector signed short __a, vector signed short __b) { 2388 vector unsigned long long __res = 2389 #ifdef __LITTLE_ENDIAN__ 2390 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2391 #else 2392 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2393 #endif 2394 if (__res[0] == 64) { 2395 return (__res[1] + 64) >> 4; 2396 } 2397 return __res[0] >> 4; 2398 } 2399 2400 static __inline__ unsigned __ATTRS_o_ai 2401 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2402 vector unsigned long long __res = 2403 #ifdef __LITTLE_ENDIAN__ 2404 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2405 #else 2406 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2407 #endif 2408 if (__res[0] == 64) { 2409 return (__res[1] + 64) >> 4; 2410 } 2411 return __res[0] >> 4; 2412 } 2413 2414 static __inline__ unsigned __ATTRS_o_ai 2415 vec_first_match_index(vector signed int __a, vector signed int __b) { 2416 vector unsigned long long __res = 2417 #ifdef __LITTLE_ENDIAN__ 2418 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2419 #else 2420 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2421 #endif 2422 if (__res[0] == 64) { 2423 return (__res[1] + 64) >> 5; 2424 } 2425 return __res[0] >> 5; 2426 } 2427 2428 static __inline__ unsigned __ATTRS_o_ai 2429 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2430 vector unsigned long long __res = 2431 #ifdef __LITTLE_ENDIAN__ 2432 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2433 #else 2434 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2435 #endif 2436 if (__res[0] == 64) { 2437 return (__res[1] + 64) >> 5; 2438 } 2439 return __res[0] >> 5; 2440 } 2441 2442 /* vec_first_match_or_eos_index */ 2443 2444 static __inline__ unsigned __ATTRS_o_ai 2445 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2446 /* Compare the result of the comparison of two vectors with either and OR the 2447 result. Either the elements are equal or one will equal the comparison 2448 result if either is zero. 2449 */ 2450 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2451 vector bool char __tmp2 = __tmp1 | 2452 vec_cmpeq((vector signed char)__tmp1, __a) | 2453 vec_cmpeq((vector signed char)__tmp1, __b); 2454 2455 vector unsigned long long __res = 2456 #ifdef __LITTLE_ENDIAN__ 2457 vec_cnttz((vector unsigned long long)__tmp2); 2458 #else 2459 vec_cntlz((vector unsigned long long)__tmp2); 2460 #endif 2461 if (__res[0] == 64) { 2462 return (__res[1] + 64) >> 3; 2463 } 2464 return __res[0] >> 3; 2465 } 2466 2467 static __inline__ unsigned __ATTRS_o_ai 2468 vec_first_match_or_eos_index(vector unsigned char __a, 2469 vector unsigned char __b) { 2470 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2471 vector bool char __tmp2 = __tmp1 | 2472 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2473 vec_cmpeq((vector unsigned char)__tmp1, __b); 2474 2475 vector unsigned long long __res = 2476 #ifdef __LITTLE_ENDIAN__ 2477 vec_cnttz((vector unsigned long long)__tmp2); 2478 #else 2479 vec_cntlz((vector unsigned long long)__tmp2); 2480 #endif 2481 if (__res[0] == 64) { 2482 return (__res[1] + 64) >> 3; 2483 } 2484 return __res[0] >> 3; 2485 } 2486 2487 static __inline__ unsigned __ATTRS_o_ai 2488 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2489 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2490 vector bool short __tmp2 = __tmp1 | 2491 vec_cmpeq((vector signed short)__tmp1, __a) | 2492 vec_cmpeq((vector signed short)__tmp1, __b); 2493 2494 vector unsigned long long __res = 2495 #ifdef __LITTLE_ENDIAN__ 2496 vec_cnttz((vector unsigned long long)__tmp2); 2497 #else 2498 vec_cntlz((vector unsigned long long)__tmp2); 2499 #endif 2500 if (__res[0] == 64) { 2501 return (__res[1] + 64) >> 4; 2502 } 2503 return __res[0] >> 4; 2504 } 2505 2506 static __inline__ unsigned __ATTRS_o_ai 2507 vec_first_match_or_eos_index(vector unsigned short __a, 2508 vector unsigned short __b) { 2509 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2510 vector bool short __tmp2 = __tmp1 | 2511 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2512 vec_cmpeq((vector unsigned short)__tmp1, __b); 2513 2514 vector unsigned long long __res = 2515 #ifdef __LITTLE_ENDIAN__ 2516 vec_cnttz((vector unsigned long long)__tmp2); 2517 #else 2518 vec_cntlz((vector unsigned long long)__tmp2); 2519 #endif 2520 if (__res[0] == 64) { 2521 return (__res[1] + 64) >> 4; 2522 } 2523 return __res[0] >> 4; 2524 } 2525 2526 static __inline__ unsigned __ATTRS_o_ai 2527 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2528 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2529 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2530 vec_cmpeq((vector signed int)__tmp1, __b); 2531 2532 vector unsigned long long __res = 2533 #ifdef __LITTLE_ENDIAN__ 2534 vec_cnttz((vector unsigned long long)__tmp2); 2535 #else 2536 vec_cntlz((vector unsigned long long)__tmp2); 2537 #endif 2538 if (__res[0] == 64) { 2539 return (__res[1] + 64) >> 5; 2540 } 2541 return __res[0] >> 5; 2542 } 2543 2544 static __inline__ unsigned __ATTRS_o_ai 2545 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2546 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2547 vector bool int __tmp2 = __tmp1 | 2548 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2549 vec_cmpeq((vector unsigned int)__tmp1, __b); 2550 2551 vector unsigned long long __res = 2552 #ifdef __LITTLE_ENDIAN__ 2553 vec_cnttz((vector unsigned long long)__tmp2); 2554 #else 2555 vec_cntlz((vector unsigned long long)__tmp2); 2556 #endif 2557 if (__res[0] == 64) { 2558 return (__res[1] + 64) >> 5; 2559 } 2560 return __res[0] >> 5; 2561 } 2562 2563 /* vec_first_mismatch_index */ 2564 2565 static __inline__ unsigned __ATTRS_o_ai 2566 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2567 vector unsigned long long __res = 2568 #ifdef __LITTLE_ENDIAN__ 2569 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2570 #else 2571 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2572 #endif 2573 if (__res[0] == 64) { 2574 return (__res[1] + 64) >> 3; 2575 } 2576 return __res[0] >> 3; 2577 } 2578 2579 static __inline__ unsigned __ATTRS_o_ai 2580 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2581 vector unsigned long long __res = 2582 #ifdef __LITTLE_ENDIAN__ 2583 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2584 #else 2585 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2586 #endif 2587 if (__res[0] == 64) { 2588 return (__res[1] + 64) >> 3; 2589 } 2590 return __res[0] >> 3; 2591 } 2592 2593 static __inline__ unsigned __ATTRS_o_ai 2594 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2595 vector unsigned long long __res = 2596 #ifdef __LITTLE_ENDIAN__ 2597 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2598 #else 2599 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2600 #endif 2601 if (__res[0] == 64) { 2602 return (__res[1] + 64) >> 4; 2603 } 2604 return __res[0] >> 4; 2605 } 2606 2607 static __inline__ unsigned __ATTRS_o_ai 2608 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2609 vector unsigned long long __res = 2610 #ifdef __LITTLE_ENDIAN__ 2611 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2612 #else 2613 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2614 #endif 2615 if (__res[0] == 64) { 2616 return (__res[1] + 64) >> 4; 2617 } 2618 return __res[0] >> 4; 2619 } 2620 2621 static __inline__ unsigned __ATTRS_o_ai 2622 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2623 vector unsigned long long __res = 2624 #ifdef __LITTLE_ENDIAN__ 2625 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2626 #else 2627 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2628 #endif 2629 if (__res[0] == 64) { 2630 return (__res[1] + 64) >> 5; 2631 } 2632 return __res[0] >> 5; 2633 } 2634 2635 static __inline__ unsigned __ATTRS_o_ai 2636 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2637 vector unsigned long long __res = 2638 #ifdef __LITTLE_ENDIAN__ 2639 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2640 #else 2641 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2642 #endif 2643 if (__res[0] == 64) { 2644 return (__res[1] + 64) >> 5; 2645 } 2646 return __res[0] >> 5; 2647 } 2648 2649 /* vec_first_mismatch_or_eos_index */ 2650 2651 static __inline__ unsigned __ATTRS_o_ai 2652 vec_first_mismatch_or_eos_index(vector signed char __a, 2653 vector signed char __b) { 2654 vector unsigned long long __res = 2655 #ifdef __LITTLE_ENDIAN__ 2656 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2657 #else 2658 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2659 #endif 2660 if (__res[0] == 64) { 2661 return (__res[1] + 64) >> 3; 2662 } 2663 return __res[0] >> 3; 2664 } 2665 2666 static __inline__ unsigned __ATTRS_o_ai 2667 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2668 vector unsigned char __b) { 2669 vector unsigned long long __res = 2670 #ifdef __LITTLE_ENDIAN__ 2671 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2672 #else 2673 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2674 #endif 2675 if (__res[0] == 64) { 2676 return (__res[1] + 64) >> 3; 2677 } 2678 return __res[0] >> 3; 2679 } 2680 2681 static __inline__ unsigned __ATTRS_o_ai 2682 vec_first_mismatch_or_eos_index(vector signed short __a, 2683 vector signed short __b) { 2684 vector unsigned long long __res = 2685 #ifdef __LITTLE_ENDIAN__ 2686 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2687 #else 2688 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2689 #endif 2690 if (__res[0] == 64) { 2691 return (__res[1] + 64) >> 4; 2692 } 2693 return __res[0] >> 4; 2694 } 2695 2696 static __inline__ unsigned __ATTRS_o_ai 2697 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2698 vector unsigned short __b) { 2699 vector unsigned long long __res = 2700 #ifdef __LITTLE_ENDIAN__ 2701 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2702 #else 2703 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2704 #endif 2705 if (__res[0] == 64) { 2706 return (__res[1] + 64) >> 4; 2707 } 2708 return __res[0] >> 4; 2709 } 2710 2711 static __inline__ unsigned __ATTRS_o_ai 2712 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2713 vector unsigned long long __res = 2714 #ifdef __LITTLE_ENDIAN__ 2715 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2716 #else 2717 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2718 #endif 2719 if (__res[0] == 64) { 2720 return (__res[1] + 64) >> 5; 2721 } 2722 return __res[0] >> 5; 2723 } 2724 2725 static __inline__ unsigned __ATTRS_o_ai 2726 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2727 vector unsigned int __b) { 2728 vector unsigned long long __res = 2729 #ifdef __LITTLE_ENDIAN__ 2730 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2731 #else 2732 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2733 #endif 2734 if (__res[0] == 64) { 2735 return (__res[1] + 64) >> 5; 2736 } 2737 return __res[0] >> 5; 2738 } 2739 2740 static __inline__ vector double __ATTRS_o_ai 2741 vec_insert_exp(vector double __a, vector unsigned long long __b) { 2742 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 2743 } 2744 2745 static __inline__ vector double __ATTRS_o_ai 2746 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 2747 return __builtin_vsx_xviexpdp(__a,__b); 2748 } 2749 2750 static __inline__ vector float __ATTRS_o_ai 2751 vec_insert_exp(vector float __a, vector unsigned int __b) { 2752 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 2753 } 2754 2755 static __inline__ vector float __ATTRS_o_ai 2756 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 2757 return __builtin_vsx_xviexpsp(__a,__b); 2758 } 2759 2760 #if defined(__powerpc64__) 2761 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 2762 size_t __b) { 2763 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 2764 } 2765 2766 static __inline__ vector unsigned char __ATTRS_o_ai 2767 vec_xl_len(const unsigned char *__a, size_t __b) { 2768 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 2769 } 2770 2771 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 2772 size_t __b) { 2773 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 2774 } 2775 2776 static __inline__ vector unsigned short __ATTRS_o_ai 2777 vec_xl_len(const unsigned short *__a, size_t __b) { 2778 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 2779 } 2780 2781 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 2782 size_t __b) { 2783 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 2784 } 2785 2786 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 2787 size_t __b) { 2788 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 2789 } 2790 2791 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 2792 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 2793 } 2794 2795 static __inline__ vector signed __int128 __ATTRS_o_ai 2796 vec_xl_len(const signed __int128 *__a, size_t __b) { 2797 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 2798 } 2799 2800 static __inline__ vector unsigned __int128 __ATTRS_o_ai 2801 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 2802 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 2803 } 2804 2805 static __inline__ vector signed long long __ATTRS_o_ai 2806 vec_xl_len(const signed long long *__a, size_t __b) { 2807 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 2808 } 2809 2810 static __inline__ vector unsigned long long __ATTRS_o_ai 2811 vec_xl_len(const unsigned long long *__a, size_t __b) { 2812 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 2813 } 2814 2815 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 2816 size_t __b) { 2817 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 2818 } 2819 2820 static __inline__ vector unsigned char __ATTRS_o_ai 2821 vec_xl_len_r(const unsigned char *__a, size_t __b) { 2822 vector unsigned char __res = 2823 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 2824 #ifdef __LITTLE_ENDIAN__ 2825 vector unsigned char __mask = 2826 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 2827 __res = (vector unsigned char)__builtin_altivec_vperm_4si( 2828 (vector int)__res, (vector int)__res, __mask); 2829 #endif 2830 return __res; 2831 } 2832 2833 // vec_xst_len 2834 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 2835 unsigned char *__b, 2836 size_t __c) { 2837 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2838 } 2839 2840 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, 2841 signed char *__b, size_t __c) { 2842 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2843 } 2844 2845 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a, 2846 signed short *__b, size_t __c) { 2847 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2848 } 2849 2850 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, 2851 unsigned short *__b, 2852 size_t __c) { 2853 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2854 } 2855 2856 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 2857 signed int *__b, size_t __c) { 2858 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2859 } 2860 2861 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, 2862 unsigned int *__b, size_t __c) { 2863 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2864 } 2865 2866 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, 2867 size_t __c) { 2868 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2869 } 2870 2871 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 2872 signed __int128 *__b, 2873 size_t __c) { 2874 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2875 } 2876 2877 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, 2878 unsigned __int128 *__b, 2879 size_t __c) { 2880 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2881 } 2882 2883 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 2884 signed long long *__b, 2885 size_t __c) { 2886 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2887 } 2888 2889 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 2890 unsigned long long *__b, 2891 size_t __c) { 2892 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2893 } 2894 2895 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, 2896 size_t __c) { 2897 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2898 } 2899 2900 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, 2901 unsigned char *__b, 2902 size_t __c) { 2903 #ifdef __LITTLE_ENDIAN__ 2904 vector unsigned char __mask = 2905 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 2906 vector unsigned char __res = 2907 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); 2908 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 2909 #else 2910 return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56)); 2911 #endif 2912 } 2913 #endif 2914 #endif 2915 2916 /* vec_cpsgn */ 2917 2918 #ifdef __VSX__ 2919 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 2920 vector float __b) { 2921 return __builtin_vsx_xvcpsgnsp(__a, __b); 2922 } 2923 2924 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 2925 vector double __b) { 2926 return __builtin_vsx_xvcpsgndp(__a, __b); 2927 } 2928 #endif 2929 2930 /* vec_ctf */ 2931 2932 #ifdef __VSX__ 2933 #define vec_ctf(__a, __b) \ 2934 _Generic((__a), vector int \ 2935 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 2936 vector unsigned int \ 2937 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 2938 (__b)), \ 2939 vector unsigned long long \ 2940 : (__builtin_convertvector((vector unsigned long long)(__a), \ 2941 vector double) * \ 2942 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 2943 << 52)), \ 2944 vector signed long long \ 2945 : (__builtin_convertvector((vector signed long long)(__a), \ 2946 vector double) * \ 2947 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 2948 << 52))) 2949 #else 2950 #define vec_ctf(__a, __b) \ 2951 _Generic((__a), vector int \ 2952 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 2953 vector unsigned int \ 2954 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 2955 (__b))) 2956 #endif 2957 2958 /* vec_vcfsx */ 2959 2960 #define vec_vcfux __builtin_altivec_vcfux 2961 2962 /* vec_vcfux */ 2963 2964 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 2965 2966 /* vec_cts */ 2967 2968 #ifdef __VSX__ 2969 #define vec_cts(__a, __b) \ 2970 _Generic((__a), vector float \ 2971 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 2972 vector double \ 2973 : __extension__({ \ 2974 vector double __ret = \ 2975 (vector double)(__a) * \ 2976 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 2977 << 52); \ 2978 __builtin_convertvector(__ret, vector signed long long); \ 2979 })) 2980 #else 2981 #define vec_cts __builtin_altivec_vctsxs 2982 #endif 2983 2984 /* vec_vctsxs */ 2985 2986 #define vec_vctsxs __builtin_altivec_vctsxs 2987 2988 /* vec_ctu */ 2989 2990 #ifdef __VSX__ 2991 #define vec_ctu(__a, __b) \ 2992 _Generic((__a), vector float \ 2993 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 2994 vector double \ 2995 : __extension__({ \ 2996 vector double __ret = \ 2997 (vector double)(__a) * \ 2998 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 2999 << 52); \ 3000 __builtin_convertvector(__ret, vector unsigned long long); \ 3001 })) 3002 #else 3003 #define vec_ctu __builtin_altivec_vctuxs 3004 #endif 3005 3006 /* vec_vctuxs */ 3007 3008 #define vec_vctuxs __builtin_altivec_vctuxs 3009 3010 /* vec_signed */ 3011 3012 static __inline__ vector signed int __ATTRS_o_ai 3013 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3014 3015 static __inline__ vector signed int __ATTRS_o_ai 3016 vec_signed(vector float __a) { 3017 return __builtin_convertvector(__a, vector signed int); 3018 } 3019 3020 #ifdef __VSX__ 3021 static __inline__ vector signed long long __ATTRS_o_ai 3022 vec_signed(vector double __a) { 3023 return __builtin_convertvector(__a, vector signed long long); 3024 } 3025 3026 static __inline__ vector signed int __attribute__((__always_inline__)) 3027 vec_signed2(vector double __a, vector double __b) { 3028 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3029 } 3030 3031 static __inline__ vector signed int __ATTRS_o_ai 3032 vec_signede(vector double __a) { 3033 #ifdef __LITTLE_ENDIAN__ 3034 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3035 return vec_sld(__ret, __ret, 12); 3036 #else 3037 return __builtin_vsx_xvcvdpsxws(__a); 3038 #endif 3039 } 3040 3041 static __inline__ vector signed int __ATTRS_o_ai 3042 vec_signedo(vector double __a) { 3043 #ifdef __LITTLE_ENDIAN__ 3044 return __builtin_vsx_xvcvdpsxws(__a); 3045 #else 3046 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3047 return vec_sld(__ret, __ret, 12); 3048 #endif 3049 } 3050 #endif 3051 3052 /* vec_unsigned */ 3053 3054 static __inline__ vector unsigned int __ATTRS_o_ai 3055 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3056 3057 static __inline__ vector unsigned int __ATTRS_o_ai 3058 vec_unsigned(vector float __a) { 3059 return __builtin_convertvector(__a, vector unsigned int); 3060 } 3061 3062 #ifdef __VSX__ 3063 static __inline__ vector unsigned long long __ATTRS_o_ai 3064 vec_unsigned(vector double __a) { 3065 return __builtin_convertvector(__a, vector unsigned long long); 3066 } 3067 3068 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3069 vec_unsigned2(vector double __a, vector double __b) { 3070 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3071 } 3072 3073 static __inline__ vector unsigned int __ATTRS_o_ai 3074 vec_unsignede(vector double __a) { 3075 #ifdef __LITTLE_ENDIAN__ 3076 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3077 return vec_sld(__ret, __ret, 12); 3078 #else 3079 return __builtin_vsx_xvcvdpuxws(__a); 3080 #endif 3081 } 3082 3083 static __inline__ vector unsigned int __ATTRS_o_ai 3084 vec_unsignedo(vector double __a) { 3085 #ifdef __LITTLE_ENDIAN__ 3086 return __builtin_vsx_xvcvdpuxws(__a); 3087 #else 3088 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3089 return vec_sld(__ret, __ret, 12); 3090 #endif 3091 } 3092 #endif 3093 3094 /* vec_float */ 3095 3096 static __inline__ vector float __ATTRS_o_ai 3097 vec_sld(vector float, vector float, unsigned const int __c); 3098 3099 static __inline__ vector float __ATTRS_o_ai 3100 vec_float(vector signed int __a) { 3101 return __builtin_convertvector(__a, vector float); 3102 } 3103 3104 static __inline__ vector float __ATTRS_o_ai 3105 vec_float(vector unsigned int __a) { 3106 return __builtin_convertvector(__a, vector float); 3107 } 3108 3109 #ifdef __VSX__ 3110 static __inline__ vector float __ATTRS_o_ai 3111 vec_float2(vector signed long long __a, vector signed long long __b) { 3112 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3113 } 3114 3115 static __inline__ vector float __ATTRS_o_ai 3116 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3117 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3118 } 3119 3120 static __inline__ vector float __ATTRS_o_ai 3121 vec_float2(vector double __a, vector double __b) { 3122 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3123 } 3124 3125 static __inline__ vector float __ATTRS_o_ai 3126 vec_floate(vector signed long long __a) { 3127 #ifdef __LITTLE_ENDIAN__ 3128 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3129 return vec_sld(__ret, __ret, 12); 3130 #else 3131 return __builtin_vsx_xvcvsxdsp(__a); 3132 #endif 3133 } 3134 3135 static __inline__ vector float __ATTRS_o_ai 3136 vec_floate(vector unsigned long long __a) { 3137 #ifdef __LITTLE_ENDIAN__ 3138 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3139 return vec_sld(__ret, __ret, 12); 3140 #else 3141 return __builtin_vsx_xvcvuxdsp(__a); 3142 #endif 3143 } 3144 3145 static __inline__ vector float __ATTRS_o_ai 3146 vec_floate(vector double __a) { 3147 #ifdef __LITTLE_ENDIAN__ 3148 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3149 return vec_sld(__ret, __ret, 12); 3150 #else 3151 return __builtin_vsx_xvcvdpsp(__a); 3152 #endif 3153 } 3154 3155 static __inline__ vector float __ATTRS_o_ai 3156 vec_floato(vector signed long long __a) { 3157 #ifdef __LITTLE_ENDIAN__ 3158 return __builtin_vsx_xvcvsxdsp(__a); 3159 #else 3160 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3161 return vec_sld(__ret, __ret, 12); 3162 #endif 3163 } 3164 3165 static __inline__ vector float __ATTRS_o_ai 3166 vec_floato(vector unsigned long long __a) { 3167 #ifdef __LITTLE_ENDIAN__ 3168 return __builtin_vsx_xvcvuxdsp(__a); 3169 #else 3170 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3171 return vec_sld(__ret, __ret, 12); 3172 #endif 3173 } 3174 3175 static __inline__ vector float __ATTRS_o_ai 3176 vec_floato(vector double __a) { 3177 #ifdef __LITTLE_ENDIAN__ 3178 return __builtin_vsx_xvcvdpsp(__a); 3179 #else 3180 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3181 return vec_sld(__ret, __ret, 12); 3182 #endif 3183 } 3184 #endif 3185 3186 /* vec_double */ 3187 3188 #ifdef __VSX__ 3189 static __inline__ vector double __ATTRS_o_ai 3190 vec_double(vector signed long long __a) { 3191 return __builtin_convertvector(__a, vector double); 3192 } 3193 3194 static __inline__ vector double __ATTRS_o_ai 3195 vec_double(vector unsigned long long __a) { 3196 return __builtin_convertvector(__a, vector double); 3197 } 3198 3199 static __inline__ vector double __ATTRS_o_ai 3200 vec_doublee(vector signed int __a) { 3201 #ifdef __LITTLE_ENDIAN__ 3202 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3203 #else 3204 return __builtin_vsx_xvcvsxwdp(__a); 3205 #endif 3206 } 3207 3208 static __inline__ vector double __ATTRS_o_ai 3209 vec_doublee(vector unsigned int __a) { 3210 #ifdef __LITTLE_ENDIAN__ 3211 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3212 #else 3213 return __builtin_vsx_xvcvuxwdp(__a); 3214 #endif 3215 } 3216 3217 static __inline__ vector double __ATTRS_o_ai 3218 vec_doublee(vector float __a) { 3219 #ifdef __LITTLE_ENDIAN__ 3220 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3221 #else 3222 return __builtin_vsx_xvcvspdp(__a); 3223 #endif 3224 } 3225 3226 static __inline__ vector double __ATTRS_o_ai 3227 vec_doubleh(vector signed int __a) { 3228 vector double __ret = {__a[0], __a[1]}; 3229 return __ret; 3230 } 3231 3232 static __inline__ vector double __ATTRS_o_ai 3233 vec_doubleh(vector unsigned int __a) { 3234 vector double __ret = {__a[0], __a[1]}; 3235 return __ret; 3236 } 3237 3238 static __inline__ vector double __ATTRS_o_ai 3239 vec_doubleh(vector float __a) { 3240 vector double __ret = {__a[0], __a[1]}; 3241 return __ret; 3242 } 3243 3244 static __inline__ vector double __ATTRS_o_ai 3245 vec_doublel(vector signed int __a) { 3246 vector double __ret = {__a[2], __a[3]}; 3247 return __ret; 3248 } 3249 3250 static __inline__ vector double __ATTRS_o_ai 3251 vec_doublel(vector unsigned int __a) { 3252 vector double __ret = {__a[2], __a[3]}; 3253 return __ret; 3254 } 3255 3256 static __inline__ vector double __ATTRS_o_ai 3257 vec_doublel(vector float __a) { 3258 vector double __ret = {__a[2], __a[3]}; 3259 return __ret; 3260 } 3261 3262 static __inline__ vector double __ATTRS_o_ai 3263 vec_doubleo(vector signed int __a) { 3264 #ifdef __LITTLE_ENDIAN__ 3265 return __builtin_vsx_xvcvsxwdp(__a); 3266 #else 3267 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3268 #endif 3269 } 3270 3271 static __inline__ vector double __ATTRS_o_ai 3272 vec_doubleo(vector unsigned int __a) { 3273 #ifdef __LITTLE_ENDIAN__ 3274 return __builtin_vsx_xvcvuxwdp(__a); 3275 #else 3276 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3277 #endif 3278 } 3279 3280 static __inline__ vector double __ATTRS_o_ai 3281 vec_doubleo(vector float __a) { 3282 #ifdef __LITTLE_ENDIAN__ 3283 return __builtin_vsx_xvcvspdp(__a); 3284 #else 3285 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3286 #endif 3287 } 3288 #endif 3289 3290 /* vec_div */ 3291 3292 /* Integer vector divides (vectors are scalarized, elements divided 3293 and the vectors reassembled). 3294 */ 3295 static __inline__ vector signed char __ATTRS_o_ai 3296 vec_div(vector signed char __a, vector signed char __b) { 3297 return __a / __b; 3298 } 3299 3300 static __inline__ vector unsigned char __ATTRS_o_ai 3301 vec_div(vector unsigned char __a, vector unsigned char __b) { 3302 return __a / __b; 3303 } 3304 3305 static __inline__ vector signed short __ATTRS_o_ai 3306 vec_div(vector signed short __a, vector signed short __b) { 3307 return __a / __b; 3308 } 3309 3310 static __inline__ vector unsigned short __ATTRS_o_ai 3311 vec_div(vector unsigned short __a, vector unsigned short __b) { 3312 return __a / __b; 3313 } 3314 3315 static __inline__ vector signed int __ATTRS_o_ai 3316 vec_div(vector signed int __a, vector signed int __b) { 3317 return __a / __b; 3318 } 3319 3320 static __inline__ vector unsigned int __ATTRS_o_ai 3321 vec_div(vector unsigned int __a, vector unsigned int __b) { 3322 return __a / __b; 3323 } 3324 3325 #ifdef __VSX__ 3326 static __inline__ vector signed long long __ATTRS_o_ai 3327 vec_div(vector signed long long __a, vector signed long long __b) { 3328 return __a / __b; 3329 } 3330 3331 static __inline__ vector unsigned long long __ATTRS_o_ai 3332 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3333 return __a / __b; 3334 } 3335 3336 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3337 vector float __b) { 3338 return __a / __b; 3339 } 3340 3341 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3342 vector double __b) { 3343 return __a / __b; 3344 } 3345 #endif 3346 3347 /* vec_dss */ 3348 3349 #define vec_dss __builtin_altivec_dss 3350 3351 /* vec_dssall */ 3352 3353 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3354 __builtin_altivec_dssall(); 3355 } 3356 3357 /* vec_dst */ 3358 #define vec_dst(__PTR, __CW, __STR) \ 3359 __extension__( \ 3360 { __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)); }) 3361 3362 /* vec_dstst */ 3363 #define vec_dstst(__PTR, __CW, __STR) \ 3364 __extension__( \ 3365 { __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)); }) 3366 3367 /* vec_dststt */ 3368 #define vec_dststt(__PTR, __CW, __STR) \ 3369 __extension__( \ 3370 { __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)); }) 3371 3372 /* vec_dstt */ 3373 #define vec_dstt(__PTR, __CW, __STR) \ 3374 __extension__( \ 3375 { __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)); }) 3376 3377 /* vec_eqv */ 3378 3379 #ifdef __POWER8_VECTOR__ 3380 static __inline__ vector signed char __ATTRS_o_ai 3381 vec_eqv(vector signed char __a, vector signed char __b) { 3382 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3383 (vector unsigned int)__b); 3384 } 3385 3386 static __inline__ vector unsigned char __ATTRS_o_ai 3387 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3388 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3389 (vector unsigned int)__b); 3390 } 3391 3392 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3393 vector bool char __b) { 3394 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3395 (vector unsigned int)__b); 3396 } 3397 3398 static __inline__ vector signed short __ATTRS_o_ai 3399 vec_eqv(vector signed short __a, vector signed short __b) { 3400 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3401 (vector unsigned int)__b); 3402 } 3403 3404 static __inline__ vector unsigned short __ATTRS_o_ai 3405 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3406 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3407 (vector unsigned int)__b); 3408 } 3409 3410 static __inline__ vector bool short __ATTRS_o_ai 3411 vec_eqv(vector bool short __a, vector bool short __b) { 3412 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3413 (vector unsigned int)__b); 3414 } 3415 3416 static __inline__ vector signed int __ATTRS_o_ai 3417 vec_eqv(vector signed int __a, vector signed int __b) { 3418 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3419 (vector unsigned int)__b); 3420 } 3421 3422 static __inline__ vector unsigned int __ATTRS_o_ai 3423 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3424 return __builtin_vsx_xxleqv(__a, __b); 3425 } 3426 3427 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3428 vector bool int __b) { 3429 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3430 (vector unsigned int)__b); 3431 } 3432 3433 static __inline__ vector signed long long __ATTRS_o_ai 3434 vec_eqv(vector signed long long __a, vector signed long long __b) { 3435 return (vector signed long long)__builtin_vsx_xxleqv( 3436 (vector unsigned int)__a, (vector unsigned int)__b); 3437 } 3438 3439 static __inline__ vector unsigned long long __ATTRS_o_ai 3440 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3441 return (vector unsigned long long)__builtin_vsx_xxleqv( 3442 (vector unsigned int)__a, (vector unsigned int)__b); 3443 } 3444 3445 static __inline__ vector bool long long __ATTRS_o_ai 3446 vec_eqv(vector bool long long __a, vector bool long long __b) { 3447 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3448 (vector unsigned int)__b); 3449 } 3450 3451 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3452 vector float __b) { 3453 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3454 (vector unsigned int)__b); 3455 } 3456 3457 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3458 vector double __b) { 3459 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3460 (vector unsigned int)__b); 3461 } 3462 #endif 3463 3464 /* vec_expte */ 3465 3466 static __inline__ vector float __attribute__((__always_inline__)) 3467 vec_expte(vector float __a) { 3468 return __builtin_altivec_vexptefp(__a); 3469 } 3470 3471 /* vec_vexptefp */ 3472 3473 static __inline__ vector float __attribute__((__always_inline__)) 3474 vec_vexptefp(vector float __a) { 3475 return __builtin_altivec_vexptefp(__a); 3476 } 3477 3478 /* vec_floor */ 3479 3480 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 3481 #ifdef __VSX__ 3482 return __builtin_vsx_xvrspim(__a); 3483 #else 3484 return __builtin_altivec_vrfim(__a); 3485 #endif 3486 } 3487 3488 #ifdef __VSX__ 3489 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 3490 return __builtin_vsx_xvrdpim(__a); 3491 } 3492 #endif 3493 3494 /* vec_vrfim */ 3495 3496 static __inline__ vector float __attribute__((__always_inline__)) 3497 vec_vrfim(vector float __a) { 3498 return __builtin_altivec_vrfim(__a); 3499 } 3500 3501 /* vec_ld */ 3502 3503 static __inline__ vector signed char __ATTRS_o_ai 3504 vec_ld(int __a, const vector signed char *__b) { 3505 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3506 } 3507 3508 static __inline__ vector signed char __ATTRS_o_ai 3509 vec_ld(int __a, const signed char *__b) { 3510 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3511 } 3512 3513 static __inline__ vector unsigned char __ATTRS_o_ai 3514 vec_ld(int __a, const vector unsigned char *__b) { 3515 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3516 } 3517 3518 static __inline__ vector unsigned char __ATTRS_o_ai 3519 vec_ld(int __a, const unsigned char *__b) { 3520 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3521 } 3522 3523 static __inline__ vector bool char __ATTRS_o_ai 3524 vec_ld(int __a, const vector bool char *__b) { 3525 return (vector bool char)__builtin_altivec_lvx(__a, __b); 3526 } 3527 3528 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, 3529 const vector short *__b) { 3530 return (vector short)__builtin_altivec_lvx(__a, __b); 3531 } 3532 3533 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) { 3534 return (vector short)__builtin_altivec_lvx(__a, __b); 3535 } 3536 3537 static __inline__ vector unsigned short __ATTRS_o_ai 3538 vec_ld(int __a, const vector unsigned short *__b) { 3539 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3540 } 3541 3542 static __inline__ vector unsigned short __ATTRS_o_ai 3543 vec_ld(int __a, const unsigned short *__b) { 3544 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3545 } 3546 3547 static __inline__ vector bool short __ATTRS_o_ai 3548 vec_ld(int __a, const vector bool short *__b) { 3549 return (vector bool short)__builtin_altivec_lvx(__a, __b); 3550 } 3551 3552 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a, 3553 const vector pixel *__b) { 3554 return (vector pixel)__builtin_altivec_lvx(__a, __b); 3555 } 3556 3557 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, 3558 const vector int *__b) { 3559 return (vector int)__builtin_altivec_lvx(__a, __b); 3560 } 3561 3562 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) { 3563 return (vector int)__builtin_altivec_lvx(__a, __b); 3564 } 3565 3566 static __inline__ vector unsigned int __ATTRS_o_ai 3567 vec_ld(int __a, const vector unsigned int *__b) { 3568 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3569 } 3570 3571 static __inline__ vector unsigned int __ATTRS_o_ai 3572 vec_ld(int __a, const unsigned int *__b) { 3573 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3574 } 3575 3576 static __inline__ vector bool int __ATTRS_o_ai 3577 vec_ld(int __a, const vector bool int *__b) { 3578 return (vector bool int)__builtin_altivec_lvx(__a, __b); 3579 } 3580 3581 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, 3582 const vector float *__b) { 3583 return (vector float)__builtin_altivec_lvx(__a, __b); 3584 } 3585 3586 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) { 3587 return (vector float)__builtin_altivec_lvx(__a, __b); 3588 } 3589 3590 /* vec_lvx */ 3591 3592 static __inline__ vector signed char __ATTRS_o_ai 3593 vec_lvx(int __a, const vector signed char *__b) { 3594 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3595 } 3596 3597 static __inline__ vector signed char __ATTRS_o_ai 3598 vec_lvx(int __a, const signed char *__b) { 3599 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3600 } 3601 3602 static __inline__ vector unsigned char __ATTRS_o_ai 3603 vec_lvx(int __a, const vector unsigned char *__b) { 3604 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3605 } 3606 3607 static __inline__ vector unsigned char __ATTRS_o_ai 3608 vec_lvx(int __a, const unsigned char *__b) { 3609 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3610 } 3611 3612 static __inline__ vector bool char __ATTRS_o_ai 3613 vec_lvx(int __a, const vector bool char *__b) { 3614 return (vector bool char)__builtin_altivec_lvx(__a, __b); 3615 } 3616 3617 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, 3618 const vector short *__b) { 3619 return (vector short)__builtin_altivec_lvx(__a, __b); 3620 } 3621 3622 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) { 3623 return (vector short)__builtin_altivec_lvx(__a, __b); 3624 } 3625 3626 static __inline__ vector unsigned short __ATTRS_o_ai 3627 vec_lvx(int __a, const vector unsigned short *__b) { 3628 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3629 } 3630 3631 static __inline__ vector unsigned short __ATTRS_o_ai 3632 vec_lvx(int __a, const unsigned short *__b) { 3633 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3634 } 3635 3636 static __inline__ vector bool short __ATTRS_o_ai 3637 vec_lvx(int __a, const vector bool short *__b) { 3638 return (vector bool short)__builtin_altivec_lvx(__a, __b); 3639 } 3640 3641 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a, 3642 const vector pixel *__b) { 3643 return (vector pixel)__builtin_altivec_lvx(__a, __b); 3644 } 3645 3646 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, 3647 const vector int *__b) { 3648 return (vector int)__builtin_altivec_lvx(__a, __b); 3649 } 3650 3651 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) { 3652 return (vector int)__builtin_altivec_lvx(__a, __b); 3653 } 3654 3655 static __inline__ vector unsigned int __ATTRS_o_ai 3656 vec_lvx(int __a, const vector unsigned int *__b) { 3657 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3658 } 3659 3660 static __inline__ vector unsigned int __ATTRS_o_ai 3661 vec_lvx(int __a, const unsigned int *__b) { 3662 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3663 } 3664 3665 static __inline__ vector bool int __ATTRS_o_ai 3666 vec_lvx(int __a, const vector bool int *__b) { 3667 return (vector bool int)__builtin_altivec_lvx(__a, __b); 3668 } 3669 3670 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, 3671 const vector float *__b) { 3672 return (vector float)__builtin_altivec_lvx(__a, __b); 3673 } 3674 3675 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) { 3676 return (vector float)__builtin_altivec_lvx(__a, __b); 3677 } 3678 3679 /* vec_lde */ 3680 3681 static __inline__ vector signed char __ATTRS_o_ai 3682 vec_lde(int __a, const signed char *__b) { 3683 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 3684 } 3685 3686 static __inline__ vector unsigned char __ATTRS_o_ai 3687 vec_lde(int __a, const unsigned char *__b) { 3688 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 3689 } 3690 3691 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) { 3692 return (vector short)__builtin_altivec_lvehx(__a, __b); 3693 } 3694 3695 static __inline__ vector unsigned short __ATTRS_o_ai 3696 vec_lde(int __a, const unsigned short *__b) { 3697 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 3698 } 3699 3700 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) { 3701 return (vector int)__builtin_altivec_lvewx(__a, __b); 3702 } 3703 3704 static __inline__ vector unsigned int __ATTRS_o_ai 3705 vec_lde(int __a, const unsigned int *__b) { 3706 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 3707 } 3708 3709 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) { 3710 return (vector float)__builtin_altivec_lvewx(__a, __b); 3711 } 3712 3713 /* vec_lvebx */ 3714 3715 static __inline__ vector signed char __ATTRS_o_ai 3716 vec_lvebx(int __a, const signed char *__b) { 3717 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 3718 } 3719 3720 static __inline__ vector unsigned char __ATTRS_o_ai 3721 vec_lvebx(int __a, const unsigned char *__b) { 3722 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 3723 } 3724 3725 /* vec_lvehx */ 3726 3727 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a, 3728 const short *__b) { 3729 return (vector short)__builtin_altivec_lvehx(__a, __b); 3730 } 3731 3732 static __inline__ vector unsigned short __ATTRS_o_ai 3733 vec_lvehx(int __a, const unsigned short *__b) { 3734 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 3735 } 3736 3737 /* vec_lvewx */ 3738 3739 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) { 3740 return (vector int)__builtin_altivec_lvewx(__a, __b); 3741 } 3742 3743 static __inline__ vector unsigned int __ATTRS_o_ai 3744 vec_lvewx(int __a, const unsigned int *__b) { 3745 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 3746 } 3747 3748 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a, 3749 const float *__b) { 3750 return (vector float)__builtin_altivec_lvewx(__a, __b); 3751 } 3752 3753 /* vec_ldl */ 3754 3755 static __inline__ vector signed char __ATTRS_o_ai 3756 vec_ldl(int __a, const vector signed char *__b) { 3757 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 3758 } 3759 3760 static __inline__ vector signed char __ATTRS_o_ai 3761 vec_ldl(int __a, const signed char *__b) { 3762 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 3763 } 3764 3765 static __inline__ vector unsigned char __ATTRS_o_ai 3766 vec_ldl(int __a, const vector unsigned char *__b) { 3767 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 3768 } 3769 3770 static __inline__ vector unsigned char __ATTRS_o_ai 3771 vec_ldl(int __a, const unsigned char *__b) { 3772 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 3773 } 3774 3775 static __inline__ vector bool char __ATTRS_o_ai 3776 vec_ldl(int __a, const vector bool char *__b) { 3777 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 3778 } 3779 3780 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, 3781 const vector short *__b) { 3782 return (vector short)__builtin_altivec_lvxl(__a, __b); 3783 } 3784 3785 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) { 3786 return (vector short)__builtin_altivec_lvxl(__a, __b); 3787 } 3788 3789 static __inline__ vector unsigned short __ATTRS_o_ai 3790 vec_ldl(int __a, const vector unsigned short *__b) { 3791 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 3792 } 3793 3794 static __inline__ vector unsigned short __ATTRS_o_ai 3795 vec_ldl(int __a, const unsigned short *__b) { 3796 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 3797 } 3798 3799 static __inline__ vector bool short __ATTRS_o_ai 3800 vec_ldl(int __a, const vector bool short *__b) { 3801 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 3802 } 3803 3804 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a, 3805 const vector pixel *__b) { 3806 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 3807 } 3808 3809 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, 3810 const vector int *__b) { 3811 return (vector int)__builtin_altivec_lvxl(__a, __b); 3812 } 3813 3814 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) { 3815 return (vector int)__builtin_altivec_lvxl(__a, __b); 3816 } 3817 3818 static __inline__ vector unsigned int __ATTRS_o_ai 3819 vec_ldl(int __a, const vector unsigned int *__b) { 3820 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 3821 } 3822 3823 static __inline__ vector unsigned int __ATTRS_o_ai 3824 vec_ldl(int __a, const unsigned int *__b) { 3825 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 3826 } 3827 3828 static __inline__ vector bool int __ATTRS_o_ai 3829 vec_ldl(int __a, const vector bool int *__b) { 3830 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 3831 } 3832 3833 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, 3834 const vector float *__b) { 3835 return (vector float)__builtin_altivec_lvxl(__a, __b); 3836 } 3837 3838 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) { 3839 return (vector float)__builtin_altivec_lvxl(__a, __b); 3840 } 3841 3842 /* vec_lvxl */ 3843 3844 static __inline__ vector signed char __ATTRS_o_ai 3845 vec_lvxl(int __a, const vector signed char *__b) { 3846 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 3847 } 3848 3849 static __inline__ vector signed char __ATTRS_o_ai 3850 vec_lvxl(int __a, const signed char *__b) { 3851 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 3852 } 3853 3854 static __inline__ vector unsigned char __ATTRS_o_ai 3855 vec_lvxl(int __a, const vector unsigned char *__b) { 3856 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 3857 } 3858 3859 static __inline__ vector unsigned char __ATTRS_o_ai 3860 vec_lvxl(int __a, const unsigned char *__b) { 3861 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 3862 } 3863 3864 static __inline__ vector bool char __ATTRS_o_ai 3865 vec_lvxl(int __a, const vector bool char *__b) { 3866 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 3867 } 3868 3869 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 3870 const vector short *__b) { 3871 return (vector short)__builtin_altivec_lvxl(__a, __b); 3872 } 3873 3874 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 3875 const short *__b) { 3876 return (vector short)__builtin_altivec_lvxl(__a, __b); 3877 } 3878 3879 static __inline__ vector unsigned short __ATTRS_o_ai 3880 vec_lvxl(int __a, const vector unsigned short *__b) { 3881 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 3882 } 3883 3884 static __inline__ vector unsigned short __ATTRS_o_ai 3885 vec_lvxl(int __a, const unsigned short *__b) { 3886 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 3887 } 3888 3889 static __inline__ vector bool short __ATTRS_o_ai 3890 vec_lvxl(int __a, const vector bool short *__b) { 3891 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 3892 } 3893 3894 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a, 3895 const vector pixel *__b) { 3896 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 3897 } 3898 3899 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, 3900 const vector int *__b) { 3901 return (vector int)__builtin_altivec_lvxl(__a, __b); 3902 } 3903 3904 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) { 3905 return (vector int)__builtin_altivec_lvxl(__a, __b); 3906 } 3907 3908 static __inline__ vector unsigned int __ATTRS_o_ai 3909 vec_lvxl(int __a, const vector unsigned int *__b) { 3910 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 3911 } 3912 3913 static __inline__ vector unsigned int __ATTRS_o_ai 3914 vec_lvxl(int __a, const unsigned int *__b) { 3915 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 3916 } 3917 3918 static __inline__ vector bool int __ATTRS_o_ai 3919 vec_lvxl(int __a, const vector bool int *__b) { 3920 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 3921 } 3922 3923 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 3924 const vector float *__b) { 3925 return (vector float)__builtin_altivec_lvxl(__a, __b); 3926 } 3927 3928 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 3929 const float *__b) { 3930 return (vector float)__builtin_altivec_lvxl(__a, __b); 3931 } 3932 3933 /* vec_loge */ 3934 3935 static __inline__ vector float __attribute__((__always_inline__)) 3936 vec_loge(vector float __a) { 3937 return __builtin_altivec_vlogefp(__a); 3938 } 3939 3940 /* vec_vlogefp */ 3941 3942 static __inline__ vector float __attribute__((__always_inline__)) 3943 vec_vlogefp(vector float __a) { 3944 return __builtin_altivec_vlogefp(__a); 3945 } 3946 3947 /* vec_lvsl */ 3948 3949 #ifdef __LITTLE_ENDIAN__ 3950 static __inline__ vector unsigned char __ATTRS_o_ai 3951 __attribute__((__deprecated__("use assignment for unaligned little endian \ 3952 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 3953 vector unsigned char mask = 3954 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 3955 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 3956 7, 6, 5, 4, 3, 2, 1, 0}; 3957 return vec_perm(mask, mask, reverse); 3958 } 3959 #else 3960 static __inline__ vector unsigned char __ATTRS_o_ai 3961 vec_lvsl(int __a, const signed char *__b) { 3962 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 3963 } 3964 #endif 3965 3966 #ifdef __LITTLE_ENDIAN__ 3967 static __inline__ vector unsigned char __ATTRS_o_ai 3968 __attribute__((__deprecated__("use assignment for unaligned little endian \ 3969 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 3970 vector unsigned char mask = 3971 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 3972 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 3973 7, 6, 5, 4, 3, 2, 1, 0}; 3974 return vec_perm(mask, mask, reverse); 3975 } 3976 #else 3977 static __inline__ vector unsigned char __ATTRS_o_ai 3978 vec_lvsl(int __a, const unsigned char *__b) { 3979 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 3980 } 3981 #endif 3982 3983 #ifdef __LITTLE_ENDIAN__ 3984 static __inline__ vector unsigned char __ATTRS_o_ai 3985 __attribute__((__deprecated__("use assignment for unaligned little endian \ 3986 loads/stores"))) vec_lvsl(int __a, const short *__b) { 3987 vector unsigned char mask = 3988 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 3989 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 3990 7, 6, 5, 4, 3, 2, 1, 0}; 3991 return vec_perm(mask, mask, reverse); 3992 } 3993 #else 3994 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 3995 const short *__b) { 3996 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 3997 } 3998 #endif 3999 4000 #ifdef __LITTLE_ENDIAN__ 4001 static __inline__ vector unsigned char __ATTRS_o_ai 4002 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4003 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4004 vector unsigned char mask = 4005 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4006 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4007 7, 6, 5, 4, 3, 2, 1, 0}; 4008 return vec_perm(mask, mask, reverse); 4009 } 4010 #else 4011 static __inline__ vector unsigned char __ATTRS_o_ai 4012 vec_lvsl(int __a, const unsigned short *__b) { 4013 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4014 } 4015 #endif 4016 4017 #ifdef __LITTLE_ENDIAN__ 4018 static __inline__ vector unsigned char __ATTRS_o_ai 4019 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4020 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4021 vector unsigned char mask = 4022 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4023 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4024 7, 6, 5, 4, 3, 2, 1, 0}; 4025 return vec_perm(mask, mask, reverse); 4026 } 4027 #else 4028 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4029 const int *__b) { 4030 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4031 } 4032 #endif 4033 4034 #ifdef __LITTLE_ENDIAN__ 4035 static __inline__ vector unsigned char __ATTRS_o_ai 4036 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4037 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4038 vector unsigned char mask = 4039 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4040 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4041 7, 6, 5, 4, 3, 2, 1, 0}; 4042 return vec_perm(mask, mask, reverse); 4043 } 4044 #else 4045 static __inline__ vector unsigned char __ATTRS_o_ai 4046 vec_lvsl(int __a, const unsigned int *__b) { 4047 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4048 } 4049 #endif 4050 4051 #ifdef __LITTLE_ENDIAN__ 4052 static __inline__ vector unsigned char __ATTRS_o_ai 4053 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4054 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4055 vector unsigned char mask = 4056 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4057 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4058 7, 6, 5, 4, 3, 2, 1, 0}; 4059 return vec_perm(mask, mask, reverse); 4060 } 4061 #else 4062 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4063 const float *__b) { 4064 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4065 } 4066 #endif 4067 4068 /* vec_lvsr */ 4069 4070 #ifdef __LITTLE_ENDIAN__ 4071 static __inline__ vector unsigned char __ATTRS_o_ai 4072 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4073 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4074 vector unsigned char mask = 4075 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4076 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4077 7, 6, 5, 4, 3, 2, 1, 0}; 4078 return vec_perm(mask, mask, reverse); 4079 } 4080 #else 4081 static __inline__ vector unsigned char __ATTRS_o_ai 4082 vec_lvsr(int __a, const signed char *__b) { 4083 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4084 } 4085 #endif 4086 4087 #ifdef __LITTLE_ENDIAN__ 4088 static __inline__ vector unsigned char __ATTRS_o_ai 4089 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4090 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4091 vector unsigned char mask = 4092 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4093 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4094 7, 6, 5, 4, 3, 2, 1, 0}; 4095 return vec_perm(mask, mask, reverse); 4096 } 4097 #else 4098 static __inline__ vector unsigned char __ATTRS_o_ai 4099 vec_lvsr(int __a, const unsigned char *__b) { 4100 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4101 } 4102 #endif 4103 4104 #ifdef __LITTLE_ENDIAN__ 4105 static __inline__ vector unsigned char __ATTRS_o_ai 4106 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4107 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4108 vector unsigned char mask = 4109 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4110 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4111 7, 6, 5, 4, 3, 2, 1, 0}; 4112 return vec_perm(mask, mask, reverse); 4113 } 4114 #else 4115 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4116 const short *__b) { 4117 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4118 } 4119 #endif 4120 4121 #ifdef __LITTLE_ENDIAN__ 4122 static __inline__ vector unsigned char __ATTRS_o_ai 4123 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4124 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4125 vector unsigned char mask = 4126 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4127 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4128 7, 6, 5, 4, 3, 2, 1, 0}; 4129 return vec_perm(mask, mask, reverse); 4130 } 4131 #else 4132 static __inline__ vector unsigned char __ATTRS_o_ai 4133 vec_lvsr(int __a, const unsigned short *__b) { 4134 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4135 } 4136 #endif 4137 4138 #ifdef __LITTLE_ENDIAN__ 4139 static __inline__ vector unsigned char __ATTRS_o_ai 4140 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4141 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4142 vector unsigned char mask = 4143 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4144 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4145 7, 6, 5, 4, 3, 2, 1, 0}; 4146 return vec_perm(mask, mask, reverse); 4147 } 4148 #else 4149 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4150 const int *__b) { 4151 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4152 } 4153 #endif 4154 4155 #ifdef __LITTLE_ENDIAN__ 4156 static __inline__ vector unsigned char __ATTRS_o_ai 4157 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4158 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4159 vector unsigned char mask = 4160 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4161 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4162 7, 6, 5, 4, 3, 2, 1, 0}; 4163 return vec_perm(mask, mask, reverse); 4164 } 4165 #else 4166 static __inline__ vector unsigned char __ATTRS_o_ai 4167 vec_lvsr(int __a, const unsigned int *__b) { 4168 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4169 } 4170 #endif 4171 4172 #ifdef __LITTLE_ENDIAN__ 4173 static __inline__ vector unsigned char __ATTRS_o_ai 4174 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4175 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4176 vector unsigned char mask = 4177 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4178 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4179 7, 6, 5, 4, 3, 2, 1, 0}; 4180 return vec_perm(mask, mask, reverse); 4181 } 4182 #else 4183 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4184 const float *__b) { 4185 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4186 } 4187 #endif 4188 4189 /* vec_madd */ 4190 static __inline__ vector signed short __ATTRS_o_ai 4191 vec_mladd(vector signed short, vector signed short, vector signed short); 4192 static __inline__ vector signed short __ATTRS_o_ai 4193 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4194 static __inline__ vector signed short __ATTRS_o_ai 4195 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4196 static __inline__ vector unsigned short __ATTRS_o_ai 4197 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4198 4199 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4200 vector signed short __a, vector signed short __b, vector signed short __c) { 4201 return vec_mladd(__a, __b, __c); 4202 } 4203 4204 static __inline__ vector signed short __ATTRS_o_ai 4205 vec_madd(vector signed short __a, vector unsigned short __b, 4206 vector unsigned short __c) { 4207 return vec_mladd(__a, __b, __c); 4208 } 4209 4210 static __inline__ vector signed short __ATTRS_o_ai 4211 vec_madd(vector unsigned short __a, vector signed short __b, 4212 vector signed short __c) { 4213 return vec_mladd(__a, __b, __c); 4214 } 4215 4216 static __inline__ vector unsigned short __ATTRS_o_ai 4217 vec_madd(vector unsigned short __a, vector unsigned short __b, 4218 vector unsigned short __c) { 4219 return vec_mladd(__a, __b, __c); 4220 } 4221 4222 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4223 vector float __b, 4224 vector float __c) { 4225 #ifdef __VSX__ 4226 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4227 #else 4228 return __builtin_altivec_vmaddfp(__a, __b, __c); 4229 #endif 4230 } 4231 4232 #ifdef __VSX__ 4233 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4234 vector double __b, 4235 vector double __c) { 4236 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4237 } 4238 #endif 4239 4240 /* vec_vmaddfp */ 4241 4242 static __inline__ vector float __attribute__((__always_inline__)) 4243 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4244 return __builtin_altivec_vmaddfp(__a, __b, __c); 4245 } 4246 4247 /* vec_madds */ 4248 4249 static __inline__ vector signed short __attribute__((__always_inline__)) 4250 vec_madds(vector signed short __a, vector signed short __b, 4251 vector signed short __c) { 4252 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4253 } 4254 4255 /* vec_vmhaddshs */ 4256 static __inline__ vector signed short __attribute__((__always_inline__)) 4257 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4258 vector signed short __c) { 4259 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4260 } 4261 4262 /* vec_msub */ 4263 4264 #ifdef __VSX__ 4265 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4266 vector float __b, 4267 vector float __c) { 4268 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4269 } 4270 4271 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4272 vector double __b, 4273 vector double __c) { 4274 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4275 } 4276 #endif 4277 4278 /* vec_max */ 4279 4280 static __inline__ vector signed char __ATTRS_o_ai 4281 vec_max(vector signed char __a, vector signed char __b) { 4282 return __builtin_altivec_vmaxsb(__a, __b); 4283 } 4284 4285 static __inline__ vector signed char __ATTRS_o_ai 4286 vec_max(vector bool char __a, vector signed char __b) { 4287 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4288 } 4289 4290 static __inline__ vector signed char __ATTRS_o_ai 4291 vec_max(vector signed char __a, vector bool char __b) { 4292 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4293 } 4294 4295 static __inline__ vector unsigned char __ATTRS_o_ai 4296 vec_max(vector unsigned char __a, vector unsigned char __b) { 4297 return __builtin_altivec_vmaxub(__a, __b); 4298 } 4299 4300 static __inline__ vector unsigned char __ATTRS_o_ai 4301 vec_max(vector bool char __a, vector unsigned char __b) { 4302 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4303 } 4304 4305 static __inline__ vector unsigned char __ATTRS_o_ai 4306 vec_max(vector unsigned char __a, vector bool char __b) { 4307 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4308 } 4309 4310 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4311 vector short __b) { 4312 return __builtin_altivec_vmaxsh(__a, __b); 4313 } 4314 4315 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4316 vector short __b) { 4317 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4318 } 4319 4320 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4321 vector bool short __b) { 4322 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4323 } 4324 4325 static __inline__ vector unsigned short __ATTRS_o_ai 4326 vec_max(vector unsigned short __a, vector unsigned short __b) { 4327 return __builtin_altivec_vmaxuh(__a, __b); 4328 } 4329 4330 static __inline__ vector unsigned short __ATTRS_o_ai 4331 vec_max(vector bool short __a, vector unsigned short __b) { 4332 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4333 } 4334 4335 static __inline__ vector unsigned short __ATTRS_o_ai 4336 vec_max(vector unsigned short __a, vector bool short __b) { 4337 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4338 } 4339 4340 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4341 vector int __b) { 4342 return __builtin_altivec_vmaxsw(__a, __b); 4343 } 4344 4345 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4346 vector int __b) { 4347 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4348 } 4349 4350 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4351 vector bool int __b) { 4352 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4353 } 4354 4355 static __inline__ vector unsigned int __ATTRS_o_ai 4356 vec_max(vector unsigned int __a, vector unsigned int __b) { 4357 return __builtin_altivec_vmaxuw(__a, __b); 4358 } 4359 4360 static __inline__ vector unsigned int __ATTRS_o_ai 4361 vec_max(vector bool int __a, vector unsigned int __b) { 4362 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4363 } 4364 4365 static __inline__ vector unsigned int __ATTRS_o_ai 4366 vec_max(vector unsigned int __a, vector bool int __b) { 4367 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4368 } 4369 4370 #ifdef __POWER8_VECTOR__ 4371 static __inline__ vector signed long long __ATTRS_o_ai 4372 vec_max(vector signed long long __a, vector signed long long __b) { 4373 return __builtin_altivec_vmaxsd(__a, __b); 4374 } 4375 4376 static __inline__ vector signed long long __ATTRS_o_ai 4377 vec_max(vector bool long long __a, vector signed long long __b) { 4378 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4379 } 4380 4381 static __inline__ vector signed long long __ATTRS_o_ai 4382 vec_max(vector signed long long __a, vector bool long long __b) { 4383 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4384 } 4385 4386 static __inline__ vector unsigned long long __ATTRS_o_ai 4387 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4388 return __builtin_altivec_vmaxud(__a, __b); 4389 } 4390 4391 static __inline__ vector unsigned long long __ATTRS_o_ai 4392 vec_max(vector bool long long __a, vector unsigned long long __b) { 4393 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4394 } 4395 4396 static __inline__ vector unsigned long long __ATTRS_o_ai 4397 vec_max(vector unsigned long long __a, vector bool long long __b) { 4398 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4399 } 4400 #endif 4401 4402 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4403 vector float __b) { 4404 #ifdef __VSX__ 4405 return __builtin_vsx_xvmaxsp(__a, __b); 4406 #else 4407 return __builtin_altivec_vmaxfp(__a, __b); 4408 #endif 4409 } 4410 4411 #ifdef __VSX__ 4412 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4413 vector double __b) { 4414 return __builtin_vsx_xvmaxdp(__a, __b); 4415 } 4416 #endif 4417 4418 /* vec_vmaxsb */ 4419 4420 static __inline__ vector signed char __ATTRS_o_ai 4421 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4422 return __builtin_altivec_vmaxsb(__a, __b); 4423 } 4424 4425 static __inline__ vector signed char __ATTRS_o_ai 4426 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4427 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4428 } 4429 4430 static __inline__ vector signed char __ATTRS_o_ai 4431 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4432 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4433 } 4434 4435 /* vec_vmaxub */ 4436 4437 static __inline__ vector unsigned char __ATTRS_o_ai 4438 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4439 return __builtin_altivec_vmaxub(__a, __b); 4440 } 4441 4442 static __inline__ vector unsigned char __ATTRS_o_ai 4443 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4444 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4445 } 4446 4447 static __inline__ vector unsigned char __ATTRS_o_ai 4448 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4449 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4450 } 4451 4452 /* vec_vmaxsh */ 4453 4454 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4455 vector short __b) { 4456 return __builtin_altivec_vmaxsh(__a, __b); 4457 } 4458 4459 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 4460 vector short __b) { 4461 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4462 } 4463 4464 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4465 vector bool short __b) { 4466 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4467 } 4468 4469 /* vec_vmaxuh */ 4470 4471 static __inline__ vector unsigned short __ATTRS_o_ai 4472 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 4473 return __builtin_altivec_vmaxuh(__a, __b); 4474 } 4475 4476 static __inline__ vector unsigned short __ATTRS_o_ai 4477 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 4478 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4479 } 4480 4481 static __inline__ vector unsigned short __ATTRS_o_ai 4482 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 4483 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4484 } 4485 4486 /* vec_vmaxsw */ 4487 4488 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4489 vector int __b) { 4490 return __builtin_altivec_vmaxsw(__a, __b); 4491 } 4492 4493 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 4494 vector int __b) { 4495 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4496 } 4497 4498 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4499 vector bool int __b) { 4500 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4501 } 4502 4503 /* vec_vmaxuw */ 4504 4505 static __inline__ vector unsigned int __ATTRS_o_ai 4506 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 4507 return __builtin_altivec_vmaxuw(__a, __b); 4508 } 4509 4510 static __inline__ vector unsigned int __ATTRS_o_ai 4511 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 4512 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4513 } 4514 4515 static __inline__ vector unsigned int __ATTRS_o_ai 4516 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 4517 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4518 } 4519 4520 /* vec_vmaxfp */ 4521 4522 static __inline__ vector float __attribute__((__always_inline__)) 4523 vec_vmaxfp(vector float __a, vector float __b) { 4524 #ifdef __VSX__ 4525 return __builtin_vsx_xvmaxsp(__a, __b); 4526 #else 4527 return __builtin_altivec_vmaxfp(__a, __b); 4528 #endif 4529 } 4530 4531 /* vec_mergeh */ 4532 4533 static __inline__ vector signed char __ATTRS_o_ai 4534 vec_mergeh(vector signed char __a, vector signed char __b) { 4535 return vec_perm(__a, __b, 4536 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4537 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4538 0x06, 0x16, 0x07, 0x17)); 4539 } 4540 4541 static __inline__ vector unsigned char __ATTRS_o_ai 4542 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 4543 return vec_perm(__a, __b, 4544 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4545 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4546 0x06, 0x16, 0x07, 0x17)); 4547 } 4548 4549 static __inline__ vector bool char __ATTRS_o_ai 4550 vec_mergeh(vector bool char __a, vector bool char __b) { 4551 return vec_perm(__a, __b, 4552 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4553 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4554 0x06, 0x16, 0x07, 0x17)); 4555 } 4556 4557 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 4558 vector short __b) { 4559 return vec_perm(__a, __b, 4560 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4561 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4562 0x06, 0x07, 0x16, 0x17)); 4563 } 4564 4565 static __inline__ vector unsigned short __ATTRS_o_ai 4566 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 4567 return vec_perm(__a, __b, 4568 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4569 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4570 0x06, 0x07, 0x16, 0x17)); 4571 } 4572 4573 static __inline__ vector bool short __ATTRS_o_ai 4574 vec_mergeh(vector bool short __a, vector bool short __b) { 4575 return vec_perm(__a, __b, 4576 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4577 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4578 0x06, 0x07, 0x16, 0x17)); 4579 } 4580 4581 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 4582 vector pixel __b) { 4583 return vec_perm(__a, __b, 4584 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4585 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4586 0x06, 0x07, 0x16, 0x17)); 4587 } 4588 4589 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 4590 vector int __b) { 4591 return vec_perm(__a, __b, 4592 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4593 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4594 0x14, 0x15, 0x16, 0x17)); 4595 } 4596 4597 static __inline__ vector unsigned int __ATTRS_o_ai 4598 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 4599 return vec_perm(__a, __b, 4600 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4601 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4602 0x14, 0x15, 0x16, 0x17)); 4603 } 4604 4605 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 4606 vector bool int __b) { 4607 return vec_perm(__a, __b, 4608 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4609 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4610 0x14, 0x15, 0x16, 0x17)); 4611 } 4612 4613 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 4614 vector float __b) { 4615 return vec_perm(__a, __b, 4616 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4617 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4618 0x14, 0x15, 0x16, 0x17)); 4619 } 4620 4621 #ifdef __VSX__ 4622 static __inline__ vector signed long long __ATTRS_o_ai 4623 vec_mergeh(vector signed long long __a, vector signed long long __b) { 4624 return vec_perm(__a, __b, 4625 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4626 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4627 0x14, 0x15, 0x16, 0x17)); 4628 } 4629 4630 static __inline__ vector signed long long __ATTRS_o_ai 4631 vec_mergeh(vector signed long long __a, vector bool long long __b) { 4632 return vec_perm(__a, (vector signed long long)__b, 4633 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4634 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4635 0x14, 0x15, 0x16, 0x17)); 4636 } 4637 4638 static __inline__ vector signed long long __ATTRS_o_ai 4639 vec_mergeh(vector bool long long __a, vector signed long long __b) { 4640 return vec_perm((vector signed long long)__a, __b, 4641 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4642 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4643 0x14, 0x15, 0x16, 0x17)); 4644 } 4645 4646 static __inline__ vector unsigned long long __ATTRS_o_ai 4647 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 4648 return vec_perm(__a, __b, 4649 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4650 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4651 0x14, 0x15, 0x16, 0x17)); 4652 } 4653 4654 static __inline__ vector unsigned long long __ATTRS_o_ai 4655 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 4656 return vec_perm(__a, (vector unsigned long long)__b, 4657 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4658 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4659 0x14, 0x15, 0x16, 0x17)); 4660 } 4661 4662 static __inline__ vector unsigned long long __ATTRS_o_ai 4663 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 4664 return vec_perm((vector unsigned long long)__a, __b, 4665 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4666 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4667 0x14, 0x15, 0x16, 0x17)); 4668 } 4669 4670 static __inline__ vector bool long long __ATTRS_o_ai 4671 vec_mergeh(vector bool long long __a, vector bool long long __b) { 4672 return vec_perm(__a, __b, 4673 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4674 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4675 0x14, 0x15, 0x16, 0x17)); 4676 } 4677 4678 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 4679 vector double __b) { 4680 return vec_perm(__a, __b, 4681 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4682 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4683 0x14, 0x15, 0x16, 0x17)); 4684 } 4685 static __inline__ vector double __ATTRS_o_ai 4686 vec_mergeh(vector double __a, vector bool long long __b) { 4687 return vec_perm(__a, (vector double)__b, 4688 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4689 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4690 0x14, 0x15, 0x16, 0x17)); 4691 } 4692 static __inline__ vector double __ATTRS_o_ai 4693 vec_mergeh(vector bool long long __a, vector double __b) { 4694 return vec_perm((vector double)__a, __b, 4695 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4696 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4697 0x14, 0x15, 0x16, 0x17)); 4698 } 4699 #endif 4700 4701 /* vec_vmrghb */ 4702 4703 #define __builtin_altivec_vmrghb vec_vmrghb 4704 4705 static __inline__ vector signed char __ATTRS_o_ai 4706 vec_vmrghb(vector signed char __a, vector signed char __b) { 4707 return vec_perm(__a, __b, 4708 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4709 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4710 0x06, 0x16, 0x07, 0x17)); 4711 } 4712 4713 static __inline__ vector unsigned char __ATTRS_o_ai 4714 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 4715 return vec_perm(__a, __b, 4716 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4717 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4718 0x06, 0x16, 0x07, 0x17)); 4719 } 4720 4721 static __inline__ vector bool char __ATTRS_o_ai 4722 vec_vmrghb(vector bool char __a, vector bool char __b) { 4723 return vec_perm(__a, __b, 4724 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4725 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4726 0x06, 0x16, 0x07, 0x17)); 4727 } 4728 4729 /* vec_vmrghh */ 4730 4731 #define __builtin_altivec_vmrghh vec_vmrghh 4732 4733 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 4734 vector short __b) { 4735 return vec_perm(__a, __b, 4736 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4737 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4738 0x06, 0x07, 0x16, 0x17)); 4739 } 4740 4741 static __inline__ vector unsigned short __ATTRS_o_ai 4742 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 4743 return vec_perm(__a, __b, 4744 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4745 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4746 0x06, 0x07, 0x16, 0x17)); 4747 } 4748 4749 static __inline__ vector bool short __ATTRS_o_ai 4750 vec_vmrghh(vector bool short __a, vector bool short __b) { 4751 return vec_perm(__a, __b, 4752 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4753 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4754 0x06, 0x07, 0x16, 0x17)); 4755 } 4756 4757 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 4758 vector pixel __b) { 4759 return vec_perm(__a, __b, 4760 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4761 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4762 0x06, 0x07, 0x16, 0x17)); 4763 } 4764 4765 /* vec_vmrghw */ 4766 4767 #define __builtin_altivec_vmrghw vec_vmrghw 4768 4769 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 4770 vector int __b) { 4771 return vec_perm(__a, __b, 4772 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4773 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4774 0x14, 0x15, 0x16, 0x17)); 4775 } 4776 4777 static __inline__ vector unsigned int __ATTRS_o_ai 4778 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 4779 return vec_perm(__a, __b, 4780 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4781 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4782 0x14, 0x15, 0x16, 0x17)); 4783 } 4784 4785 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 4786 vector bool int __b) { 4787 return vec_perm(__a, __b, 4788 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4789 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4790 0x14, 0x15, 0x16, 0x17)); 4791 } 4792 4793 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 4794 vector float __b) { 4795 return vec_perm(__a, __b, 4796 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4797 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4798 0x14, 0x15, 0x16, 0x17)); 4799 } 4800 4801 /* vec_mergel */ 4802 4803 static __inline__ vector signed char __ATTRS_o_ai 4804 vec_mergel(vector signed char __a, vector signed char __b) { 4805 return vec_perm(__a, __b, 4806 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4807 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4808 0x0E, 0x1E, 0x0F, 0x1F)); 4809 } 4810 4811 static __inline__ vector unsigned char __ATTRS_o_ai 4812 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 4813 return vec_perm(__a, __b, 4814 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4815 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4816 0x0E, 0x1E, 0x0F, 0x1F)); 4817 } 4818 4819 static __inline__ vector bool char __ATTRS_o_ai 4820 vec_mergel(vector bool char __a, vector bool char __b) { 4821 return vec_perm(__a, __b, 4822 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4823 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4824 0x0E, 0x1E, 0x0F, 0x1F)); 4825 } 4826 4827 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 4828 vector short __b) { 4829 return vec_perm(__a, __b, 4830 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 4831 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 4832 0x0E, 0x0F, 0x1E, 0x1F)); 4833 } 4834 4835 static __inline__ vector unsigned short __ATTRS_o_ai 4836 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 4837 return vec_perm(__a, __b, 4838 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 4839 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 4840 0x0E, 0x0F, 0x1E, 0x1F)); 4841 } 4842 4843 static __inline__ vector bool short __ATTRS_o_ai 4844 vec_mergel(vector bool short __a, vector bool short __b) { 4845 return vec_perm(__a, __b, 4846 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 4847 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 4848 0x0E, 0x0F, 0x1E, 0x1F)); 4849 } 4850 4851 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 4852 vector pixel __b) { 4853 return vec_perm(__a, __b, 4854 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 4855 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 4856 0x0E, 0x0F, 0x1E, 0x1F)); 4857 } 4858 4859 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 4860 vector int __b) { 4861 return vec_perm(__a, __b, 4862 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 4863 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 4864 0x1C, 0x1D, 0x1E, 0x1F)); 4865 } 4866 4867 static __inline__ vector unsigned int __ATTRS_o_ai 4868 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 4869 return vec_perm(__a, __b, 4870 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 4871 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 4872 0x1C, 0x1D, 0x1E, 0x1F)); 4873 } 4874 4875 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 4876 vector bool int __b) { 4877 return vec_perm(__a, __b, 4878 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 4879 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 4880 0x1C, 0x1D, 0x1E, 0x1F)); 4881 } 4882 4883 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 4884 vector float __b) { 4885 return vec_perm(__a, __b, 4886 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 4887 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 4888 0x1C, 0x1D, 0x1E, 0x1F)); 4889 } 4890 4891 #ifdef __VSX__ 4892 static __inline__ vector signed long long __ATTRS_o_ai 4893 vec_mergel(vector signed long long __a, vector signed long long __b) { 4894 return vec_perm(__a, __b, 4895 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4896 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4897 0x1C, 0x1D, 0x1E, 0x1F)); 4898 } 4899 static __inline__ vector signed long long __ATTRS_o_ai 4900 vec_mergel(vector signed long long __a, vector bool long long __b) { 4901 return vec_perm(__a, (vector signed long long)__b, 4902 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4903 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4904 0x1C, 0x1D, 0x1E, 0x1F)); 4905 } 4906 static __inline__ vector signed long long __ATTRS_o_ai 4907 vec_mergel(vector bool long long __a, vector signed long long __b) { 4908 return vec_perm((vector signed long long)__a, __b, 4909 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4910 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4911 0x1C, 0x1D, 0x1E, 0x1F)); 4912 } 4913 static __inline__ vector unsigned long long __ATTRS_o_ai 4914 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 4915 return vec_perm(__a, __b, 4916 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4917 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4918 0x1C, 0x1D, 0x1E, 0x1F)); 4919 } 4920 static __inline__ vector unsigned long long __ATTRS_o_ai 4921 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 4922 return vec_perm(__a, (vector unsigned long long)__b, 4923 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4924 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4925 0x1C, 0x1D, 0x1E, 0x1F)); 4926 } 4927 static __inline__ vector unsigned long long __ATTRS_o_ai 4928 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 4929 return vec_perm((vector unsigned long long)__a, __b, 4930 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4931 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4932 0x1C, 0x1D, 0x1E, 0x1F)); 4933 } 4934 static __inline__ vector bool long long __ATTRS_o_ai 4935 vec_mergel(vector bool long long __a, vector bool long long __b) { 4936 return vec_perm(__a, __b, 4937 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4938 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4939 0x1C, 0x1D, 0x1E, 0x1F)); 4940 } 4941 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 4942 vector double __b) { 4943 return vec_perm(__a, __b, 4944 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4945 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4946 0x1C, 0x1D, 0x1E, 0x1F)); 4947 } 4948 static __inline__ vector double __ATTRS_o_ai 4949 vec_mergel(vector double __a, vector bool long long __b) { 4950 return vec_perm(__a, (vector double)__b, 4951 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4952 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4953 0x1C, 0x1D, 0x1E, 0x1F)); 4954 } 4955 static __inline__ vector double __ATTRS_o_ai 4956 vec_mergel(vector bool long long __a, vector double __b) { 4957 return vec_perm((vector double)__a, __b, 4958 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 4959 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 4960 0x1C, 0x1D, 0x1E, 0x1F)); 4961 } 4962 #endif 4963 4964 /* vec_vmrglb */ 4965 4966 #define __builtin_altivec_vmrglb vec_vmrglb 4967 4968 static __inline__ vector signed char __ATTRS_o_ai 4969 vec_vmrglb(vector signed char __a, vector signed char __b) { 4970 return vec_perm(__a, __b, 4971 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4972 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4973 0x0E, 0x1E, 0x0F, 0x1F)); 4974 } 4975 4976 static __inline__ vector unsigned char __ATTRS_o_ai 4977 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 4978 return vec_perm(__a, __b, 4979 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4980 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4981 0x0E, 0x1E, 0x0F, 0x1F)); 4982 } 4983 4984 static __inline__ vector bool char __ATTRS_o_ai 4985 vec_vmrglb(vector bool char __a, vector bool char __b) { 4986 return vec_perm(__a, __b, 4987 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4988 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4989 0x0E, 0x1E, 0x0F, 0x1F)); 4990 } 4991 4992 /* vec_vmrglh */ 4993 4994 #define __builtin_altivec_vmrglh vec_vmrglh 4995 4996 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 4997 vector short __b) { 4998 return vec_perm(__a, __b, 4999 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5000 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5001 0x0E, 0x0F, 0x1E, 0x1F)); 5002 } 5003 5004 static __inline__ vector unsigned short __ATTRS_o_ai 5005 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5006 return vec_perm(__a, __b, 5007 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5008 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5009 0x0E, 0x0F, 0x1E, 0x1F)); 5010 } 5011 5012 static __inline__ vector bool short __ATTRS_o_ai 5013 vec_vmrglh(vector bool short __a, vector bool short __b) { 5014 return vec_perm(__a, __b, 5015 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5016 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5017 0x0E, 0x0F, 0x1E, 0x1F)); 5018 } 5019 5020 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5021 vector pixel __b) { 5022 return vec_perm(__a, __b, 5023 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5024 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5025 0x0E, 0x0F, 0x1E, 0x1F)); 5026 } 5027 5028 /* vec_vmrglw */ 5029 5030 #define __builtin_altivec_vmrglw vec_vmrglw 5031 5032 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5033 vector int __b) { 5034 return vec_perm(__a, __b, 5035 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5036 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5037 0x1C, 0x1D, 0x1E, 0x1F)); 5038 } 5039 5040 static __inline__ vector unsigned int __ATTRS_o_ai 5041 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5042 return vec_perm(__a, __b, 5043 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5044 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5045 0x1C, 0x1D, 0x1E, 0x1F)); 5046 } 5047 5048 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5049 vector bool int __b) { 5050 return vec_perm(__a, __b, 5051 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5052 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5053 0x1C, 0x1D, 0x1E, 0x1F)); 5054 } 5055 5056 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5057 vector float __b) { 5058 return vec_perm(__a, __b, 5059 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5060 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5061 0x1C, 0x1D, 0x1E, 0x1F)); 5062 } 5063 5064 #ifdef __POWER8_VECTOR__ 5065 /* vec_mergee */ 5066 5067 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5068 vector bool int __b) { 5069 return vec_perm(__a, __b, 5070 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5071 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5072 0x18, 0x19, 0x1A, 0x1B)); 5073 } 5074 5075 static __inline__ vector signed int __ATTRS_o_ai 5076 vec_mergee(vector signed int __a, vector signed int __b) { 5077 return vec_perm(__a, __b, 5078 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5079 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5080 0x18, 0x19, 0x1A, 0x1B)); 5081 } 5082 5083 static __inline__ vector unsigned int __ATTRS_o_ai 5084 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5085 return vec_perm(__a, __b, 5086 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5087 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5088 0x18, 0x19, 0x1A, 0x1B)); 5089 } 5090 5091 static __inline__ vector bool long long __ATTRS_o_ai 5092 vec_mergee(vector bool long long __a, vector bool long long __b) { 5093 return vec_mergeh(__a, __b); 5094 } 5095 5096 static __inline__ vector signed long long __ATTRS_o_ai 5097 vec_mergee(vector signed long long __a, vector signed long long __b) { 5098 return vec_mergeh(__a, __b); 5099 } 5100 5101 static __inline__ vector unsigned long long __ATTRS_o_ai 5102 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5103 return vec_mergeh(__a, __b); 5104 } 5105 5106 static __inline__ vector float __ATTRS_o_ai 5107 vec_mergee(vector float __a, vector float __b) { 5108 return vec_perm(__a, __b, 5109 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5110 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5111 0x18, 0x19, 0x1A, 0x1B)); 5112 } 5113 5114 static __inline__ vector double __ATTRS_o_ai 5115 vec_mergee(vector double __a, vector double __b) { 5116 return vec_mergeh(__a, __b); 5117 } 5118 5119 /* vec_mergeo */ 5120 5121 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5122 vector bool int __b) { 5123 return vec_perm(__a, __b, 5124 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5125 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5126 0x1C, 0x1D, 0x1E, 0x1F)); 5127 } 5128 5129 static __inline__ vector signed int __ATTRS_o_ai 5130 vec_mergeo(vector signed int __a, vector signed int __b) { 5131 return vec_perm(__a, __b, 5132 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5133 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5134 0x1C, 0x1D, 0x1E, 0x1F)); 5135 } 5136 5137 static __inline__ vector unsigned int __ATTRS_o_ai 5138 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5139 return vec_perm(__a, __b, 5140 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5141 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5142 0x1C, 0x1D, 0x1E, 0x1F)); 5143 } 5144 5145 static __inline__ vector bool long long __ATTRS_o_ai 5146 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5147 return vec_mergel(__a, __b); 5148 } 5149 5150 static __inline__ vector signed long long __ATTRS_o_ai 5151 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5152 return vec_mergel(__a, __b); 5153 } 5154 5155 static __inline__ vector unsigned long long __ATTRS_o_ai 5156 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5157 return vec_mergel(__a, __b); 5158 } 5159 5160 static __inline__ vector float __ATTRS_o_ai 5161 vec_mergeo(vector float __a, vector float __b) { 5162 return vec_perm(__a, __b, 5163 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5164 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5165 0x1C, 0x1D, 0x1E, 0x1F)); 5166 } 5167 5168 static __inline__ vector double __ATTRS_o_ai 5169 vec_mergeo(vector double __a, vector double __b) { 5170 return vec_mergel(__a, __b); 5171 } 5172 5173 #endif 5174 5175 /* vec_mfvscr */ 5176 5177 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5178 vec_mfvscr(void) { 5179 return __builtin_altivec_mfvscr(); 5180 } 5181 5182 /* vec_min */ 5183 5184 static __inline__ vector signed char __ATTRS_o_ai 5185 vec_min(vector signed char __a, vector signed char __b) { 5186 return __builtin_altivec_vminsb(__a, __b); 5187 } 5188 5189 static __inline__ vector signed char __ATTRS_o_ai 5190 vec_min(vector bool char __a, vector signed char __b) { 5191 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5192 } 5193 5194 static __inline__ vector signed char __ATTRS_o_ai 5195 vec_min(vector signed char __a, vector bool char __b) { 5196 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5197 } 5198 5199 static __inline__ vector unsigned char __ATTRS_o_ai 5200 vec_min(vector unsigned char __a, vector unsigned char __b) { 5201 return __builtin_altivec_vminub(__a, __b); 5202 } 5203 5204 static __inline__ vector unsigned char __ATTRS_o_ai 5205 vec_min(vector bool char __a, vector unsigned char __b) { 5206 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5207 } 5208 5209 static __inline__ vector unsigned char __ATTRS_o_ai 5210 vec_min(vector unsigned char __a, vector bool char __b) { 5211 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5212 } 5213 5214 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5215 vector short __b) { 5216 return __builtin_altivec_vminsh(__a, __b); 5217 } 5218 5219 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5220 vector short __b) { 5221 return __builtin_altivec_vminsh((vector short)__a, __b); 5222 } 5223 5224 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5225 vector bool short __b) { 5226 return __builtin_altivec_vminsh(__a, (vector short)__b); 5227 } 5228 5229 static __inline__ vector unsigned short __ATTRS_o_ai 5230 vec_min(vector unsigned short __a, vector unsigned short __b) { 5231 return __builtin_altivec_vminuh(__a, __b); 5232 } 5233 5234 static __inline__ vector unsigned short __ATTRS_o_ai 5235 vec_min(vector bool short __a, vector unsigned short __b) { 5236 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5237 } 5238 5239 static __inline__ vector unsigned short __ATTRS_o_ai 5240 vec_min(vector unsigned short __a, vector bool short __b) { 5241 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5242 } 5243 5244 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5245 vector int __b) { 5246 return __builtin_altivec_vminsw(__a, __b); 5247 } 5248 5249 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5250 vector int __b) { 5251 return __builtin_altivec_vminsw((vector int)__a, __b); 5252 } 5253 5254 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5255 vector bool int __b) { 5256 return __builtin_altivec_vminsw(__a, (vector int)__b); 5257 } 5258 5259 static __inline__ vector unsigned int __ATTRS_o_ai 5260 vec_min(vector unsigned int __a, vector unsigned int __b) { 5261 return __builtin_altivec_vminuw(__a, __b); 5262 } 5263 5264 static __inline__ vector unsigned int __ATTRS_o_ai 5265 vec_min(vector bool int __a, vector unsigned int __b) { 5266 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5267 } 5268 5269 static __inline__ vector unsigned int __ATTRS_o_ai 5270 vec_min(vector unsigned int __a, vector bool int __b) { 5271 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5272 } 5273 5274 #ifdef __POWER8_VECTOR__ 5275 static __inline__ vector signed long long __ATTRS_o_ai 5276 vec_min(vector signed long long __a, vector signed long long __b) { 5277 return __builtin_altivec_vminsd(__a, __b); 5278 } 5279 5280 static __inline__ vector signed long long __ATTRS_o_ai 5281 vec_min(vector bool long long __a, vector signed long long __b) { 5282 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5283 } 5284 5285 static __inline__ vector signed long long __ATTRS_o_ai 5286 vec_min(vector signed long long __a, vector bool long long __b) { 5287 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5288 } 5289 5290 static __inline__ vector unsigned long long __ATTRS_o_ai 5291 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5292 return __builtin_altivec_vminud(__a, __b); 5293 } 5294 5295 static __inline__ vector unsigned long long __ATTRS_o_ai 5296 vec_min(vector bool long long __a, vector unsigned long long __b) { 5297 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5298 } 5299 5300 static __inline__ vector unsigned long long __ATTRS_o_ai 5301 vec_min(vector unsigned long long __a, vector bool long long __b) { 5302 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5303 } 5304 #endif 5305 5306 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5307 vector float __b) { 5308 #ifdef __VSX__ 5309 return __builtin_vsx_xvminsp(__a, __b); 5310 #else 5311 return __builtin_altivec_vminfp(__a, __b); 5312 #endif 5313 } 5314 5315 #ifdef __VSX__ 5316 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5317 vector double __b) { 5318 return __builtin_vsx_xvmindp(__a, __b); 5319 } 5320 #endif 5321 5322 /* vec_vminsb */ 5323 5324 static __inline__ vector signed char __ATTRS_o_ai 5325 vec_vminsb(vector signed char __a, vector signed char __b) { 5326 return __builtin_altivec_vminsb(__a, __b); 5327 } 5328 5329 static __inline__ vector signed char __ATTRS_o_ai 5330 vec_vminsb(vector bool char __a, vector signed char __b) { 5331 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5332 } 5333 5334 static __inline__ vector signed char __ATTRS_o_ai 5335 vec_vminsb(vector signed char __a, vector bool char __b) { 5336 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5337 } 5338 5339 /* vec_vminub */ 5340 5341 static __inline__ vector unsigned char __ATTRS_o_ai 5342 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5343 return __builtin_altivec_vminub(__a, __b); 5344 } 5345 5346 static __inline__ vector unsigned char __ATTRS_o_ai 5347 vec_vminub(vector bool char __a, vector unsigned char __b) { 5348 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5349 } 5350 5351 static __inline__ vector unsigned char __ATTRS_o_ai 5352 vec_vminub(vector unsigned char __a, vector bool char __b) { 5353 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5354 } 5355 5356 /* vec_vminsh */ 5357 5358 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5359 vector short __b) { 5360 return __builtin_altivec_vminsh(__a, __b); 5361 } 5362 5363 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5364 vector short __b) { 5365 return __builtin_altivec_vminsh((vector short)__a, __b); 5366 } 5367 5368 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5369 vector bool short __b) { 5370 return __builtin_altivec_vminsh(__a, (vector short)__b); 5371 } 5372 5373 /* vec_vminuh */ 5374 5375 static __inline__ vector unsigned short __ATTRS_o_ai 5376 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5377 return __builtin_altivec_vminuh(__a, __b); 5378 } 5379 5380 static __inline__ vector unsigned short __ATTRS_o_ai 5381 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5382 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5383 } 5384 5385 static __inline__ vector unsigned short __ATTRS_o_ai 5386 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5387 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5388 } 5389 5390 /* vec_vminsw */ 5391 5392 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5393 vector int __b) { 5394 return __builtin_altivec_vminsw(__a, __b); 5395 } 5396 5397 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5398 vector int __b) { 5399 return __builtin_altivec_vminsw((vector int)__a, __b); 5400 } 5401 5402 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5403 vector bool int __b) { 5404 return __builtin_altivec_vminsw(__a, (vector int)__b); 5405 } 5406 5407 /* vec_vminuw */ 5408 5409 static __inline__ vector unsigned int __ATTRS_o_ai 5410 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5411 return __builtin_altivec_vminuw(__a, __b); 5412 } 5413 5414 static __inline__ vector unsigned int __ATTRS_o_ai 5415 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5416 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5417 } 5418 5419 static __inline__ vector unsigned int __ATTRS_o_ai 5420 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5421 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5422 } 5423 5424 /* vec_vminfp */ 5425 5426 static __inline__ vector float __attribute__((__always_inline__)) 5427 vec_vminfp(vector float __a, vector float __b) { 5428 #ifdef __VSX__ 5429 return __builtin_vsx_xvminsp(__a, __b); 5430 #else 5431 return __builtin_altivec_vminfp(__a, __b); 5432 #endif 5433 } 5434 5435 /* vec_mladd */ 5436 5437 #define __builtin_altivec_vmladduhm vec_mladd 5438 5439 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5440 vector short __b, 5441 vector short __c) { 5442 return __a * __b + __c; 5443 } 5444 5445 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5446 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5447 return __a * (vector short)__b + (vector short)__c; 5448 } 5449 5450 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5451 vector short __b, 5452 vector short __c) { 5453 return (vector short)__a * __b + __c; 5454 } 5455 5456 static __inline__ vector unsigned short __ATTRS_o_ai 5457 vec_mladd(vector unsigned short __a, vector unsigned short __b, 5458 vector unsigned short __c) { 5459 return __a * __b + __c; 5460 } 5461 5462 /* vec_vmladduhm */ 5463 5464 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 5465 vector short __b, 5466 vector short __c) { 5467 return __a * __b + __c; 5468 } 5469 5470 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 5471 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5472 return __a * (vector short)__b + (vector short)__c; 5473 } 5474 5475 static __inline__ vector short __ATTRS_o_ai 5476 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 5477 return (vector short)__a * __b + __c; 5478 } 5479 5480 static __inline__ vector unsigned short __ATTRS_o_ai 5481 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 5482 vector unsigned short __c) { 5483 return __a * __b + __c; 5484 } 5485 5486 /* vec_mradds */ 5487 5488 static __inline__ vector short __attribute__((__always_inline__)) 5489 vec_mradds(vector short __a, vector short __b, vector short __c) { 5490 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5491 } 5492 5493 /* vec_vmhraddshs */ 5494 5495 static __inline__ vector short __attribute__((__always_inline__)) 5496 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 5497 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5498 } 5499 5500 /* vec_msum */ 5501 5502 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 5503 vector unsigned char __b, 5504 vector int __c) { 5505 return __builtin_altivec_vmsummbm(__a, __b, __c); 5506 } 5507 5508 static __inline__ vector unsigned int __ATTRS_o_ai 5509 vec_msum(vector unsigned char __a, vector unsigned char __b, 5510 vector unsigned int __c) { 5511 return __builtin_altivec_vmsumubm(__a, __b, __c); 5512 } 5513 5514 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 5515 vector short __b, 5516 vector int __c) { 5517 return __builtin_altivec_vmsumshm(__a, __b, __c); 5518 } 5519 5520 static __inline__ vector unsigned int __ATTRS_o_ai 5521 vec_msum(vector unsigned short __a, vector unsigned short __b, 5522 vector unsigned int __c) { 5523 return __builtin_altivec_vmsumuhm(__a, __b, __c); 5524 } 5525 5526 /* vec_vmsummbm */ 5527 5528 static __inline__ vector int __attribute__((__always_inline__)) 5529 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 5530 return __builtin_altivec_vmsummbm(__a, __b, __c); 5531 } 5532 5533 /* vec_vmsumubm */ 5534 5535 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5536 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 5537 vector unsigned int __c) { 5538 return __builtin_altivec_vmsumubm(__a, __b, __c); 5539 } 5540 5541 /* vec_vmsumshm */ 5542 5543 static __inline__ vector int __attribute__((__always_inline__)) 5544 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 5545 return __builtin_altivec_vmsumshm(__a, __b, __c); 5546 } 5547 5548 /* vec_vmsumuhm */ 5549 5550 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5551 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 5552 vector unsigned int __c) { 5553 return __builtin_altivec_vmsumuhm(__a, __b, __c); 5554 } 5555 5556 /* vec_msums */ 5557 5558 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 5559 vector short __b, 5560 vector int __c) { 5561 return __builtin_altivec_vmsumshs(__a, __b, __c); 5562 } 5563 5564 static __inline__ vector unsigned int __ATTRS_o_ai 5565 vec_msums(vector unsigned short __a, vector unsigned short __b, 5566 vector unsigned int __c) { 5567 return __builtin_altivec_vmsumuhs(__a, __b, __c); 5568 } 5569 5570 /* vec_vmsumshs */ 5571 5572 static __inline__ vector int __attribute__((__always_inline__)) 5573 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 5574 return __builtin_altivec_vmsumshs(__a, __b, __c); 5575 } 5576 5577 /* vec_vmsumuhs */ 5578 5579 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5580 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 5581 vector unsigned int __c) { 5582 return __builtin_altivec_vmsumuhs(__a, __b, __c); 5583 } 5584 5585 /* vec_mtvscr */ 5586 5587 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 5588 __builtin_altivec_mtvscr((vector int)__a); 5589 } 5590 5591 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 5592 __builtin_altivec_mtvscr((vector int)__a); 5593 } 5594 5595 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 5596 __builtin_altivec_mtvscr((vector int)__a); 5597 } 5598 5599 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 5600 __builtin_altivec_mtvscr((vector int)__a); 5601 } 5602 5603 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 5604 __builtin_altivec_mtvscr((vector int)__a); 5605 } 5606 5607 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 5608 __builtin_altivec_mtvscr((vector int)__a); 5609 } 5610 5611 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 5612 __builtin_altivec_mtvscr((vector int)__a); 5613 } 5614 5615 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 5616 __builtin_altivec_mtvscr((vector int)__a); 5617 } 5618 5619 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 5620 __builtin_altivec_mtvscr((vector int)__a); 5621 } 5622 5623 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 5624 __builtin_altivec_mtvscr((vector int)__a); 5625 } 5626 5627 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 5628 __builtin_altivec_mtvscr((vector int)__a); 5629 } 5630 5631 /* vec_mul */ 5632 5633 /* Integer vector multiplication will involve multiplication of the odd/even 5634 elements separately, then truncating the results and moving to the 5635 result vector. 5636 */ 5637 static __inline__ vector signed char __ATTRS_o_ai 5638 vec_mul(vector signed char __a, vector signed char __b) { 5639 return __a * __b; 5640 } 5641 5642 static __inline__ vector unsigned char __ATTRS_o_ai 5643 vec_mul(vector unsigned char __a, vector unsigned char __b) { 5644 return __a * __b; 5645 } 5646 5647 static __inline__ vector signed short __ATTRS_o_ai 5648 vec_mul(vector signed short __a, vector signed short __b) { 5649 return __a * __b; 5650 } 5651 5652 static __inline__ vector unsigned short __ATTRS_o_ai 5653 vec_mul(vector unsigned short __a, vector unsigned short __b) { 5654 return __a * __b; 5655 } 5656 5657 static __inline__ vector signed int __ATTRS_o_ai 5658 vec_mul(vector signed int __a, vector signed int __b) { 5659 return __a * __b; 5660 } 5661 5662 static __inline__ vector unsigned int __ATTRS_o_ai 5663 vec_mul(vector unsigned int __a, vector unsigned int __b) { 5664 return __a * __b; 5665 } 5666 5667 #ifdef __VSX__ 5668 static __inline__ vector signed long long __ATTRS_o_ai 5669 vec_mul(vector signed long long __a, vector signed long long __b) { 5670 return __a * __b; 5671 } 5672 5673 static __inline__ vector unsigned long long __ATTRS_o_ai 5674 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 5675 return __a * __b; 5676 } 5677 #endif 5678 5679 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 5680 vector float __b) { 5681 return __a * __b; 5682 } 5683 5684 #ifdef __VSX__ 5685 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 5686 vector double __b) { 5687 return __a * __b; 5688 } 5689 #endif 5690 5691 /* The vmulos* and vmules* instructions have a big endian bias, so 5692 we must reverse the meaning of "even" and "odd" for little endian. */ 5693 5694 /* vec_mule */ 5695 5696 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 5697 vector signed char __b) { 5698 #ifdef __LITTLE_ENDIAN__ 5699 return __builtin_altivec_vmulosb(__a, __b); 5700 #else 5701 return __builtin_altivec_vmulesb(__a, __b); 5702 #endif 5703 } 5704 5705 static __inline__ vector unsigned short __ATTRS_o_ai 5706 vec_mule(vector unsigned char __a, vector unsigned char __b) { 5707 #ifdef __LITTLE_ENDIAN__ 5708 return __builtin_altivec_vmuloub(__a, __b); 5709 #else 5710 return __builtin_altivec_vmuleub(__a, __b); 5711 #endif 5712 } 5713 5714 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 5715 vector short __b) { 5716 #ifdef __LITTLE_ENDIAN__ 5717 return __builtin_altivec_vmulosh(__a, __b); 5718 #else 5719 return __builtin_altivec_vmulesh(__a, __b); 5720 #endif 5721 } 5722 5723 static __inline__ vector unsigned int __ATTRS_o_ai 5724 vec_mule(vector unsigned short __a, vector unsigned short __b) { 5725 #ifdef __LITTLE_ENDIAN__ 5726 return __builtin_altivec_vmulouh(__a, __b); 5727 #else 5728 return __builtin_altivec_vmuleuh(__a, __b); 5729 #endif 5730 } 5731 5732 #ifdef __POWER8_VECTOR__ 5733 static __inline__ vector signed long long __ATTRS_o_ai 5734 vec_mule(vector signed int __a, vector signed int __b) { 5735 #ifdef __LITTLE_ENDIAN__ 5736 return __builtin_altivec_vmulosw(__a, __b); 5737 #else 5738 return __builtin_altivec_vmulesw(__a, __b); 5739 #endif 5740 } 5741 5742 static __inline__ vector unsigned long long __ATTRS_o_ai 5743 vec_mule(vector unsigned int __a, vector unsigned int __b) { 5744 #ifdef __LITTLE_ENDIAN__ 5745 return __builtin_altivec_vmulouw(__a, __b); 5746 #else 5747 return __builtin_altivec_vmuleuw(__a, __b); 5748 #endif 5749 } 5750 #endif 5751 5752 /* vec_vmulesb */ 5753 5754 static __inline__ vector short __attribute__((__always_inline__)) 5755 vec_vmulesb(vector signed char __a, vector signed char __b) { 5756 #ifdef __LITTLE_ENDIAN__ 5757 return __builtin_altivec_vmulosb(__a, __b); 5758 #else 5759 return __builtin_altivec_vmulesb(__a, __b); 5760 #endif 5761 } 5762 5763 /* vec_vmuleub */ 5764 5765 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5766 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 5767 #ifdef __LITTLE_ENDIAN__ 5768 return __builtin_altivec_vmuloub(__a, __b); 5769 #else 5770 return __builtin_altivec_vmuleub(__a, __b); 5771 #endif 5772 } 5773 5774 /* vec_vmulesh */ 5775 5776 static __inline__ vector int __attribute__((__always_inline__)) 5777 vec_vmulesh(vector short __a, vector short __b) { 5778 #ifdef __LITTLE_ENDIAN__ 5779 return __builtin_altivec_vmulosh(__a, __b); 5780 #else 5781 return __builtin_altivec_vmulesh(__a, __b); 5782 #endif 5783 } 5784 5785 /* vec_vmuleuh */ 5786 5787 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5788 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 5789 #ifdef __LITTLE_ENDIAN__ 5790 return __builtin_altivec_vmulouh(__a, __b); 5791 #else 5792 return __builtin_altivec_vmuleuh(__a, __b); 5793 #endif 5794 } 5795 5796 /* vec_mulo */ 5797 5798 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 5799 vector signed char __b) { 5800 #ifdef __LITTLE_ENDIAN__ 5801 return __builtin_altivec_vmulesb(__a, __b); 5802 #else 5803 return __builtin_altivec_vmulosb(__a, __b); 5804 #endif 5805 } 5806 5807 static __inline__ vector unsigned short __ATTRS_o_ai 5808 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 5809 #ifdef __LITTLE_ENDIAN__ 5810 return __builtin_altivec_vmuleub(__a, __b); 5811 #else 5812 return __builtin_altivec_vmuloub(__a, __b); 5813 #endif 5814 } 5815 5816 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 5817 vector short __b) { 5818 #ifdef __LITTLE_ENDIAN__ 5819 return __builtin_altivec_vmulesh(__a, __b); 5820 #else 5821 return __builtin_altivec_vmulosh(__a, __b); 5822 #endif 5823 } 5824 5825 static __inline__ vector unsigned int __ATTRS_o_ai 5826 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 5827 #ifdef __LITTLE_ENDIAN__ 5828 return __builtin_altivec_vmuleuh(__a, __b); 5829 #else 5830 return __builtin_altivec_vmulouh(__a, __b); 5831 #endif 5832 } 5833 5834 #ifdef __POWER8_VECTOR__ 5835 static __inline__ vector signed long long __ATTRS_o_ai 5836 vec_mulo(vector signed int __a, vector signed int __b) { 5837 #ifdef __LITTLE_ENDIAN__ 5838 return __builtin_altivec_vmulesw(__a, __b); 5839 #else 5840 return __builtin_altivec_vmulosw(__a, __b); 5841 #endif 5842 } 5843 5844 static __inline__ vector unsigned long long __ATTRS_o_ai 5845 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 5846 #ifdef __LITTLE_ENDIAN__ 5847 return __builtin_altivec_vmuleuw(__a, __b); 5848 #else 5849 return __builtin_altivec_vmulouw(__a, __b); 5850 #endif 5851 } 5852 #endif 5853 5854 /* vec_vmulosb */ 5855 5856 static __inline__ vector short __attribute__((__always_inline__)) 5857 vec_vmulosb(vector signed char __a, vector signed char __b) { 5858 #ifdef __LITTLE_ENDIAN__ 5859 return __builtin_altivec_vmulesb(__a, __b); 5860 #else 5861 return __builtin_altivec_vmulosb(__a, __b); 5862 #endif 5863 } 5864 5865 /* vec_vmuloub */ 5866 5867 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5868 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 5869 #ifdef __LITTLE_ENDIAN__ 5870 return __builtin_altivec_vmuleub(__a, __b); 5871 #else 5872 return __builtin_altivec_vmuloub(__a, __b); 5873 #endif 5874 } 5875 5876 /* vec_vmulosh */ 5877 5878 static __inline__ vector int __attribute__((__always_inline__)) 5879 vec_vmulosh(vector short __a, vector short __b) { 5880 #ifdef __LITTLE_ENDIAN__ 5881 return __builtin_altivec_vmulesh(__a, __b); 5882 #else 5883 return __builtin_altivec_vmulosh(__a, __b); 5884 #endif 5885 } 5886 5887 /* vec_vmulouh */ 5888 5889 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5890 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 5891 #ifdef __LITTLE_ENDIAN__ 5892 return __builtin_altivec_vmuleuh(__a, __b); 5893 #else 5894 return __builtin_altivec_vmulouh(__a, __b); 5895 #endif 5896 } 5897 5898 /* vec_nand */ 5899 5900 #ifdef __POWER8_VECTOR__ 5901 static __inline__ vector signed char __ATTRS_o_ai 5902 vec_nand(vector signed char __a, vector signed char __b) { 5903 return ~(__a & __b); 5904 } 5905 5906 static __inline__ vector signed char __ATTRS_o_ai 5907 vec_nand(vector signed char __a, vector bool char __b) { 5908 return ~(__a & __b); 5909 } 5910 5911 static __inline__ vector signed char __ATTRS_o_ai 5912 vec_nand(vector bool char __a, vector signed char __b) { 5913 return ~(__a & __b); 5914 } 5915 5916 static __inline__ vector unsigned char __ATTRS_o_ai 5917 vec_nand(vector unsigned char __a, vector unsigned char __b) { 5918 return ~(__a & __b); 5919 } 5920 5921 static __inline__ vector unsigned char __ATTRS_o_ai 5922 vec_nand(vector unsigned char __a, vector bool char __b) { 5923 return ~(__a & __b); 5924 } 5925 5926 static __inline__ vector unsigned char __ATTRS_o_ai 5927 vec_nand(vector bool char __a, vector unsigned char __b) { 5928 return ~(__a & __b); 5929 } 5930 5931 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 5932 vector bool char __b) { 5933 return ~(__a & __b); 5934 } 5935 5936 static __inline__ vector signed short __ATTRS_o_ai 5937 vec_nand(vector signed short __a, vector signed short __b) { 5938 return ~(__a & __b); 5939 } 5940 5941 static __inline__ vector signed short __ATTRS_o_ai 5942 vec_nand(vector signed short __a, vector bool short __b) { 5943 return ~(__a & __b); 5944 } 5945 5946 static __inline__ vector signed short __ATTRS_o_ai 5947 vec_nand(vector bool short __a, vector signed short __b) { 5948 return ~(__a & __b); 5949 } 5950 5951 static __inline__ vector unsigned short __ATTRS_o_ai 5952 vec_nand(vector unsigned short __a, vector unsigned short __b) { 5953 return ~(__a & __b); 5954 } 5955 5956 static __inline__ vector unsigned short __ATTRS_o_ai 5957 vec_nand(vector unsigned short __a, vector bool short __b) { 5958 return ~(__a & __b); 5959 } 5960 5961 static __inline__ vector bool short __ATTRS_o_ai 5962 vec_nand(vector bool short __a, vector bool short __b) { 5963 return ~(__a & __b); 5964 } 5965 5966 static __inline__ vector signed int __ATTRS_o_ai 5967 vec_nand(vector signed int __a, vector signed int __b) { 5968 return ~(__a & __b); 5969 } 5970 5971 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 5972 vector bool int __b) { 5973 return ~(__a & __b); 5974 } 5975 5976 static __inline__ vector signed int __ATTRS_o_ai 5977 vec_nand(vector bool int __a, vector signed int __b) { 5978 return ~(__a & __b); 5979 } 5980 5981 static __inline__ vector unsigned int __ATTRS_o_ai 5982 vec_nand(vector unsigned int __a, vector unsigned int __b) { 5983 return ~(__a & __b); 5984 } 5985 5986 static __inline__ vector unsigned int __ATTRS_o_ai 5987 vec_nand(vector unsigned int __a, vector bool int __b) { 5988 return ~(__a & __b); 5989 } 5990 5991 static __inline__ vector unsigned int __ATTRS_o_ai 5992 vec_nand(vector bool int __a, vector unsigned int __b) { 5993 return ~(__a & __b); 5994 } 5995 5996 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 5997 vector bool int __b) { 5998 return ~(__a & __b); 5999 } 6000 6001 static __inline__ vector float __ATTRS_o_ai 6002 vec_nand(vector float __a, vector float __b) { 6003 return (vector float)(~((vector unsigned int)__a & 6004 (vector unsigned int)__b)); 6005 } 6006 6007 static __inline__ vector signed long long __ATTRS_o_ai 6008 vec_nand(vector signed long long __a, vector signed long long __b) { 6009 return ~(__a & __b); 6010 } 6011 6012 static __inline__ vector signed long long __ATTRS_o_ai 6013 vec_nand(vector signed long long __a, vector bool long long __b) { 6014 return ~(__a & __b); 6015 } 6016 6017 static __inline__ vector signed long long __ATTRS_o_ai 6018 vec_nand(vector bool long long __a, vector signed long long __b) { 6019 return ~(__a & __b); 6020 } 6021 6022 static __inline__ vector unsigned long long __ATTRS_o_ai 6023 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6024 return ~(__a & __b); 6025 } 6026 6027 static __inline__ vector unsigned long long __ATTRS_o_ai 6028 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6029 return ~(__a & __b); 6030 } 6031 6032 static __inline__ vector unsigned long long __ATTRS_o_ai 6033 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6034 return ~(__a & __b); 6035 } 6036 6037 static __inline__ vector bool long long __ATTRS_o_ai 6038 vec_nand(vector bool long long __a, vector bool long long __b) { 6039 return ~(__a & __b); 6040 } 6041 6042 static __inline__ vector double __ATTRS_o_ai 6043 vec_nand(vector double __a, vector double __b) { 6044 return (vector double)(~((vector unsigned long long)__a & 6045 (vector unsigned long long)__b)); 6046 } 6047 6048 #endif 6049 6050 /* vec_nmadd */ 6051 6052 #ifdef __VSX__ 6053 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6054 vector float __b, 6055 vector float __c) { 6056 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6057 } 6058 6059 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6060 vector double __b, 6061 vector double __c) { 6062 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6063 } 6064 #endif 6065 6066 /* vec_nmsub */ 6067 6068 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6069 vector float __b, 6070 vector float __c) { 6071 #ifdef __VSX__ 6072 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6073 #else 6074 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6075 #endif 6076 } 6077 6078 #ifdef __VSX__ 6079 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6080 vector double __b, 6081 vector double __c) { 6082 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6083 } 6084 #endif 6085 6086 /* vec_vnmsubfp */ 6087 6088 static __inline__ vector float __attribute__((__always_inline__)) 6089 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6090 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6091 } 6092 6093 /* vec_nor */ 6094 6095 #define __builtin_altivec_vnor vec_nor 6096 6097 static __inline__ vector signed char __ATTRS_o_ai 6098 vec_nor(vector signed char __a, vector signed char __b) { 6099 return ~(__a | __b); 6100 } 6101 6102 static __inline__ vector unsigned char __ATTRS_o_ai 6103 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6104 return ~(__a | __b); 6105 } 6106 6107 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6108 vector bool char __b) { 6109 return ~(__a | __b); 6110 } 6111 6112 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6113 vector short __b) { 6114 return ~(__a | __b); 6115 } 6116 6117 static __inline__ vector unsigned short __ATTRS_o_ai 6118 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6119 return ~(__a | __b); 6120 } 6121 6122 static __inline__ vector bool short __ATTRS_o_ai 6123 vec_nor(vector bool short __a, vector bool short __b) { 6124 return ~(__a | __b); 6125 } 6126 6127 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6128 vector int __b) { 6129 return ~(__a | __b); 6130 } 6131 6132 static __inline__ vector unsigned int __ATTRS_o_ai 6133 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6134 return ~(__a | __b); 6135 } 6136 6137 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6138 vector bool int __b) { 6139 return ~(__a | __b); 6140 } 6141 6142 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6143 vector float __b) { 6144 vector unsigned int __res = 6145 ~((vector unsigned int)__a | (vector unsigned int)__b); 6146 return (vector float)__res; 6147 } 6148 6149 #ifdef __VSX__ 6150 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6151 vector double __b) { 6152 vector unsigned long long __res = 6153 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6154 return (vector double)__res; 6155 } 6156 #endif 6157 6158 /* vec_vnor */ 6159 6160 static __inline__ vector signed char __ATTRS_o_ai 6161 vec_vnor(vector signed char __a, vector signed char __b) { 6162 return ~(__a | __b); 6163 } 6164 6165 static __inline__ vector unsigned char __ATTRS_o_ai 6166 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6167 return ~(__a | __b); 6168 } 6169 6170 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6171 vector bool char __b) { 6172 return ~(__a | __b); 6173 } 6174 6175 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6176 vector short __b) { 6177 return ~(__a | __b); 6178 } 6179 6180 static __inline__ vector unsigned short __ATTRS_o_ai 6181 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6182 return ~(__a | __b); 6183 } 6184 6185 static __inline__ vector bool short __ATTRS_o_ai 6186 vec_vnor(vector bool short __a, vector bool short __b) { 6187 return ~(__a | __b); 6188 } 6189 6190 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6191 vector int __b) { 6192 return ~(__a | __b); 6193 } 6194 6195 static __inline__ vector unsigned int __ATTRS_o_ai 6196 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6197 return ~(__a | __b); 6198 } 6199 6200 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6201 vector bool int __b) { 6202 return ~(__a | __b); 6203 } 6204 6205 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6206 vector float __b) { 6207 vector unsigned int __res = 6208 ~((vector unsigned int)__a | (vector unsigned int)__b); 6209 return (vector float)__res; 6210 } 6211 6212 #ifdef __VSX__ 6213 static __inline__ vector signed long long __ATTRS_o_ai 6214 vec_nor(vector signed long long __a, vector signed long long __b) { 6215 return ~(__a | __b); 6216 } 6217 6218 static __inline__ vector unsigned long long __ATTRS_o_ai 6219 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6220 return ~(__a | __b); 6221 } 6222 6223 static __inline__ vector bool long long __ATTRS_o_ai 6224 vec_nor(vector bool long long __a, vector bool long long __b) { 6225 return ~(__a | __b); 6226 } 6227 #endif 6228 6229 /* vec_or */ 6230 6231 #define __builtin_altivec_vor vec_or 6232 6233 static __inline__ vector signed char __ATTRS_o_ai 6234 vec_or(vector signed char __a, vector signed char __b) { 6235 return __a | __b; 6236 } 6237 6238 static __inline__ vector signed char __ATTRS_o_ai 6239 vec_or(vector bool char __a, vector signed char __b) { 6240 return (vector signed char)__a | __b; 6241 } 6242 6243 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6244 vector bool char __b) { 6245 return __a | (vector signed char)__b; 6246 } 6247 6248 static __inline__ vector unsigned char __ATTRS_o_ai 6249 vec_or(vector unsigned char __a, vector unsigned char __b) { 6250 return __a | __b; 6251 } 6252 6253 static __inline__ vector unsigned char __ATTRS_o_ai 6254 vec_or(vector bool char __a, vector unsigned char __b) { 6255 return (vector unsigned char)__a | __b; 6256 } 6257 6258 static __inline__ vector unsigned char __ATTRS_o_ai 6259 vec_or(vector unsigned char __a, vector bool char __b) { 6260 return __a | (vector unsigned char)__b; 6261 } 6262 6263 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6264 vector bool char __b) { 6265 return __a | __b; 6266 } 6267 6268 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6269 vector short __b) { 6270 return __a | __b; 6271 } 6272 6273 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6274 vector short __b) { 6275 return (vector short)__a | __b; 6276 } 6277 6278 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6279 vector bool short __b) { 6280 return __a | (vector short)__b; 6281 } 6282 6283 static __inline__ vector unsigned short __ATTRS_o_ai 6284 vec_or(vector unsigned short __a, vector unsigned short __b) { 6285 return __a | __b; 6286 } 6287 6288 static __inline__ vector unsigned short __ATTRS_o_ai 6289 vec_or(vector bool short __a, vector unsigned short __b) { 6290 return (vector unsigned short)__a | __b; 6291 } 6292 6293 static __inline__ vector unsigned short __ATTRS_o_ai 6294 vec_or(vector unsigned short __a, vector bool short __b) { 6295 return __a | (vector unsigned short)__b; 6296 } 6297 6298 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6299 vector bool short __b) { 6300 return __a | __b; 6301 } 6302 6303 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6304 vector int __b) { 6305 return __a | __b; 6306 } 6307 6308 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6309 vector int __b) { 6310 return (vector int)__a | __b; 6311 } 6312 6313 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6314 vector bool int __b) { 6315 return __a | (vector int)__b; 6316 } 6317 6318 static __inline__ vector unsigned int __ATTRS_o_ai 6319 vec_or(vector unsigned int __a, vector unsigned int __b) { 6320 return __a | __b; 6321 } 6322 6323 static __inline__ vector unsigned int __ATTRS_o_ai 6324 vec_or(vector bool int __a, vector unsigned int __b) { 6325 return (vector unsigned int)__a | __b; 6326 } 6327 6328 static __inline__ vector unsigned int __ATTRS_o_ai 6329 vec_or(vector unsigned int __a, vector bool int __b) { 6330 return __a | (vector unsigned int)__b; 6331 } 6332 6333 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6334 vector bool int __b) { 6335 return __a | __b; 6336 } 6337 6338 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6339 vector float __b) { 6340 vector unsigned int __res = 6341 (vector unsigned int)__a | (vector unsigned int)__b; 6342 return (vector float)__res; 6343 } 6344 6345 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6346 vector float __b) { 6347 vector unsigned int __res = 6348 (vector unsigned int)__a | (vector unsigned int)__b; 6349 return (vector float)__res; 6350 } 6351 6352 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6353 vector bool int __b) { 6354 vector unsigned int __res = 6355 (vector unsigned int)__a | (vector unsigned int)__b; 6356 return (vector float)__res; 6357 } 6358 6359 #ifdef __VSX__ 6360 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6361 vector double __b) { 6362 return (vector double)((vector unsigned long long)__a | 6363 (vector unsigned long long)__b); 6364 } 6365 6366 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6367 vector bool long long __b) { 6368 return (vector double)((vector unsigned long long)__a | 6369 (vector unsigned long long)__b); 6370 } 6371 6372 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6373 vector double __b) { 6374 return (vector double)((vector unsigned long long)__a | 6375 (vector unsigned long long)__b); 6376 } 6377 6378 static __inline__ vector signed long long __ATTRS_o_ai 6379 vec_or(vector signed long long __a, vector signed long long __b) { 6380 return __a | __b; 6381 } 6382 6383 static __inline__ vector signed long long __ATTRS_o_ai 6384 vec_or(vector bool long long __a, vector signed long long __b) { 6385 return (vector signed long long)__a | __b; 6386 } 6387 6388 static __inline__ vector signed long long __ATTRS_o_ai 6389 vec_or(vector signed long long __a, vector bool long long __b) { 6390 return __a | (vector signed long long)__b; 6391 } 6392 6393 static __inline__ vector unsigned long long __ATTRS_o_ai 6394 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 6395 return __a | __b; 6396 } 6397 6398 static __inline__ vector unsigned long long __ATTRS_o_ai 6399 vec_or(vector bool long long __a, vector unsigned long long __b) { 6400 return (vector unsigned long long)__a | __b; 6401 } 6402 6403 static __inline__ vector unsigned long long __ATTRS_o_ai 6404 vec_or(vector unsigned long long __a, vector bool long long __b) { 6405 return __a | (vector unsigned long long)__b; 6406 } 6407 6408 static __inline__ vector bool long long __ATTRS_o_ai 6409 vec_or(vector bool long long __a, vector bool long long __b) { 6410 return __a | __b; 6411 } 6412 #endif 6413 6414 #ifdef __POWER8_VECTOR__ 6415 static __inline__ vector signed char __ATTRS_o_ai 6416 vec_orc(vector signed char __a, vector signed char __b) { 6417 return __a | ~__b; 6418 } 6419 6420 static __inline__ vector signed char __ATTRS_o_ai 6421 vec_orc(vector signed char __a, vector bool char __b) { 6422 return __a | ~__b; 6423 } 6424 6425 static __inline__ vector signed char __ATTRS_o_ai 6426 vec_orc(vector bool char __a, vector signed char __b) { 6427 return __a | ~__b; 6428 } 6429 6430 static __inline__ vector unsigned char __ATTRS_o_ai 6431 vec_orc(vector unsigned char __a, vector unsigned char __b) { 6432 return __a | ~__b; 6433 } 6434 6435 static __inline__ vector unsigned char __ATTRS_o_ai 6436 vec_orc(vector unsigned char __a, vector bool char __b) { 6437 return __a | ~__b; 6438 } 6439 6440 static __inline__ vector unsigned char __ATTRS_o_ai 6441 vec_orc(vector bool char __a, vector unsigned char __b) { 6442 return __a | ~__b; 6443 } 6444 6445 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 6446 vector bool char __b) { 6447 return __a | ~__b; 6448 } 6449 6450 static __inline__ vector signed short __ATTRS_o_ai 6451 vec_orc(vector signed short __a, vector signed short __b) { 6452 return __a | ~__b; 6453 } 6454 6455 static __inline__ vector signed short __ATTRS_o_ai 6456 vec_orc(vector signed short __a, vector bool short __b) { 6457 return __a | ~__b; 6458 } 6459 6460 static __inline__ vector signed short __ATTRS_o_ai 6461 vec_orc(vector bool short __a, vector signed short __b) { 6462 return __a | ~__b; 6463 } 6464 6465 static __inline__ vector unsigned short __ATTRS_o_ai 6466 vec_orc(vector unsigned short __a, vector unsigned short __b) { 6467 return __a | ~__b; 6468 } 6469 6470 static __inline__ vector unsigned short __ATTRS_o_ai 6471 vec_orc(vector unsigned short __a, vector bool short __b) { 6472 return __a | ~__b; 6473 } 6474 6475 static __inline__ vector unsigned short __ATTRS_o_ai 6476 vec_orc(vector bool short __a, vector unsigned short __b) { 6477 return __a | ~__b; 6478 } 6479 6480 static __inline__ vector bool short __ATTRS_o_ai 6481 vec_orc(vector bool short __a, vector bool short __b) { 6482 return __a | ~__b; 6483 } 6484 6485 static __inline__ vector signed int __ATTRS_o_ai 6486 vec_orc(vector signed int __a, vector signed int __b) { 6487 return __a | ~__b; 6488 } 6489 6490 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 6491 vector bool int __b) { 6492 return __a | ~__b; 6493 } 6494 6495 static __inline__ vector signed int __ATTRS_o_ai 6496 vec_orc(vector bool int __a, vector signed int __b) { 6497 return __a | ~__b; 6498 } 6499 6500 static __inline__ vector unsigned int __ATTRS_o_ai 6501 vec_orc(vector unsigned int __a, vector unsigned int __b) { 6502 return __a | ~__b; 6503 } 6504 6505 static __inline__ vector unsigned int __ATTRS_o_ai 6506 vec_orc(vector unsigned int __a, vector bool int __b) { 6507 return __a | ~__b; 6508 } 6509 6510 static __inline__ vector unsigned int __ATTRS_o_ai 6511 vec_orc(vector bool int __a, vector unsigned int __b) { 6512 return __a | ~__b; 6513 } 6514 6515 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 6516 vector bool int __b) { 6517 return __a | ~__b; 6518 } 6519 6520 static __inline__ vector float __ATTRS_o_ai 6521 vec_orc(vector bool int __a, vector float __b) { 6522 return (vector float)(__a | ~(vector unsigned int)__b); 6523 } 6524 6525 static __inline__ vector float __ATTRS_o_ai 6526 vec_orc(vector float __a, vector bool int __b) { 6527 return (vector float)((vector unsigned int)__a | ~__b); 6528 } 6529 6530 static __inline__ vector signed long long __ATTRS_o_ai 6531 vec_orc(vector signed long long __a, vector signed long long __b) { 6532 return __a | ~__b; 6533 } 6534 6535 static __inline__ vector signed long long __ATTRS_o_ai 6536 vec_orc(vector signed long long __a, vector bool long long __b) { 6537 return __a | ~__b; 6538 } 6539 6540 static __inline__ vector signed long long __ATTRS_o_ai 6541 vec_orc(vector bool long long __a, vector signed long long __b) { 6542 return __a | ~__b; 6543 } 6544 6545 static __inline__ vector unsigned long long __ATTRS_o_ai 6546 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 6547 return __a | ~__b; 6548 } 6549 6550 static __inline__ vector unsigned long long __ATTRS_o_ai 6551 vec_orc(vector unsigned long long __a, vector bool long long __b) { 6552 return __a | ~__b; 6553 } 6554 6555 static __inline__ vector unsigned long long __ATTRS_o_ai 6556 vec_orc(vector bool long long __a, vector unsigned long long __b) { 6557 return __a | ~__b; 6558 } 6559 6560 static __inline__ vector bool long long __ATTRS_o_ai 6561 vec_orc(vector bool long long __a, vector bool long long __b) { 6562 return __a | ~__b; 6563 } 6564 6565 static __inline__ vector double __ATTRS_o_ai 6566 vec_orc(vector double __a, vector bool long long __b) { 6567 return (vector double)((vector unsigned long long)__a | ~__b); 6568 } 6569 6570 static __inline__ vector double __ATTRS_o_ai 6571 vec_orc(vector bool long long __a, vector double __b) { 6572 return (vector double)(__a | ~(vector unsigned long long)__b); 6573 } 6574 #endif 6575 6576 /* vec_vor */ 6577 6578 static __inline__ vector signed char __ATTRS_o_ai 6579 vec_vor(vector signed char __a, vector signed char __b) { 6580 return __a | __b; 6581 } 6582 6583 static __inline__ vector signed char __ATTRS_o_ai 6584 vec_vor(vector bool char __a, vector signed char __b) { 6585 return (vector signed char)__a | __b; 6586 } 6587 6588 static __inline__ vector signed char __ATTRS_o_ai 6589 vec_vor(vector signed char __a, vector bool char __b) { 6590 return __a | (vector signed char)__b; 6591 } 6592 6593 static __inline__ vector unsigned char __ATTRS_o_ai 6594 vec_vor(vector unsigned char __a, vector unsigned char __b) { 6595 return __a | __b; 6596 } 6597 6598 static __inline__ vector unsigned char __ATTRS_o_ai 6599 vec_vor(vector bool char __a, vector unsigned char __b) { 6600 return (vector unsigned char)__a | __b; 6601 } 6602 6603 static __inline__ vector unsigned char __ATTRS_o_ai 6604 vec_vor(vector unsigned char __a, vector bool char __b) { 6605 return __a | (vector unsigned char)__b; 6606 } 6607 6608 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 6609 vector bool char __b) { 6610 return __a | __b; 6611 } 6612 6613 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 6614 vector short __b) { 6615 return __a | __b; 6616 } 6617 6618 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 6619 vector short __b) { 6620 return (vector short)__a | __b; 6621 } 6622 6623 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 6624 vector bool short __b) { 6625 return __a | (vector short)__b; 6626 } 6627 6628 static __inline__ vector unsigned short __ATTRS_o_ai 6629 vec_vor(vector unsigned short __a, vector unsigned short __b) { 6630 return __a | __b; 6631 } 6632 6633 static __inline__ vector unsigned short __ATTRS_o_ai 6634 vec_vor(vector bool short __a, vector unsigned short __b) { 6635 return (vector unsigned short)__a | __b; 6636 } 6637 6638 static __inline__ vector unsigned short __ATTRS_o_ai 6639 vec_vor(vector unsigned short __a, vector bool short __b) { 6640 return __a | (vector unsigned short)__b; 6641 } 6642 6643 static __inline__ vector bool short __ATTRS_o_ai 6644 vec_vor(vector bool short __a, vector bool short __b) { 6645 return __a | __b; 6646 } 6647 6648 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 6649 vector int __b) { 6650 return __a | __b; 6651 } 6652 6653 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 6654 vector int __b) { 6655 return (vector int)__a | __b; 6656 } 6657 6658 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 6659 vector bool int __b) { 6660 return __a | (vector int)__b; 6661 } 6662 6663 static __inline__ vector unsigned int __ATTRS_o_ai 6664 vec_vor(vector unsigned int __a, vector unsigned int __b) { 6665 return __a | __b; 6666 } 6667 6668 static __inline__ vector unsigned int __ATTRS_o_ai 6669 vec_vor(vector bool int __a, vector unsigned int __b) { 6670 return (vector unsigned int)__a | __b; 6671 } 6672 6673 static __inline__ vector unsigned int __ATTRS_o_ai 6674 vec_vor(vector unsigned int __a, vector bool int __b) { 6675 return __a | (vector unsigned int)__b; 6676 } 6677 6678 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 6679 vector bool int __b) { 6680 return __a | __b; 6681 } 6682 6683 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 6684 vector float __b) { 6685 vector unsigned int __res = 6686 (vector unsigned int)__a | (vector unsigned int)__b; 6687 return (vector float)__res; 6688 } 6689 6690 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 6691 vector float __b) { 6692 vector unsigned int __res = 6693 (vector unsigned int)__a | (vector unsigned int)__b; 6694 return (vector float)__res; 6695 } 6696 6697 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 6698 vector bool int __b) { 6699 vector unsigned int __res = 6700 (vector unsigned int)__a | (vector unsigned int)__b; 6701 return (vector float)__res; 6702 } 6703 6704 #ifdef __VSX__ 6705 static __inline__ vector signed long long __ATTRS_o_ai 6706 vec_vor(vector signed long long __a, vector signed long long __b) { 6707 return __a | __b; 6708 } 6709 6710 static __inline__ vector signed long long __ATTRS_o_ai 6711 vec_vor(vector bool long long __a, vector signed long long __b) { 6712 return (vector signed long long)__a | __b; 6713 } 6714 6715 static __inline__ vector signed long long __ATTRS_o_ai 6716 vec_vor(vector signed long long __a, vector bool long long __b) { 6717 return __a | (vector signed long long)__b; 6718 } 6719 6720 static __inline__ vector unsigned long long __ATTRS_o_ai 6721 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 6722 return __a | __b; 6723 } 6724 6725 static __inline__ vector unsigned long long __ATTRS_o_ai 6726 vec_vor(vector bool long long __a, vector unsigned long long __b) { 6727 return (vector unsigned long long)__a | __b; 6728 } 6729 6730 static __inline__ vector unsigned long long __ATTRS_o_ai 6731 vec_vor(vector unsigned long long __a, vector bool long long __b) { 6732 return __a | (vector unsigned long long)__b; 6733 } 6734 6735 static __inline__ vector bool long long __ATTRS_o_ai 6736 vec_vor(vector bool long long __a, vector bool long long __b) { 6737 return __a | __b; 6738 } 6739 #endif 6740 6741 /* vec_pack */ 6742 6743 /* The various vector pack instructions have a big-endian bias, so for 6744 little endian we must handle reversed element numbering. */ 6745 6746 static __inline__ vector signed char __ATTRS_o_ai 6747 vec_pack(vector signed short __a, vector signed short __b) { 6748 #ifdef __LITTLE_ENDIAN__ 6749 return (vector signed char)vec_perm( 6750 __a, __b, 6751 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6752 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6753 #else 6754 return (vector signed char)vec_perm( 6755 __a, __b, 6756 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 6757 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 6758 #endif 6759 } 6760 6761 static __inline__ vector unsigned char __ATTRS_o_ai 6762 vec_pack(vector unsigned short __a, vector unsigned short __b) { 6763 #ifdef __LITTLE_ENDIAN__ 6764 return (vector unsigned char)vec_perm( 6765 __a, __b, 6766 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6767 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6768 #else 6769 return (vector unsigned char)vec_perm( 6770 __a, __b, 6771 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 6772 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 6773 #endif 6774 } 6775 6776 static __inline__ vector bool char __ATTRS_o_ai 6777 vec_pack(vector bool short __a, vector bool short __b) { 6778 #ifdef __LITTLE_ENDIAN__ 6779 return (vector bool char)vec_perm( 6780 __a, __b, 6781 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6782 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6783 #else 6784 return (vector bool char)vec_perm( 6785 __a, __b, 6786 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 6787 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 6788 #endif 6789 } 6790 6791 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 6792 vector int __b) { 6793 #ifdef __LITTLE_ENDIAN__ 6794 return (vector short)vec_perm( 6795 __a, __b, 6796 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 6797 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 6798 #else 6799 return (vector short)vec_perm( 6800 __a, __b, 6801 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 6802 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 6803 #endif 6804 } 6805 6806 static __inline__ vector unsigned short __ATTRS_o_ai 6807 vec_pack(vector unsigned int __a, vector unsigned int __b) { 6808 #ifdef __LITTLE_ENDIAN__ 6809 return (vector unsigned short)vec_perm( 6810 __a, __b, 6811 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 6812 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 6813 #else 6814 return (vector unsigned short)vec_perm( 6815 __a, __b, 6816 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 6817 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 6818 #endif 6819 } 6820 6821 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 6822 vector bool int __b) { 6823 #ifdef __LITTLE_ENDIAN__ 6824 return (vector bool short)vec_perm( 6825 __a, __b, 6826 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 6827 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 6828 #else 6829 return (vector bool short)vec_perm( 6830 __a, __b, 6831 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 6832 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 6833 #endif 6834 } 6835 6836 #ifdef __VSX__ 6837 static __inline__ vector signed int __ATTRS_o_ai 6838 vec_pack(vector signed long long __a, vector signed long long __b) { 6839 #ifdef __LITTLE_ENDIAN__ 6840 return (vector signed int)vec_perm( 6841 __a, __b, 6842 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 6843 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 6844 #else 6845 return (vector signed int)vec_perm( 6846 __a, __b, 6847 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 6848 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 6849 #endif 6850 } 6851 static __inline__ vector unsigned int __ATTRS_o_ai 6852 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 6853 #ifdef __LITTLE_ENDIAN__ 6854 return (vector unsigned int)vec_perm( 6855 __a, __b, 6856 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 6857 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 6858 #else 6859 return (vector unsigned int)vec_perm( 6860 __a, __b, 6861 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 6862 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 6863 #endif 6864 } 6865 6866 static __inline__ vector bool int __ATTRS_o_ai 6867 vec_pack(vector bool long long __a, vector bool long long __b) { 6868 #ifdef __LITTLE_ENDIAN__ 6869 return (vector bool int)vec_perm( 6870 __a, __b, 6871 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 6872 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 6873 #else 6874 return (vector bool int)vec_perm( 6875 __a, __b, 6876 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 6877 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 6878 #endif 6879 } 6880 6881 static __inline__ vector float __ATTRS_o_ai 6882 vec_pack(vector double __a, vector double __b) { 6883 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 6884 } 6885 #endif 6886 6887 #ifdef __POWER9_VECTOR__ 6888 static __inline__ vector unsigned short __ATTRS_o_ai 6889 vec_pack_to_short_fp32(vector float __a, vector float __b) { 6890 vector float __resa = __builtin_vsx_xvcvsphp(__a); 6891 vector float __resb = __builtin_vsx_xvcvsphp(__b); 6892 #ifdef __LITTLE_ENDIAN__ 6893 return (vector unsigned short)vec_mergee(__resa, __resb); 6894 #else 6895 return (vector unsigned short)vec_mergeo(__resa, __resb); 6896 #endif 6897 } 6898 6899 #endif 6900 /* vec_vpkuhum */ 6901 6902 #define __builtin_altivec_vpkuhum vec_vpkuhum 6903 6904 static __inline__ vector signed char __ATTRS_o_ai 6905 vec_vpkuhum(vector signed short __a, vector signed short __b) { 6906 #ifdef __LITTLE_ENDIAN__ 6907 return (vector signed char)vec_perm( 6908 __a, __b, 6909 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6910 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6911 #else 6912 return (vector signed char)vec_perm( 6913 __a, __b, 6914 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 6915 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 6916 #endif 6917 } 6918 6919 static __inline__ vector unsigned char __ATTRS_o_ai 6920 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 6921 #ifdef __LITTLE_ENDIAN__ 6922 return (vector unsigned char)vec_perm( 6923 __a, __b, 6924 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6925 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6926 #else 6927 return (vector unsigned char)vec_perm( 6928 __a, __b, 6929 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 6930 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 6931 #endif 6932 } 6933 6934 static __inline__ vector bool char __ATTRS_o_ai 6935 vec_vpkuhum(vector bool short __a, vector bool short __b) { 6936 #ifdef __LITTLE_ENDIAN__ 6937 return (vector bool char)vec_perm( 6938 __a, __b, 6939 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6940 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6941 #else 6942 return (vector bool char)vec_perm( 6943 __a, __b, 6944 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 6945 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 6946 #endif 6947 } 6948 6949 /* vec_vpkuwum */ 6950 6951 #define __builtin_altivec_vpkuwum vec_vpkuwum 6952 6953 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 6954 vector int __b) { 6955 #ifdef __LITTLE_ENDIAN__ 6956 return (vector short)vec_perm( 6957 __a, __b, 6958 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 6959 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 6960 #else 6961 return (vector short)vec_perm( 6962 __a, __b, 6963 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 6964 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 6965 #endif 6966 } 6967 6968 static __inline__ vector unsigned short __ATTRS_o_ai 6969 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 6970 #ifdef __LITTLE_ENDIAN__ 6971 return (vector unsigned short)vec_perm( 6972 __a, __b, 6973 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 6974 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 6975 #else 6976 return (vector unsigned short)vec_perm( 6977 __a, __b, 6978 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 6979 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 6980 #endif 6981 } 6982 6983 static __inline__ vector bool short __ATTRS_o_ai 6984 vec_vpkuwum(vector bool int __a, vector bool int __b) { 6985 #ifdef __LITTLE_ENDIAN__ 6986 return (vector bool short)vec_perm( 6987 __a, __b, 6988 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 6989 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 6990 #else 6991 return (vector bool short)vec_perm( 6992 __a, __b, 6993 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 6994 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 6995 #endif 6996 } 6997 6998 /* vec_vpkudum */ 6999 7000 #ifdef __POWER8_VECTOR__ 7001 #define __builtin_altivec_vpkudum vec_vpkudum 7002 7003 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7004 vector long long __b) { 7005 #ifdef __LITTLE_ENDIAN__ 7006 return (vector int)vec_perm( 7007 __a, __b, 7008 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7009 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7010 #else 7011 return (vector int)vec_perm( 7012 __a, __b, 7013 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7014 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7015 #endif 7016 } 7017 7018 static __inline__ vector unsigned int __ATTRS_o_ai 7019 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7020 #ifdef __LITTLE_ENDIAN__ 7021 return (vector unsigned int)vec_perm( 7022 __a, __b, 7023 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7024 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7025 #else 7026 return (vector unsigned int)vec_perm( 7027 __a, __b, 7028 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7029 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7030 #endif 7031 } 7032 7033 static __inline__ vector bool int __ATTRS_o_ai 7034 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7035 #ifdef __LITTLE_ENDIAN__ 7036 return (vector bool int)vec_perm( 7037 (vector long long)__a, (vector long long)__b, 7038 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7039 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7040 #else 7041 return (vector bool int)vec_perm( 7042 (vector long long)__a, (vector long long)__b, 7043 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7044 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7045 #endif 7046 } 7047 #endif 7048 7049 /* vec_packpx */ 7050 7051 static __inline__ vector pixel __attribute__((__always_inline__)) 7052 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7053 #ifdef __LITTLE_ENDIAN__ 7054 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7055 #else 7056 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7057 #endif 7058 } 7059 7060 /* vec_vpkpx */ 7061 7062 static __inline__ vector pixel __attribute__((__always_inline__)) 7063 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7064 #ifdef __LITTLE_ENDIAN__ 7065 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7066 #else 7067 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7068 #endif 7069 } 7070 7071 /* vec_packs */ 7072 7073 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7074 vector short __b) { 7075 #ifdef __LITTLE_ENDIAN__ 7076 return __builtin_altivec_vpkshss(__b, __a); 7077 #else 7078 return __builtin_altivec_vpkshss(__a, __b); 7079 #endif 7080 } 7081 7082 static __inline__ vector unsigned char __ATTRS_o_ai 7083 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7084 #ifdef __LITTLE_ENDIAN__ 7085 return __builtin_altivec_vpkuhus(__b, __a); 7086 #else 7087 return __builtin_altivec_vpkuhus(__a, __b); 7088 #endif 7089 } 7090 7091 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7092 vector int __b) { 7093 #ifdef __LITTLE_ENDIAN__ 7094 return __builtin_altivec_vpkswss(__b, __a); 7095 #else 7096 return __builtin_altivec_vpkswss(__a, __b); 7097 #endif 7098 } 7099 7100 static __inline__ vector unsigned short __ATTRS_o_ai 7101 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7102 #ifdef __LITTLE_ENDIAN__ 7103 return __builtin_altivec_vpkuwus(__b, __a); 7104 #else 7105 return __builtin_altivec_vpkuwus(__a, __b); 7106 #endif 7107 } 7108 7109 #ifdef __POWER8_VECTOR__ 7110 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7111 vector long long __b) { 7112 #ifdef __LITTLE_ENDIAN__ 7113 return __builtin_altivec_vpksdss(__b, __a); 7114 #else 7115 return __builtin_altivec_vpksdss(__a, __b); 7116 #endif 7117 } 7118 7119 static __inline__ vector unsigned int __ATTRS_o_ai 7120 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7121 #ifdef __LITTLE_ENDIAN__ 7122 return __builtin_altivec_vpkudus(__b, __a); 7123 #else 7124 return __builtin_altivec_vpkudus(__a, __b); 7125 #endif 7126 } 7127 #endif 7128 7129 /* vec_vpkshss */ 7130 7131 static __inline__ vector signed char __attribute__((__always_inline__)) 7132 vec_vpkshss(vector short __a, vector short __b) { 7133 #ifdef __LITTLE_ENDIAN__ 7134 return __builtin_altivec_vpkshss(__b, __a); 7135 #else 7136 return __builtin_altivec_vpkshss(__a, __b); 7137 #endif 7138 } 7139 7140 /* vec_vpksdss */ 7141 7142 #ifdef __POWER8_VECTOR__ 7143 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7144 vector long long __b) { 7145 #ifdef __LITTLE_ENDIAN__ 7146 return __builtin_altivec_vpksdss(__b, __a); 7147 #else 7148 return __builtin_altivec_vpksdss(__a, __b); 7149 #endif 7150 } 7151 #endif 7152 7153 /* vec_vpkuhus */ 7154 7155 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7156 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7157 #ifdef __LITTLE_ENDIAN__ 7158 return __builtin_altivec_vpkuhus(__b, __a); 7159 #else 7160 return __builtin_altivec_vpkuhus(__a, __b); 7161 #endif 7162 } 7163 7164 /* vec_vpkudus */ 7165 7166 #ifdef __POWER8_VECTOR__ 7167 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7168 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7169 #ifdef __LITTLE_ENDIAN__ 7170 return __builtin_altivec_vpkudus(__b, __a); 7171 #else 7172 return __builtin_altivec_vpkudus(__a, __b); 7173 #endif 7174 } 7175 #endif 7176 7177 /* vec_vpkswss */ 7178 7179 static __inline__ vector signed short __attribute__((__always_inline__)) 7180 vec_vpkswss(vector int __a, vector int __b) { 7181 #ifdef __LITTLE_ENDIAN__ 7182 return __builtin_altivec_vpkswss(__b, __a); 7183 #else 7184 return __builtin_altivec_vpkswss(__a, __b); 7185 #endif 7186 } 7187 7188 /* vec_vpkuwus */ 7189 7190 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7191 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7192 #ifdef __LITTLE_ENDIAN__ 7193 return __builtin_altivec_vpkuwus(__b, __a); 7194 #else 7195 return __builtin_altivec_vpkuwus(__a, __b); 7196 #endif 7197 } 7198 7199 /* vec_packsu */ 7200 7201 static __inline__ vector unsigned char __ATTRS_o_ai 7202 vec_packsu(vector short __a, vector short __b) { 7203 #ifdef __LITTLE_ENDIAN__ 7204 return __builtin_altivec_vpkshus(__b, __a); 7205 #else 7206 return __builtin_altivec_vpkshus(__a, __b); 7207 #endif 7208 } 7209 7210 static __inline__ vector unsigned char __ATTRS_o_ai 7211 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7212 #ifdef __LITTLE_ENDIAN__ 7213 return __builtin_altivec_vpkuhus(__b, __a); 7214 #else 7215 return __builtin_altivec_vpkuhus(__a, __b); 7216 #endif 7217 } 7218 7219 static __inline__ vector unsigned short __ATTRS_o_ai 7220 vec_packsu(vector int __a, vector int __b) { 7221 #ifdef __LITTLE_ENDIAN__ 7222 return __builtin_altivec_vpkswus(__b, __a); 7223 #else 7224 return __builtin_altivec_vpkswus(__a, __b); 7225 #endif 7226 } 7227 7228 static __inline__ vector unsigned short __ATTRS_o_ai 7229 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7230 #ifdef __LITTLE_ENDIAN__ 7231 return __builtin_altivec_vpkuwus(__b, __a); 7232 #else 7233 return __builtin_altivec_vpkuwus(__a, __b); 7234 #endif 7235 } 7236 7237 #ifdef __POWER8_VECTOR__ 7238 static __inline__ vector unsigned int __ATTRS_o_ai 7239 vec_packsu(vector long long __a, vector long long __b) { 7240 #ifdef __LITTLE_ENDIAN__ 7241 return __builtin_altivec_vpksdus(__b, __a); 7242 #else 7243 return __builtin_altivec_vpksdus(__a, __b); 7244 #endif 7245 } 7246 7247 static __inline__ vector unsigned int __ATTRS_o_ai 7248 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7249 #ifdef __LITTLE_ENDIAN__ 7250 return __builtin_altivec_vpkudus(__b, __a); 7251 #else 7252 return __builtin_altivec_vpkudus(__a, __b); 7253 #endif 7254 } 7255 #endif 7256 7257 /* vec_vpkshus */ 7258 7259 static __inline__ vector unsigned char __ATTRS_o_ai 7260 vec_vpkshus(vector short __a, vector short __b) { 7261 #ifdef __LITTLE_ENDIAN__ 7262 return __builtin_altivec_vpkshus(__b, __a); 7263 #else 7264 return __builtin_altivec_vpkshus(__a, __b); 7265 #endif 7266 } 7267 7268 static __inline__ vector unsigned char __ATTRS_o_ai 7269 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7270 #ifdef __LITTLE_ENDIAN__ 7271 return __builtin_altivec_vpkuhus(__b, __a); 7272 #else 7273 return __builtin_altivec_vpkuhus(__a, __b); 7274 #endif 7275 } 7276 7277 /* vec_vpkswus */ 7278 7279 static __inline__ vector unsigned short __ATTRS_o_ai 7280 vec_vpkswus(vector int __a, vector int __b) { 7281 #ifdef __LITTLE_ENDIAN__ 7282 return __builtin_altivec_vpkswus(__b, __a); 7283 #else 7284 return __builtin_altivec_vpkswus(__a, __b); 7285 #endif 7286 } 7287 7288 static __inline__ vector unsigned short __ATTRS_o_ai 7289 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7290 #ifdef __LITTLE_ENDIAN__ 7291 return __builtin_altivec_vpkuwus(__b, __a); 7292 #else 7293 return __builtin_altivec_vpkuwus(__a, __b); 7294 #endif 7295 } 7296 7297 /* vec_vpksdus */ 7298 7299 #ifdef __POWER8_VECTOR__ 7300 static __inline__ vector unsigned int __ATTRS_o_ai 7301 vec_vpksdus(vector long long __a, vector long long __b) { 7302 #ifdef __LITTLE_ENDIAN__ 7303 return __builtin_altivec_vpksdus(__b, __a); 7304 #else 7305 return __builtin_altivec_vpksdus(__a, __b); 7306 #endif 7307 } 7308 #endif 7309 7310 /* vec_perm */ 7311 7312 // The vperm instruction is defined architecturally with a big-endian bias. 7313 // For little endian, we swap the input operands and invert the permute 7314 // control vector. Only the rightmost 5 bits matter, so we could use 7315 // a vector of all 31s instead of all 255s to perform the inversion. 7316 // However, when the PCV is not a constant, using 255 has an advantage 7317 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7318 // later, possibly a vec_nand). 7319 7320 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7321 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7322 #ifdef __LITTLE_ENDIAN__ 7323 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7324 255, 255, 255, 255, 255, 255, 255, 255}; 7325 __d = vec_xor(__c, __d); 7326 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7327 (vector int)__a, __d); 7328 #else 7329 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7330 (vector int)__b, __c); 7331 #endif 7332 } 7333 7334 static __inline__ vector unsigned char __ATTRS_o_ai 7335 vec_perm(vector unsigned char __a, vector unsigned char __b, 7336 vector unsigned char __c) { 7337 #ifdef __LITTLE_ENDIAN__ 7338 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7339 255, 255, 255, 255, 255, 255, 255, 255}; 7340 __d = vec_xor(__c, __d); 7341 return (vector unsigned char)__builtin_altivec_vperm_4si( 7342 (vector int)__b, (vector int)__a, __d); 7343 #else 7344 return (vector unsigned char)__builtin_altivec_vperm_4si( 7345 (vector int)__a, (vector int)__b, __c); 7346 #endif 7347 } 7348 7349 static __inline__ vector bool char __ATTRS_o_ai 7350 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7351 #ifdef __LITTLE_ENDIAN__ 7352 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7353 255, 255, 255, 255, 255, 255, 255, 255}; 7354 __d = vec_xor(__c, __d); 7355 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 7356 (vector int)__a, __d); 7357 #else 7358 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7359 (vector int)__b, __c); 7360 #endif 7361 } 7362 7363 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7364 vector signed short __b, 7365 vector unsigned char __c) { 7366 #ifdef __LITTLE_ENDIAN__ 7367 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7368 255, 255, 255, 255, 255, 255, 255, 255}; 7369 __d = vec_xor(__c, __d); 7370 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 7371 (vector int)__a, __d); 7372 #else 7373 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 7374 (vector int)__b, __c); 7375 #endif 7376 } 7377 7378 static __inline__ vector unsigned short __ATTRS_o_ai 7379 vec_perm(vector unsigned short __a, vector unsigned short __b, 7380 vector unsigned char __c) { 7381 #ifdef __LITTLE_ENDIAN__ 7382 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7383 255, 255, 255, 255, 255, 255, 255, 255}; 7384 __d = vec_xor(__c, __d); 7385 return (vector unsigned short)__builtin_altivec_vperm_4si( 7386 (vector int)__b, (vector int)__a, __d); 7387 #else 7388 return (vector unsigned short)__builtin_altivec_vperm_4si( 7389 (vector int)__a, (vector int)__b, __c); 7390 #endif 7391 } 7392 7393 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 7394 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7395 #ifdef __LITTLE_ENDIAN__ 7396 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7397 255, 255, 255, 255, 255, 255, 255, 255}; 7398 __d = vec_xor(__c, __d); 7399 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 7400 (vector int)__a, __d); 7401 #else 7402 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 7403 (vector int)__b, __c); 7404 #endif 7405 } 7406 7407 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 7408 vector pixel __b, 7409 vector unsigned char __c) { 7410 #ifdef __LITTLE_ENDIAN__ 7411 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7412 255, 255, 255, 255, 255, 255, 255, 255}; 7413 __d = vec_xor(__c, __d); 7414 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 7415 (vector int)__a, __d); 7416 #else 7417 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 7418 (vector int)__b, __c); 7419 #endif 7420 } 7421 7422 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 7423 vector signed int __b, 7424 vector unsigned char __c) { 7425 #ifdef __LITTLE_ENDIAN__ 7426 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7427 255, 255, 255, 255, 255, 255, 255, 255}; 7428 __d = vec_xor(__c, __d); 7429 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 7430 #else 7431 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 7432 #endif 7433 } 7434 7435 static __inline__ vector unsigned int __ATTRS_o_ai 7436 vec_perm(vector unsigned int __a, vector unsigned int __b, 7437 vector unsigned char __c) { 7438 #ifdef __LITTLE_ENDIAN__ 7439 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7440 255, 255, 255, 255, 255, 255, 255, 255}; 7441 __d = vec_xor(__c, __d); 7442 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 7443 (vector int)__a, __d); 7444 #else 7445 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 7446 (vector int)__b, __c); 7447 #endif 7448 } 7449 7450 static __inline__ vector bool int __ATTRS_o_ai 7451 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 7452 #ifdef __LITTLE_ENDIAN__ 7453 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7454 255, 255, 255, 255, 255, 255, 255, 255}; 7455 __d = vec_xor(__c, __d); 7456 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 7457 (vector int)__a, __d); 7458 #else 7459 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 7460 (vector int)__b, __c); 7461 #endif 7462 } 7463 7464 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 7465 vector float __b, 7466 vector unsigned char __c) { 7467 #ifdef __LITTLE_ENDIAN__ 7468 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7469 255, 255, 255, 255, 255, 255, 255, 255}; 7470 __d = vec_xor(__c, __d); 7471 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 7472 (vector int)__a, __d); 7473 #else 7474 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 7475 (vector int)__b, __c); 7476 #endif 7477 } 7478 7479 #ifdef __VSX__ 7480 static __inline__ vector long long __ATTRS_o_ai 7481 vec_perm(vector signed long long __a, vector signed long long __b, 7482 vector unsigned char __c) { 7483 #ifdef __LITTLE_ENDIAN__ 7484 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7485 255, 255, 255, 255, 255, 255, 255, 255}; 7486 __d = vec_xor(__c, __d); 7487 return (vector signed long long)__builtin_altivec_vperm_4si( 7488 (vector int)__b, (vector int)__a, __d); 7489 #else 7490 return (vector signed long long)__builtin_altivec_vperm_4si( 7491 (vector int)__a, (vector int)__b, __c); 7492 #endif 7493 } 7494 7495 static __inline__ vector unsigned long long __ATTRS_o_ai 7496 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 7497 vector unsigned char __c) { 7498 #ifdef __LITTLE_ENDIAN__ 7499 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7500 255, 255, 255, 255, 255, 255, 255, 255}; 7501 __d = vec_xor(__c, __d); 7502 return (vector unsigned long long)__builtin_altivec_vperm_4si( 7503 (vector int)__b, (vector int)__a, __d); 7504 #else 7505 return (vector unsigned long long)__builtin_altivec_vperm_4si( 7506 (vector int)__a, (vector int)__b, __c); 7507 #endif 7508 } 7509 7510 static __inline__ vector bool long long __ATTRS_o_ai 7511 vec_perm(vector bool long long __a, vector bool long long __b, 7512 vector unsigned char __c) { 7513 #ifdef __LITTLE_ENDIAN__ 7514 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7515 255, 255, 255, 255, 255, 255, 255, 255}; 7516 __d = vec_xor(__c, __d); 7517 return (vector bool long long)__builtin_altivec_vperm_4si( 7518 (vector int)__b, (vector int)__a, __d); 7519 #else 7520 return (vector bool long long)__builtin_altivec_vperm_4si( 7521 (vector int)__a, (vector int)__b, __c); 7522 #endif 7523 } 7524 7525 static __inline__ vector double __ATTRS_o_ai 7526 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 7527 #ifdef __LITTLE_ENDIAN__ 7528 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7529 255, 255, 255, 255, 255, 255, 255, 255}; 7530 __d = vec_xor(__c, __d); 7531 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 7532 (vector int)__a, __d); 7533 #else 7534 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 7535 (vector int)__b, __c); 7536 #endif 7537 } 7538 #endif 7539 7540 /* vec_vperm */ 7541 7542 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 7543 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7544 return vec_perm(__a, __b, __c); 7545 } 7546 7547 static __inline__ vector unsigned char __ATTRS_o_ai 7548 vec_vperm(vector unsigned char __a, vector unsigned char __b, 7549 vector unsigned char __c) { 7550 return vec_perm(__a, __b, __c); 7551 } 7552 7553 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 7554 vector bool char __a, vector bool char __b, vector unsigned char __c) { 7555 return vec_perm(__a, __b, __c); 7556 } 7557 7558 static __inline__ vector short __ATTRS_o_ai 7559 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 7560 return vec_perm(__a, __b, __c); 7561 } 7562 7563 static __inline__ vector unsigned short __ATTRS_o_ai 7564 vec_vperm(vector unsigned short __a, vector unsigned short __b, 7565 vector unsigned char __c) { 7566 return vec_perm(__a, __b, __c); 7567 } 7568 7569 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 7570 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7571 return vec_perm(__a, __b, __c); 7572 } 7573 7574 static __inline__ vector pixel __ATTRS_o_ai 7575 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 7576 return vec_perm(__a, __b, __c); 7577 } 7578 7579 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 7580 vector int __b, 7581 vector unsigned char __c) { 7582 return vec_perm(__a, __b, __c); 7583 } 7584 7585 static __inline__ vector unsigned int __ATTRS_o_ai 7586 vec_vperm(vector unsigned int __a, vector unsigned int __b, 7587 vector unsigned char __c) { 7588 return vec_perm(__a, __b, __c); 7589 } 7590 7591 static __inline__ vector bool int __ATTRS_o_ai 7592 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 7593 return vec_perm(__a, __b, __c); 7594 } 7595 7596 static __inline__ vector float __ATTRS_o_ai 7597 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 7598 return vec_perm(__a, __b, __c); 7599 } 7600 7601 #ifdef __VSX__ 7602 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 7603 vector long long __a, vector long long __b, vector unsigned char __c) { 7604 return vec_perm(__a, __b, __c); 7605 } 7606 7607 static __inline__ vector unsigned long long __ATTRS_o_ai 7608 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 7609 vector unsigned char __c) { 7610 return vec_perm(__a, __b, __c); 7611 } 7612 7613 static __inline__ vector double __ATTRS_o_ai 7614 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 7615 return vec_perm(__a, __b, __c); 7616 } 7617 #endif 7618 7619 /* vec_re */ 7620 7621 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 7622 #ifdef __VSX__ 7623 return __builtin_vsx_xvresp(__a); 7624 #else 7625 return __builtin_altivec_vrefp(__a); 7626 #endif 7627 } 7628 7629 #ifdef __VSX__ 7630 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 7631 return __builtin_vsx_xvredp(__a); 7632 } 7633 #endif 7634 7635 /* vec_vrefp */ 7636 7637 static __inline__ vector float __attribute__((__always_inline__)) 7638 vec_vrefp(vector float __a) { 7639 return __builtin_altivec_vrefp(__a); 7640 } 7641 7642 /* vec_rl */ 7643 7644 static __inline__ vector signed char __ATTRS_o_ai 7645 vec_rl(vector signed char __a, vector unsigned char __b) { 7646 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 7647 } 7648 7649 static __inline__ vector unsigned char __ATTRS_o_ai 7650 vec_rl(vector unsigned char __a, vector unsigned char __b) { 7651 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 7652 } 7653 7654 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 7655 vector unsigned short __b) { 7656 return __builtin_altivec_vrlh(__a, __b); 7657 } 7658 7659 static __inline__ vector unsigned short __ATTRS_o_ai 7660 vec_rl(vector unsigned short __a, vector unsigned short __b) { 7661 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 7662 } 7663 7664 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 7665 vector unsigned int __b) { 7666 return __builtin_altivec_vrlw(__a, __b); 7667 } 7668 7669 static __inline__ vector unsigned int __ATTRS_o_ai 7670 vec_rl(vector unsigned int __a, vector unsigned int __b) { 7671 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 7672 } 7673 7674 #ifdef __POWER8_VECTOR__ 7675 static __inline__ vector signed long long __ATTRS_o_ai 7676 vec_rl(vector signed long long __a, vector unsigned long long __b) { 7677 return __builtin_altivec_vrld(__a, __b); 7678 } 7679 7680 static __inline__ vector unsigned long long __ATTRS_o_ai 7681 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 7682 return __builtin_altivec_vrld(__a, __b); 7683 } 7684 #endif 7685 7686 /* vec_rlmi */ 7687 #ifdef __POWER9_VECTOR__ 7688 static __inline__ vector unsigned int __ATTRS_o_ai 7689 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 7690 vector unsigned int __c) { 7691 return __builtin_altivec_vrlwmi(__a, __c, __b); 7692 } 7693 7694 static __inline__ vector unsigned long long __ATTRS_o_ai 7695 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 7696 vector unsigned long long __c) { 7697 return __builtin_altivec_vrldmi(__a, __c, __b); 7698 } 7699 7700 /* vec_rlnm */ 7701 static __inline__ vector unsigned int __ATTRS_o_ai 7702 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 7703 vector unsigned int __c) { 7704 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 7705 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 7706 } 7707 7708 static __inline__ vector unsigned long long __ATTRS_o_ai 7709 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 7710 vector unsigned long long __c) { 7711 vector unsigned long long OneByte = { 0x8, 0x8 }; 7712 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 7713 } 7714 #endif 7715 7716 /* vec_vrlb */ 7717 7718 static __inline__ vector signed char __ATTRS_o_ai 7719 vec_vrlb(vector signed char __a, vector unsigned char __b) { 7720 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 7721 } 7722 7723 static __inline__ vector unsigned char __ATTRS_o_ai 7724 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 7725 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 7726 } 7727 7728 /* vec_vrlh */ 7729 7730 static __inline__ vector short __ATTRS_o_ai 7731 vec_vrlh(vector short __a, vector unsigned short __b) { 7732 return __builtin_altivec_vrlh(__a, __b); 7733 } 7734 7735 static __inline__ vector unsigned short __ATTRS_o_ai 7736 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 7737 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 7738 } 7739 7740 /* vec_vrlw */ 7741 7742 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 7743 vector unsigned int __b) { 7744 return __builtin_altivec_vrlw(__a, __b); 7745 } 7746 7747 static __inline__ vector unsigned int __ATTRS_o_ai 7748 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 7749 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 7750 } 7751 7752 /* vec_round */ 7753 7754 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 7755 #ifdef __VSX__ 7756 return __builtin_vsx_xvrspi(__a); 7757 #else 7758 return __builtin_altivec_vrfin(__a); 7759 #endif 7760 } 7761 7762 #ifdef __VSX__ 7763 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 7764 return __builtin_vsx_xvrdpi(__a); 7765 } 7766 7767 /* vec_rint */ 7768 7769 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 7770 return __builtin_vsx_xvrspic(__a); 7771 } 7772 7773 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 7774 return __builtin_vsx_xvrdpic(__a); 7775 } 7776 7777 /* vec_nearbyint */ 7778 7779 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 7780 return __builtin_vsx_xvrspi(__a); 7781 } 7782 7783 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 7784 return __builtin_vsx_xvrdpi(__a); 7785 } 7786 #endif 7787 7788 /* vec_vrfin */ 7789 7790 static __inline__ vector float __attribute__((__always_inline__)) 7791 vec_vrfin(vector float __a) { 7792 return __builtin_altivec_vrfin(__a); 7793 } 7794 7795 /* vec_sqrt */ 7796 7797 #ifdef __VSX__ 7798 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 7799 return __builtin_vsx_xvsqrtsp(__a); 7800 } 7801 7802 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 7803 return __builtin_vsx_xvsqrtdp(__a); 7804 } 7805 #endif 7806 7807 /* vec_rsqrte */ 7808 7809 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 7810 #ifdef __VSX__ 7811 return __builtin_vsx_xvrsqrtesp(__a); 7812 #else 7813 return __builtin_altivec_vrsqrtefp(__a); 7814 #endif 7815 } 7816 7817 #ifdef __VSX__ 7818 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 7819 return __builtin_vsx_xvrsqrtedp(__a); 7820 } 7821 #endif 7822 7823 /* vec_vrsqrtefp */ 7824 7825 static __inline__ __vector float __attribute__((__always_inline__)) 7826 vec_vrsqrtefp(vector float __a) { 7827 return __builtin_altivec_vrsqrtefp(__a); 7828 } 7829 7830 /* vec_sel */ 7831 7832 #define __builtin_altivec_vsel_4si vec_sel 7833 7834 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 7835 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7836 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 7837 } 7838 7839 static __inline__ vector signed char __ATTRS_o_ai 7840 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 7841 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 7842 } 7843 7844 static __inline__ vector unsigned char __ATTRS_o_ai 7845 vec_sel(vector unsigned char __a, vector unsigned char __b, 7846 vector unsigned char __c) { 7847 return (__a & ~__c) | (__b & __c); 7848 } 7849 7850 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 7851 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 7852 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 7853 } 7854 7855 static __inline__ vector bool char __ATTRS_o_ai 7856 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7857 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 7858 } 7859 7860 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 7861 vector bool char __b, 7862 vector bool char __c) { 7863 return (__a & ~__c) | (__b & __c); 7864 } 7865 7866 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 7867 vector short __b, 7868 vector unsigned short __c) { 7869 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 7870 } 7871 7872 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 7873 vector short __b, 7874 vector bool short __c) { 7875 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 7876 } 7877 7878 static __inline__ vector unsigned short __ATTRS_o_ai 7879 vec_sel(vector unsigned short __a, vector unsigned short __b, 7880 vector unsigned short __c) { 7881 return (__a & ~__c) | (__b & __c); 7882 } 7883 7884 static __inline__ vector unsigned short __ATTRS_o_ai 7885 vec_sel(vector unsigned short __a, vector unsigned short __b, 7886 vector bool short __c) { 7887 return (__a & ~(vector unsigned short)__c) | 7888 (__b & (vector unsigned short)__c); 7889 } 7890 7891 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 7892 vector bool short __a, vector bool short __b, vector unsigned short __c) { 7893 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 7894 } 7895 7896 static __inline__ vector bool short __ATTRS_o_ai 7897 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 7898 return (__a & ~__c) | (__b & __c); 7899 } 7900 7901 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 7902 vector int __b, 7903 vector unsigned int __c) { 7904 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 7905 } 7906 7907 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 7908 vector int __b, 7909 vector bool int __c) { 7910 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 7911 } 7912 7913 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 7914 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 7915 return (__a & ~__c) | (__b & __c); 7916 } 7917 7918 static __inline__ vector unsigned int __ATTRS_o_ai 7919 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 7920 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 7921 } 7922 7923 static __inline__ vector bool int __ATTRS_o_ai 7924 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 7925 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 7926 } 7927 7928 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 7929 vector bool int __b, 7930 vector bool int __c) { 7931 return (__a & ~__c) | (__b & __c); 7932 } 7933 7934 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 7935 vector float __b, 7936 vector unsigned int __c) { 7937 vector int __res = ((vector int)__a & ~(vector int)__c) | 7938 ((vector int)__b & (vector int)__c); 7939 return (vector float)__res; 7940 } 7941 7942 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 7943 vector float __b, 7944 vector bool int __c) { 7945 vector int __res = ((vector int)__a & ~(vector int)__c) | 7946 ((vector int)__b & (vector int)__c); 7947 return (vector float)__res; 7948 } 7949 7950 #ifdef __VSX__ 7951 static __inline__ vector double __ATTRS_o_ai 7952 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 7953 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 7954 ((vector long long)__b & (vector long long)__c); 7955 return (vector double)__res; 7956 } 7957 7958 static __inline__ vector double __ATTRS_o_ai 7959 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 7960 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 7961 ((vector long long)__b & (vector long long)__c); 7962 return (vector double)__res; 7963 } 7964 #endif 7965 7966 /* vec_vsel */ 7967 7968 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 7969 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7970 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 7971 } 7972 7973 static __inline__ vector signed char __ATTRS_o_ai 7974 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 7975 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 7976 } 7977 7978 static __inline__ vector unsigned char __ATTRS_o_ai 7979 vec_vsel(vector unsigned char __a, vector unsigned char __b, 7980 vector unsigned char __c) { 7981 return (__a & ~__c) | (__b & __c); 7982 } 7983 7984 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 7985 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 7986 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 7987 } 7988 7989 static __inline__ vector bool char __ATTRS_o_ai 7990 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7991 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 7992 } 7993 7994 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 7995 vector bool char __b, 7996 vector bool char __c) { 7997 return (__a & ~__c) | (__b & __c); 7998 } 7999 8000 static __inline__ vector short __ATTRS_o_ai 8001 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8002 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8003 } 8004 8005 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8006 vector short __b, 8007 vector bool short __c) { 8008 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8009 } 8010 8011 static __inline__ vector unsigned short __ATTRS_o_ai 8012 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8013 vector unsigned short __c) { 8014 return (__a & ~__c) | (__b & __c); 8015 } 8016 8017 static __inline__ vector unsigned short __ATTRS_o_ai 8018 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8019 vector bool short __c) { 8020 return (__a & ~(vector unsigned short)__c) | 8021 (__b & (vector unsigned short)__c); 8022 } 8023 8024 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8025 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8026 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8027 } 8028 8029 static __inline__ vector bool short __ATTRS_o_ai 8030 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8031 return (__a & ~__c) | (__b & __c); 8032 } 8033 8034 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8035 vector int __b, 8036 vector unsigned int __c) { 8037 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8038 } 8039 8040 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8041 vector int __b, 8042 vector bool int __c) { 8043 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8044 } 8045 8046 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8047 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8048 return (__a & ~__c) | (__b & __c); 8049 } 8050 8051 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8052 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8053 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8054 } 8055 8056 static __inline__ vector bool int __ATTRS_o_ai 8057 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8058 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8059 } 8060 8061 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8062 vector bool int __b, 8063 vector bool int __c) { 8064 return (__a & ~__c) | (__b & __c); 8065 } 8066 8067 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8068 vector float __b, 8069 vector unsigned int __c) { 8070 vector int __res = ((vector int)__a & ~(vector int)__c) | 8071 ((vector int)__b & (vector int)__c); 8072 return (vector float)__res; 8073 } 8074 8075 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8076 vector float __b, 8077 vector bool int __c) { 8078 vector int __res = ((vector int)__a & ~(vector int)__c) | 8079 ((vector int)__b & (vector int)__c); 8080 return (vector float)__res; 8081 } 8082 8083 /* vec_sl */ 8084 8085 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8086 // than the length of __a. 8087 static __inline__ vector unsigned char __ATTRS_o_ai 8088 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8089 return __a << (__b % 8090 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8091 } 8092 8093 static __inline__ vector signed char __ATTRS_o_ai 8094 vec_sl(vector signed char __a, vector unsigned char __b) { 8095 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8096 } 8097 8098 static __inline__ vector unsigned short __ATTRS_o_ai 8099 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8100 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8101 __CHAR_BIT__)); 8102 } 8103 8104 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8105 vector unsigned short __b) { 8106 return (vector short)vec_sl((vector unsigned short)__a, __b); 8107 } 8108 8109 static __inline__ vector unsigned int __ATTRS_o_ai 8110 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8111 return __a << (__b % 8112 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8113 } 8114 8115 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8116 vector unsigned int __b) { 8117 return (vector int)vec_sl((vector unsigned int)__a, __b); 8118 } 8119 8120 #ifdef __POWER8_VECTOR__ 8121 static __inline__ vector unsigned long long __ATTRS_o_ai 8122 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8123 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8124 __CHAR_BIT__)); 8125 } 8126 8127 static __inline__ vector long long __ATTRS_o_ai 8128 vec_sl(vector long long __a, vector unsigned long long __b) { 8129 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8130 } 8131 #endif 8132 8133 /* vec_vslb */ 8134 8135 #define __builtin_altivec_vslb vec_vslb 8136 8137 static __inline__ vector signed char __ATTRS_o_ai 8138 vec_vslb(vector signed char __a, vector unsigned char __b) { 8139 return vec_sl(__a, __b); 8140 } 8141 8142 static __inline__ vector unsigned char __ATTRS_o_ai 8143 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8144 return vec_sl(__a, __b); 8145 } 8146 8147 /* vec_vslh */ 8148 8149 #define __builtin_altivec_vslh vec_vslh 8150 8151 static __inline__ vector short __ATTRS_o_ai 8152 vec_vslh(vector short __a, vector unsigned short __b) { 8153 return vec_sl(__a, __b); 8154 } 8155 8156 static __inline__ vector unsigned short __ATTRS_o_ai 8157 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8158 return vec_sl(__a, __b); 8159 } 8160 8161 /* vec_vslw */ 8162 8163 #define __builtin_altivec_vslw vec_vslw 8164 8165 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8166 vector unsigned int __b) { 8167 return vec_sl(__a, __b); 8168 } 8169 8170 static __inline__ vector unsigned int __ATTRS_o_ai 8171 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 8172 return vec_sl(__a, __b); 8173 } 8174 8175 /* vec_sld */ 8176 8177 #define __builtin_altivec_vsldoi_4si vec_sld 8178 8179 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 8180 vector signed char __a, vector signed char __b, unsigned const int __c) { 8181 unsigned char __d = __c & 0x0F; 8182 #ifdef __LITTLE_ENDIAN__ 8183 return vec_perm( 8184 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8185 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8186 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8187 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8188 #else 8189 return vec_perm( 8190 __a, __b, 8191 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8192 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8193 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8194 #endif 8195 } 8196 8197 static __inline__ vector unsigned char __ATTRS_o_ai 8198 vec_sld(vector unsigned char __a, vector unsigned char __b, 8199 unsigned const int __c) { 8200 unsigned char __d = __c & 0x0F; 8201 #ifdef __LITTLE_ENDIAN__ 8202 return vec_perm( 8203 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8204 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8205 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8206 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8207 #else 8208 return vec_perm( 8209 __a, __b, 8210 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8211 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8212 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8213 #endif 8214 } 8215 8216 static __inline__ vector bool char __ATTRS_o_ai 8217 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 8218 unsigned char __d = __c & 0x0F; 8219 #ifdef __LITTLE_ENDIAN__ 8220 return vec_perm( 8221 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8222 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8223 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8224 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8225 #else 8226 return vec_perm( 8227 __a, __b, 8228 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8229 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8230 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8231 #endif 8232 } 8233 8234 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 8235 vector signed short __a, vector signed short __b, unsigned const int __c) { 8236 unsigned char __d = __c & 0x0F; 8237 #ifdef __LITTLE_ENDIAN__ 8238 return vec_perm( 8239 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8240 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8241 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8242 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8243 #else 8244 return vec_perm( 8245 __a, __b, 8246 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8247 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8248 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8249 #endif 8250 } 8251 8252 static __inline__ vector unsigned short __ATTRS_o_ai 8253 vec_sld(vector unsigned short __a, vector unsigned short __b, 8254 unsigned const int __c) { 8255 unsigned char __d = __c & 0x0F; 8256 #ifdef __LITTLE_ENDIAN__ 8257 return vec_perm( 8258 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8259 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8260 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8261 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8262 #else 8263 return vec_perm( 8264 __a, __b, 8265 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8266 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8267 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8268 #endif 8269 } 8270 8271 static __inline__ vector bool short __ATTRS_o_ai 8272 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 8273 unsigned char __d = __c & 0x0F; 8274 #ifdef __LITTLE_ENDIAN__ 8275 return vec_perm( 8276 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8277 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8278 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8279 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8280 #else 8281 return vec_perm( 8282 __a, __b, 8283 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8284 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8285 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8286 #endif 8287 } 8288 8289 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 8290 vector pixel __b, 8291 unsigned const int __c) { 8292 unsigned char __d = __c & 0x0F; 8293 #ifdef __LITTLE_ENDIAN__ 8294 return vec_perm( 8295 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8296 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8297 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8298 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8299 #else 8300 return vec_perm( 8301 __a, __b, 8302 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8303 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8304 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8305 #endif 8306 } 8307 8308 static __inline__ vector signed int __ATTRS_o_ai 8309 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 8310 unsigned char __d = __c & 0x0F; 8311 #ifdef __LITTLE_ENDIAN__ 8312 return vec_perm( 8313 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8314 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8315 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8316 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8317 #else 8318 return vec_perm( 8319 __a, __b, 8320 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8321 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8322 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8323 #endif 8324 } 8325 8326 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 8327 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 8328 unsigned char __d = __c & 0x0F; 8329 #ifdef __LITTLE_ENDIAN__ 8330 return vec_perm( 8331 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8332 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8333 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8334 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8335 #else 8336 return vec_perm( 8337 __a, __b, 8338 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8339 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8340 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8341 #endif 8342 } 8343 8344 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 8345 vector bool int __b, 8346 unsigned const int __c) { 8347 unsigned char __d = __c & 0x0F; 8348 #ifdef __LITTLE_ENDIAN__ 8349 return vec_perm( 8350 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8351 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8352 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8353 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8354 #else 8355 return vec_perm( 8356 __a, __b, 8357 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8358 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8359 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8360 #endif 8361 } 8362 8363 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 8364 vector float __b, 8365 unsigned const int __c) { 8366 unsigned char __d = __c & 0x0F; 8367 #ifdef __LITTLE_ENDIAN__ 8368 return vec_perm( 8369 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8370 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8371 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8372 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8373 #else 8374 return vec_perm( 8375 __a, __b, 8376 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8377 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8378 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8379 #endif 8380 } 8381 8382 #ifdef __VSX__ 8383 static __inline__ vector bool long long __ATTRS_o_ai 8384 vec_sld(vector bool long long __a, vector bool long long __b, 8385 unsigned const int __c) { 8386 unsigned char __d = __c & 0x0F; 8387 #ifdef __LITTLE_ENDIAN__ 8388 return vec_perm( 8389 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8390 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8391 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8392 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8393 #else 8394 return vec_perm( 8395 __a, __b, 8396 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8397 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8398 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8399 #endif 8400 } 8401 8402 static __inline__ vector signed long long __ATTRS_o_ai 8403 vec_sld(vector signed long long __a, vector signed long long __b, 8404 unsigned const int __c) { 8405 unsigned char __d = __c & 0x0F; 8406 #ifdef __LITTLE_ENDIAN__ 8407 return vec_perm( 8408 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8409 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8410 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8411 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8412 #else 8413 return vec_perm( 8414 __a, __b, 8415 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8416 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8417 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8418 #endif 8419 } 8420 8421 static __inline__ vector unsigned long long __ATTRS_o_ai 8422 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 8423 unsigned const int __c) { 8424 unsigned char __d = __c & 0x0F; 8425 #ifdef __LITTLE_ENDIAN__ 8426 return vec_perm( 8427 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8428 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8429 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8430 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8431 #else 8432 return vec_perm( 8433 __a, __b, 8434 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8435 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8436 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8437 #endif 8438 } 8439 8440 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 8441 vector double __b, 8442 unsigned const int __c) { 8443 unsigned char __d = __c & 0x0F; 8444 #ifdef __LITTLE_ENDIAN__ 8445 return vec_perm( 8446 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8447 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8448 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8449 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8450 #else 8451 return vec_perm( 8452 __a, __b, 8453 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8454 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8455 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8456 #endif 8457 } 8458 #endif 8459 8460 /* vec_sldw */ 8461 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 8462 vector signed char __a, vector signed char __b, unsigned const int __c) { 8463 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8464 } 8465 8466 static __inline__ vector unsigned char __ATTRS_o_ai 8467 vec_sldw(vector unsigned char __a, vector unsigned char __b, 8468 unsigned const int __c) { 8469 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8470 } 8471 8472 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 8473 vector signed short __a, vector signed short __b, unsigned const int __c) { 8474 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8475 } 8476 8477 static __inline__ vector unsigned short __ATTRS_o_ai 8478 vec_sldw(vector unsigned short __a, vector unsigned short __b, 8479 unsigned const int __c) { 8480 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8481 } 8482 8483 static __inline__ vector signed int __ATTRS_o_ai 8484 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 8485 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8486 } 8487 8488 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 8489 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 8490 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8491 } 8492 8493 #ifdef __VSX__ 8494 static __inline__ vector signed long long __ATTRS_o_ai 8495 vec_sldw(vector signed long long __a, vector signed long long __b, 8496 unsigned const int __c) { 8497 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8498 } 8499 8500 static __inline__ vector unsigned long long __ATTRS_o_ai 8501 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 8502 unsigned const int __c) { 8503 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8504 } 8505 #endif 8506 8507 #ifdef __POWER9_VECTOR__ 8508 /* vec_slv */ 8509 static __inline__ vector unsigned char __ATTRS_o_ai 8510 vec_slv(vector unsigned char __a, vector unsigned char __b) { 8511 return __builtin_altivec_vslv(__a, __b); 8512 } 8513 8514 /* vec_srv */ 8515 static __inline__ vector unsigned char __ATTRS_o_ai 8516 vec_srv(vector unsigned char __a, vector unsigned char __b) { 8517 return __builtin_altivec_vsrv(__a, __b); 8518 } 8519 #endif 8520 8521 /* vec_vsldoi */ 8522 8523 static __inline__ vector signed char __ATTRS_o_ai 8524 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 8525 unsigned char __d = __c & 0x0F; 8526 #ifdef __LITTLE_ENDIAN__ 8527 return vec_perm( 8528 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8529 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8530 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8531 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8532 #else 8533 return vec_perm( 8534 __a, __b, 8535 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8536 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8537 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8538 #endif 8539 } 8540 8541 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 8542 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 8543 unsigned char __d = __c & 0x0F; 8544 #ifdef __LITTLE_ENDIAN__ 8545 return vec_perm( 8546 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8547 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8548 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8549 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8550 #else 8551 return vec_perm( 8552 __a, __b, 8553 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8554 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8555 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8556 #endif 8557 } 8558 8559 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 8560 vector short __b, 8561 unsigned char __c) { 8562 unsigned char __d = __c & 0x0F; 8563 #ifdef __LITTLE_ENDIAN__ 8564 return vec_perm( 8565 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8566 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8567 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8568 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8569 #else 8570 return vec_perm( 8571 __a, __b, 8572 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8573 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8574 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8575 #endif 8576 } 8577 8578 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 8579 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 8580 unsigned char __d = __c & 0x0F; 8581 #ifdef __LITTLE_ENDIAN__ 8582 return vec_perm( 8583 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8584 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8585 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8586 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8587 #else 8588 return vec_perm( 8589 __a, __b, 8590 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8591 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8592 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8593 #endif 8594 } 8595 8596 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 8597 vector pixel __b, 8598 unsigned char __c) { 8599 unsigned char __d = __c & 0x0F; 8600 #ifdef __LITTLE_ENDIAN__ 8601 return vec_perm( 8602 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8603 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8604 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8605 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8606 #else 8607 return vec_perm( 8608 __a, __b, 8609 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8610 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8611 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8612 #endif 8613 } 8614 8615 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 8616 vector int __b, 8617 unsigned char __c) { 8618 unsigned char __d = __c & 0x0F; 8619 #ifdef __LITTLE_ENDIAN__ 8620 return vec_perm( 8621 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8622 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8623 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8624 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8625 #else 8626 return vec_perm( 8627 __a, __b, 8628 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8629 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8630 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8631 #endif 8632 } 8633 8634 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 8635 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 8636 unsigned char __d = __c & 0x0F; 8637 #ifdef __LITTLE_ENDIAN__ 8638 return vec_perm( 8639 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8640 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8641 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8642 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8643 #else 8644 return vec_perm( 8645 __a, __b, 8646 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8647 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8648 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8649 #endif 8650 } 8651 8652 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 8653 vector float __b, 8654 unsigned char __c) { 8655 unsigned char __d = __c & 0x0F; 8656 #ifdef __LITTLE_ENDIAN__ 8657 return vec_perm( 8658 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8659 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8660 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8661 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8662 #else 8663 return vec_perm( 8664 __a, __b, 8665 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8666 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8667 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8668 #endif 8669 } 8670 8671 /* vec_sll */ 8672 8673 static __inline__ vector signed char __ATTRS_o_ai 8674 vec_sll(vector signed char __a, vector unsigned char __b) { 8675 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 8676 (vector int)__b); 8677 } 8678 8679 static __inline__ vector signed char __ATTRS_o_ai 8680 vec_sll(vector signed char __a, vector unsigned short __b) { 8681 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 8682 (vector int)__b); 8683 } 8684 8685 static __inline__ vector signed char __ATTRS_o_ai 8686 vec_sll(vector signed char __a, vector unsigned int __b) { 8687 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 8688 (vector int)__b); 8689 } 8690 8691 static __inline__ vector unsigned char __ATTRS_o_ai 8692 vec_sll(vector unsigned char __a, vector unsigned char __b) { 8693 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 8694 (vector int)__b); 8695 } 8696 8697 static __inline__ vector unsigned char __ATTRS_o_ai 8698 vec_sll(vector unsigned char __a, vector unsigned short __b) { 8699 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 8700 (vector int)__b); 8701 } 8702 8703 static __inline__ vector unsigned char __ATTRS_o_ai 8704 vec_sll(vector unsigned char __a, vector unsigned int __b) { 8705 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 8706 (vector int)__b); 8707 } 8708 8709 static __inline__ vector bool char __ATTRS_o_ai 8710 vec_sll(vector bool char __a, vector unsigned char __b) { 8711 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 8712 (vector int)__b); 8713 } 8714 8715 static __inline__ vector bool char __ATTRS_o_ai 8716 vec_sll(vector bool char __a, vector unsigned short __b) { 8717 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 8718 (vector int)__b); 8719 } 8720 8721 static __inline__ vector bool char __ATTRS_o_ai 8722 vec_sll(vector bool char __a, vector unsigned int __b) { 8723 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 8724 (vector int)__b); 8725 } 8726 8727 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 8728 vector unsigned char __b) { 8729 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8730 } 8731 8732 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 8733 vector unsigned short __b) { 8734 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8735 } 8736 8737 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 8738 vector unsigned int __b) { 8739 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8740 } 8741 8742 static __inline__ vector unsigned short __ATTRS_o_ai 8743 vec_sll(vector unsigned short __a, vector unsigned char __b) { 8744 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 8745 (vector int)__b); 8746 } 8747 8748 static __inline__ vector unsigned short __ATTRS_o_ai 8749 vec_sll(vector unsigned short __a, vector unsigned short __b) { 8750 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 8751 (vector int)__b); 8752 } 8753 8754 static __inline__ vector unsigned short __ATTRS_o_ai 8755 vec_sll(vector unsigned short __a, vector unsigned int __b) { 8756 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 8757 (vector int)__b); 8758 } 8759 8760 static __inline__ vector bool short __ATTRS_o_ai 8761 vec_sll(vector bool short __a, vector unsigned char __b) { 8762 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 8763 (vector int)__b); 8764 } 8765 8766 static __inline__ vector bool short __ATTRS_o_ai 8767 vec_sll(vector bool short __a, vector unsigned short __b) { 8768 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 8769 (vector int)__b); 8770 } 8771 8772 static __inline__ vector bool short __ATTRS_o_ai 8773 vec_sll(vector bool short __a, vector unsigned int __b) { 8774 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 8775 (vector int)__b); 8776 } 8777 8778 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 8779 vector unsigned char __b) { 8780 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8781 } 8782 8783 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 8784 vector unsigned short __b) { 8785 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8786 } 8787 8788 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 8789 vector unsigned int __b) { 8790 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8791 } 8792 8793 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 8794 vector unsigned char __b) { 8795 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 8796 } 8797 8798 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 8799 vector unsigned short __b) { 8800 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 8801 } 8802 8803 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 8804 vector unsigned int __b) { 8805 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 8806 } 8807 8808 static __inline__ vector unsigned int __ATTRS_o_ai 8809 vec_sll(vector unsigned int __a, vector unsigned char __b) { 8810 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 8811 (vector int)__b); 8812 } 8813 8814 static __inline__ vector unsigned int __ATTRS_o_ai 8815 vec_sll(vector unsigned int __a, vector unsigned short __b) { 8816 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 8817 (vector int)__b); 8818 } 8819 8820 static __inline__ vector unsigned int __ATTRS_o_ai 8821 vec_sll(vector unsigned int __a, vector unsigned int __b) { 8822 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 8823 (vector int)__b); 8824 } 8825 8826 static __inline__ vector bool int __ATTRS_o_ai 8827 vec_sll(vector bool int __a, vector unsigned char __b) { 8828 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 8829 (vector int)__b); 8830 } 8831 8832 static __inline__ vector bool int __ATTRS_o_ai 8833 vec_sll(vector bool int __a, vector unsigned short __b) { 8834 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 8835 (vector int)__b); 8836 } 8837 8838 static __inline__ vector bool int __ATTRS_o_ai 8839 vec_sll(vector bool int __a, vector unsigned int __b) { 8840 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 8841 (vector int)__b); 8842 } 8843 8844 #ifdef __VSX__ 8845 static __inline__ vector signed long long __ATTRS_o_ai 8846 vec_sll(vector signed long long __a, vector unsigned char __b) { 8847 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 8848 (vector int)__b); 8849 } 8850 8851 static __inline__ vector unsigned long long __ATTRS_o_ai 8852 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 8853 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 8854 (vector int)__b); 8855 } 8856 #endif 8857 8858 /* vec_vsl */ 8859 8860 static __inline__ vector signed char __ATTRS_o_ai 8861 vec_vsl(vector signed char __a, vector unsigned char __b) { 8862 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 8863 (vector int)__b); 8864 } 8865 8866 static __inline__ vector signed char __ATTRS_o_ai 8867 vec_vsl(vector signed char __a, vector unsigned short __b) { 8868 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 8869 (vector int)__b); 8870 } 8871 8872 static __inline__ vector signed char __ATTRS_o_ai 8873 vec_vsl(vector signed char __a, vector unsigned int __b) { 8874 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 8875 (vector int)__b); 8876 } 8877 8878 static __inline__ vector unsigned char __ATTRS_o_ai 8879 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 8880 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 8881 (vector int)__b); 8882 } 8883 8884 static __inline__ vector unsigned char __ATTRS_o_ai 8885 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 8886 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 8887 (vector int)__b); 8888 } 8889 8890 static __inline__ vector unsigned char __ATTRS_o_ai 8891 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 8892 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 8893 (vector int)__b); 8894 } 8895 8896 static __inline__ vector bool char __ATTRS_o_ai 8897 vec_vsl(vector bool char __a, vector unsigned char __b) { 8898 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 8899 (vector int)__b); 8900 } 8901 8902 static __inline__ vector bool char __ATTRS_o_ai 8903 vec_vsl(vector bool char __a, vector unsigned short __b) { 8904 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 8905 (vector int)__b); 8906 } 8907 8908 static __inline__ vector bool char __ATTRS_o_ai 8909 vec_vsl(vector bool char __a, vector unsigned int __b) { 8910 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 8911 (vector int)__b); 8912 } 8913 8914 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 8915 vector unsigned char __b) { 8916 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8917 } 8918 8919 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 8920 vector unsigned short __b) { 8921 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8922 } 8923 8924 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 8925 vector unsigned int __b) { 8926 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8927 } 8928 8929 static __inline__ vector unsigned short __ATTRS_o_ai 8930 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 8931 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 8932 (vector int)__b); 8933 } 8934 8935 static __inline__ vector unsigned short __ATTRS_o_ai 8936 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 8937 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 8938 (vector int)__b); 8939 } 8940 8941 static __inline__ vector unsigned short __ATTRS_o_ai 8942 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 8943 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 8944 (vector int)__b); 8945 } 8946 8947 static __inline__ vector bool short __ATTRS_o_ai 8948 vec_vsl(vector bool short __a, vector unsigned char __b) { 8949 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 8950 (vector int)__b); 8951 } 8952 8953 static __inline__ vector bool short __ATTRS_o_ai 8954 vec_vsl(vector bool short __a, vector unsigned short __b) { 8955 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 8956 (vector int)__b); 8957 } 8958 8959 static __inline__ vector bool short __ATTRS_o_ai 8960 vec_vsl(vector bool short __a, vector unsigned int __b) { 8961 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 8962 (vector int)__b); 8963 } 8964 8965 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 8966 vector unsigned char __b) { 8967 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8968 } 8969 8970 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 8971 vector unsigned short __b) { 8972 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8973 } 8974 8975 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 8976 vector unsigned int __b) { 8977 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 8978 } 8979 8980 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 8981 vector unsigned char __b) { 8982 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 8983 } 8984 8985 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 8986 vector unsigned short __b) { 8987 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 8988 } 8989 8990 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 8991 vector unsigned int __b) { 8992 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 8993 } 8994 8995 static __inline__ vector unsigned int __ATTRS_o_ai 8996 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 8997 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 8998 (vector int)__b); 8999 } 9000 9001 static __inline__ vector unsigned int __ATTRS_o_ai 9002 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9003 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9004 (vector int)__b); 9005 } 9006 9007 static __inline__ vector unsigned int __ATTRS_o_ai 9008 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9009 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9010 (vector int)__b); 9011 } 9012 9013 static __inline__ vector bool int __ATTRS_o_ai 9014 vec_vsl(vector bool int __a, vector unsigned char __b) { 9015 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9016 (vector int)__b); 9017 } 9018 9019 static __inline__ vector bool int __ATTRS_o_ai 9020 vec_vsl(vector bool int __a, vector unsigned short __b) { 9021 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9022 (vector int)__b); 9023 } 9024 9025 static __inline__ vector bool int __ATTRS_o_ai 9026 vec_vsl(vector bool int __a, vector unsigned int __b) { 9027 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9028 (vector int)__b); 9029 } 9030 9031 /* vec_slo */ 9032 9033 static __inline__ vector signed char __ATTRS_o_ai 9034 vec_slo(vector signed char __a, vector signed char __b) { 9035 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9036 (vector int)__b); 9037 } 9038 9039 static __inline__ vector signed char __ATTRS_o_ai 9040 vec_slo(vector signed char __a, vector unsigned char __b) { 9041 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9042 (vector int)__b); 9043 } 9044 9045 static __inline__ vector unsigned char __ATTRS_o_ai 9046 vec_slo(vector unsigned char __a, vector signed char __b) { 9047 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9048 (vector int)__b); 9049 } 9050 9051 static __inline__ vector unsigned char __ATTRS_o_ai 9052 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9053 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9054 (vector int)__b); 9055 } 9056 9057 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9058 vector signed char __b) { 9059 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9060 } 9061 9062 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9063 vector unsigned char __b) { 9064 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9065 } 9066 9067 static __inline__ vector unsigned short __ATTRS_o_ai 9068 vec_slo(vector unsigned short __a, vector signed char __b) { 9069 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9070 (vector int)__b); 9071 } 9072 9073 static __inline__ vector unsigned short __ATTRS_o_ai 9074 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9075 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9076 (vector int)__b); 9077 } 9078 9079 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9080 vector signed char __b) { 9081 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9082 } 9083 9084 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9085 vector unsigned char __b) { 9086 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9087 } 9088 9089 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9090 vector signed char __b) { 9091 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9092 } 9093 9094 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9095 vector unsigned char __b) { 9096 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9097 } 9098 9099 static __inline__ vector unsigned int __ATTRS_o_ai 9100 vec_slo(vector unsigned int __a, vector signed char __b) { 9101 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9102 (vector int)__b); 9103 } 9104 9105 static __inline__ vector unsigned int __ATTRS_o_ai 9106 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9107 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9108 (vector int)__b); 9109 } 9110 9111 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9112 vector signed char __b) { 9113 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9114 } 9115 9116 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9117 vector unsigned char __b) { 9118 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9119 } 9120 9121 #ifdef __VSX__ 9122 static __inline__ vector signed long long __ATTRS_o_ai 9123 vec_slo(vector signed long long __a, vector signed char __b) { 9124 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9125 (vector int)__b); 9126 } 9127 9128 static __inline__ vector signed long long __ATTRS_o_ai 9129 vec_slo(vector signed long long __a, vector unsigned char __b) { 9130 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9131 (vector int)__b); 9132 } 9133 9134 static __inline__ vector unsigned long long __ATTRS_o_ai 9135 vec_slo(vector unsigned long long __a, vector signed char __b) { 9136 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9137 (vector int)__b); 9138 } 9139 9140 static __inline__ vector unsigned long long __ATTRS_o_ai 9141 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9142 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9143 (vector int)__b); 9144 } 9145 #endif 9146 9147 /* vec_vslo */ 9148 9149 static __inline__ vector signed char __ATTRS_o_ai 9150 vec_vslo(vector signed char __a, vector signed char __b) { 9151 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9152 (vector int)__b); 9153 } 9154 9155 static __inline__ vector signed char __ATTRS_o_ai 9156 vec_vslo(vector signed char __a, vector unsigned char __b) { 9157 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9158 (vector int)__b); 9159 } 9160 9161 static __inline__ vector unsigned char __ATTRS_o_ai 9162 vec_vslo(vector unsigned char __a, vector signed char __b) { 9163 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9164 (vector int)__b); 9165 } 9166 9167 static __inline__ vector unsigned char __ATTRS_o_ai 9168 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 9169 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9170 (vector int)__b); 9171 } 9172 9173 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9174 vector signed char __b) { 9175 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9176 } 9177 9178 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9179 vector unsigned char __b) { 9180 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9181 } 9182 9183 static __inline__ vector unsigned short __ATTRS_o_ai 9184 vec_vslo(vector unsigned short __a, vector signed char __b) { 9185 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9186 (vector int)__b); 9187 } 9188 9189 static __inline__ vector unsigned short __ATTRS_o_ai 9190 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 9191 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9192 (vector int)__b); 9193 } 9194 9195 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9196 vector signed char __b) { 9197 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9198 } 9199 9200 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9201 vector unsigned char __b) { 9202 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9203 } 9204 9205 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9206 vector signed char __b) { 9207 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9208 } 9209 9210 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9211 vector unsigned char __b) { 9212 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9213 } 9214 9215 static __inline__ vector unsigned int __ATTRS_o_ai 9216 vec_vslo(vector unsigned int __a, vector signed char __b) { 9217 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9218 (vector int)__b); 9219 } 9220 9221 static __inline__ vector unsigned int __ATTRS_o_ai 9222 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 9223 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9224 (vector int)__b); 9225 } 9226 9227 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9228 vector signed char __b) { 9229 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9230 } 9231 9232 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9233 vector unsigned char __b) { 9234 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9235 } 9236 9237 /* vec_splat */ 9238 9239 static __inline__ vector signed char __ATTRS_o_ai 9240 vec_splat(vector signed char __a, unsigned const int __b) { 9241 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9242 } 9243 9244 static __inline__ vector unsigned char __ATTRS_o_ai 9245 vec_splat(vector unsigned char __a, unsigned const int __b) { 9246 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9247 } 9248 9249 static __inline__ vector bool char __ATTRS_o_ai 9250 vec_splat(vector bool char __a, unsigned const int __b) { 9251 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9252 } 9253 9254 static __inline__ vector signed short __ATTRS_o_ai 9255 vec_splat(vector signed short __a, unsigned const int __b) { 9256 unsigned char b0 = (__b & 0x07) * 2; 9257 unsigned char b1 = b0 + 1; 9258 return vec_perm(__a, __a, 9259 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9260 b0, b1, b0, b1, b0, b1)); 9261 } 9262 9263 static __inline__ vector unsigned short __ATTRS_o_ai 9264 vec_splat(vector unsigned short __a, unsigned const int __b) { 9265 unsigned char b0 = (__b & 0x07) * 2; 9266 unsigned char b1 = b0 + 1; 9267 return vec_perm(__a, __a, 9268 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9269 b0, b1, b0, b1, b0, b1)); 9270 } 9271 9272 static __inline__ vector bool short __ATTRS_o_ai 9273 vec_splat(vector bool short __a, unsigned const int __b) { 9274 unsigned char b0 = (__b & 0x07) * 2; 9275 unsigned char b1 = b0 + 1; 9276 return vec_perm(__a, __a, 9277 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9278 b0, b1, b0, b1, b0, b1)); 9279 } 9280 9281 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 9282 unsigned const int __b) { 9283 unsigned char b0 = (__b & 0x07) * 2; 9284 unsigned char b1 = b0 + 1; 9285 return vec_perm(__a, __a, 9286 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9287 b0, b1, b0, b1, b0, b1)); 9288 } 9289 9290 static __inline__ vector signed int __ATTRS_o_ai 9291 vec_splat(vector signed int __a, unsigned const int __b) { 9292 unsigned char b0 = (__b & 0x03) * 4; 9293 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9294 return vec_perm(__a, __a, 9295 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9296 b2, b3, b0, b1, b2, b3)); 9297 } 9298 9299 static __inline__ vector unsigned int __ATTRS_o_ai 9300 vec_splat(vector unsigned int __a, unsigned const int __b) { 9301 unsigned char b0 = (__b & 0x03) * 4; 9302 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9303 return vec_perm(__a, __a, 9304 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9305 b2, b3, b0, b1, b2, b3)); 9306 } 9307 9308 static __inline__ vector bool int __ATTRS_o_ai 9309 vec_splat(vector bool int __a, unsigned const int __b) { 9310 unsigned char b0 = (__b & 0x03) * 4; 9311 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9312 return vec_perm(__a, __a, 9313 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9314 b2, b3, b0, b1, b2, b3)); 9315 } 9316 9317 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 9318 unsigned const int __b) { 9319 unsigned char b0 = (__b & 0x03) * 4; 9320 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9321 return vec_perm(__a, __a, 9322 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9323 b2, b3, b0, b1, b2, b3)); 9324 } 9325 9326 #ifdef __VSX__ 9327 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 9328 unsigned const int __b) { 9329 unsigned char b0 = (__b & 0x01) * 8; 9330 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9331 b6 = b0 + 6, b7 = b0 + 7; 9332 return vec_perm(__a, __a, 9333 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9334 b2, b3, b4, b5, b6, b7)); 9335 } 9336 static __inline__ vector bool long long __ATTRS_o_ai 9337 vec_splat(vector bool long long __a, unsigned const int __b) { 9338 unsigned char b0 = (__b & 0x01) * 8; 9339 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9340 b6 = b0 + 6, b7 = b0 + 7; 9341 return vec_perm(__a, __a, 9342 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9343 b2, b3, b4, b5, b6, b7)); 9344 } 9345 static __inline__ vector signed long long __ATTRS_o_ai 9346 vec_splat(vector signed long long __a, unsigned const int __b) { 9347 unsigned char b0 = (__b & 0x01) * 8; 9348 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9349 b6 = b0 + 6, b7 = b0 + 7; 9350 return vec_perm(__a, __a, 9351 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9352 b2, b3, b4, b5, b6, b7)); 9353 } 9354 static __inline__ vector unsigned long long __ATTRS_o_ai 9355 vec_splat(vector unsigned long long __a, unsigned const int __b) { 9356 unsigned char b0 = (__b & 0x01) * 8; 9357 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9358 b6 = b0 + 6, b7 = b0 + 7; 9359 return vec_perm(__a, __a, 9360 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9361 b2, b3, b4, b5, b6, b7)); 9362 } 9363 #endif 9364 9365 /* vec_vspltb */ 9366 9367 #define __builtin_altivec_vspltb vec_vspltb 9368 9369 static __inline__ vector signed char __ATTRS_o_ai 9370 vec_vspltb(vector signed char __a, unsigned char __b) { 9371 return vec_perm(__a, __a, (vector unsigned char)(__b)); 9372 } 9373 9374 static __inline__ vector unsigned char __ATTRS_o_ai 9375 vec_vspltb(vector unsigned char __a, unsigned char __b) { 9376 return vec_perm(__a, __a, (vector unsigned char)(__b)); 9377 } 9378 9379 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 9380 unsigned char __b) { 9381 return vec_perm(__a, __a, (vector unsigned char)(__b)); 9382 } 9383 9384 /* vec_vsplth */ 9385 9386 #define __builtin_altivec_vsplth vec_vsplth 9387 9388 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 9389 unsigned char __b) { 9390 __b *= 2; 9391 unsigned char b1 = __b + 1; 9392 return vec_perm(__a, __a, 9393 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9394 __b, b1, __b, b1, __b, b1, __b, b1)); 9395 } 9396 9397 static __inline__ vector unsigned short __ATTRS_o_ai 9398 vec_vsplth(vector unsigned short __a, unsigned char __b) { 9399 __b *= 2; 9400 unsigned char b1 = __b + 1; 9401 return vec_perm(__a, __a, 9402 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9403 __b, b1, __b, b1, __b, b1, __b, b1)); 9404 } 9405 9406 static __inline__ vector bool short __ATTRS_o_ai 9407 vec_vsplth(vector bool short __a, unsigned char __b) { 9408 __b *= 2; 9409 unsigned char b1 = __b + 1; 9410 return vec_perm(__a, __a, 9411 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9412 __b, b1, __b, b1, __b, b1, __b, b1)); 9413 } 9414 9415 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 9416 unsigned char __b) { 9417 __b *= 2; 9418 unsigned char b1 = __b + 1; 9419 return vec_perm(__a, __a, 9420 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9421 __b, b1, __b, b1, __b, b1, __b, b1)); 9422 } 9423 9424 /* vec_vspltw */ 9425 9426 #define __builtin_altivec_vspltw vec_vspltw 9427 9428 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 9429 unsigned char __b) { 9430 __b *= 4; 9431 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9432 return vec_perm(__a, __a, 9433 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9434 b1, b2, b3, __b, b1, b2, b3)); 9435 } 9436 9437 static __inline__ vector unsigned int __ATTRS_o_ai 9438 vec_vspltw(vector unsigned int __a, unsigned char __b) { 9439 __b *= 4; 9440 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9441 return vec_perm(__a, __a, 9442 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9443 b1, b2, b3, __b, b1, b2, b3)); 9444 } 9445 9446 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 9447 unsigned char __b) { 9448 __b *= 4; 9449 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9450 return vec_perm(__a, __a, 9451 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9452 b1, b2, b3, __b, b1, b2, b3)); 9453 } 9454 9455 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 9456 unsigned char __b) { 9457 __b *= 4; 9458 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9459 return vec_perm(__a, __a, 9460 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9461 b1, b2, b3, __b, b1, b2, b3)); 9462 } 9463 9464 /* vec_splat_s8 */ 9465 9466 #define __builtin_altivec_vspltisb vec_splat_s8 9467 9468 // FIXME: parameter should be treated as 5-bit signed literal 9469 static __inline__ vector signed char __ATTRS_o_ai 9470 vec_splat_s8(signed char __a) { 9471 return (vector signed char)(__a); 9472 } 9473 9474 /* vec_vspltisb */ 9475 9476 // FIXME: parameter should be treated as 5-bit signed literal 9477 static __inline__ vector signed char __ATTRS_o_ai 9478 vec_vspltisb(signed char __a) { 9479 return (vector signed char)(__a); 9480 } 9481 9482 /* vec_splat_s16 */ 9483 9484 #define __builtin_altivec_vspltish vec_splat_s16 9485 9486 // FIXME: parameter should be treated as 5-bit signed literal 9487 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 9488 return (vector short)(__a); 9489 } 9490 9491 /* vec_vspltish */ 9492 9493 // FIXME: parameter should be treated as 5-bit signed literal 9494 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 9495 return (vector short)(__a); 9496 } 9497 9498 /* vec_splat_s32 */ 9499 9500 #define __builtin_altivec_vspltisw vec_splat_s32 9501 9502 // FIXME: parameter should be treated as 5-bit signed literal 9503 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 9504 return (vector int)(__a); 9505 } 9506 9507 /* vec_vspltisw */ 9508 9509 // FIXME: parameter should be treated as 5-bit signed literal 9510 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 9511 return (vector int)(__a); 9512 } 9513 9514 /* vec_splat_u8 */ 9515 9516 // FIXME: parameter should be treated as 5-bit signed literal 9517 static __inline__ vector unsigned char __ATTRS_o_ai 9518 vec_splat_u8(unsigned char __a) { 9519 return (vector unsigned char)(__a); 9520 } 9521 9522 /* vec_splat_u16 */ 9523 9524 // FIXME: parameter should be treated as 5-bit signed literal 9525 static __inline__ vector unsigned short __ATTRS_o_ai 9526 vec_splat_u16(signed char __a) { 9527 return (vector unsigned short)(__a); 9528 } 9529 9530 /* vec_splat_u32 */ 9531 9532 // FIXME: parameter should be treated as 5-bit signed literal 9533 static __inline__ vector unsigned int __ATTRS_o_ai 9534 vec_splat_u32(signed char __a) { 9535 return (vector unsigned int)(__a); 9536 } 9537 9538 /* vec_sr */ 9539 9540 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 9541 // than the length of __a. 9542 static __inline__ vector unsigned char __ATTRS_o_ai 9543 vec_sr(vector unsigned char __a, vector unsigned char __b) { 9544 return __a >> 9545 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 9546 } 9547 9548 static __inline__ vector signed char __ATTRS_o_ai 9549 vec_sr(vector signed char __a, vector unsigned char __b) { 9550 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 9551 } 9552 9553 static __inline__ vector unsigned short __ATTRS_o_ai 9554 vec_sr(vector unsigned short __a, vector unsigned short __b) { 9555 return __a >> 9556 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 9557 } 9558 9559 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 9560 vector unsigned short __b) { 9561 return (vector short)vec_sr((vector unsigned short)__a, __b); 9562 } 9563 9564 static __inline__ vector unsigned int __ATTRS_o_ai 9565 vec_sr(vector unsigned int __a, vector unsigned int __b) { 9566 return __a >> 9567 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 9568 } 9569 9570 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 9571 vector unsigned int __b) { 9572 return (vector int)vec_sr((vector unsigned int)__a, __b); 9573 } 9574 9575 #ifdef __POWER8_VECTOR__ 9576 static __inline__ vector unsigned long long __ATTRS_o_ai 9577 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 9578 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 9579 __CHAR_BIT__)); 9580 } 9581 9582 static __inline__ vector long long __ATTRS_o_ai 9583 vec_sr(vector long long __a, vector unsigned long long __b) { 9584 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 9585 } 9586 #endif 9587 9588 /* vec_vsrb */ 9589 9590 #define __builtin_altivec_vsrb vec_vsrb 9591 9592 static __inline__ vector signed char __ATTRS_o_ai 9593 vec_vsrb(vector signed char __a, vector unsigned char __b) { 9594 return vec_sr(__a, __b); 9595 } 9596 9597 static __inline__ vector unsigned char __ATTRS_o_ai 9598 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 9599 return vec_sr(__a, __b); 9600 } 9601 9602 /* vec_vsrh */ 9603 9604 #define __builtin_altivec_vsrh vec_vsrh 9605 9606 static __inline__ vector short __ATTRS_o_ai 9607 vec_vsrh(vector short __a, vector unsigned short __b) { 9608 return vec_sr(__a, __b); 9609 } 9610 9611 static __inline__ vector unsigned short __ATTRS_o_ai 9612 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 9613 return vec_sr(__a, __b); 9614 } 9615 9616 /* vec_vsrw */ 9617 9618 #define __builtin_altivec_vsrw vec_vsrw 9619 9620 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 9621 vector unsigned int __b) { 9622 return vec_sr(__a, __b); 9623 } 9624 9625 static __inline__ vector unsigned int __ATTRS_o_ai 9626 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 9627 return vec_sr(__a, __b); 9628 } 9629 9630 /* vec_sra */ 9631 9632 static __inline__ vector signed char __ATTRS_o_ai 9633 vec_sra(vector signed char __a, vector unsigned char __b) { 9634 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 9635 } 9636 9637 static __inline__ vector unsigned char __ATTRS_o_ai 9638 vec_sra(vector unsigned char __a, vector unsigned char __b) { 9639 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 9640 } 9641 9642 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 9643 vector unsigned short __b) { 9644 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 9645 } 9646 9647 static __inline__ vector unsigned short __ATTRS_o_ai 9648 vec_sra(vector unsigned short __a, vector unsigned short __b) { 9649 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 9650 } 9651 9652 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 9653 vector unsigned int __b) { 9654 return __builtin_altivec_vsraw(__a, __b); 9655 } 9656 9657 static __inline__ vector unsigned int __ATTRS_o_ai 9658 vec_sra(vector unsigned int __a, vector unsigned int __b) { 9659 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 9660 } 9661 9662 #ifdef __POWER8_VECTOR__ 9663 static __inline__ vector signed long long __ATTRS_o_ai 9664 vec_sra(vector signed long long __a, vector unsigned long long __b) { 9665 return __a >> __b; 9666 } 9667 9668 static __inline__ vector unsigned long long __ATTRS_o_ai 9669 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 9670 return (vector unsigned long long)((vector signed long long)__a >> __b); 9671 } 9672 #endif 9673 9674 /* vec_vsrab */ 9675 9676 static __inline__ vector signed char __ATTRS_o_ai 9677 vec_vsrab(vector signed char __a, vector unsigned char __b) { 9678 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 9679 } 9680 9681 static __inline__ vector unsigned char __ATTRS_o_ai 9682 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 9683 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 9684 } 9685 9686 /* vec_vsrah */ 9687 9688 static __inline__ vector short __ATTRS_o_ai 9689 vec_vsrah(vector short __a, vector unsigned short __b) { 9690 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 9691 } 9692 9693 static __inline__ vector unsigned short __ATTRS_o_ai 9694 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 9695 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 9696 } 9697 9698 /* vec_vsraw */ 9699 9700 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 9701 vector unsigned int __b) { 9702 return __builtin_altivec_vsraw(__a, __b); 9703 } 9704 9705 static __inline__ vector unsigned int __ATTRS_o_ai 9706 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 9707 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 9708 } 9709 9710 /* vec_srl */ 9711 9712 static __inline__ vector signed char __ATTRS_o_ai 9713 vec_srl(vector signed char __a, vector unsigned char __b) { 9714 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 9715 (vector int)__b); 9716 } 9717 9718 static __inline__ vector signed char __ATTRS_o_ai 9719 vec_srl(vector signed char __a, vector unsigned short __b) { 9720 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 9721 (vector int)__b); 9722 } 9723 9724 static __inline__ vector signed char __ATTRS_o_ai 9725 vec_srl(vector signed char __a, vector unsigned int __b) { 9726 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 9727 (vector int)__b); 9728 } 9729 9730 static __inline__ vector unsigned char __ATTRS_o_ai 9731 vec_srl(vector unsigned char __a, vector unsigned char __b) { 9732 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 9733 (vector int)__b); 9734 } 9735 9736 static __inline__ vector unsigned char __ATTRS_o_ai 9737 vec_srl(vector unsigned char __a, vector unsigned short __b) { 9738 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 9739 (vector int)__b); 9740 } 9741 9742 static __inline__ vector unsigned char __ATTRS_o_ai 9743 vec_srl(vector unsigned char __a, vector unsigned int __b) { 9744 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 9745 (vector int)__b); 9746 } 9747 9748 static __inline__ vector bool char __ATTRS_o_ai 9749 vec_srl(vector bool char __a, vector unsigned char __b) { 9750 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 9751 (vector int)__b); 9752 } 9753 9754 static __inline__ vector bool char __ATTRS_o_ai 9755 vec_srl(vector bool char __a, vector unsigned short __b) { 9756 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 9757 (vector int)__b); 9758 } 9759 9760 static __inline__ vector bool char __ATTRS_o_ai 9761 vec_srl(vector bool char __a, vector unsigned int __b) { 9762 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 9763 (vector int)__b); 9764 } 9765 9766 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 9767 vector unsigned char __b) { 9768 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9769 } 9770 9771 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 9772 vector unsigned short __b) { 9773 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9774 } 9775 9776 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 9777 vector unsigned int __b) { 9778 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9779 } 9780 9781 static __inline__ vector unsigned short __ATTRS_o_ai 9782 vec_srl(vector unsigned short __a, vector unsigned char __b) { 9783 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 9784 (vector int)__b); 9785 } 9786 9787 static __inline__ vector unsigned short __ATTRS_o_ai 9788 vec_srl(vector unsigned short __a, vector unsigned short __b) { 9789 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 9790 (vector int)__b); 9791 } 9792 9793 static __inline__ vector unsigned short __ATTRS_o_ai 9794 vec_srl(vector unsigned short __a, vector unsigned int __b) { 9795 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 9796 (vector int)__b); 9797 } 9798 9799 static __inline__ vector bool short __ATTRS_o_ai 9800 vec_srl(vector bool short __a, vector unsigned char __b) { 9801 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 9802 (vector int)__b); 9803 } 9804 9805 static __inline__ vector bool short __ATTRS_o_ai 9806 vec_srl(vector bool short __a, vector unsigned short __b) { 9807 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 9808 (vector int)__b); 9809 } 9810 9811 static __inline__ vector bool short __ATTRS_o_ai 9812 vec_srl(vector bool short __a, vector unsigned int __b) { 9813 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 9814 (vector int)__b); 9815 } 9816 9817 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 9818 vector unsigned char __b) { 9819 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9820 } 9821 9822 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 9823 vector unsigned short __b) { 9824 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9825 } 9826 9827 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 9828 vector unsigned int __b) { 9829 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9830 } 9831 9832 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 9833 vector unsigned char __b) { 9834 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 9835 } 9836 9837 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 9838 vector unsigned short __b) { 9839 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 9840 } 9841 9842 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 9843 vector unsigned int __b) { 9844 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 9845 } 9846 9847 static __inline__ vector unsigned int __ATTRS_o_ai 9848 vec_srl(vector unsigned int __a, vector unsigned char __b) { 9849 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 9850 (vector int)__b); 9851 } 9852 9853 static __inline__ vector unsigned int __ATTRS_o_ai 9854 vec_srl(vector unsigned int __a, vector unsigned short __b) { 9855 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 9856 (vector int)__b); 9857 } 9858 9859 static __inline__ vector unsigned int __ATTRS_o_ai 9860 vec_srl(vector unsigned int __a, vector unsigned int __b) { 9861 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 9862 (vector int)__b); 9863 } 9864 9865 static __inline__ vector bool int __ATTRS_o_ai 9866 vec_srl(vector bool int __a, vector unsigned char __b) { 9867 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 9868 (vector int)__b); 9869 } 9870 9871 static __inline__ vector bool int __ATTRS_o_ai 9872 vec_srl(vector bool int __a, vector unsigned short __b) { 9873 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 9874 (vector int)__b); 9875 } 9876 9877 static __inline__ vector bool int __ATTRS_o_ai 9878 vec_srl(vector bool int __a, vector unsigned int __b) { 9879 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 9880 (vector int)__b); 9881 } 9882 9883 #ifdef __VSX__ 9884 static __inline__ vector signed long long __ATTRS_o_ai 9885 vec_srl(vector signed long long __a, vector unsigned char __b) { 9886 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 9887 (vector int)__b); 9888 } 9889 9890 static __inline__ vector unsigned long long __ATTRS_o_ai 9891 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 9892 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 9893 (vector int)__b); 9894 } 9895 #endif 9896 9897 /* vec_vsr */ 9898 9899 static __inline__ vector signed char __ATTRS_o_ai 9900 vec_vsr(vector signed char __a, vector unsigned char __b) { 9901 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 9902 (vector int)__b); 9903 } 9904 9905 static __inline__ vector signed char __ATTRS_o_ai 9906 vec_vsr(vector signed char __a, vector unsigned short __b) { 9907 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 9908 (vector int)__b); 9909 } 9910 9911 static __inline__ vector signed char __ATTRS_o_ai 9912 vec_vsr(vector signed char __a, vector unsigned int __b) { 9913 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 9914 (vector int)__b); 9915 } 9916 9917 static __inline__ vector unsigned char __ATTRS_o_ai 9918 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 9919 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 9920 (vector int)__b); 9921 } 9922 9923 static __inline__ vector unsigned char __ATTRS_o_ai 9924 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 9925 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 9926 (vector int)__b); 9927 } 9928 9929 static __inline__ vector unsigned char __ATTRS_o_ai 9930 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 9931 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 9932 (vector int)__b); 9933 } 9934 9935 static __inline__ vector bool char __ATTRS_o_ai 9936 vec_vsr(vector bool char __a, vector unsigned char __b) { 9937 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 9938 (vector int)__b); 9939 } 9940 9941 static __inline__ vector bool char __ATTRS_o_ai 9942 vec_vsr(vector bool char __a, vector unsigned short __b) { 9943 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 9944 (vector int)__b); 9945 } 9946 9947 static __inline__ vector bool char __ATTRS_o_ai 9948 vec_vsr(vector bool char __a, vector unsigned int __b) { 9949 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 9950 (vector int)__b); 9951 } 9952 9953 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 9954 vector unsigned char __b) { 9955 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9956 } 9957 9958 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 9959 vector unsigned short __b) { 9960 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9961 } 9962 9963 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 9964 vector unsigned int __b) { 9965 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 9966 } 9967 9968 static __inline__ vector unsigned short __ATTRS_o_ai 9969 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 9970 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 9971 (vector int)__b); 9972 } 9973 9974 static __inline__ vector unsigned short __ATTRS_o_ai 9975 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 9976 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 9977 (vector int)__b); 9978 } 9979 9980 static __inline__ vector unsigned short __ATTRS_o_ai 9981 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 9982 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 9983 (vector int)__b); 9984 } 9985 9986 static __inline__ vector bool short __ATTRS_o_ai 9987 vec_vsr(vector bool short __a, vector unsigned char __b) { 9988 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 9989 (vector int)__b); 9990 } 9991 9992 static __inline__ vector bool short __ATTRS_o_ai 9993 vec_vsr(vector bool short __a, vector unsigned short __b) { 9994 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 9995 (vector int)__b); 9996 } 9997 9998 static __inline__ vector bool short __ATTRS_o_ai 9999 vec_vsr(vector bool short __a, vector unsigned int __b) { 10000 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10001 (vector int)__b); 10002 } 10003 10004 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10005 vector unsigned char __b) { 10006 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10007 } 10008 10009 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10010 vector unsigned short __b) { 10011 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10012 } 10013 10014 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10015 vector unsigned int __b) { 10016 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10017 } 10018 10019 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10020 vector unsigned char __b) { 10021 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10022 } 10023 10024 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10025 vector unsigned short __b) { 10026 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10027 } 10028 10029 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10030 vector unsigned int __b) { 10031 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10032 } 10033 10034 static __inline__ vector unsigned int __ATTRS_o_ai 10035 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10036 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10037 (vector int)__b); 10038 } 10039 10040 static __inline__ vector unsigned int __ATTRS_o_ai 10041 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10042 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10043 (vector int)__b); 10044 } 10045 10046 static __inline__ vector unsigned int __ATTRS_o_ai 10047 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10048 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10049 (vector int)__b); 10050 } 10051 10052 static __inline__ vector bool int __ATTRS_o_ai 10053 vec_vsr(vector bool int __a, vector unsigned char __b) { 10054 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10055 (vector int)__b); 10056 } 10057 10058 static __inline__ vector bool int __ATTRS_o_ai 10059 vec_vsr(vector bool int __a, vector unsigned short __b) { 10060 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10061 (vector int)__b); 10062 } 10063 10064 static __inline__ vector bool int __ATTRS_o_ai 10065 vec_vsr(vector bool int __a, vector unsigned int __b) { 10066 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10067 (vector int)__b); 10068 } 10069 10070 /* vec_sro */ 10071 10072 static __inline__ vector signed char __ATTRS_o_ai 10073 vec_sro(vector signed char __a, vector signed char __b) { 10074 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10075 (vector int)__b); 10076 } 10077 10078 static __inline__ vector signed char __ATTRS_o_ai 10079 vec_sro(vector signed char __a, vector unsigned char __b) { 10080 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10081 (vector int)__b); 10082 } 10083 10084 static __inline__ vector unsigned char __ATTRS_o_ai 10085 vec_sro(vector unsigned char __a, vector signed char __b) { 10086 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10087 (vector int)__b); 10088 } 10089 10090 static __inline__ vector unsigned char __ATTRS_o_ai 10091 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10092 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10093 (vector int)__b); 10094 } 10095 10096 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10097 vector signed char __b) { 10098 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10099 } 10100 10101 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10102 vector unsigned char __b) { 10103 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10104 } 10105 10106 static __inline__ vector unsigned short __ATTRS_o_ai 10107 vec_sro(vector unsigned short __a, vector signed char __b) { 10108 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10109 (vector int)__b); 10110 } 10111 10112 static __inline__ vector unsigned short __ATTRS_o_ai 10113 vec_sro(vector unsigned short __a, vector unsigned char __b) { 10114 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10115 (vector int)__b); 10116 } 10117 10118 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10119 vector signed char __b) { 10120 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10121 } 10122 10123 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10124 vector unsigned char __b) { 10125 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10126 } 10127 10128 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10129 vector signed char __b) { 10130 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10131 } 10132 10133 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10134 vector unsigned char __b) { 10135 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10136 } 10137 10138 static __inline__ vector unsigned int __ATTRS_o_ai 10139 vec_sro(vector unsigned int __a, vector signed char __b) { 10140 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10141 (vector int)__b); 10142 } 10143 10144 static __inline__ vector unsigned int __ATTRS_o_ai 10145 vec_sro(vector unsigned int __a, vector unsigned char __b) { 10146 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10147 (vector int)__b); 10148 } 10149 10150 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10151 vector signed char __b) { 10152 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10153 } 10154 10155 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10156 vector unsigned char __b) { 10157 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10158 } 10159 10160 #ifdef __VSX__ 10161 static __inline__ vector signed long long __ATTRS_o_ai 10162 vec_sro(vector signed long long __a, vector signed char __b) { 10163 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10164 (vector int)__b); 10165 } 10166 10167 static __inline__ vector signed long long __ATTRS_o_ai 10168 vec_sro(vector signed long long __a, vector unsigned char __b) { 10169 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10170 (vector int)__b); 10171 } 10172 10173 static __inline__ vector unsigned long long __ATTRS_o_ai 10174 vec_sro(vector unsigned long long __a, vector signed char __b) { 10175 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10176 (vector int)__b); 10177 } 10178 10179 static __inline__ vector unsigned long long __ATTRS_o_ai 10180 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 10181 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10182 (vector int)__b); 10183 } 10184 #endif 10185 10186 /* vec_vsro */ 10187 10188 static __inline__ vector signed char __ATTRS_o_ai 10189 vec_vsro(vector signed char __a, vector signed char __b) { 10190 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10191 (vector int)__b); 10192 } 10193 10194 static __inline__ vector signed char __ATTRS_o_ai 10195 vec_vsro(vector signed char __a, vector unsigned char __b) { 10196 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10197 (vector int)__b); 10198 } 10199 10200 static __inline__ vector unsigned char __ATTRS_o_ai 10201 vec_vsro(vector unsigned char __a, vector signed char __b) { 10202 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10203 (vector int)__b); 10204 } 10205 10206 static __inline__ vector unsigned char __ATTRS_o_ai 10207 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 10208 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10209 (vector int)__b); 10210 } 10211 10212 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 10213 vector signed char __b) { 10214 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10215 } 10216 10217 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 10218 vector unsigned char __b) { 10219 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10220 } 10221 10222 static __inline__ vector unsigned short __ATTRS_o_ai 10223 vec_vsro(vector unsigned short __a, vector signed char __b) { 10224 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10225 (vector int)__b); 10226 } 10227 10228 static __inline__ vector unsigned short __ATTRS_o_ai 10229 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 10230 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10231 (vector int)__b); 10232 } 10233 10234 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 10235 vector signed char __b) { 10236 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10237 } 10238 10239 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 10240 vector unsigned char __b) { 10241 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10242 } 10243 10244 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 10245 vector signed char __b) { 10246 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10247 } 10248 10249 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 10250 vector unsigned char __b) { 10251 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10252 } 10253 10254 static __inline__ vector unsigned int __ATTRS_o_ai 10255 vec_vsro(vector unsigned int __a, vector signed char __b) { 10256 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10257 (vector int)__b); 10258 } 10259 10260 static __inline__ vector unsigned int __ATTRS_o_ai 10261 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 10262 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10263 (vector int)__b); 10264 } 10265 10266 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 10267 vector signed char __b) { 10268 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10269 } 10270 10271 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 10272 vector unsigned char __b) { 10273 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10274 } 10275 10276 /* vec_st */ 10277 10278 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 10279 vector signed char *__c) { 10280 __builtin_altivec_stvx((vector int)__a, __b, __c); 10281 } 10282 10283 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 10284 signed char *__c) { 10285 __builtin_altivec_stvx((vector int)__a, __b, __c); 10286 } 10287 10288 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 10289 vector unsigned char *__c) { 10290 __builtin_altivec_stvx((vector int)__a, __b, __c); 10291 } 10292 10293 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 10294 unsigned char *__c) { 10295 __builtin_altivec_stvx((vector int)__a, __b, __c); 10296 } 10297 10298 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 10299 signed char *__c) { 10300 __builtin_altivec_stvx((vector int)__a, __b, __c); 10301 } 10302 10303 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 10304 unsigned char *__c) { 10305 __builtin_altivec_stvx((vector int)__a, __b, __c); 10306 } 10307 10308 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 10309 vector bool char *__c) { 10310 __builtin_altivec_stvx((vector int)__a, __b, __c); 10311 } 10312 10313 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 10314 vector short *__c) { 10315 __builtin_altivec_stvx((vector int)__a, __b, __c); 10316 } 10317 10318 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 10319 short *__c) { 10320 __builtin_altivec_stvx((vector int)__a, __b, __c); 10321 } 10322 10323 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 10324 vector unsigned short *__c) { 10325 __builtin_altivec_stvx((vector int)__a, __b, __c); 10326 } 10327 10328 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 10329 unsigned short *__c) { 10330 __builtin_altivec_stvx((vector int)__a, __b, __c); 10331 } 10332 10333 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 10334 short *__c) { 10335 __builtin_altivec_stvx((vector int)__a, __b, __c); 10336 } 10337 10338 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 10339 unsigned short *__c) { 10340 __builtin_altivec_stvx((vector int)__a, __b, __c); 10341 } 10342 10343 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 10344 vector bool short *__c) { 10345 __builtin_altivec_stvx((vector int)__a, __b, __c); 10346 } 10347 10348 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 10349 short *__c) { 10350 __builtin_altivec_stvx((vector int)__a, __b, __c); 10351 } 10352 10353 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 10354 unsigned short *__c) { 10355 __builtin_altivec_stvx((vector int)__a, __b, __c); 10356 } 10357 10358 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 10359 vector pixel *__c) { 10360 __builtin_altivec_stvx((vector int)__a, __b, __c); 10361 } 10362 10363 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, 10364 vector int *__c) { 10365 __builtin_altivec_stvx(__a, __b, __c); 10366 } 10367 10368 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) { 10369 __builtin_altivec_stvx(__a, __b, __c); 10370 } 10371 10372 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 10373 vector unsigned int *__c) { 10374 __builtin_altivec_stvx((vector int)__a, __b, __c); 10375 } 10376 10377 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 10378 unsigned int *__c) { 10379 __builtin_altivec_stvx((vector int)__a, __b, __c); 10380 } 10381 10382 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 10383 int *__c) { 10384 __builtin_altivec_stvx((vector int)__a, __b, __c); 10385 } 10386 10387 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 10388 unsigned int *__c) { 10389 __builtin_altivec_stvx((vector int)__a, __b, __c); 10390 } 10391 10392 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 10393 vector bool int *__c) { 10394 __builtin_altivec_stvx((vector int)__a, __b, __c); 10395 } 10396 10397 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 10398 vector float *__c) { 10399 __builtin_altivec_stvx((vector int)__a, __b, __c); 10400 } 10401 10402 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 10403 float *__c) { 10404 __builtin_altivec_stvx((vector int)__a, __b, __c); 10405 } 10406 10407 /* vec_stvx */ 10408 10409 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 10410 vector signed char *__c) { 10411 __builtin_altivec_stvx((vector int)__a, __b, __c); 10412 } 10413 10414 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 10415 signed char *__c) { 10416 __builtin_altivec_stvx((vector int)__a, __b, __c); 10417 } 10418 10419 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 10420 vector unsigned char *__c) { 10421 __builtin_altivec_stvx((vector int)__a, __b, __c); 10422 } 10423 10424 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 10425 unsigned char *__c) { 10426 __builtin_altivec_stvx((vector int)__a, __b, __c); 10427 } 10428 10429 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 10430 signed char *__c) { 10431 __builtin_altivec_stvx((vector int)__a, __b, __c); 10432 } 10433 10434 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 10435 unsigned char *__c) { 10436 __builtin_altivec_stvx((vector int)__a, __b, __c); 10437 } 10438 10439 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 10440 vector bool char *__c) { 10441 __builtin_altivec_stvx((vector int)__a, __b, __c); 10442 } 10443 10444 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 10445 vector short *__c) { 10446 __builtin_altivec_stvx((vector int)__a, __b, __c); 10447 } 10448 10449 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 10450 short *__c) { 10451 __builtin_altivec_stvx((vector int)__a, __b, __c); 10452 } 10453 10454 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 10455 vector unsigned short *__c) { 10456 __builtin_altivec_stvx((vector int)__a, __b, __c); 10457 } 10458 10459 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 10460 unsigned short *__c) { 10461 __builtin_altivec_stvx((vector int)__a, __b, __c); 10462 } 10463 10464 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 10465 short *__c) { 10466 __builtin_altivec_stvx((vector int)__a, __b, __c); 10467 } 10468 10469 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 10470 unsigned short *__c) { 10471 __builtin_altivec_stvx((vector int)__a, __b, __c); 10472 } 10473 10474 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 10475 vector bool short *__c) { 10476 __builtin_altivec_stvx((vector int)__a, __b, __c); 10477 } 10478 10479 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 10480 short *__c) { 10481 __builtin_altivec_stvx((vector int)__a, __b, __c); 10482 } 10483 10484 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 10485 unsigned short *__c) { 10486 __builtin_altivec_stvx((vector int)__a, __b, __c); 10487 } 10488 10489 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 10490 vector pixel *__c) { 10491 __builtin_altivec_stvx((vector int)__a, __b, __c); 10492 } 10493 10494 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 10495 vector int *__c) { 10496 __builtin_altivec_stvx(__a, __b, __c); 10497 } 10498 10499 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 10500 int *__c) { 10501 __builtin_altivec_stvx(__a, __b, __c); 10502 } 10503 10504 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 10505 vector unsigned int *__c) { 10506 __builtin_altivec_stvx((vector int)__a, __b, __c); 10507 } 10508 10509 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 10510 unsigned int *__c) { 10511 __builtin_altivec_stvx((vector int)__a, __b, __c); 10512 } 10513 10514 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 10515 int *__c) { 10516 __builtin_altivec_stvx((vector int)__a, __b, __c); 10517 } 10518 10519 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 10520 unsigned int *__c) { 10521 __builtin_altivec_stvx((vector int)__a, __b, __c); 10522 } 10523 10524 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 10525 vector bool int *__c) { 10526 __builtin_altivec_stvx((vector int)__a, __b, __c); 10527 } 10528 10529 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 10530 vector float *__c) { 10531 __builtin_altivec_stvx((vector int)__a, __b, __c); 10532 } 10533 10534 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 10535 float *__c) { 10536 __builtin_altivec_stvx((vector int)__a, __b, __c); 10537 } 10538 10539 /* vec_ste */ 10540 10541 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b, 10542 signed char *__c) { 10543 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10544 } 10545 10546 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b, 10547 unsigned char *__c) { 10548 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10549 } 10550 10551 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b, 10552 signed char *__c) { 10553 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10554 } 10555 10556 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b, 10557 unsigned char *__c) { 10558 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10559 } 10560 10561 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b, 10562 short *__c) { 10563 __builtin_altivec_stvehx(__a, __b, __c); 10564 } 10565 10566 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b, 10567 unsigned short *__c) { 10568 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10569 } 10570 10571 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 10572 short *__c) { 10573 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10574 } 10575 10576 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 10577 unsigned short *__c) { 10578 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10579 } 10580 10581 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, 10582 short *__c) { 10583 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10584 } 10585 10586 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, 10587 unsigned short *__c) { 10588 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10589 } 10590 10591 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) { 10592 __builtin_altivec_stvewx(__a, __b, __c); 10593 } 10594 10595 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b, 10596 unsigned int *__c) { 10597 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10598 } 10599 10600 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 10601 int *__c) { 10602 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10603 } 10604 10605 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 10606 unsigned int *__c) { 10607 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10608 } 10609 10610 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b, 10611 float *__c) { 10612 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10613 } 10614 10615 /* vec_stvebx */ 10616 10617 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b, 10618 signed char *__c) { 10619 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10620 } 10621 10622 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 10623 int __b, unsigned char *__c) { 10624 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10625 } 10626 10627 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b, 10628 signed char *__c) { 10629 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10630 } 10631 10632 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b, 10633 unsigned char *__c) { 10634 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10635 } 10636 10637 /* vec_stvehx */ 10638 10639 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, 10640 short *__c) { 10641 __builtin_altivec_stvehx(__a, __b, __c); 10642 } 10643 10644 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 10645 int __b, unsigned short *__c) { 10646 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10647 } 10648 10649 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 10650 short *__c) { 10651 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10652 } 10653 10654 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 10655 unsigned short *__c) { 10656 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10657 } 10658 10659 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, 10660 short *__c) { 10661 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10662 } 10663 10664 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, 10665 unsigned short *__c) { 10666 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10667 } 10668 10669 /* vec_stvewx */ 10670 10671 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, 10672 int *__c) { 10673 __builtin_altivec_stvewx(__a, __b, __c); 10674 } 10675 10676 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b, 10677 unsigned int *__c) { 10678 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10679 } 10680 10681 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 10682 int *__c) { 10683 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10684 } 10685 10686 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 10687 unsigned int *__c) { 10688 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10689 } 10690 10691 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, 10692 float *__c) { 10693 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10694 } 10695 10696 /* vec_stl */ 10697 10698 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 10699 vector signed char *__c) { 10700 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10701 } 10702 10703 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 10704 signed char *__c) { 10705 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10706 } 10707 10708 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 10709 vector unsigned char *__c) { 10710 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10711 } 10712 10713 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 10714 unsigned char *__c) { 10715 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10716 } 10717 10718 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 10719 signed char *__c) { 10720 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10721 } 10722 10723 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 10724 unsigned char *__c) { 10725 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10726 } 10727 10728 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 10729 vector bool char *__c) { 10730 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10731 } 10732 10733 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 10734 vector short *__c) { 10735 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10736 } 10737 10738 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 10739 short *__c) { 10740 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10741 } 10742 10743 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 10744 vector unsigned short *__c) { 10745 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10746 } 10747 10748 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 10749 unsigned short *__c) { 10750 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10751 } 10752 10753 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 10754 short *__c) { 10755 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10756 } 10757 10758 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 10759 unsigned short *__c) { 10760 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10761 } 10762 10763 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 10764 vector bool short *__c) { 10765 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10766 } 10767 10768 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 10769 short *__c) { 10770 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10771 } 10772 10773 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 10774 unsigned short *__c) { 10775 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10776 } 10777 10778 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 10779 vector pixel *__c) { 10780 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10781 } 10782 10783 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 10784 vector int *__c) { 10785 __builtin_altivec_stvxl(__a, __b, __c); 10786 } 10787 10788 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 10789 __builtin_altivec_stvxl(__a, __b, __c); 10790 } 10791 10792 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 10793 vector unsigned int *__c) { 10794 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10795 } 10796 10797 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 10798 unsigned int *__c) { 10799 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10800 } 10801 10802 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 10803 int *__c) { 10804 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10805 } 10806 10807 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 10808 unsigned int *__c) { 10809 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10810 } 10811 10812 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 10813 vector bool int *__c) { 10814 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10815 } 10816 10817 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 10818 vector float *__c) { 10819 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10820 } 10821 10822 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 10823 float *__c) { 10824 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10825 } 10826 10827 /* vec_stvxl */ 10828 10829 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 10830 vector signed char *__c) { 10831 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10832 } 10833 10834 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 10835 signed char *__c) { 10836 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10837 } 10838 10839 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 10840 vector unsigned char *__c) { 10841 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10842 } 10843 10844 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 10845 unsigned char *__c) { 10846 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10847 } 10848 10849 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 10850 signed char *__c) { 10851 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10852 } 10853 10854 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 10855 unsigned char *__c) { 10856 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10857 } 10858 10859 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 10860 vector bool char *__c) { 10861 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10862 } 10863 10864 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 10865 vector short *__c) { 10866 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10867 } 10868 10869 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 10870 short *__c) { 10871 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10872 } 10873 10874 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 10875 int __b, 10876 vector unsigned short *__c) { 10877 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10878 } 10879 10880 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 10881 int __b, unsigned short *__c) { 10882 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10883 } 10884 10885 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 10886 short *__c) { 10887 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10888 } 10889 10890 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 10891 unsigned short *__c) { 10892 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10893 } 10894 10895 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 10896 vector bool short *__c) { 10897 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10898 } 10899 10900 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 10901 short *__c) { 10902 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10903 } 10904 10905 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 10906 unsigned short *__c) { 10907 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10908 } 10909 10910 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 10911 vector pixel *__c) { 10912 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10913 } 10914 10915 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 10916 vector int *__c) { 10917 __builtin_altivec_stvxl(__a, __b, __c); 10918 } 10919 10920 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 10921 int *__c) { 10922 __builtin_altivec_stvxl(__a, __b, __c); 10923 } 10924 10925 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 10926 vector unsigned int *__c) { 10927 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10928 } 10929 10930 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 10931 unsigned int *__c) { 10932 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10933 } 10934 10935 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 10936 int *__c) { 10937 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10938 } 10939 10940 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 10941 unsigned int *__c) { 10942 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10943 } 10944 10945 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 10946 vector bool int *__c) { 10947 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10948 } 10949 10950 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 10951 vector float *__c) { 10952 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10953 } 10954 10955 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 10956 float *__c) { 10957 __builtin_altivec_stvxl((vector int)__a, __b, __c); 10958 } 10959 10960 /* vec_sub */ 10961 10962 static __inline__ vector signed char __ATTRS_o_ai 10963 vec_sub(vector signed char __a, vector signed char __b) { 10964 return __a - __b; 10965 } 10966 10967 static __inline__ vector signed char __ATTRS_o_ai 10968 vec_sub(vector bool char __a, vector signed char __b) { 10969 return (vector signed char)__a - __b; 10970 } 10971 10972 static __inline__ vector signed char __ATTRS_o_ai 10973 vec_sub(vector signed char __a, vector bool char __b) { 10974 return __a - (vector signed char)__b; 10975 } 10976 10977 static __inline__ vector unsigned char __ATTRS_o_ai 10978 vec_sub(vector unsigned char __a, vector unsigned char __b) { 10979 return __a - __b; 10980 } 10981 10982 static __inline__ vector unsigned char __ATTRS_o_ai 10983 vec_sub(vector bool char __a, vector unsigned char __b) { 10984 return (vector unsigned char)__a - __b; 10985 } 10986 10987 static __inline__ vector unsigned char __ATTRS_o_ai 10988 vec_sub(vector unsigned char __a, vector bool char __b) { 10989 return __a - (vector unsigned char)__b; 10990 } 10991 10992 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 10993 vector short __b) { 10994 return __a - __b; 10995 } 10996 10997 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 10998 vector short __b) { 10999 return (vector short)__a - __b; 11000 } 11001 11002 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11003 vector bool short __b) { 11004 return __a - (vector short)__b; 11005 } 11006 11007 static __inline__ vector unsigned short __ATTRS_o_ai 11008 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11009 return __a - __b; 11010 } 11011 11012 static __inline__ vector unsigned short __ATTRS_o_ai 11013 vec_sub(vector bool short __a, vector unsigned short __b) { 11014 return (vector unsigned short)__a - __b; 11015 } 11016 11017 static __inline__ vector unsigned short __ATTRS_o_ai 11018 vec_sub(vector unsigned short __a, vector bool short __b) { 11019 return __a - (vector unsigned short)__b; 11020 } 11021 11022 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11023 vector int __b) { 11024 return __a - __b; 11025 } 11026 11027 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11028 vector int __b) { 11029 return (vector int)__a - __b; 11030 } 11031 11032 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11033 vector bool int __b) { 11034 return __a - (vector int)__b; 11035 } 11036 11037 static __inline__ vector unsigned int __ATTRS_o_ai 11038 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11039 return __a - __b; 11040 } 11041 11042 static __inline__ vector unsigned int __ATTRS_o_ai 11043 vec_sub(vector bool int __a, vector unsigned int __b) { 11044 return (vector unsigned int)__a - __b; 11045 } 11046 11047 static __inline__ vector unsigned int __ATTRS_o_ai 11048 vec_sub(vector unsigned int __a, vector bool int __b) { 11049 return __a - (vector unsigned int)__b; 11050 } 11051 11052 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11053 static __inline__ vector signed __int128 __ATTRS_o_ai 11054 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11055 return __a - __b; 11056 } 11057 11058 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11059 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11060 return __a - __b; 11061 } 11062 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11063 11064 #ifdef __VSX__ 11065 static __inline__ vector signed long long __ATTRS_o_ai 11066 vec_sub(vector signed long long __a, vector signed long long __b) { 11067 return __a - __b; 11068 } 11069 11070 static __inline__ vector unsigned long long __ATTRS_o_ai 11071 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11072 return __a - __b; 11073 } 11074 11075 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11076 vector double __b) { 11077 return __a - __b; 11078 } 11079 #endif 11080 11081 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11082 vector float __b) { 11083 return __a - __b; 11084 } 11085 11086 /* vec_vsububm */ 11087 11088 #define __builtin_altivec_vsububm vec_vsububm 11089 11090 static __inline__ vector signed char __ATTRS_o_ai 11091 vec_vsububm(vector signed char __a, vector signed char __b) { 11092 return __a - __b; 11093 } 11094 11095 static __inline__ vector signed char __ATTRS_o_ai 11096 vec_vsububm(vector bool char __a, vector signed char __b) { 11097 return (vector signed char)__a - __b; 11098 } 11099 11100 static __inline__ vector signed char __ATTRS_o_ai 11101 vec_vsububm(vector signed char __a, vector bool char __b) { 11102 return __a - (vector signed char)__b; 11103 } 11104 11105 static __inline__ vector unsigned char __ATTRS_o_ai 11106 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 11107 return __a - __b; 11108 } 11109 11110 static __inline__ vector unsigned char __ATTRS_o_ai 11111 vec_vsububm(vector bool char __a, vector unsigned char __b) { 11112 return (vector unsigned char)__a - __b; 11113 } 11114 11115 static __inline__ vector unsigned char __ATTRS_o_ai 11116 vec_vsububm(vector unsigned char __a, vector bool char __b) { 11117 return __a - (vector unsigned char)__b; 11118 } 11119 11120 /* vec_vsubuhm */ 11121 11122 #define __builtin_altivec_vsubuhm vec_vsubuhm 11123 11124 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11125 vector short __b) { 11126 return __a - __b; 11127 } 11128 11129 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 11130 vector short __b) { 11131 return (vector short)__a - __b; 11132 } 11133 11134 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11135 vector bool short __b) { 11136 return __a - (vector short)__b; 11137 } 11138 11139 static __inline__ vector unsigned short __ATTRS_o_ai 11140 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 11141 return __a - __b; 11142 } 11143 11144 static __inline__ vector unsigned short __ATTRS_o_ai 11145 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 11146 return (vector unsigned short)__a - __b; 11147 } 11148 11149 static __inline__ vector unsigned short __ATTRS_o_ai 11150 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 11151 return __a - (vector unsigned short)__b; 11152 } 11153 11154 /* vec_vsubuwm */ 11155 11156 #define __builtin_altivec_vsubuwm vec_vsubuwm 11157 11158 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11159 vector int __b) { 11160 return __a - __b; 11161 } 11162 11163 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 11164 vector int __b) { 11165 return (vector int)__a - __b; 11166 } 11167 11168 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11169 vector bool int __b) { 11170 return __a - (vector int)__b; 11171 } 11172 11173 static __inline__ vector unsigned int __ATTRS_o_ai 11174 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 11175 return __a - __b; 11176 } 11177 11178 static __inline__ vector unsigned int __ATTRS_o_ai 11179 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 11180 return (vector unsigned int)__a - __b; 11181 } 11182 11183 static __inline__ vector unsigned int __ATTRS_o_ai 11184 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 11185 return __a - (vector unsigned int)__b; 11186 } 11187 11188 /* vec_vsubfp */ 11189 11190 #define __builtin_altivec_vsubfp vec_vsubfp 11191 11192 static __inline__ vector float __attribute__((__always_inline__)) 11193 vec_vsubfp(vector float __a, vector float __b) { 11194 return __a - __b; 11195 } 11196 11197 /* vec_subc */ 11198 11199 static __inline__ vector signed int __ATTRS_o_ai 11200 vec_subc(vector signed int __a, vector signed int __b) { 11201 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 11202 (vector unsigned int) __b); 11203 } 11204 11205 static __inline__ vector unsigned int __ATTRS_o_ai 11206 vec_subc(vector unsigned int __a, vector unsigned int __b) { 11207 return __builtin_altivec_vsubcuw(__a, __b); 11208 } 11209 11210 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11211 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11212 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11213 return __builtin_altivec_vsubcuq(__a, __b); 11214 } 11215 11216 static __inline__ vector signed __int128 __ATTRS_o_ai 11217 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 11218 return __builtin_altivec_vsubcuq(__a, __b); 11219 } 11220 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11221 11222 /* vec_vsubcuw */ 11223 11224 static __inline__ vector unsigned int __attribute__((__always_inline__)) 11225 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 11226 return __builtin_altivec_vsubcuw(__a, __b); 11227 } 11228 11229 /* vec_subs */ 11230 11231 static __inline__ vector signed char __ATTRS_o_ai 11232 vec_subs(vector signed char __a, vector signed char __b) { 11233 return __builtin_altivec_vsubsbs(__a, __b); 11234 } 11235 11236 static __inline__ vector signed char __ATTRS_o_ai 11237 vec_subs(vector bool char __a, vector signed char __b) { 11238 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 11239 } 11240 11241 static __inline__ vector signed char __ATTRS_o_ai 11242 vec_subs(vector signed char __a, vector bool char __b) { 11243 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 11244 } 11245 11246 static __inline__ vector unsigned char __ATTRS_o_ai 11247 vec_subs(vector unsigned char __a, vector unsigned char __b) { 11248 return __builtin_altivec_vsububs(__a, __b); 11249 } 11250 11251 static __inline__ vector unsigned char __ATTRS_o_ai 11252 vec_subs(vector bool char __a, vector unsigned char __b) { 11253 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 11254 } 11255 11256 static __inline__ vector unsigned char __ATTRS_o_ai 11257 vec_subs(vector unsigned char __a, vector bool char __b) { 11258 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 11259 } 11260 11261 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 11262 vector short __b) { 11263 return __builtin_altivec_vsubshs(__a, __b); 11264 } 11265 11266 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 11267 vector short __b) { 11268 return __builtin_altivec_vsubshs((vector short)__a, __b); 11269 } 11270 11271 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 11272 vector bool short __b) { 11273 return __builtin_altivec_vsubshs(__a, (vector short)__b); 11274 } 11275 11276 static __inline__ vector unsigned short __ATTRS_o_ai 11277 vec_subs(vector unsigned short __a, vector unsigned short __b) { 11278 return __builtin_altivec_vsubuhs(__a, __b); 11279 } 11280 11281 static __inline__ vector unsigned short __ATTRS_o_ai 11282 vec_subs(vector bool short __a, vector unsigned short __b) { 11283 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 11284 } 11285 11286 static __inline__ vector unsigned short __ATTRS_o_ai 11287 vec_subs(vector unsigned short __a, vector bool short __b) { 11288 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 11289 } 11290 11291 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 11292 vector int __b) { 11293 return __builtin_altivec_vsubsws(__a, __b); 11294 } 11295 11296 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 11297 vector int __b) { 11298 return __builtin_altivec_vsubsws((vector int)__a, __b); 11299 } 11300 11301 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 11302 vector bool int __b) { 11303 return __builtin_altivec_vsubsws(__a, (vector int)__b); 11304 } 11305 11306 static __inline__ vector unsigned int __ATTRS_o_ai 11307 vec_subs(vector unsigned int __a, vector unsigned int __b) { 11308 return __builtin_altivec_vsubuws(__a, __b); 11309 } 11310 11311 static __inline__ vector unsigned int __ATTRS_o_ai 11312 vec_subs(vector bool int __a, vector unsigned int __b) { 11313 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 11314 } 11315 11316 static __inline__ vector unsigned int __ATTRS_o_ai 11317 vec_subs(vector unsigned int __a, vector bool int __b) { 11318 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 11319 } 11320 11321 /* vec_vsubsbs */ 11322 11323 static __inline__ vector signed char __ATTRS_o_ai 11324 vec_vsubsbs(vector signed char __a, vector signed char __b) { 11325 return __builtin_altivec_vsubsbs(__a, __b); 11326 } 11327 11328 static __inline__ vector signed char __ATTRS_o_ai 11329 vec_vsubsbs(vector bool char __a, vector signed char __b) { 11330 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 11331 } 11332 11333 static __inline__ vector signed char __ATTRS_o_ai 11334 vec_vsubsbs(vector signed char __a, vector bool char __b) { 11335 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 11336 } 11337 11338 /* vec_vsububs */ 11339 11340 static __inline__ vector unsigned char __ATTRS_o_ai 11341 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 11342 return __builtin_altivec_vsububs(__a, __b); 11343 } 11344 11345 static __inline__ vector unsigned char __ATTRS_o_ai 11346 vec_vsububs(vector bool char __a, vector unsigned char __b) { 11347 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 11348 } 11349 11350 static __inline__ vector unsigned char __ATTRS_o_ai 11351 vec_vsububs(vector unsigned char __a, vector bool char __b) { 11352 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 11353 } 11354 11355 /* vec_vsubshs */ 11356 11357 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 11358 vector short __b) { 11359 return __builtin_altivec_vsubshs(__a, __b); 11360 } 11361 11362 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 11363 vector short __b) { 11364 return __builtin_altivec_vsubshs((vector short)__a, __b); 11365 } 11366 11367 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 11368 vector bool short __b) { 11369 return __builtin_altivec_vsubshs(__a, (vector short)__b); 11370 } 11371 11372 /* vec_vsubuhs */ 11373 11374 static __inline__ vector unsigned short __ATTRS_o_ai 11375 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 11376 return __builtin_altivec_vsubuhs(__a, __b); 11377 } 11378 11379 static __inline__ vector unsigned short __ATTRS_o_ai 11380 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 11381 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 11382 } 11383 11384 static __inline__ vector unsigned short __ATTRS_o_ai 11385 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 11386 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 11387 } 11388 11389 /* vec_vsubsws */ 11390 11391 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 11392 vector int __b) { 11393 return __builtin_altivec_vsubsws(__a, __b); 11394 } 11395 11396 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 11397 vector int __b) { 11398 return __builtin_altivec_vsubsws((vector int)__a, __b); 11399 } 11400 11401 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 11402 vector bool int __b) { 11403 return __builtin_altivec_vsubsws(__a, (vector int)__b); 11404 } 11405 11406 /* vec_vsubuws */ 11407 11408 static __inline__ vector unsigned int __ATTRS_o_ai 11409 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 11410 return __builtin_altivec_vsubuws(__a, __b); 11411 } 11412 11413 static __inline__ vector unsigned int __ATTRS_o_ai 11414 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 11415 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 11416 } 11417 11418 static __inline__ vector unsigned int __ATTRS_o_ai 11419 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 11420 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 11421 } 11422 11423 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11424 /* vec_vsubuqm */ 11425 11426 static __inline__ vector signed __int128 __ATTRS_o_ai 11427 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 11428 return __a - __b; 11429 } 11430 11431 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11432 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11433 return __a - __b; 11434 } 11435 11436 /* vec_vsubeuqm */ 11437 11438 11439 static __inline__ vector signed __int128 __ATTRS_o_ai 11440 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 11441 vector signed __int128 __c) { 11442 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11443 } 11444 11445 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11446 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 11447 vector unsigned __int128 __c) { 11448 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11449 } 11450 11451 static __inline__ vector signed __int128 __ATTRS_o_ai 11452 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 11453 vector signed __int128 __c) { 11454 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11455 } 11456 11457 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11458 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 11459 vector unsigned __int128 __c) { 11460 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11461 } 11462 11463 /* vec_vsubcuq */ 11464 11465 static __inline__ vector signed __int128 __ATTRS_o_ai 11466 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 11467 return __builtin_altivec_vsubcuq(__a, __b); 11468 } 11469 11470 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11471 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11472 return __builtin_altivec_vsubcuq(__a, __b); 11473 } 11474 11475 /* vec_vsubecuq */ 11476 11477 static __inline__ vector signed __int128 __ATTRS_o_ai 11478 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 11479 vector signed __int128 __c) { 11480 return __builtin_altivec_vsubecuq(__a, __b, __c); 11481 } 11482 11483 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11484 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 11485 vector unsigned __int128 __c) { 11486 return __builtin_altivec_vsubecuq(__a, __b, __c); 11487 } 11488 11489 static __inline__ vector signed int __ATTRS_o_ai 11490 vec_subec(vector signed int __a, vector signed int __b, 11491 vector signed int __c) { 11492 return vec_addec(__a, ~__b, __c); 11493 } 11494 11495 static __inline__ vector unsigned int __ATTRS_o_ai 11496 vec_subec(vector unsigned int __a, vector unsigned int __b, 11497 vector unsigned int __c) { 11498 return vec_addec(__a, ~__b, __c); 11499 } 11500 11501 static __inline__ vector signed __int128 __ATTRS_o_ai 11502 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 11503 vector signed __int128 __c) { 11504 return __builtin_altivec_vsubecuq(__a, __b, __c); 11505 } 11506 11507 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11508 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 11509 vector unsigned __int128 __c) { 11510 return __builtin_altivec_vsubecuq(__a, __b, __c); 11511 } 11512 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11513 11514 static __inline__ vector signed int __ATTRS_o_ai 11515 vec_sube(vector signed int __a, vector signed int __b, 11516 vector signed int __c) { 11517 vector signed int __mask = {1, 1, 1, 1}; 11518 vector signed int __carry = __c & __mask; 11519 return vec_adde(__a, ~__b, __carry); 11520 } 11521 11522 static __inline__ vector unsigned int __ATTRS_o_ai 11523 vec_sube(vector unsigned int __a, vector unsigned int __b, 11524 vector unsigned int __c) { 11525 vector unsigned int __mask = {1, 1, 1, 1}; 11526 vector unsigned int __carry = __c & __mask; 11527 return vec_adde(__a, ~__b, __carry); 11528 } 11529 /* vec_sum4s */ 11530 11531 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 11532 vector int __b) { 11533 return __builtin_altivec_vsum4sbs(__a, __b); 11534 } 11535 11536 static __inline__ vector unsigned int __ATTRS_o_ai 11537 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 11538 return __builtin_altivec_vsum4ubs(__a, __b); 11539 } 11540 11541 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 11542 vector int __b) { 11543 return __builtin_altivec_vsum4shs(__a, __b); 11544 } 11545 11546 /* vec_vsum4sbs */ 11547 11548 static __inline__ vector int __attribute__((__always_inline__)) 11549 vec_vsum4sbs(vector signed char __a, vector int __b) { 11550 return __builtin_altivec_vsum4sbs(__a, __b); 11551 } 11552 11553 /* vec_vsum4ubs */ 11554 11555 static __inline__ vector unsigned int __attribute__((__always_inline__)) 11556 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 11557 return __builtin_altivec_vsum4ubs(__a, __b); 11558 } 11559 11560 /* vec_vsum4shs */ 11561 11562 static __inline__ vector int __attribute__((__always_inline__)) 11563 vec_vsum4shs(vector signed short __a, vector int __b) { 11564 return __builtin_altivec_vsum4shs(__a, __b); 11565 } 11566 11567 /* vec_sum2s */ 11568 11569 /* The vsum2sws instruction has a big-endian bias, so that the second 11570 input vector and the result always reference big-endian elements 11571 1 and 3 (little-endian element 0 and 2). For ease of porting the 11572 programmer wants elements 1 and 3 in both cases, so for little 11573 endian we must perform some permutes. */ 11574 11575 static __inline__ vector signed int __attribute__((__always_inline__)) 11576 vec_sum2s(vector int __a, vector int __b) { 11577 #ifdef __LITTLE_ENDIAN__ 11578 vector int __c = (vector signed int)vec_perm( 11579 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11580 8, 9, 10, 11)); 11581 __c = __builtin_altivec_vsum2sws(__a, __c); 11582 return (vector signed int)vec_perm( 11583 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11584 8, 9, 10, 11)); 11585 #else 11586 return __builtin_altivec_vsum2sws(__a, __b); 11587 #endif 11588 } 11589 11590 /* vec_vsum2sws */ 11591 11592 static __inline__ vector signed int __attribute__((__always_inline__)) 11593 vec_vsum2sws(vector int __a, vector int __b) { 11594 #ifdef __LITTLE_ENDIAN__ 11595 vector int __c = (vector signed int)vec_perm( 11596 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11597 8, 9, 10, 11)); 11598 __c = __builtin_altivec_vsum2sws(__a, __c); 11599 return (vector signed int)vec_perm( 11600 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11601 8, 9, 10, 11)); 11602 #else 11603 return __builtin_altivec_vsum2sws(__a, __b); 11604 #endif 11605 } 11606 11607 /* vec_sums */ 11608 11609 /* The vsumsws instruction has a big-endian bias, so that the second 11610 input vector and the result always reference big-endian element 3 11611 (little-endian element 0). For ease of porting the programmer 11612 wants element 3 in both cases, so for little endian we must perform 11613 some permutes. */ 11614 11615 static __inline__ vector signed int __attribute__((__always_inline__)) 11616 vec_sums(vector signed int __a, vector signed int __b) { 11617 #ifdef __LITTLE_ENDIAN__ 11618 __b = (vector signed int)vec_splat(__b, 3); 11619 __b = __builtin_altivec_vsumsws(__a, __b); 11620 return (vector signed int)(0, 0, 0, __b[0]); 11621 #else 11622 return __builtin_altivec_vsumsws(__a, __b); 11623 #endif 11624 } 11625 11626 /* vec_vsumsws */ 11627 11628 static __inline__ vector signed int __attribute__((__always_inline__)) 11629 vec_vsumsws(vector signed int __a, vector signed int __b) { 11630 #ifdef __LITTLE_ENDIAN__ 11631 __b = (vector signed int)vec_splat(__b, 3); 11632 __b = __builtin_altivec_vsumsws(__a, __b); 11633 return (vector signed int)(0, 0, 0, __b[0]); 11634 #else 11635 return __builtin_altivec_vsumsws(__a, __b); 11636 #endif 11637 } 11638 11639 /* vec_trunc */ 11640 11641 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 11642 #ifdef __VSX__ 11643 return __builtin_vsx_xvrspiz(__a); 11644 #else 11645 return __builtin_altivec_vrfiz(__a); 11646 #endif 11647 } 11648 11649 #ifdef __VSX__ 11650 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 11651 return __builtin_vsx_xvrdpiz(__a); 11652 } 11653 #endif 11654 11655 /* vec_vrfiz */ 11656 11657 static __inline__ vector float __attribute__((__always_inline__)) 11658 vec_vrfiz(vector float __a) { 11659 return __builtin_altivec_vrfiz(__a); 11660 } 11661 11662 /* vec_unpackh */ 11663 11664 /* The vector unpack instructions all have a big-endian bias, so for 11665 little endian we must reverse the meanings of "high" and "low." */ 11666 11667 static __inline__ vector short __ATTRS_o_ai 11668 vec_unpackh(vector signed char __a) { 11669 #ifdef __LITTLE_ENDIAN__ 11670 return __builtin_altivec_vupklsb((vector char)__a); 11671 #else 11672 return __builtin_altivec_vupkhsb((vector char)__a); 11673 #endif 11674 } 11675 11676 static __inline__ vector bool short __ATTRS_o_ai 11677 vec_unpackh(vector bool char __a) { 11678 #ifdef __LITTLE_ENDIAN__ 11679 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 11680 #else 11681 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 11682 #endif 11683 } 11684 11685 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 11686 #ifdef __LITTLE_ENDIAN__ 11687 return __builtin_altivec_vupklsh(__a); 11688 #else 11689 return __builtin_altivec_vupkhsh(__a); 11690 #endif 11691 } 11692 11693 static __inline__ vector bool int __ATTRS_o_ai 11694 vec_unpackh(vector bool short __a) { 11695 #ifdef __LITTLE_ENDIAN__ 11696 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 11697 #else 11698 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 11699 #endif 11700 } 11701 11702 static __inline__ vector unsigned int __ATTRS_o_ai 11703 vec_unpackh(vector pixel __a) { 11704 #ifdef __LITTLE_ENDIAN__ 11705 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 11706 #else 11707 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 11708 #endif 11709 } 11710 11711 #ifdef __POWER8_VECTOR__ 11712 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 11713 #ifdef __LITTLE_ENDIAN__ 11714 return __builtin_altivec_vupklsw(__a); 11715 #else 11716 return __builtin_altivec_vupkhsw(__a); 11717 #endif 11718 } 11719 11720 static __inline__ vector bool long long __ATTRS_o_ai 11721 vec_unpackh(vector bool int __a) { 11722 #ifdef __LITTLE_ENDIAN__ 11723 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 11724 #else 11725 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 11726 #endif 11727 } 11728 11729 static __inline__ vector double __ATTRS_o_ai 11730 vec_unpackh(vector float __a) { 11731 return (vector double)(__a[0], __a[1]); 11732 } 11733 #endif 11734 11735 /* vec_vupkhsb */ 11736 11737 static __inline__ vector short __ATTRS_o_ai 11738 vec_vupkhsb(vector signed char __a) { 11739 #ifdef __LITTLE_ENDIAN__ 11740 return __builtin_altivec_vupklsb((vector char)__a); 11741 #else 11742 return __builtin_altivec_vupkhsb((vector char)__a); 11743 #endif 11744 } 11745 11746 static __inline__ vector bool short __ATTRS_o_ai 11747 vec_vupkhsb(vector bool char __a) { 11748 #ifdef __LITTLE_ENDIAN__ 11749 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 11750 #else 11751 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 11752 #endif 11753 } 11754 11755 /* vec_vupkhsh */ 11756 11757 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 11758 #ifdef __LITTLE_ENDIAN__ 11759 return __builtin_altivec_vupklsh(__a); 11760 #else 11761 return __builtin_altivec_vupkhsh(__a); 11762 #endif 11763 } 11764 11765 static __inline__ vector bool int __ATTRS_o_ai 11766 vec_vupkhsh(vector bool short __a) { 11767 #ifdef __LITTLE_ENDIAN__ 11768 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 11769 #else 11770 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 11771 #endif 11772 } 11773 11774 static __inline__ vector unsigned int __ATTRS_o_ai 11775 vec_vupkhsh(vector pixel __a) { 11776 #ifdef __LITTLE_ENDIAN__ 11777 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 11778 #else 11779 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 11780 #endif 11781 } 11782 11783 /* vec_vupkhsw */ 11784 11785 #ifdef __POWER8_VECTOR__ 11786 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 11787 #ifdef __LITTLE_ENDIAN__ 11788 return __builtin_altivec_vupklsw(__a); 11789 #else 11790 return __builtin_altivec_vupkhsw(__a); 11791 #endif 11792 } 11793 11794 static __inline__ vector bool long long __ATTRS_o_ai 11795 vec_vupkhsw(vector bool int __a) { 11796 #ifdef __LITTLE_ENDIAN__ 11797 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 11798 #else 11799 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 11800 #endif 11801 } 11802 #endif 11803 11804 /* vec_unpackl */ 11805 11806 static __inline__ vector short __ATTRS_o_ai 11807 vec_unpackl(vector signed char __a) { 11808 #ifdef __LITTLE_ENDIAN__ 11809 return __builtin_altivec_vupkhsb((vector char)__a); 11810 #else 11811 return __builtin_altivec_vupklsb((vector char)__a); 11812 #endif 11813 } 11814 11815 static __inline__ vector bool short __ATTRS_o_ai 11816 vec_unpackl(vector bool char __a) { 11817 #ifdef __LITTLE_ENDIAN__ 11818 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 11819 #else 11820 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 11821 #endif 11822 } 11823 11824 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 11825 #ifdef __LITTLE_ENDIAN__ 11826 return __builtin_altivec_vupkhsh(__a); 11827 #else 11828 return __builtin_altivec_vupklsh(__a); 11829 #endif 11830 } 11831 11832 static __inline__ vector bool int __ATTRS_o_ai 11833 vec_unpackl(vector bool short __a) { 11834 #ifdef __LITTLE_ENDIAN__ 11835 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 11836 #else 11837 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 11838 #endif 11839 } 11840 11841 static __inline__ vector unsigned int __ATTRS_o_ai 11842 vec_unpackl(vector pixel __a) { 11843 #ifdef __LITTLE_ENDIAN__ 11844 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 11845 #else 11846 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 11847 #endif 11848 } 11849 11850 #ifdef __POWER8_VECTOR__ 11851 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 11852 #ifdef __LITTLE_ENDIAN__ 11853 return __builtin_altivec_vupkhsw(__a); 11854 #else 11855 return __builtin_altivec_vupklsw(__a); 11856 #endif 11857 } 11858 11859 static __inline__ vector bool long long __ATTRS_o_ai 11860 vec_unpackl(vector bool int __a) { 11861 #ifdef __LITTLE_ENDIAN__ 11862 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 11863 #else 11864 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 11865 #endif 11866 } 11867 11868 static __inline__ vector double __ATTRS_o_ai 11869 vec_unpackl(vector float __a) { 11870 return (vector double)(__a[2], __a[3]); 11871 } 11872 #endif 11873 11874 /* vec_vupklsb */ 11875 11876 static __inline__ vector short __ATTRS_o_ai 11877 vec_vupklsb(vector signed char __a) { 11878 #ifdef __LITTLE_ENDIAN__ 11879 return __builtin_altivec_vupkhsb((vector char)__a); 11880 #else 11881 return __builtin_altivec_vupklsb((vector char)__a); 11882 #endif 11883 } 11884 11885 static __inline__ vector bool short __ATTRS_o_ai 11886 vec_vupklsb(vector bool char __a) { 11887 #ifdef __LITTLE_ENDIAN__ 11888 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 11889 #else 11890 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 11891 #endif 11892 } 11893 11894 /* vec_vupklsh */ 11895 11896 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 11897 #ifdef __LITTLE_ENDIAN__ 11898 return __builtin_altivec_vupkhsh(__a); 11899 #else 11900 return __builtin_altivec_vupklsh(__a); 11901 #endif 11902 } 11903 11904 static __inline__ vector bool int __ATTRS_o_ai 11905 vec_vupklsh(vector bool short __a) { 11906 #ifdef __LITTLE_ENDIAN__ 11907 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 11908 #else 11909 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 11910 #endif 11911 } 11912 11913 static __inline__ vector unsigned int __ATTRS_o_ai 11914 vec_vupklsh(vector pixel __a) { 11915 #ifdef __LITTLE_ENDIAN__ 11916 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 11917 #else 11918 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 11919 #endif 11920 } 11921 11922 /* vec_vupklsw */ 11923 11924 #ifdef __POWER8_VECTOR__ 11925 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 11926 #ifdef __LITTLE_ENDIAN__ 11927 return __builtin_altivec_vupkhsw(__a); 11928 #else 11929 return __builtin_altivec_vupklsw(__a); 11930 #endif 11931 } 11932 11933 static __inline__ vector bool long long __ATTRS_o_ai 11934 vec_vupklsw(vector bool int __a) { 11935 #ifdef __LITTLE_ENDIAN__ 11936 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 11937 #else 11938 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 11939 #endif 11940 } 11941 #endif 11942 11943 /* vec_vsx_ld */ 11944 11945 #ifdef __VSX__ 11946 11947 static __inline__ vector bool int __ATTRS_o_ai 11948 vec_vsx_ld(int __a, const vector bool int *__b) { 11949 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 11950 } 11951 11952 static __inline__ vector signed int __ATTRS_o_ai 11953 vec_vsx_ld(int __a, const vector signed int *__b) { 11954 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 11955 } 11956 11957 static __inline__ vector signed int __ATTRS_o_ai 11958 vec_vsx_ld(int __a, const signed int *__b) { 11959 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 11960 } 11961 11962 static __inline__ vector unsigned int __ATTRS_o_ai 11963 vec_vsx_ld(int __a, const vector unsigned int *__b) { 11964 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 11965 } 11966 11967 static __inline__ vector unsigned int __ATTRS_o_ai 11968 vec_vsx_ld(int __a, const unsigned int *__b) { 11969 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 11970 } 11971 11972 static __inline__ vector float __ATTRS_o_ai 11973 vec_vsx_ld(int __a, const vector float *__b) { 11974 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 11975 } 11976 11977 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 11978 const float *__b) { 11979 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 11980 } 11981 11982 static __inline__ vector signed long long __ATTRS_o_ai 11983 vec_vsx_ld(int __a, const vector signed long long *__b) { 11984 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 11985 } 11986 11987 static __inline__ vector unsigned long long __ATTRS_o_ai 11988 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 11989 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 11990 } 11991 11992 static __inline__ vector double __ATTRS_o_ai 11993 vec_vsx_ld(int __a, const vector double *__b) { 11994 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 11995 } 11996 11997 static __inline__ vector double __ATTRS_o_ai 11998 vec_vsx_ld(int __a, const double *__b) { 11999 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12000 } 12001 12002 static __inline__ vector bool short __ATTRS_o_ai 12003 vec_vsx_ld(int __a, const vector bool short *__b) { 12004 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12005 } 12006 12007 static __inline__ vector signed short __ATTRS_o_ai 12008 vec_vsx_ld(int __a, const vector signed short *__b) { 12009 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12010 } 12011 12012 static __inline__ vector signed short __ATTRS_o_ai 12013 vec_vsx_ld(int __a, const signed short *__b) { 12014 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12015 } 12016 12017 static __inline__ vector unsigned short __ATTRS_o_ai 12018 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12019 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12020 } 12021 12022 static __inline__ vector unsigned short __ATTRS_o_ai 12023 vec_vsx_ld(int __a, const unsigned short *__b) { 12024 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12025 } 12026 12027 static __inline__ vector bool char __ATTRS_o_ai 12028 vec_vsx_ld(int __a, const vector bool char *__b) { 12029 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12030 } 12031 12032 static __inline__ vector signed char __ATTRS_o_ai 12033 vec_vsx_ld(int __a, const vector signed char *__b) { 12034 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12035 } 12036 12037 static __inline__ vector signed char __ATTRS_o_ai 12038 vec_vsx_ld(int __a, const signed char *__b) { 12039 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12040 } 12041 12042 static __inline__ vector unsigned char __ATTRS_o_ai 12043 vec_vsx_ld(int __a, const vector unsigned char *__b) { 12044 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12045 } 12046 12047 static __inline__ vector unsigned char __ATTRS_o_ai 12048 vec_vsx_ld(int __a, const unsigned char *__b) { 12049 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12050 } 12051 12052 #endif 12053 12054 /* vec_vsx_st */ 12055 12056 #ifdef __VSX__ 12057 12058 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12059 vector bool int *__c) { 12060 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12061 } 12062 12063 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12064 signed int *__c) { 12065 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12066 } 12067 12068 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12069 unsigned int *__c) { 12070 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12071 } 12072 12073 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12074 vector signed int *__c) { 12075 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12076 } 12077 12078 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12079 signed int *__c) { 12080 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12081 } 12082 12083 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12084 vector unsigned int *__c) { 12085 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12086 } 12087 12088 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12089 unsigned int *__c) { 12090 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12091 } 12092 12093 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12094 vector float *__c) { 12095 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12096 } 12097 12098 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12099 float *__c) { 12100 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12101 } 12102 12103 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 12104 int __b, 12105 vector signed long long *__c) { 12106 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12107 } 12108 12109 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 12110 int __b, 12111 vector unsigned long long *__c) { 12112 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12113 } 12114 12115 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12116 vector double *__c) { 12117 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12118 } 12119 12120 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12121 double *__c) { 12122 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12123 } 12124 12125 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12126 vector bool short *__c) { 12127 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12128 } 12129 12130 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12131 signed short *__c) { 12132 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12133 } 12134 12135 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12136 unsigned short *__c) { 12137 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12138 } 12139 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 12140 vector signed short *__c) { 12141 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12142 } 12143 12144 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 12145 signed short *__c) { 12146 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12147 } 12148 12149 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 12150 int __b, 12151 vector unsigned short *__c) { 12152 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12153 } 12154 12155 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 12156 int __b, unsigned short *__c) { 12157 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12158 } 12159 12160 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 12161 vector bool char *__c) { 12162 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12163 } 12164 12165 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 12166 signed char *__c) { 12167 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12168 } 12169 12170 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 12171 unsigned char *__c) { 12172 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12173 } 12174 12175 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 12176 vector signed char *__c) { 12177 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12178 } 12179 12180 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 12181 signed char *__c) { 12182 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12183 } 12184 12185 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 12186 int __b, 12187 vector unsigned char *__c) { 12188 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12189 } 12190 12191 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 12192 int __b, unsigned char *__c) { 12193 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12194 } 12195 12196 #endif 12197 12198 #ifdef __VSX__ 12199 #define vec_xxpermdi __builtin_vsx_xxpermdi 12200 #define vec_xxsldwi __builtin_vsx_xxsldwi 12201 #endif 12202 12203 /* vec_xor */ 12204 12205 #define __builtin_altivec_vxor vec_xor 12206 12207 static __inline__ vector signed char __ATTRS_o_ai 12208 vec_xor(vector signed char __a, vector signed char __b) { 12209 return __a ^ __b; 12210 } 12211 12212 static __inline__ vector signed char __ATTRS_o_ai 12213 vec_xor(vector bool char __a, vector signed char __b) { 12214 return (vector signed char)__a ^ __b; 12215 } 12216 12217 static __inline__ vector signed char __ATTRS_o_ai 12218 vec_xor(vector signed char __a, vector bool char __b) { 12219 return __a ^ (vector signed char)__b; 12220 } 12221 12222 static __inline__ vector unsigned char __ATTRS_o_ai 12223 vec_xor(vector unsigned char __a, vector unsigned char __b) { 12224 return __a ^ __b; 12225 } 12226 12227 static __inline__ vector unsigned char __ATTRS_o_ai 12228 vec_xor(vector bool char __a, vector unsigned char __b) { 12229 return (vector unsigned char)__a ^ __b; 12230 } 12231 12232 static __inline__ vector unsigned char __ATTRS_o_ai 12233 vec_xor(vector unsigned char __a, vector bool char __b) { 12234 return __a ^ (vector unsigned char)__b; 12235 } 12236 12237 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 12238 vector bool char __b) { 12239 return __a ^ __b; 12240 } 12241 12242 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 12243 vector short __b) { 12244 return __a ^ __b; 12245 } 12246 12247 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 12248 vector short __b) { 12249 return (vector short)__a ^ __b; 12250 } 12251 12252 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 12253 vector bool short __b) { 12254 return __a ^ (vector short)__b; 12255 } 12256 12257 static __inline__ vector unsigned short __ATTRS_o_ai 12258 vec_xor(vector unsigned short __a, vector unsigned short __b) { 12259 return __a ^ __b; 12260 } 12261 12262 static __inline__ vector unsigned short __ATTRS_o_ai 12263 vec_xor(vector bool short __a, vector unsigned short __b) { 12264 return (vector unsigned short)__a ^ __b; 12265 } 12266 12267 static __inline__ vector unsigned short __ATTRS_o_ai 12268 vec_xor(vector unsigned short __a, vector bool short __b) { 12269 return __a ^ (vector unsigned short)__b; 12270 } 12271 12272 static __inline__ vector bool short __ATTRS_o_ai 12273 vec_xor(vector bool short __a, vector bool short __b) { 12274 return __a ^ __b; 12275 } 12276 12277 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 12278 vector int __b) { 12279 return __a ^ __b; 12280 } 12281 12282 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 12283 vector int __b) { 12284 return (vector int)__a ^ __b; 12285 } 12286 12287 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 12288 vector bool int __b) { 12289 return __a ^ (vector int)__b; 12290 } 12291 12292 static __inline__ vector unsigned int __ATTRS_o_ai 12293 vec_xor(vector unsigned int __a, vector unsigned int __b) { 12294 return __a ^ __b; 12295 } 12296 12297 static __inline__ vector unsigned int __ATTRS_o_ai 12298 vec_xor(vector bool int __a, vector unsigned int __b) { 12299 return (vector unsigned int)__a ^ __b; 12300 } 12301 12302 static __inline__ vector unsigned int __ATTRS_o_ai 12303 vec_xor(vector unsigned int __a, vector bool int __b) { 12304 return __a ^ (vector unsigned int)__b; 12305 } 12306 12307 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 12308 vector bool int __b) { 12309 return __a ^ __b; 12310 } 12311 12312 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 12313 vector float __b) { 12314 vector unsigned int __res = 12315 (vector unsigned int)__a ^ (vector unsigned int)__b; 12316 return (vector float)__res; 12317 } 12318 12319 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 12320 vector float __b) { 12321 vector unsigned int __res = 12322 (vector unsigned int)__a ^ (vector unsigned int)__b; 12323 return (vector float)__res; 12324 } 12325 12326 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 12327 vector bool int __b) { 12328 vector unsigned int __res = 12329 (vector unsigned int)__a ^ (vector unsigned int)__b; 12330 return (vector float)__res; 12331 } 12332 12333 #ifdef __VSX__ 12334 static __inline__ vector signed long long __ATTRS_o_ai 12335 vec_xor(vector signed long long __a, vector signed long long __b) { 12336 return __a ^ __b; 12337 } 12338 12339 static __inline__ vector signed long long __ATTRS_o_ai 12340 vec_xor(vector bool long long __a, vector signed long long __b) { 12341 return (vector signed long long)__a ^ __b; 12342 } 12343 12344 static __inline__ vector signed long long __ATTRS_o_ai 12345 vec_xor(vector signed long long __a, vector bool long long __b) { 12346 return __a ^ (vector signed long long)__b; 12347 } 12348 12349 static __inline__ vector unsigned long long __ATTRS_o_ai 12350 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 12351 return __a ^ __b; 12352 } 12353 12354 static __inline__ vector unsigned long long __ATTRS_o_ai 12355 vec_xor(vector bool long long __a, vector unsigned long long __b) { 12356 return (vector unsigned long long)__a ^ __b; 12357 } 12358 12359 static __inline__ vector unsigned long long __ATTRS_o_ai 12360 vec_xor(vector unsigned long long __a, vector bool long long __b) { 12361 return __a ^ (vector unsigned long long)__b; 12362 } 12363 12364 static __inline__ vector bool long long __ATTRS_o_ai 12365 vec_xor(vector bool long long __a, vector bool long long __b) { 12366 return __a ^ __b; 12367 } 12368 12369 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 12370 vector double __b) { 12371 return (vector double)((vector unsigned long long)__a ^ 12372 (vector unsigned long long)__b); 12373 } 12374 12375 static __inline__ vector double __ATTRS_o_ai 12376 vec_xor(vector double __a, vector bool long long __b) { 12377 return (vector double)((vector unsigned long long)__a ^ 12378 (vector unsigned long long)__b); 12379 } 12380 12381 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 12382 vector double __b) { 12383 return (vector double)((vector unsigned long long)__a ^ 12384 (vector unsigned long long)__b); 12385 } 12386 #endif 12387 12388 /* vec_vxor */ 12389 12390 static __inline__ vector signed char __ATTRS_o_ai 12391 vec_vxor(vector signed char __a, vector signed char __b) { 12392 return __a ^ __b; 12393 } 12394 12395 static __inline__ vector signed char __ATTRS_o_ai 12396 vec_vxor(vector bool char __a, vector signed char __b) { 12397 return (vector signed char)__a ^ __b; 12398 } 12399 12400 static __inline__ vector signed char __ATTRS_o_ai 12401 vec_vxor(vector signed char __a, vector bool char __b) { 12402 return __a ^ (vector signed char)__b; 12403 } 12404 12405 static __inline__ vector unsigned char __ATTRS_o_ai 12406 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 12407 return __a ^ __b; 12408 } 12409 12410 static __inline__ vector unsigned char __ATTRS_o_ai 12411 vec_vxor(vector bool char __a, vector unsigned char __b) { 12412 return (vector unsigned char)__a ^ __b; 12413 } 12414 12415 static __inline__ vector unsigned char __ATTRS_o_ai 12416 vec_vxor(vector unsigned char __a, vector bool char __b) { 12417 return __a ^ (vector unsigned char)__b; 12418 } 12419 12420 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 12421 vector bool char __b) { 12422 return __a ^ __b; 12423 } 12424 12425 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 12426 vector short __b) { 12427 return __a ^ __b; 12428 } 12429 12430 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 12431 vector short __b) { 12432 return (vector short)__a ^ __b; 12433 } 12434 12435 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 12436 vector bool short __b) { 12437 return __a ^ (vector short)__b; 12438 } 12439 12440 static __inline__ vector unsigned short __ATTRS_o_ai 12441 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 12442 return __a ^ __b; 12443 } 12444 12445 static __inline__ vector unsigned short __ATTRS_o_ai 12446 vec_vxor(vector bool short __a, vector unsigned short __b) { 12447 return (vector unsigned short)__a ^ __b; 12448 } 12449 12450 static __inline__ vector unsigned short __ATTRS_o_ai 12451 vec_vxor(vector unsigned short __a, vector bool short __b) { 12452 return __a ^ (vector unsigned short)__b; 12453 } 12454 12455 static __inline__ vector bool short __ATTRS_o_ai 12456 vec_vxor(vector bool short __a, vector bool short __b) { 12457 return __a ^ __b; 12458 } 12459 12460 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 12461 vector int __b) { 12462 return __a ^ __b; 12463 } 12464 12465 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 12466 vector int __b) { 12467 return (vector int)__a ^ __b; 12468 } 12469 12470 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 12471 vector bool int __b) { 12472 return __a ^ (vector int)__b; 12473 } 12474 12475 static __inline__ vector unsigned int __ATTRS_o_ai 12476 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 12477 return __a ^ __b; 12478 } 12479 12480 static __inline__ vector unsigned int __ATTRS_o_ai 12481 vec_vxor(vector bool int __a, vector unsigned int __b) { 12482 return (vector unsigned int)__a ^ __b; 12483 } 12484 12485 static __inline__ vector unsigned int __ATTRS_o_ai 12486 vec_vxor(vector unsigned int __a, vector bool int __b) { 12487 return __a ^ (vector unsigned int)__b; 12488 } 12489 12490 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 12491 vector bool int __b) { 12492 return __a ^ __b; 12493 } 12494 12495 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 12496 vector float __b) { 12497 vector unsigned int __res = 12498 (vector unsigned int)__a ^ (vector unsigned int)__b; 12499 return (vector float)__res; 12500 } 12501 12502 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 12503 vector float __b) { 12504 vector unsigned int __res = 12505 (vector unsigned int)__a ^ (vector unsigned int)__b; 12506 return (vector float)__res; 12507 } 12508 12509 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 12510 vector bool int __b) { 12511 vector unsigned int __res = 12512 (vector unsigned int)__a ^ (vector unsigned int)__b; 12513 return (vector float)__res; 12514 } 12515 12516 #ifdef __VSX__ 12517 static __inline__ vector signed long long __ATTRS_o_ai 12518 vec_vxor(vector signed long long __a, vector signed long long __b) { 12519 return __a ^ __b; 12520 } 12521 12522 static __inline__ vector signed long long __ATTRS_o_ai 12523 vec_vxor(vector bool long long __a, vector signed long long __b) { 12524 return (vector signed long long)__a ^ __b; 12525 } 12526 12527 static __inline__ vector signed long long __ATTRS_o_ai 12528 vec_vxor(vector signed long long __a, vector bool long long __b) { 12529 return __a ^ (vector signed long long)__b; 12530 } 12531 12532 static __inline__ vector unsigned long long __ATTRS_o_ai 12533 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 12534 return __a ^ __b; 12535 } 12536 12537 static __inline__ vector unsigned long long __ATTRS_o_ai 12538 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 12539 return (vector unsigned long long)__a ^ __b; 12540 } 12541 12542 static __inline__ vector unsigned long long __ATTRS_o_ai 12543 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 12544 return __a ^ (vector unsigned long long)__b; 12545 } 12546 12547 static __inline__ vector bool long long __ATTRS_o_ai 12548 vec_vxor(vector bool long long __a, vector bool long long __b) { 12549 return __a ^ __b; 12550 } 12551 #endif 12552 12553 /* ------------------------ extensions for CBEA ----------------------------- */ 12554 12555 /* vec_extract */ 12556 12557 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 12558 int __b) { 12559 return __a[__b]; 12560 } 12561 12562 static __inline__ unsigned char __ATTRS_o_ai 12563 vec_extract(vector unsigned char __a, int __b) { 12564 return __a[__b]; 12565 } 12566 12567 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 12568 int __b) { 12569 return __a[__b]; 12570 } 12571 12572 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 12573 int __b) { 12574 return __a[__b]; 12575 } 12576 12577 static __inline__ unsigned short __ATTRS_o_ai 12578 vec_extract(vector unsigned short __a, int __b) { 12579 return __a[__b]; 12580 } 12581 12582 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 12583 int __b) { 12584 return __a[__b]; 12585 } 12586 12587 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 12588 int __b) { 12589 return __a[__b]; 12590 } 12591 12592 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 12593 int __b) { 12594 return __a[__b]; 12595 } 12596 12597 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 12598 int __b) { 12599 return __a[__b]; 12600 } 12601 12602 #ifdef __VSX__ 12603 static __inline__ signed long long __ATTRS_o_ai 12604 vec_extract(vector signed long long __a, int __b) { 12605 return __a[__b]; 12606 } 12607 12608 static __inline__ unsigned long long __ATTRS_o_ai 12609 vec_extract(vector unsigned long long __a, int __b) { 12610 return __a[__b]; 12611 } 12612 12613 static __inline__ unsigned long long __ATTRS_o_ai 12614 vec_extract(vector bool long long __a, int __b) { 12615 return __a[__b]; 12616 } 12617 12618 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) { 12619 return __a[__b]; 12620 } 12621 #endif 12622 12623 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) { 12624 return __a[__b]; 12625 } 12626 12627 #ifdef __POWER9_VECTOR__ 12628 12629 #define vec_insert4b __builtin_vsx_insertword 12630 #define vec_extract4b __builtin_vsx_extractuword 12631 12632 /* vec_extract_exp */ 12633 12634 static __inline__ vector unsigned int __ATTRS_o_ai 12635 vec_extract_exp(vector float __a) { 12636 return __builtin_vsx_xvxexpsp(__a); 12637 } 12638 12639 static __inline__ vector unsigned long long __ATTRS_o_ai 12640 vec_extract_exp(vector double __a) { 12641 return __builtin_vsx_xvxexpdp(__a); 12642 } 12643 12644 /* vec_extract_sig */ 12645 12646 static __inline__ vector unsigned int __ATTRS_o_ai 12647 vec_extract_sig(vector float __a) { 12648 return __builtin_vsx_xvxsigsp(__a); 12649 } 12650 12651 static __inline__ vector unsigned long long __ATTRS_o_ai 12652 vec_extract_sig (vector double __a) { 12653 return __builtin_vsx_xvxsigdp(__a); 12654 } 12655 12656 static __inline__ vector float __ATTRS_o_ai 12657 vec_extract_fp32_from_shorth(vector unsigned short __a) { 12658 vector unsigned short __b = 12659 #ifdef __LITTLE_ENDIAN__ 12660 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 12661 #else 12662 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 12663 #endif 12664 return __builtin_vsx_xvcvhpsp(__b); 12665 } 12666 12667 static __inline__ vector float __ATTRS_o_ai 12668 vec_extract_fp32_from_shortl(vector unsigned short __a) { 12669 vector unsigned short __b = 12670 #ifdef __LITTLE_ENDIAN__ 12671 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 12672 #else 12673 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 12674 #endif 12675 return __builtin_vsx_xvcvhpsp(__b); 12676 } 12677 #endif /* __POWER9_VECTOR__ */ 12678 12679 /* vec_insert */ 12680 12681 static __inline__ vector signed char __ATTRS_o_ai 12682 vec_insert(signed char __a, vector signed char __b, int __c) { 12683 __b[__c] = __a; 12684 return __b; 12685 } 12686 12687 static __inline__ vector unsigned char __ATTRS_o_ai 12688 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 12689 __b[__c] = __a; 12690 return __b; 12691 } 12692 12693 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 12694 vector bool char __b, 12695 int __c) { 12696 __b[__c] = __a; 12697 return __b; 12698 } 12699 12700 static __inline__ vector signed short __ATTRS_o_ai 12701 vec_insert(signed short __a, vector signed short __b, int __c) { 12702 __b[__c] = __a; 12703 return __b; 12704 } 12705 12706 static __inline__ vector unsigned short __ATTRS_o_ai 12707 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 12708 __b[__c] = __a; 12709 return __b; 12710 } 12711 12712 static __inline__ vector bool short __ATTRS_o_ai 12713 vec_insert(unsigned short __a, vector bool short __b, int __c) { 12714 __b[__c] = __a; 12715 return __b; 12716 } 12717 12718 static __inline__ vector signed int __ATTRS_o_ai 12719 vec_insert(signed int __a, vector signed int __b, int __c) { 12720 __b[__c] = __a; 12721 return __b; 12722 } 12723 12724 static __inline__ vector unsigned int __ATTRS_o_ai 12725 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 12726 __b[__c] = __a; 12727 return __b; 12728 } 12729 12730 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 12731 vector bool int __b, 12732 int __c) { 12733 __b[__c] = __a; 12734 return __b; 12735 } 12736 12737 #ifdef __VSX__ 12738 static __inline__ vector signed long long __ATTRS_o_ai 12739 vec_insert(signed long long __a, vector signed long long __b, int __c) { 12740 __b[__c] = __a; 12741 return __b; 12742 } 12743 12744 static __inline__ vector unsigned long long __ATTRS_o_ai 12745 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 12746 __b[__c] = __a; 12747 return __b; 12748 } 12749 12750 static __inline__ vector bool long long __ATTRS_o_ai 12751 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 12752 __b[__c] = __a; 12753 return __b; 12754 } 12755 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 12756 vector double __b, 12757 int __c) { 12758 __b[__c] = __a; 12759 return __b; 12760 } 12761 #endif 12762 12763 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 12764 vector float __b, 12765 int __c) { 12766 __b[__c] = __a; 12767 return __b; 12768 } 12769 12770 /* vec_lvlx */ 12771 12772 static __inline__ vector signed char __ATTRS_o_ai 12773 vec_lvlx(int __a, const signed char *__b) { 12774 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 12775 vec_lvsl(__a, __b)); 12776 } 12777 12778 static __inline__ vector signed char __ATTRS_o_ai 12779 vec_lvlx(int __a, const vector signed char *__b) { 12780 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 12781 vec_lvsl(__a, (unsigned char *)__b)); 12782 } 12783 12784 static __inline__ vector unsigned char __ATTRS_o_ai 12785 vec_lvlx(int __a, const unsigned char *__b) { 12786 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 12787 vec_lvsl(__a, __b)); 12788 } 12789 12790 static __inline__ vector unsigned char __ATTRS_o_ai 12791 vec_lvlx(int __a, const vector unsigned char *__b) { 12792 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 12793 vec_lvsl(__a, (unsigned char *)__b)); 12794 } 12795 12796 static __inline__ vector bool char __ATTRS_o_ai 12797 vec_lvlx(int __a, const vector bool char *__b) { 12798 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 12799 vec_lvsl(__a, (unsigned char *)__b)); 12800 } 12801 12802 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 12803 const short *__b) { 12804 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 12805 } 12806 12807 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 12808 const vector short *__b) { 12809 return vec_perm(vec_ld(__a, __b), (vector short)(0), 12810 vec_lvsl(__a, (unsigned char *)__b)); 12811 } 12812 12813 static __inline__ vector unsigned short __ATTRS_o_ai 12814 vec_lvlx(int __a, const unsigned short *__b) { 12815 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 12816 vec_lvsl(__a, __b)); 12817 } 12818 12819 static __inline__ vector unsigned short __ATTRS_o_ai 12820 vec_lvlx(int __a, const vector unsigned short *__b) { 12821 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 12822 vec_lvsl(__a, (unsigned char *)__b)); 12823 } 12824 12825 static __inline__ vector bool short __ATTRS_o_ai 12826 vec_lvlx(int __a, const vector bool short *__b) { 12827 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 12828 vec_lvsl(__a, (unsigned char *)__b)); 12829 } 12830 12831 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 12832 const vector pixel *__b) { 12833 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 12834 vec_lvsl(__a, (unsigned char *)__b)); 12835 } 12836 12837 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 12838 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 12839 } 12840 12841 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 12842 const vector int *__b) { 12843 return vec_perm(vec_ld(__a, __b), (vector int)(0), 12844 vec_lvsl(__a, (unsigned char *)__b)); 12845 } 12846 12847 static __inline__ vector unsigned int __ATTRS_o_ai 12848 vec_lvlx(int __a, const unsigned int *__b) { 12849 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 12850 vec_lvsl(__a, __b)); 12851 } 12852 12853 static __inline__ vector unsigned int __ATTRS_o_ai 12854 vec_lvlx(int __a, const vector unsigned int *__b) { 12855 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 12856 vec_lvsl(__a, (unsigned char *)__b)); 12857 } 12858 12859 static __inline__ vector bool int __ATTRS_o_ai 12860 vec_lvlx(int __a, const vector bool int *__b) { 12861 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 12862 vec_lvsl(__a, (unsigned char *)__b)); 12863 } 12864 12865 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 12866 const float *__b) { 12867 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 12868 } 12869 12870 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 12871 const vector float *__b) { 12872 return vec_perm(vec_ld(__a, __b), (vector float)(0), 12873 vec_lvsl(__a, (unsigned char *)__b)); 12874 } 12875 12876 /* vec_lvlxl */ 12877 12878 static __inline__ vector signed char __ATTRS_o_ai 12879 vec_lvlxl(int __a, const signed char *__b) { 12880 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 12881 vec_lvsl(__a, __b)); 12882 } 12883 12884 static __inline__ vector signed char __ATTRS_o_ai 12885 vec_lvlxl(int __a, const vector signed char *__b) { 12886 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 12887 vec_lvsl(__a, (unsigned char *)__b)); 12888 } 12889 12890 static __inline__ vector unsigned char __ATTRS_o_ai 12891 vec_lvlxl(int __a, const unsigned char *__b) { 12892 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 12893 vec_lvsl(__a, __b)); 12894 } 12895 12896 static __inline__ vector unsigned char __ATTRS_o_ai 12897 vec_lvlxl(int __a, const vector unsigned char *__b) { 12898 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 12899 vec_lvsl(__a, (unsigned char *)__b)); 12900 } 12901 12902 static __inline__ vector bool char __ATTRS_o_ai 12903 vec_lvlxl(int __a, const vector bool char *__b) { 12904 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 12905 vec_lvsl(__a, (unsigned char *)__b)); 12906 } 12907 12908 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 12909 const short *__b) { 12910 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 12911 } 12912 12913 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 12914 const vector short *__b) { 12915 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 12916 vec_lvsl(__a, (unsigned char *)__b)); 12917 } 12918 12919 static __inline__ vector unsigned short __ATTRS_o_ai 12920 vec_lvlxl(int __a, const unsigned short *__b) { 12921 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 12922 vec_lvsl(__a, __b)); 12923 } 12924 12925 static __inline__ vector unsigned short __ATTRS_o_ai 12926 vec_lvlxl(int __a, const vector unsigned short *__b) { 12927 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 12928 vec_lvsl(__a, (unsigned char *)__b)); 12929 } 12930 12931 static __inline__ vector bool short __ATTRS_o_ai 12932 vec_lvlxl(int __a, const vector bool short *__b) { 12933 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 12934 vec_lvsl(__a, (unsigned char *)__b)); 12935 } 12936 12937 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 12938 const vector pixel *__b) { 12939 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 12940 vec_lvsl(__a, (unsigned char *)__b)); 12941 } 12942 12943 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 12944 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 12945 } 12946 12947 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 12948 const vector int *__b) { 12949 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 12950 vec_lvsl(__a, (unsigned char *)__b)); 12951 } 12952 12953 static __inline__ vector unsigned int __ATTRS_o_ai 12954 vec_lvlxl(int __a, const unsigned int *__b) { 12955 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 12956 vec_lvsl(__a, __b)); 12957 } 12958 12959 static __inline__ vector unsigned int __ATTRS_o_ai 12960 vec_lvlxl(int __a, const vector unsigned int *__b) { 12961 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 12962 vec_lvsl(__a, (unsigned char *)__b)); 12963 } 12964 12965 static __inline__ vector bool int __ATTRS_o_ai 12966 vec_lvlxl(int __a, const vector bool int *__b) { 12967 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 12968 vec_lvsl(__a, (unsigned char *)__b)); 12969 } 12970 12971 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 12972 const float *__b) { 12973 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 12974 } 12975 12976 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 12977 vector float *__b) { 12978 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 12979 vec_lvsl(__a, (unsigned char *)__b)); 12980 } 12981 12982 /* vec_lvrx */ 12983 12984 static __inline__ vector signed char __ATTRS_o_ai 12985 vec_lvrx(int __a, const signed char *__b) { 12986 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 12987 vec_lvsl(__a, __b)); 12988 } 12989 12990 static __inline__ vector signed char __ATTRS_o_ai 12991 vec_lvrx(int __a, const vector signed char *__b) { 12992 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 12993 vec_lvsl(__a, (unsigned char *)__b)); 12994 } 12995 12996 static __inline__ vector unsigned char __ATTRS_o_ai 12997 vec_lvrx(int __a, const unsigned char *__b) { 12998 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 12999 vec_lvsl(__a, __b)); 13000 } 13001 13002 static __inline__ vector unsigned char __ATTRS_o_ai 13003 vec_lvrx(int __a, const vector unsigned char *__b) { 13004 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13005 vec_lvsl(__a, (unsigned char *)__b)); 13006 } 13007 13008 static __inline__ vector bool char __ATTRS_o_ai 13009 vec_lvrx(int __a, const vector bool char *__b) { 13010 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13011 vec_lvsl(__a, (unsigned char *)__b)); 13012 } 13013 13014 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13015 const short *__b) { 13016 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13017 } 13018 13019 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13020 const vector short *__b) { 13021 return vec_perm((vector short)(0), vec_ld(__a, __b), 13022 vec_lvsl(__a, (unsigned char *)__b)); 13023 } 13024 13025 static __inline__ vector unsigned short __ATTRS_o_ai 13026 vec_lvrx(int __a, const unsigned short *__b) { 13027 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13028 vec_lvsl(__a, __b)); 13029 } 13030 13031 static __inline__ vector unsigned short __ATTRS_o_ai 13032 vec_lvrx(int __a, const vector unsigned short *__b) { 13033 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13034 vec_lvsl(__a, (unsigned char *)__b)); 13035 } 13036 13037 static __inline__ vector bool short __ATTRS_o_ai 13038 vec_lvrx(int __a, const vector bool short *__b) { 13039 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 13040 vec_lvsl(__a, (unsigned char *)__b)); 13041 } 13042 13043 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 13044 const vector pixel *__b) { 13045 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 13046 vec_lvsl(__a, (unsigned char *)__b)); 13047 } 13048 13049 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 13050 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13051 } 13052 13053 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 13054 const vector int *__b) { 13055 return vec_perm((vector int)(0), vec_ld(__a, __b), 13056 vec_lvsl(__a, (unsigned char *)__b)); 13057 } 13058 13059 static __inline__ vector unsigned int __ATTRS_o_ai 13060 vec_lvrx(int __a, const unsigned int *__b) { 13061 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13062 vec_lvsl(__a, __b)); 13063 } 13064 13065 static __inline__ vector unsigned int __ATTRS_o_ai 13066 vec_lvrx(int __a, const vector unsigned int *__b) { 13067 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13068 vec_lvsl(__a, (unsigned char *)__b)); 13069 } 13070 13071 static __inline__ vector bool int __ATTRS_o_ai 13072 vec_lvrx(int __a, const vector bool int *__b) { 13073 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 13074 vec_lvsl(__a, (unsigned char *)__b)); 13075 } 13076 13077 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13078 const float *__b) { 13079 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13080 } 13081 13082 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13083 const vector float *__b) { 13084 return vec_perm((vector float)(0), vec_ld(__a, __b), 13085 vec_lvsl(__a, (unsigned char *)__b)); 13086 } 13087 13088 /* vec_lvrxl */ 13089 13090 static __inline__ vector signed char __ATTRS_o_ai 13091 vec_lvrxl(int __a, const signed char *__b) { 13092 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13093 vec_lvsl(__a, __b)); 13094 } 13095 13096 static __inline__ vector signed char __ATTRS_o_ai 13097 vec_lvrxl(int __a, const vector signed char *__b) { 13098 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13099 vec_lvsl(__a, (unsigned char *)__b)); 13100 } 13101 13102 static __inline__ vector unsigned char __ATTRS_o_ai 13103 vec_lvrxl(int __a, const unsigned char *__b) { 13104 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13105 vec_lvsl(__a, __b)); 13106 } 13107 13108 static __inline__ vector unsigned char __ATTRS_o_ai 13109 vec_lvrxl(int __a, const vector unsigned char *__b) { 13110 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13111 vec_lvsl(__a, (unsigned char *)__b)); 13112 } 13113 13114 static __inline__ vector bool char __ATTRS_o_ai 13115 vec_lvrxl(int __a, const vector bool char *__b) { 13116 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 13117 vec_lvsl(__a, (unsigned char *)__b)); 13118 } 13119 13120 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 13121 const short *__b) { 13122 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13123 } 13124 13125 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 13126 const vector short *__b) { 13127 return vec_perm((vector short)(0), vec_ldl(__a, __b), 13128 vec_lvsl(__a, (unsigned char *)__b)); 13129 } 13130 13131 static __inline__ vector unsigned short __ATTRS_o_ai 13132 vec_lvrxl(int __a, const unsigned short *__b) { 13133 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 13134 vec_lvsl(__a, __b)); 13135 } 13136 13137 static __inline__ vector unsigned short __ATTRS_o_ai 13138 vec_lvrxl(int __a, const vector unsigned short *__b) { 13139 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 13140 vec_lvsl(__a, (unsigned char *)__b)); 13141 } 13142 13143 static __inline__ vector bool short __ATTRS_o_ai 13144 vec_lvrxl(int __a, const vector bool short *__b) { 13145 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 13146 vec_lvsl(__a, (unsigned char *)__b)); 13147 } 13148 13149 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 13150 const vector pixel *__b) { 13151 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 13152 vec_lvsl(__a, (unsigned char *)__b)); 13153 } 13154 13155 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 13156 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13157 } 13158 13159 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 13160 const vector int *__b) { 13161 return vec_perm((vector int)(0), vec_ldl(__a, __b), 13162 vec_lvsl(__a, (unsigned char *)__b)); 13163 } 13164 13165 static __inline__ vector unsigned int __ATTRS_o_ai 13166 vec_lvrxl(int __a, const unsigned int *__b) { 13167 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 13168 vec_lvsl(__a, __b)); 13169 } 13170 13171 static __inline__ vector unsigned int __ATTRS_o_ai 13172 vec_lvrxl(int __a, const vector unsigned int *__b) { 13173 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 13174 vec_lvsl(__a, (unsigned char *)__b)); 13175 } 13176 13177 static __inline__ vector bool int __ATTRS_o_ai 13178 vec_lvrxl(int __a, const vector bool int *__b) { 13179 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 13180 vec_lvsl(__a, (unsigned char *)__b)); 13181 } 13182 13183 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 13184 const float *__b) { 13185 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13186 } 13187 13188 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 13189 const vector float *__b) { 13190 return vec_perm((vector float)(0), vec_ldl(__a, __b), 13191 vec_lvsl(__a, (unsigned char *)__b)); 13192 } 13193 13194 /* vec_stvlx */ 13195 13196 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 13197 signed char *__c) { 13198 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13199 __c); 13200 } 13201 13202 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 13203 vector signed char *__c) { 13204 return vec_st( 13205 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13206 __b, __c); 13207 } 13208 13209 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 13210 unsigned char *__c) { 13211 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13212 __c); 13213 } 13214 13215 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 13216 vector unsigned char *__c) { 13217 return vec_st( 13218 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13219 __b, __c); 13220 } 13221 13222 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 13223 vector bool char *__c) { 13224 return vec_st( 13225 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13226 __b, __c); 13227 } 13228 13229 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 13230 short *__c) { 13231 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13232 __c); 13233 } 13234 13235 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 13236 vector short *__c) { 13237 return vec_st( 13238 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13239 __b, __c); 13240 } 13241 13242 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 13243 int __b, unsigned short *__c) { 13244 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13245 __c); 13246 } 13247 13248 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 13249 int __b, 13250 vector unsigned short *__c) { 13251 return vec_st( 13252 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13253 __b, __c); 13254 } 13255 13256 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 13257 vector bool short *__c) { 13258 return vec_st( 13259 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13260 __b, __c); 13261 } 13262 13263 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 13264 vector pixel *__c) { 13265 return vec_st( 13266 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13267 __b, __c); 13268 } 13269 13270 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 13271 int *__c) { 13272 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13273 __c); 13274 } 13275 13276 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 13277 vector int *__c) { 13278 return vec_st( 13279 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13280 __b, __c); 13281 } 13282 13283 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 13284 unsigned int *__c) { 13285 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13286 __c); 13287 } 13288 13289 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 13290 vector unsigned int *__c) { 13291 return vec_st( 13292 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13293 __b, __c); 13294 } 13295 13296 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 13297 vector bool int *__c) { 13298 return vec_st( 13299 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13300 __b, __c); 13301 } 13302 13303 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 13304 vector float *__c) { 13305 return vec_st( 13306 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13307 __b, __c); 13308 } 13309 13310 /* vec_stvlxl */ 13311 13312 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 13313 signed char *__c) { 13314 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13315 __c); 13316 } 13317 13318 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 13319 vector signed char *__c) { 13320 return vec_stl( 13321 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13322 __b, __c); 13323 } 13324 13325 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 13326 int __b, unsigned char *__c) { 13327 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13328 __c); 13329 } 13330 13331 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 13332 int __b, 13333 vector unsigned char *__c) { 13334 return vec_stl( 13335 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13336 __b, __c); 13337 } 13338 13339 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 13340 vector bool char *__c) { 13341 return vec_stl( 13342 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13343 __b, __c); 13344 } 13345 13346 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 13347 short *__c) { 13348 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13349 __c); 13350 } 13351 13352 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 13353 vector short *__c) { 13354 return vec_stl( 13355 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13356 __b, __c); 13357 } 13358 13359 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 13360 int __b, unsigned short *__c) { 13361 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13362 __c); 13363 } 13364 13365 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 13366 int __b, 13367 vector unsigned short *__c) { 13368 return vec_stl( 13369 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13370 __b, __c); 13371 } 13372 13373 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 13374 vector bool short *__c) { 13375 return vec_stl( 13376 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13377 __b, __c); 13378 } 13379 13380 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 13381 vector pixel *__c) { 13382 return vec_stl( 13383 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13384 __b, __c); 13385 } 13386 13387 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 13388 int *__c) { 13389 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13390 __c); 13391 } 13392 13393 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 13394 vector int *__c) { 13395 return vec_stl( 13396 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13397 __b, __c); 13398 } 13399 13400 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 13401 unsigned int *__c) { 13402 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13403 __c); 13404 } 13405 13406 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 13407 vector unsigned int *__c) { 13408 return vec_stl( 13409 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13410 __b, __c); 13411 } 13412 13413 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 13414 vector bool int *__c) { 13415 return vec_stl( 13416 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13417 __b, __c); 13418 } 13419 13420 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 13421 vector float *__c) { 13422 return vec_stl( 13423 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13424 __b, __c); 13425 } 13426 13427 /* vec_stvrx */ 13428 13429 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 13430 signed char *__c) { 13431 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13432 __c); 13433 } 13434 13435 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 13436 vector signed char *__c) { 13437 return vec_st( 13438 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13439 __b, __c); 13440 } 13441 13442 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 13443 unsigned char *__c) { 13444 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13445 __c); 13446 } 13447 13448 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 13449 vector unsigned char *__c) { 13450 return vec_st( 13451 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13452 __b, __c); 13453 } 13454 13455 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 13456 vector bool char *__c) { 13457 return vec_st( 13458 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13459 __b, __c); 13460 } 13461 13462 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 13463 short *__c) { 13464 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13465 __c); 13466 } 13467 13468 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 13469 vector short *__c) { 13470 return vec_st( 13471 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13472 __b, __c); 13473 } 13474 13475 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 13476 int __b, unsigned short *__c) { 13477 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13478 __c); 13479 } 13480 13481 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 13482 int __b, 13483 vector unsigned short *__c) { 13484 return vec_st( 13485 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13486 __b, __c); 13487 } 13488 13489 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 13490 vector bool short *__c) { 13491 return vec_st( 13492 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13493 __b, __c); 13494 } 13495 13496 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 13497 vector pixel *__c) { 13498 return vec_st( 13499 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13500 __b, __c); 13501 } 13502 13503 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 13504 int *__c) { 13505 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13506 __c); 13507 } 13508 13509 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 13510 vector int *__c) { 13511 return vec_st( 13512 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13513 __b, __c); 13514 } 13515 13516 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 13517 unsigned int *__c) { 13518 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13519 __c); 13520 } 13521 13522 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 13523 vector unsigned int *__c) { 13524 return vec_st( 13525 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13526 __b, __c); 13527 } 13528 13529 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 13530 vector bool int *__c) { 13531 return vec_st( 13532 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13533 __b, __c); 13534 } 13535 13536 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 13537 vector float *__c) { 13538 return vec_st( 13539 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13540 __b, __c); 13541 } 13542 13543 /* vec_stvrxl */ 13544 13545 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 13546 signed char *__c) { 13547 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13548 __c); 13549 } 13550 13551 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 13552 vector signed char *__c) { 13553 return vec_stl( 13554 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13555 __b, __c); 13556 } 13557 13558 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 13559 int __b, unsigned char *__c) { 13560 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13561 __c); 13562 } 13563 13564 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 13565 int __b, 13566 vector unsigned char *__c) { 13567 return vec_stl( 13568 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13569 __b, __c); 13570 } 13571 13572 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 13573 vector bool char *__c) { 13574 return vec_stl( 13575 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13576 __b, __c); 13577 } 13578 13579 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 13580 short *__c) { 13581 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13582 __c); 13583 } 13584 13585 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 13586 vector short *__c) { 13587 return vec_stl( 13588 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13589 __b, __c); 13590 } 13591 13592 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 13593 int __b, unsigned short *__c) { 13594 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13595 __c); 13596 } 13597 13598 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 13599 int __b, 13600 vector unsigned short *__c) { 13601 return vec_stl( 13602 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13603 __b, __c); 13604 } 13605 13606 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 13607 vector bool short *__c) { 13608 return vec_stl( 13609 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13610 __b, __c); 13611 } 13612 13613 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 13614 vector pixel *__c) { 13615 return vec_stl( 13616 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13617 __b, __c); 13618 } 13619 13620 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 13621 int *__c) { 13622 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13623 __c); 13624 } 13625 13626 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 13627 vector int *__c) { 13628 return vec_stl( 13629 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13630 __b, __c); 13631 } 13632 13633 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 13634 unsigned int *__c) { 13635 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13636 __c); 13637 } 13638 13639 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 13640 vector unsigned int *__c) { 13641 return vec_stl( 13642 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13643 __b, __c); 13644 } 13645 13646 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 13647 vector bool int *__c) { 13648 return vec_stl( 13649 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13650 __b, __c); 13651 } 13652 13653 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 13654 vector float *__c) { 13655 return vec_stl( 13656 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13657 __b, __c); 13658 } 13659 13660 /* vec_promote */ 13661 13662 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 13663 int __b) { 13664 vector signed char __res = (vector signed char)(0); 13665 __res[__b] = __a; 13666 return __res; 13667 } 13668 13669 static __inline__ vector unsigned char __ATTRS_o_ai 13670 vec_promote(unsigned char __a, int __b) { 13671 vector unsigned char __res = (vector unsigned char)(0); 13672 __res[__b] = __a; 13673 return __res; 13674 } 13675 13676 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 13677 vector short __res = (vector short)(0); 13678 __res[__b] = __a; 13679 return __res; 13680 } 13681 13682 static __inline__ vector unsigned short __ATTRS_o_ai 13683 vec_promote(unsigned short __a, int __b) { 13684 vector unsigned short __res = (vector unsigned short)(0); 13685 __res[__b] = __a; 13686 return __res; 13687 } 13688 13689 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 13690 vector int __res = (vector int)(0); 13691 __res[__b] = __a; 13692 return __res; 13693 } 13694 13695 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 13696 int __b) { 13697 vector unsigned int __res = (vector unsigned int)(0); 13698 __res[__b] = __a; 13699 return __res; 13700 } 13701 13702 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 13703 vector float __res = (vector float)(0); 13704 __res[__b] = __a; 13705 return __res; 13706 } 13707 13708 /* vec_splats */ 13709 13710 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 13711 return (vector signed char)(__a); 13712 } 13713 13714 static __inline__ vector unsigned char __ATTRS_o_ai 13715 vec_splats(unsigned char __a) { 13716 return (vector unsigned char)(__a); 13717 } 13718 13719 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 13720 return (vector short)(__a); 13721 } 13722 13723 static __inline__ vector unsigned short __ATTRS_o_ai 13724 vec_splats(unsigned short __a) { 13725 return (vector unsigned short)(__a); 13726 } 13727 13728 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 13729 return (vector int)(__a); 13730 } 13731 13732 static __inline__ vector unsigned int __ATTRS_o_ai 13733 vec_splats(unsigned int __a) { 13734 return (vector unsigned int)(__a); 13735 } 13736 13737 #ifdef __VSX__ 13738 static __inline__ vector signed long long __ATTRS_o_ai 13739 vec_splats(signed long long __a) { 13740 return (vector signed long long)(__a); 13741 } 13742 13743 static __inline__ vector unsigned long long __ATTRS_o_ai 13744 vec_splats(unsigned long long __a) { 13745 return (vector unsigned long long)(__a); 13746 } 13747 13748 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 13749 static __inline__ vector signed __int128 __ATTRS_o_ai 13750 vec_splats(signed __int128 __a) { 13751 return (vector signed __int128)(__a); 13752 } 13753 13754 static __inline__ vector unsigned __int128 __ATTRS_o_ai 13755 vec_splats(unsigned __int128 __a) { 13756 return (vector unsigned __int128)(__a); 13757 } 13758 13759 #endif 13760 13761 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 13762 return (vector double)(__a); 13763 } 13764 #endif 13765 13766 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 13767 return (vector float)(__a); 13768 } 13769 13770 /* ----------------------------- predicates --------------------------------- */ 13771 13772 /* vec_all_eq */ 13773 13774 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 13775 vector signed char __b) { 13776 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13777 (vector char)__b); 13778 } 13779 13780 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 13781 vector bool char __b) { 13782 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13783 (vector char)__b); 13784 } 13785 13786 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 13787 vector unsigned char __b) { 13788 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13789 (vector char)__b); 13790 } 13791 13792 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 13793 vector bool char __b) { 13794 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13795 (vector char)__b); 13796 } 13797 13798 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 13799 vector signed char __b) { 13800 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13801 (vector char)__b); 13802 } 13803 13804 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 13805 vector unsigned char __b) { 13806 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13807 (vector char)__b); 13808 } 13809 13810 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 13811 vector bool char __b) { 13812 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 13813 (vector char)__b); 13814 } 13815 13816 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 13817 vector short __b) { 13818 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 13819 } 13820 13821 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 13822 vector bool short __b) { 13823 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 13824 } 13825 13826 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 13827 vector unsigned short __b) { 13828 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 13829 (vector short)__b); 13830 } 13831 13832 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 13833 vector bool short __b) { 13834 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 13835 (vector short)__b); 13836 } 13837 13838 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 13839 vector short __b) { 13840 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 13841 (vector short)__b); 13842 } 13843 13844 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 13845 vector unsigned short __b) { 13846 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 13847 (vector short)__b); 13848 } 13849 13850 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 13851 vector bool short __b) { 13852 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 13853 (vector short)__b); 13854 } 13855 13856 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 13857 vector pixel __b) { 13858 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 13859 (vector short)__b); 13860 } 13861 13862 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 13863 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 13864 } 13865 13866 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 13867 vector bool int __b) { 13868 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 13869 } 13870 13871 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 13872 vector unsigned int __b) { 13873 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 13874 (vector int)__b); 13875 } 13876 13877 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 13878 vector bool int __b) { 13879 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 13880 (vector int)__b); 13881 } 13882 13883 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 13884 vector int __b) { 13885 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 13886 (vector int)__b); 13887 } 13888 13889 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 13890 vector unsigned int __b) { 13891 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 13892 (vector int)__b); 13893 } 13894 13895 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 13896 vector bool int __b) { 13897 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 13898 (vector int)__b); 13899 } 13900 13901 #ifdef __POWER8_VECTOR__ 13902 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 13903 vector signed long long __b) { 13904 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 13905 } 13906 13907 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 13908 vector bool long long __b) { 13909 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b); 13910 } 13911 13912 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 13913 vector unsigned long long __b) { 13914 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 13915 (vector long long)__b); 13916 } 13917 13918 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 13919 vector bool long long __b) { 13920 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 13921 (vector long long)__b); 13922 } 13923 13924 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 13925 vector long long __b) { 13926 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 13927 (vector long long)__b); 13928 } 13929 13930 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 13931 vector unsigned long long __b) { 13932 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 13933 (vector long long)__b); 13934 } 13935 13936 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 13937 vector bool long long __b) { 13938 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 13939 (vector long long)__b); 13940 } 13941 #endif 13942 13943 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 13944 vector float __b) { 13945 #ifdef __VSX__ 13946 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 13947 #else 13948 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 13949 #endif 13950 } 13951 13952 #ifdef __VSX__ 13953 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 13954 vector double __b) { 13955 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 13956 } 13957 #endif 13958 13959 /* vec_all_ge */ 13960 13961 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 13962 vector signed char __b) { 13963 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 13964 } 13965 13966 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 13967 vector bool char __b) { 13968 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 13969 } 13970 13971 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 13972 vector unsigned char __b) { 13973 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 13974 } 13975 13976 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 13977 vector bool char __b) { 13978 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 13979 } 13980 13981 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 13982 vector signed char __b) { 13983 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 13984 (vector unsigned char)__a); 13985 } 13986 13987 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 13988 vector unsigned char __b) { 13989 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 13990 } 13991 13992 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 13993 vector bool char __b) { 13994 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 13995 (vector unsigned char)__a); 13996 } 13997 13998 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 13999 vector short __b) { 14000 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 14001 } 14002 14003 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14004 vector bool short __b) { 14005 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 14006 } 14007 14008 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14009 vector unsigned short __b) { 14010 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 14011 } 14012 14013 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14014 vector bool short __b) { 14015 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14016 __a); 14017 } 14018 14019 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14020 vector short __b) { 14021 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14022 (vector unsigned short)__a); 14023 } 14024 14025 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14026 vector unsigned short __b) { 14027 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 14028 (vector unsigned short)__a); 14029 } 14030 14031 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14032 vector bool short __b) { 14033 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14034 (vector unsigned short)__a); 14035 } 14036 14037 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 14038 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 14039 } 14040 14041 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 14042 vector bool int __b) { 14043 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 14044 } 14045 14046 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14047 vector unsigned int __b) { 14048 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 14049 } 14050 14051 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14052 vector bool int __b) { 14053 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 14054 } 14055 14056 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14057 vector int __b) { 14058 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14059 (vector unsigned int)__a); 14060 } 14061 14062 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14063 vector unsigned int __b) { 14064 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 14065 } 14066 14067 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14068 vector bool int __b) { 14069 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14070 (vector unsigned int)__a); 14071 } 14072 14073 #ifdef __POWER8_VECTOR__ 14074 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14075 vector signed long long __b) { 14076 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 14077 } 14078 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14079 vector bool long long __b) { 14080 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 14081 __a); 14082 } 14083 14084 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 14085 vector unsigned long long __b) { 14086 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 14087 } 14088 14089 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 14090 vector bool long long __b) { 14091 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 14092 __a); 14093 } 14094 14095 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 14096 vector signed long long __b) { 14097 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 14098 (vector unsigned long long)__a); 14099 } 14100 14101 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 14102 vector unsigned long long __b) { 14103 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 14104 (vector unsigned long long)__a); 14105 } 14106 14107 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 14108 vector bool long long __b) { 14109 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 14110 (vector unsigned long long)__a); 14111 } 14112 #endif 14113 14114 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 14115 vector float __b) { 14116 #ifdef __VSX__ 14117 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 14118 #else 14119 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 14120 #endif 14121 } 14122 14123 #ifdef __VSX__ 14124 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 14125 vector double __b) { 14126 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 14127 } 14128 #endif 14129 14130 /* vec_all_gt */ 14131 14132 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 14133 vector signed char __b) { 14134 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 14135 } 14136 14137 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 14138 vector bool char __b) { 14139 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 14140 } 14141 14142 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 14143 vector unsigned char __b) { 14144 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 14145 } 14146 14147 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 14148 vector bool char __b) { 14149 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 14150 } 14151 14152 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 14153 vector signed char __b) { 14154 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 14155 (vector unsigned char)__b); 14156 } 14157 14158 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 14159 vector unsigned char __b) { 14160 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 14161 } 14162 14163 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 14164 vector bool char __b) { 14165 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 14166 (vector unsigned char)__b); 14167 } 14168 14169 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 14170 vector short __b) { 14171 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 14172 } 14173 14174 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 14175 vector bool short __b) { 14176 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 14177 } 14178 14179 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 14180 vector unsigned short __b) { 14181 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 14182 } 14183 14184 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 14185 vector bool short __b) { 14186 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 14187 (vector unsigned short)__b); 14188 } 14189 14190 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 14191 vector short __b) { 14192 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 14193 (vector unsigned short)__b); 14194 } 14195 14196 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 14197 vector unsigned short __b) { 14198 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 14199 __b); 14200 } 14201 14202 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 14203 vector bool short __b) { 14204 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 14205 (vector unsigned short)__b); 14206 } 14207 14208 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 14209 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 14210 } 14211 14212 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 14213 vector bool int __b) { 14214 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 14215 } 14216 14217 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 14218 vector unsigned int __b) { 14219 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 14220 } 14221 14222 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 14223 vector bool int __b) { 14224 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 14225 } 14226 14227 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 14228 vector int __b) { 14229 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 14230 (vector unsigned int)__b); 14231 } 14232 14233 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 14234 vector unsigned int __b) { 14235 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 14236 } 14237 14238 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 14239 vector bool int __b) { 14240 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 14241 (vector unsigned int)__b); 14242 } 14243 14244 #ifdef __POWER8_VECTOR__ 14245 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 14246 vector signed long long __b) { 14247 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 14248 } 14249 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 14250 vector bool long long __b) { 14251 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 14252 (vector signed long long)__b); 14253 } 14254 14255 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 14256 vector unsigned long long __b) { 14257 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 14258 } 14259 14260 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 14261 vector bool long long __b) { 14262 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 14263 (vector unsigned long long)__b); 14264 } 14265 14266 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 14267 vector signed long long __b) { 14268 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 14269 (vector unsigned long long)__b); 14270 } 14271 14272 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 14273 vector unsigned long long __b) { 14274 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 14275 __b); 14276 } 14277 14278 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 14279 vector bool long long __b) { 14280 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 14281 (vector unsigned long long)__b); 14282 } 14283 #endif 14284 14285 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 14286 vector float __b) { 14287 #ifdef __VSX__ 14288 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 14289 #else 14290 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 14291 #endif 14292 } 14293 14294 #ifdef __VSX__ 14295 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 14296 vector double __b) { 14297 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 14298 } 14299 #endif 14300 14301 /* vec_all_in */ 14302 14303 static __inline__ int __attribute__((__always_inline__)) 14304 vec_all_in(vector float __a, vector float __b) { 14305 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 14306 } 14307 14308 /* vec_all_le */ 14309 14310 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 14311 vector signed char __b) { 14312 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 14313 } 14314 14315 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 14316 vector bool char __b) { 14317 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 14318 } 14319 14320 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 14321 vector unsigned char __b) { 14322 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 14323 } 14324 14325 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 14326 vector bool char __b) { 14327 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 14328 } 14329 14330 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 14331 vector signed char __b) { 14332 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 14333 (vector unsigned char)__b); 14334 } 14335 14336 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 14337 vector unsigned char __b) { 14338 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 14339 } 14340 14341 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 14342 vector bool char __b) { 14343 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 14344 (vector unsigned char)__b); 14345 } 14346 14347 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 14348 vector short __b) { 14349 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 14350 } 14351 14352 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 14353 vector bool short __b) { 14354 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 14355 } 14356 14357 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 14358 vector unsigned short __b) { 14359 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 14360 } 14361 14362 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 14363 vector bool short __b) { 14364 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 14365 (vector unsigned short)__b); 14366 } 14367 14368 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 14369 vector short __b) { 14370 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 14371 (vector unsigned short)__b); 14372 } 14373 14374 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 14375 vector unsigned short __b) { 14376 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 14377 __b); 14378 } 14379 14380 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 14381 vector bool short __b) { 14382 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 14383 (vector unsigned short)__b); 14384 } 14385 14386 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 14387 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 14388 } 14389 14390 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 14391 vector bool int __b) { 14392 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 14393 } 14394 14395 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 14396 vector unsigned int __b) { 14397 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 14398 } 14399 14400 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 14401 vector bool int __b) { 14402 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 14403 } 14404 14405 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 14406 vector int __b) { 14407 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 14408 (vector unsigned int)__b); 14409 } 14410 14411 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 14412 vector unsigned int __b) { 14413 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 14414 } 14415 14416 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 14417 vector bool int __b) { 14418 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 14419 (vector unsigned int)__b); 14420 } 14421 14422 #ifdef __POWER8_VECTOR__ 14423 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 14424 vector signed long long __b) { 14425 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 14426 } 14427 14428 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 14429 vector unsigned long long __b) { 14430 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 14431 } 14432 14433 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 14434 vector bool long long __b) { 14435 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 14436 (vector signed long long)__b); 14437 } 14438 14439 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 14440 vector bool long long __b) { 14441 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 14442 (vector unsigned long long)__b); 14443 } 14444 14445 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 14446 vector signed long long __b) { 14447 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 14448 (vector unsigned long long)__b); 14449 } 14450 14451 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 14452 vector unsigned long long __b) { 14453 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 14454 __b); 14455 } 14456 14457 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 14458 vector bool long long __b) { 14459 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 14460 (vector unsigned long long)__b); 14461 } 14462 #endif 14463 14464 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 14465 vector float __b) { 14466 #ifdef __VSX__ 14467 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 14468 #else 14469 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 14470 #endif 14471 } 14472 14473 #ifdef __VSX__ 14474 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 14475 vector double __b) { 14476 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 14477 } 14478 #endif 14479 14480 /* vec_all_lt */ 14481 14482 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 14483 vector signed char __b) { 14484 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 14485 } 14486 14487 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 14488 vector bool char __b) { 14489 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 14490 } 14491 14492 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 14493 vector unsigned char __b) { 14494 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 14495 } 14496 14497 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 14498 vector bool char __b) { 14499 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 14500 } 14501 14502 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 14503 vector signed char __b) { 14504 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 14505 (vector unsigned char)__a); 14506 } 14507 14508 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 14509 vector unsigned char __b) { 14510 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 14511 } 14512 14513 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 14514 vector bool char __b) { 14515 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 14516 (vector unsigned char)__a); 14517 } 14518 14519 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 14520 vector short __b) { 14521 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 14522 } 14523 14524 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 14525 vector bool short __b) { 14526 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 14527 } 14528 14529 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 14530 vector unsigned short __b) { 14531 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 14532 } 14533 14534 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 14535 vector bool short __b) { 14536 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 14537 __a); 14538 } 14539 14540 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 14541 vector short __b) { 14542 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 14543 (vector unsigned short)__a); 14544 } 14545 14546 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 14547 vector unsigned short __b) { 14548 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 14549 (vector unsigned short)__a); 14550 } 14551 14552 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 14553 vector bool short __b) { 14554 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 14555 (vector unsigned short)__a); 14556 } 14557 14558 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 14559 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 14560 } 14561 14562 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 14563 vector bool int __b) { 14564 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 14565 } 14566 14567 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 14568 vector unsigned int __b) { 14569 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 14570 } 14571 14572 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 14573 vector bool int __b) { 14574 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 14575 } 14576 14577 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 14578 vector int __b) { 14579 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 14580 (vector unsigned int)__a); 14581 } 14582 14583 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 14584 vector unsigned int __b) { 14585 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 14586 } 14587 14588 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 14589 vector bool int __b) { 14590 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 14591 (vector unsigned int)__a); 14592 } 14593 14594 #ifdef __POWER8_VECTOR__ 14595 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 14596 vector signed long long __b) { 14597 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 14598 } 14599 14600 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 14601 vector unsigned long long __b) { 14602 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 14603 } 14604 14605 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 14606 vector bool long long __b) { 14607 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 14608 __a); 14609 } 14610 14611 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 14612 vector bool long long __b) { 14613 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 14614 __a); 14615 } 14616 14617 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 14618 vector signed long long __b) { 14619 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 14620 (vector unsigned long long)__a); 14621 } 14622 14623 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 14624 vector unsigned long long __b) { 14625 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 14626 (vector unsigned long long)__a); 14627 } 14628 14629 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 14630 vector bool long long __b) { 14631 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 14632 (vector unsigned long long)__a); 14633 } 14634 #endif 14635 14636 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 14637 vector float __b) { 14638 #ifdef __VSX__ 14639 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 14640 #else 14641 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 14642 #endif 14643 } 14644 14645 #ifdef __VSX__ 14646 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 14647 vector double __b) { 14648 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 14649 } 14650 #endif 14651 14652 /* vec_all_nan */ 14653 14654 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 14655 #ifdef __VSX__ 14656 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 14657 #else 14658 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 14659 #endif 14660 } 14661 14662 #ifdef __VSX__ 14663 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 14664 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 14665 } 14666 #endif 14667 14668 /* vec_all_ne */ 14669 14670 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 14671 vector signed char __b) { 14672 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14673 (vector char)__b); 14674 } 14675 14676 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 14677 vector bool char __b) { 14678 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14679 (vector char)__b); 14680 } 14681 14682 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 14683 vector unsigned char __b) { 14684 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14685 (vector char)__b); 14686 } 14687 14688 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 14689 vector bool char __b) { 14690 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14691 (vector char)__b); 14692 } 14693 14694 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 14695 vector signed char __b) { 14696 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14697 (vector char)__b); 14698 } 14699 14700 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 14701 vector unsigned char __b) { 14702 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14703 (vector char)__b); 14704 } 14705 14706 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 14707 vector bool char __b) { 14708 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 14709 (vector char)__b); 14710 } 14711 14712 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 14713 vector short __b) { 14714 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 14715 } 14716 14717 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 14718 vector bool short __b) { 14719 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 14720 } 14721 14722 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 14723 vector unsigned short __b) { 14724 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 14725 (vector short)__b); 14726 } 14727 14728 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 14729 vector bool short __b) { 14730 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 14731 (vector short)__b); 14732 } 14733 14734 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 14735 vector short __b) { 14736 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 14737 (vector short)__b); 14738 } 14739 14740 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 14741 vector unsigned short __b) { 14742 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 14743 (vector short)__b); 14744 } 14745 14746 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 14747 vector bool short __b) { 14748 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 14749 (vector short)__b); 14750 } 14751 14752 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 14753 vector pixel __b) { 14754 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 14755 (vector short)__b); 14756 } 14757 14758 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 14759 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 14760 } 14761 14762 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 14763 vector bool int __b) { 14764 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 14765 } 14766 14767 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 14768 vector unsigned int __b) { 14769 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 14770 (vector int)__b); 14771 } 14772 14773 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 14774 vector bool int __b) { 14775 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 14776 (vector int)__b); 14777 } 14778 14779 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 14780 vector int __b) { 14781 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 14782 (vector int)__b); 14783 } 14784 14785 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 14786 vector unsigned int __b) { 14787 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 14788 (vector int)__b); 14789 } 14790 14791 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 14792 vector bool int __b) { 14793 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 14794 (vector int)__b); 14795 } 14796 14797 #ifdef __POWER8_VECTOR__ 14798 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 14799 vector signed long long __b) { 14800 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 14801 } 14802 14803 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 14804 vector unsigned long long __b) { 14805 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 14806 (vector long long)__b); 14807 } 14808 14809 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 14810 vector bool long long __b) { 14811 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 14812 (vector signed long long)__b); 14813 } 14814 14815 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 14816 vector bool long long __b) { 14817 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 14818 (vector signed long long)__b); 14819 } 14820 14821 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 14822 vector signed long long __b) { 14823 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 14824 (vector signed long long)__b); 14825 } 14826 14827 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 14828 vector unsigned long long __b) { 14829 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 14830 (vector signed long long)__b); 14831 } 14832 14833 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 14834 vector bool long long __b) { 14835 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 14836 (vector signed long long)__b); 14837 } 14838 #endif 14839 14840 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 14841 vector float __b) { 14842 #ifdef __VSX__ 14843 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); 14844 #else 14845 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 14846 #endif 14847 } 14848 14849 #ifdef __VSX__ 14850 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 14851 vector double __b) { 14852 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 14853 } 14854 #endif 14855 14856 /* vec_all_nge */ 14857 14858 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 14859 vector float __b) { 14860 #ifdef __VSX__ 14861 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 14862 #else 14863 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 14864 #endif 14865 } 14866 14867 #ifdef __VSX__ 14868 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 14869 vector double __b) { 14870 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 14871 } 14872 #endif 14873 14874 /* vec_all_ngt */ 14875 14876 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 14877 vector float __b) { 14878 #ifdef __VSX__ 14879 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 14880 #else 14881 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 14882 #endif 14883 } 14884 14885 #ifdef __VSX__ 14886 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 14887 vector double __b) { 14888 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 14889 } 14890 #endif 14891 14892 /* vec_all_nle */ 14893 14894 static __inline__ int __attribute__((__always_inline__)) 14895 vec_all_nle(vector float __a, vector float __b) { 14896 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 14897 } 14898 14899 /* vec_all_nlt */ 14900 14901 static __inline__ int __attribute__((__always_inline__)) 14902 vec_all_nlt(vector float __a, vector float __b) { 14903 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 14904 } 14905 14906 /* vec_all_numeric */ 14907 14908 static __inline__ int __attribute__((__always_inline__)) 14909 vec_all_numeric(vector float __a) { 14910 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 14911 } 14912 14913 /* vec_any_eq */ 14914 14915 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 14916 vector signed char __b) { 14917 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14918 (vector char)__b); 14919 } 14920 14921 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 14922 vector bool char __b) { 14923 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14924 (vector char)__b); 14925 } 14926 14927 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 14928 vector unsigned char __b) { 14929 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14930 (vector char)__b); 14931 } 14932 14933 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 14934 vector bool char __b) { 14935 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14936 (vector char)__b); 14937 } 14938 14939 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 14940 vector signed char __b) { 14941 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14942 (vector char)__b); 14943 } 14944 14945 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 14946 vector unsigned char __b) { 14947 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14948 (vector char)__b); 14949 } 14950 14951 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 14952 vector bool char __b) { 14953 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 14954 (vector char)__b); 14955 } 14956 14957 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 14958 vector short __b) { 14959 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 14960 } 14961 14962 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 14963 vector bool short __b) { 14964 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 14965 } 14966 14967 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 14968 vector unsigned short __b) { 14969 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 14970 (vector short)__b); 14971 } 14972 14973 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 14974 vector bool short __b) { 14975 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 14976 (vector short)__b); 14977 } 14978 14979 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 14980 vector short __b) { 14981 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 14982 (vector short)__b); 14983 } 14984 14985 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 14986 vector unsigned short __b) { 14987 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 14988 (vector short)__b); 14989 } 14990 14991 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 14992 vector bool short __b) { 14993 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 14994 (vector short)__b); 14995 } 14996 14997 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 14998 vector pixel __b) { 14999 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15000 (vector short)__b); 15001 } 15002 15003 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 15004 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 15005 } 15006 15007 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 15008 vector bool int __b) { 15009 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 15010 } 15011 15012 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 15013 vector unsigned int __b) { 15014 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15015 (vector int)__b); 15016 } 15017 15018 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 15019 vector bool int __b) { 15020 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15021 (vector int)__b); 15022 } 15023 15024 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 15025 vector int __b) { 15026 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15027 (vector int)__b); 15028 } 15029 15030 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 15031 vector unsigned int __b) { 15032 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15033 (vector int)__b); 15034 } 15035 15036 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 15037 vector bool int __b) { 15038 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15039 (vector int)__b); 15040 } 15041 15042 #ifdef __POWER8_VECTOR__ 15043 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 15044 vector signed long long __b) { 15045 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 15046 } 15047 15048 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 15049 vector unsigned long long __b) { 15050 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 15051 (vector long long)__b); 15052 } 15053 15054 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 15055 vector bool long long __b) { 15056 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 15057 (vector signed long long)__b); 15058 } 15059 15060 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 15061 vector bool long long __b) { 15062 return __builtin_altivec_vcmpequd_p( 15063 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15064 } 15065 15066 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 15067 vector signed long long __b) { 15068 return __builtin_altivec_vcmpequd_p( 15069 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15070 } 15071 15072 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 15073 vector unsigned long long __b) { 15074 return __builtin_altivec_vcmpequd_p( 15075 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15076 } 15077 15078 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 15079 vector bool long long __b) { 15080 return __builtin_altivec_vcmpequd_p( 15081 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15082 } 15083 #endif 15084 15085 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 15086 vector float __b) { 15087 #ifdef __VSX__ 15088 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 15089 #else 15090 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 15091 #endif 15092 } 15093 15094 #ifdef __VSX__ 15095 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 15096 vector double __b) { 15097 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 15098 } 15099 #endif 15100 15101 /* vec_any_ge */ 15102 15103 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 15104 vector signed char __b) { 15105 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 15106 } 15107 15108 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 15109 vector bool char __b) { 15110 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 15111 __a); 15112 } 15113 15114 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 15115 vector unsigned char __b) { 15116 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 15117 } 15118 15119 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 15120 vector bool char __b) { 15121 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 15122 __a); 15123 } 15124 15125 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 15126 vector signed char __b) { 15127 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 15128 (vector unsigned char)__a); 15129 } 15130 15131 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 15132 vector unsigned char __b) { 15133 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 15134 (vector unsigned char)__a); 15135 } 15136 15137 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 15138 vector bool char __b) { 15139 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 15140 (vector unsigned char)__a); 15141 } 15142 15143 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 15144 vector short __b) { 15145 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 15146 } 15147 15148 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 15149 vector bool short __b) { 15150 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 15151 } 15152 15153 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 15154 vector unsigned short __b) { 15155 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 15156 } 15157 15158 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 15159 vector bool short __b) { 15160 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 15161 __a); 15162 } 15163 15164 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 15165 vector short __b) { 15166 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 15167 (vector unsigned short)__a); 15168 } 15169 15170 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 15171 vector unsigned short __b) { 15172 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 15173 (vector unsigned short)__a); 15174 } 15175 15176 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 15177 vector bool short __b) { 15178 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 15179 (vector unsigned short)__a); 15180 } 15181 15182 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 15183 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 15184 } 15185 15186 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 15187 vector bool int __b) { 15188 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 15189 } 15190 15191 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 15192 vector unsigned int __b) { 15193 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 15194 } 15195 15196 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 15197 vector bool int __b) { 15198 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 15199 __a); 15200 } 15201 15202 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 15203 vector int __b) { 15204 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 15205 (vector unsigned int)__a); 15206 } 15207 15208 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 15209 vector unsigned int __b) { 15210 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 15211 (vector unsigned int)__a); 15212 } 15213 15214 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 15215 vector bool int __b) { 15216 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 15217 (vector unsigned int)__a); 15218 } 15219 15220 #ifdef __POWER8_VECTOR__ 15221 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 15222 vector signed long long __b) { 15223 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 15224 } 15225 15226 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 15227 vector unsigned long long __b) { 15228 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 15229 } 15230 15231 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 15232 vector bool long long __b) { 15233 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 15234 (vector signed long long)__b, __a); 15235 } 15236 15237 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 15238 vector bool long long __b) { 15239 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15240 (vector unsigned long long)__b, __a); 15241 } 15242 15243 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 15244 vector signed long long __b) { 15245 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15246 (vector unsigned long long)__b, 15247 (vector unsigned long long)__a); 15248 } 15249 15250 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 15251 vector unsigned long long __b) { 15252 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 15253 (vector unsigned long long)__a); 15254 } 15255 15256 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 15257 vector bool long long __b) { 15258 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15259 (vector unsigned long long)__b, 15260 (vector unsigned long long)__a); 15261 } 15262 #endif 15263 15264 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 15265 vector float __b) { 15266 #ifdef __VSX__ 15267 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 15268 #else 15269 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 15270 #endif 15271 } 15272 15273 #ifdef __VSX__ 15274 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 15275 vector double __b) { 15276 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 15277 } 15278 #endif 15279 15280 /* vec_any_gt */ 15281 15282 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 15283 vector signed char __b) { 15284 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 15285 } 15286 15287 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 15288 vector bool char __b) { 15289 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 15290 (vector signed char)__b); 15291 } 15292 15293 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 15294 vector unsigned char __b) { 15295 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 15296 } 15297 15298 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 15299 vector bool char __b) { 15300 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 15301 (vector unsigned char)__b); 15302 } 15303 15304 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 15305 vector signed char __b) { 15306 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 15307 (vector unsigned char)__b); 15308 } 15309 15310 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 15311 vector unsigned char __b) { 15312 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 15313 __b); 15314 } 15315 15316 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 15317 vector bool char __b) { 15318 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 15319 (vector unsigned char)__b); 15320 } 15321 15322 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 15323 vector short __b) { 15324 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 15325 } 15326 15327 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 15328 vector bool short __b) { 15329 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 15330 } 15331 15332 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 15333 vector unsigned short __b) { 15334 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 15335 } 15336 15337 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 15338 vector bool short __b) { 15339 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 15340 (vector unsigned short)__b); 15341 } 15342 15343 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 15344 vector short __b) { 15345 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 15346 (vector unsigned short)__b); 15347 } 15348 15349 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 15350 vector unsigned short __b) { 15351 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 15352 __b); 15353 } 15354 15355 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 15356 vector bool short __b) { 15357 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 15358 (vector unsigned short)__b); 15359 } 15360 15361 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 15362 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 15363 } 15364 15365 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 15366 vector bool int __b) { 15367 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 15368 } 15369 15370 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 15371 vector unsigned int __b) { 15372 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 15373 } 15374 15375 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 15376 vector bool int __b) { 15377 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 15378 (vector unsigned int)__b); 15379 } 15380 15381 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 15382 vector int __b) { 15383 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 15384 (vector unsigned int)__b); 15385 } 15386 15387 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 15388 vector unsigned int __b) { 15389 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 15390 __b); 15391 } 15392 15393 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 15394 vector bool int __b) { 15395 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 15396 (vector unsigned int)__b); 15397 } 15398 15399 #ifdef __POWER8_VECTOR__ 15400 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 15401 vector signed long long __b) { 15402 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 15403 } 15404 15405 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 15406 vector unsigned long long __b) { 15407 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 15408 } 15409 15410 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 15411 vector bool long long __b) { 15412 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 15413 (vector signed long long)__b); 15414 } 15415 15416 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 15417 vector bool long long __b) { 15418 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 15419 (vector unsigned long long)__b); 15420 } 15421 15422 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 15423 vector signed long long __b) { 15424 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15425 (vector unsigned long long)__a, 15426 (vector unsigned long long)__b); 15427 } 15428 15429 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 15430 vector unsigned long long __b) { 15431 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15432 (vector unsigned long long)__a, __b); 15433 } 15434 15435 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 15436 vector bool long long __b) { 15437 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15438 (vector unsigned long long)__a, 15439 (vector unsigned long long)__b); 15440 } 15441 #endif 15442 15443 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 15444 vector float __b) { 15445 #ifdef __VSX__ 15446 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 15447 #else 15448 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 15449 #endif 15450 } 15451 15452 #ifdef __VSX__ 15453 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 15454 vector double __b) { 15455 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 15456 } 15457 #endif 15458 15459 /* vec_any_le */ 15460 15461 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 15462 vector signed char __b) { 15463 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 15464 } 15465 15466 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 15467 vector bool char __b) { 15468 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 15469 (vector signed char)__b); 15470 } 15471 15472 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 15473 vector unsigned char __b) { 15474 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 15475 } 15476 15477 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 15478 vector bool char __b) { 15479 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 15480 (vector unsigned char)__b); 15481 } 15482 15483 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 15484 vector signed char __b) { 15485 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 15486 (vector unsigned char)__b); 15487 } 15488 15489 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 15490 vector unsigned char __b) { 15491 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 15492 __b); 15493 } 15494 15495 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 15496 vector bool char __b) { 15497 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 15498 (vector unsigned char)__b); 15499 } 15500 15501 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 15502 vector short __b) { 15503 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 15504 } 15505 15506 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 15507 vector bool short __b) { 15508 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 15509 } 15510 15511 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 15512 vector unsigned short __b) { 15513 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 15514 } 15515 15516 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 15517 vector bool short __b) { 15518 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 15519 (vector unsigned short)__b); 15520 } 15521 15522 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 15523 vector short __b) { 15524 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 15525 (vector unsigned short)__b); 15526 } 15527 15528 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 15529 vector unsigned short __b) { 15530 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 15531 __b); 15532 } 15533 15534 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 15535 vector bool short __b) { 15536 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 15537 (vector unsigned short)__b); 15538 } 15539 15540 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 15541 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 15542 } 15543 15544 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 15545 vector bool int __b) { 15546 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 15547 } 15548 15549 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 15550 vector unsigned int __b) { 15551 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 15552 } 15553 15554 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 15555 vector bool int __b) { 15556 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 15557 (vector unsigned int)__b); 15558 } 15559 15560 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 15561 vector int __b) { 15562 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 15563 (vector unsigned int)__b); 15564 } 15565 15566 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 15567 vector unsigned int __b) { 15568 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 15569 __b); 15570 } 15571 15572 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 15573 vector bool int __b) { 15574 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 15575 (vector unsigned int)__b); 15576 } 15577 15578 #ifdef __POWER8_VECTOR__ 15579 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 15580 vector signed long long __b) { 15581 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 15582 } 15583 15584 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 15585 vector unsigned long long __b) { 15586 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 15587 } 15588 15589 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 15590 vector bool long long __b) { 15591 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 15592 (vector signed long long)__b); 15593 } 15594 15595 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 15596 vector bool long long __b) { 15597 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 15598 (vector unsigned long long)__b); 15599 } 15600 15601 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 15602 vector signed long long __b) { 15603 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15604 (vector unsigned long long)__a, 15605 (vector unsigned long long)__b); 15606 } 15607 15608 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 15609 vector unsigned long long __b) { 15610 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15611 (vector unsigned long long)__a, __b); 15612 } 15613 15614 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 15615 vector bool long long __b) { 15616 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15617 (vector unsigned long long)__a, 15618 (vector unsigned long long)__b); 15619 } 15620 #endif 15621 15622 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 15623 vector float __b) { 15624 #ifdef __VSX__ 15625 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 15626 #else 15627 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 15628 #endif 15629 } 15630 15631 #ifdef __VSX__ 15632 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 15633 vector double __b) { 15634 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 15635 } 15636 #endif 15637 15638 /* vec_any_lt */ 15639 15640 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 15641 vector signed char __b) { 15642 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 15643 } 15644 15645 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 15646 vector bool char __b) { 15647 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 15648 __a); 15649 } 15650 15651 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 15652 vector unsigned char __b) { 15653 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 15654 } 15655 15656 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 15657 vector bool char __b) { 15658 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 15659 __a); 15660 } 15661 15662 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 15663 vector signed char __b) { 15664 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 15665 (vector unsigned char)__a); 15666 } 15667 15668 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 15669 vector unsigned char __b) { 15670 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 15671 (vector unsigned char)__a); 15672 } 15673 15674 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 15675 vector bool char __b) { 15676 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 15677 (vector unsigned char)__a); 15678 } 15679 15680 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 15681 vector short __b) { 15682 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 15683 } 15684 15685 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 15686 vector bool short __b) { 15687 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 15688 } 15689 15690 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 15691 vector unsigned short __b) { 15692 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 15693 } 15694 15695 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 15696 vector bool short __b) { 15697 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 15698 __a); 15699 } 15700 15701 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 15702 vector short __b) { 15703 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 15704 (vector unsigned short)__a); 15705 } 15706 15707 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 15708 vector unsigned short __b) { 15709 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 15710 (vector unsigned short)__a); 15711 } 15712 15713 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 15714 vector bool short __b) { 15715 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 15716 (vector unsigned short)__a); 15717 } 15718 15719 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 15720 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 15721 } 15722 15723 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 15724 vector bool int __b) { 15725 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 15726 } 15727 15728 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 15729 vector unsigned int __b) { 15730 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 15731 } 15732 15733 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 15734 vector bool int __b) { 15735 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 15736 __a); 15737 } 15738 15739 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 15740 vector int __b) { 15741 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 15742 (vector unsigned int)__a); 15743 } 15744 15745 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 15746 vector unsigned int __b) { 15747 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 15748 (vector unsigned int)__a); 15749 } 15750 15751 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 15752 vector bool int __b) { 15753 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 15754 (vector unsigned int)__a); 15755 } 15756 15757 #ifdef __POWER8_VECTOR__ 15758 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 15759 vector signed long long __b) { 15760 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 15761 } 15762 15763 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 15764 vector unsigned long long __b) { 15765 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 15766 } 15767 15768 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 15769 vector bool long long __b) { 15770 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 15771 (vector signed long long)__b, __a); 15772 } 15773 15774 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 15775 vector bool long long __b) { 15776 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15777 (vector unsigned long long)__b, __a); 15778 } 15779 15780 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 15781 vector signed long long __b) { 15782 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15783 (vector unsigned long long)__b, 15784 (vector unsigned long long)__a); 15785 } 15786 15787 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 15788 vector unsigned long long __b) { 15789 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 15790 (vector unsigned long long)__a); 15791 } 15792 15793 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 15794 vector bool long long __b) { 15795 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15796 (vector unsigned long long)__b, 15797 (vector unsigned long long)__a); 15798 } 15799 #endif 15800 15801 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 15802 vector float __b) { 15803 #ifdef __VSX__ 15804 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 15805 #else 15806 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 15807 #endif 15808 } 15809 15810 #ifdef __VSX__ 15811 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 15812 vector double __b) { 15813 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 15814 } 15815 #endif 15816 15817 /* vec_any_nan */ 15818 15819 static __inline__ int __attribute__((__always_inline__)) 15820 vec_any_nan(vector float __a) { 15821 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 15822 } 15823 15824 /* vec_any_ne */ 15825 15826 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 15827 vector signed char __b) { 15828 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15829 (vector char)__b); 15830 } 15831 15832 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 15833 vector bool char __b) { 15834 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15835 (vector char)__b); 15836 } 15837 15838 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 15839 vector unsigned char __b) { 15840 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15841 (vector char)__b); 15842 } 15843 15844 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 15845 vector bool char __b) { 15846 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15847 (vector char)__b); 15848 } 15849 15850 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 15851 vector signed char __b) { 15852 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15853 (vector char)__b); 15854 } 15855 15856 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 15857 vector unsigned char __b) { 15858 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15859 (vector char)__b); 15860 } 15861 15862 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 15863 vector bool char __b) { 15864 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 15865 (vector char)__b); 15866 } 15867 15868 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 15869 vector short __b) { 15870 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 15871 } 15872 15873 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 15874 vector bool short __b) { 15875 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 15876 } 15877 15878 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 15879 vector unsigned short __b) { 15880 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 15881 (vector short)__b); 15882 } 15883 15884 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 15885 vector bool short __b) { 15886 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 15887 (vector short)__b); 15888 } 15889 15890 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 15891 vector short __b) { 15892 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 15893 (vector short)__b); 15894 } 15895 15896 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 15897 vector unsigned short __b) { 15898 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 15899 (vector short)__b); 15900 } 15901 15902 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 15903 vector bool short __b) { 15904 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 15905 (vector short)__b); 15906 } 15907 15908 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 15909 vector pixel __b) { 15910 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 15911 (vector short)__b); 15912 } 15913 15914 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 15915 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 15916 } 15917 15918 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 15919 vector bool int __b) { 15920 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 15921 } 15922 15923 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 15924 vector unsigned int __b) { 15925 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 15926 (vector int)__b); 15927 } 15928 15929 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 15930 vector bool int __b) { 15931 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 15932 (vector int)__b); 15933 } 15934 15935 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 15936 vector int __b) { 15937 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 15938 (vector int)__b); 15939 } 15940 15941 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 15942 vector unsigned int __b) { 15943 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 15944 (vector int)__b); 15945 } 15946 15947 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 15948 vector bool int __b) { 15949 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 15950 (vector int)__b); 15951 } 15952 15953 #ifdef __POWER8_VECTOR__ 15954 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 15955 vector signed long long __b) { 15956 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 15957 } 15958 15959 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 15960 vector unsigned long long __b) { 15961 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, 15962 (vector long long)__b); 15963 } 15964 15965 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 15966 vector bool long long __b) { 15967 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, 15968 (vector signed long long)__b); 15969 } 15970 15971 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 15972 vector bool long long __b) { 15973 return __builtin_altivec_vcmpequd_p( 15974 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 15975 } 15976 15977 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 15978 vector signed long long __b) { 15979 return __builtin_altivec_vcmpequd_p( 15980 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 15981 } 15982 15983 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 15984 vector unsigned long long __b) { 15985 return __builtin_altivec_vcmpequd_p( 15986 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 15987 } 15988 15989 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 15990 vector bool long long __b) { 15991 return __builtin_altivec_vcmpequd_p( 15992 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 15993 } 15994 #endif 15995 15996 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 15997 vector float __b) { 15998 #ifdef __VSX__ 15999 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 16000 #else 16001 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 16002 #endif 16003 } 16004 16005 #ifdef __VSX__ 16006 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 16007 vector double __b) { 16008 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 16009 } 16010 #endif 16011 16012 /* vec_any_nge */ 16013 16014 static __inline__ int __attribute__((__always_inline__)) 16015 vec_any_nge(vector float __a, vector float __b) { 16016 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 16017 } 16018 16019 /* vec_any_ngt */ 16020 16021 static __inline__ int __attribute__((__always_inline__)) 16022 vec_any_ngt(vector float __a, vector float __b) { 16023 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 16024 } 16025 16026 /* vec_any_nle */ 16027 16028 static __inline__ int __attribute__((__always_inline__)) 16029 vec_any_nle(vector float __a, vector float __b) { 16030 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 16031 } 16032 16033 /* vec_any_nlt */ 16034 16035 static __inline__ int __attribute__((__always_inline__)) 16036 vec_any_nlt(vector float __a, vector float __b) { 16037 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 16038 } 16039 16040 /* vec_any_numeric */ 16041 16042 static __inline__ int __attribute__((__always_inline__)) 16043 vec_any_numeric(vector float __a) { 16044 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 16045 } 16046 16047 /* vec_any_out */ 16048 16049 static __inline__ int __attribute__((__always_inline__)) 16050 vec_any_out(vector float __a, vector float __b) { 16051 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 16052 } 16053 16054 /* Power 8 Crypto functions 16055 Note: We diverge from the current GCC implementation with regard 16056 to cryptography and related functions as follows: 16057 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 16058 - The remaining ones are only available on Power8 and up so 16059 require -mpower8-vector 16060 The justification for this is that export requirements require that 16061 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 16062 support). As a result, we need to be able to turn off support for those. 16063 The remaining ones (currently controlled by -mcrypto for GCC) still 16064 need to be provided on compliant hardware even if Vector.Crypto is not 16065 provided. 16066 */ 16067 #ifdef __CRYPTO__ 16068 #define vec_sbox_be __builtin_altivec_crypto_vsbox 16069 #define vec_cipher_be __builtin_altivec_crypto_vcipher 16070 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 16071 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 16072 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 16073 16074 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16075 __builtin_crypto_vsbox(vector unsigned long long __a) { 16076 return __builtin_altivec_crypto_vsbox(__a); 16077 } 16078 16079 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16080 __builtin_crypto_vcipher(vector unsigned long long __a, 16081 vector unsigned long long __b) { 16082 return __builtin_altivec_crypto_vcipher(__a, __b); 16083 } 16084 16085 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16086 __builtin_crypto_vcipherlast(vector unsigned long long __a, 16087 vector unsigned long long __b) { 16088 return __builtin_altivec_crypto_vcipherlast(__a, __b); 16089 } 16090 16091 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16092 __builtin_crypto_vncipher(vector unsigned long long __a, 16093 vector unsigned long long __b) { 16094 return __builtin_altivec_crypto_vncipher(__a, __b); 16095 } 16096 16097 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16098 __builtin_crypto_vncipherlast(vector unsigned long long __a, 16099 vector unsigned long long __b) { 16100 return __builtin_altivec_crypto_vncipherlast(__a, __b); 16101 } 16102 16103 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 16104 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 16105 16106 #define vec_shasigma_be(X, Y, Z) \ 16107 _Generic((X), vector unsigned int \ 16108 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 16109 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 16110 #endif 16111 16112 #ifdef __POWER8_VECTOR__ 16113 static __inline__ vector bool char __ATTRS_o_ai 16114 vec_permxor(vector bool char __a, vector bool char __b, 16115 vector bool char __c) { 16116 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16117 } 16118 16119 static __inline__ vector signed char __ATTRS_o_ai 16120 vec_permxor(vector signed char __a, vector signed char __b, 16121 vector signed char __c) { 16122 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16123 } 16124 16125 static __inline__ vector unsigned char __ATTRS_o_ai 16126 vec_permxor(vector unsigned char __a, vector unsigned char __b, 16127 vector unsigned char __c) { 16128 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16129 } 16130 16131 static __inline__ vector unsigned char __ATTRS_o_ai 16132 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 16133 vector unsigned char __c) { 16134 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16135 } 16136 16137 static __inline__ vector unsigned short __ATTRS_o_ai 16138 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 16139 vector unsigned short __c) { 16140 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 16141 (vector unsigned char)__a, (vector unsigned char)__b, 16142 (vector unsigned char)__c); 16143 } 16144 16145 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 16146 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 16147 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 16148 (vector unsigned char)__a, (vector unsigned char)__b, 16149 (vector unsigned char)__c); 16150 } 16151 16152 static __inline__ vector unsigned long long __ATTRS_o_ai 16153 __builtin_crypto_vpermxor(vector unsigned long long __a, 16154 vector unsigned long long __b, 16155 vector unsigned long long __c) { 16156 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 16157 (vector unsigned char)__a, (vector unsigned char)__b, 16158 (vector unsigned char)__c); 16159 } 16160 16161 static __inline__ vector unsigned char __ATTRS_o_ai 16162 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 16163 return __builtin_altivec_crypto_vpmsumb(__a, __b); 16164 } 16165 16166 static __inline__ vector unsigned short __ATTRS_o_ai 16167 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 16168 return __builtin_altivec_crypto_vpmsumh(__a, __b); 16169 } 16170 16171 static __inline__ vector unsigned int __ATTRS_o_ai 16172 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 16173 return __builtin_altivec_crypto_vpmsumw(__a, __b); 16174 } 16175 16176 static __inline__ vector unsigned long long __ATTRS_o_ai 16177 __builtin_crypto_vpmsumb(vector unsigned long long __a, 16178 vector unsigned long long __b) { 16179 return __builtin_altivec_crypto_vpmsumd(__a, __b); 16180 } 16181 16182 static __inline__ vector signed char __ATTRS_o_ai 16183 vec_vgbbd(vector signed char __a) { 16184 return __builtin_altivec_vgbbd((vector unsigned char)__a); 16185 } 16186 16187 #define vec_pmsum_be __builtin_crypto_vpmsumb 16188 #define vec_gb __builtin_altivec_vgbbd 16189 16190 static __inline__ vector unsigned char __ATTRS_o_ai 16191 vec_vgbbd(vector unsigned char __a) { 16192 return __builtin_altivec_vgbbd(__a); 16193 } 16194 16195 static __inline__ vector long long __ATTRS_o_ai 16196 vec_vbpermq(vector signed char __a, vector signed char __b) { 16197 return __builtin_altivec_vbpermq((vector unsigned char)__a, 16198 (vector unsigned char)__b); 16199 } 16200 16201 static __inline__ vector long long __ATTRS_o_ai 16202 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 16203 return __builtin_altivec_vbpermq(__a, __b); 16204 } 16205 16206 #ifdef __powerpc64__ 16207 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16208 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 16209 return __builtin_altivec_vbpermq((vector unsigned char)__a, 16210 (vector unsigned char)__b); 16211 } 16212 #endif 16213 #endif 16214 16215 16216 /* vec_reve */ 16217 16218 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 16219 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 16220 5, 4, 3, 2, 1, 0); 16221 } 16222 16223 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 16224 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 16225 5, 4, 3, 2, 1, 0); 16226 } 16227 16228 static inline __ATTRS_o_ai vector unsigned char 16229 vec_reve(vector unsigned char __a) { 16230 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 16231 5, 4, 3, 2, 1, 0); 16232 } 16233 16234 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 16235 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16236 } 16237 16238 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 16239 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16240 } 16241 16242 static inline __ATTRS_o_ai vector unsigned int 16243 vec_reve(vector unsigned int __a) { 16244 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16245 } 16246 16247 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 16248 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 16249 } 16250 16251 static inline __ATTRS_o_ai vector signed short 16252 vec_reve(vector signed short __a) { 16253 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 16254 } 16255 16256 static inline __ATTRS_o_ai vector unsigned short 16257 vec_reve(vector unsigned short __a) { 16258 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 16259 } 16260 16261 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 16262 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16263 } 16264 16265 #ifdef __VSX__ 16266 static inline __ATTRS_o_ai vector bool long long 16267 vec_reve(vector bool long long __a) { 16268 return __builtin_shufflevector(__a, __a, 1, 0); 16269 } 16270 16271 static inline __ATTRS_o_ai vector signed long long 16272 vec_reve(vector signed long long __a) { 16273 return __builtin_shufflevector(__a, __a, 1, 0); 16274 } 16275 16276 static inline __ATTRS_o_ai vector unsigned long long 16277 vec_reve(vector unsigned long long __a) { 16278 return __builtin_shufflevector(__a, __a, 1, 0); 16279 } 16280 16281 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 16282 return __builtin_shufflevector(__a, __a, 1, 0); 16283 } 16284 #endif 16285 16286 /* vec_revb */ 16287 static __inline__ vector bool char __ATTRS_o_ai 16288 vec_revb(vector bool char __a) { 16289 return __a; 16290 } 16291 16292 static __inline__ vector signed char __ATTRS_o_ai 16293 vec_revb(vector signed char __a) { 16294 return __a; 16295 } 16296 16297 static __inline__ vector unsigned char __ATTRS_o_ai 16298 vec_revb(vector unsigned char __a) { 16299 return __a; 16300 } 16301 16302 static __inline__ vector bool short __ATTRS_o_ai 16303 vec_revb(vector bool short __a) { 16304 vector unsigned char __indices = 16305 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 16306 return vec_perm(__a, __a, __indices); 16307 } 16308 16309 static __inline__ vector signed short __ATTRS_o_ai 16310 vec_revb(vector signed short __a) { 16311 vector unsigned char __indices = 16312 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 16313 return vec_perm(__a, __a, __indices); 16314 } 16315 16316 static __inline__ vector unsigned short __ATTRS_o_ai 16317 vec_revb(vector unsigned short __a) { 16318 vector unsigned char __indices = 16319 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 16320 return vec_perm(__a, __a, __indices); 16321 } 16322 16323 static __inline__ vector bool int __ATTRS_o_ai 16324 vec_revb(vector bool int __a) { 16325 vector unsigned char __indices = 16326 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16327 return vec_perm(__a, __a, __indices); 16328 } 16329 16330 static __inline__ vector signed int __ATTRS_o_ai 16331 vec_revb(vector signed int __a) { 16332 vector unsigned char __indices = 16333 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16334 return vec_perm(__a, __a, __indices); 16335 } 16336 16337 static __inline__ vector unsigned int __ATTRS_o_ai 16338 vec_revb(vector unsigned int __a) { 16339 vector unsigned char __indices = 16340 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16341 return vec_perm(__a, __a, __indices); 16342 } 16343 16344 static __inline__ vector float __ATTRS_o_ai 16345 vec_revb(vector float __a) { 16346 vector unsigned char __indices = 16347 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16348 return vec_perm(__a, __a, __indices); 16349 } 16350 16351 #ifdef __VSX__ 16352 static __inline__ vector bool long long __ATTRS_o_ai 16353 vec_revb(vector bool long long __a) { 16354 vector unsigned char __indices = 16355 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16356 return vec_perm(__a, __a, __indices); 16357 } 16358 16359 static __inline__ vector signed long long __ATTRS_o_ai 16360 vec_revb(vector signed long long __a) { 16361 vector unsigned char __indices = 16362 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16363 return vec_perm(__a, __a, __indices); 16364 } 16365 16366 static __inline__ vector unsigned long long __ATTRS_o_ai 16367 vec_revb(vector unsigned long long __a) { 16368 vector unsigned char __indices = 16369 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16370 return vec_perm(__a, __a, __indices); 16371 } 16372 16373 static __inline__ vector double __ATTRS_o_ai 16374 vec_revb(vector double __a) { 16375 vector unsigned char __indices = 16376 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16377 return vec_perm(__a, __a, __indices); 16378 } 16379 #endif /* End __VSX__ */ 16380 16381 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16382 static __inline__ vector signed __int128 __ATTRS_o_ai 16383 vec_revb(vector signed __int128 __a) { 16384 vector unsigned char __indices = 16385 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 16386 return (vector signed __int128)vec_perm((vector signed int)__a, 16387 (vector signed int)__a, 16388 __indices); 16389 } 16390 16391 static __inline__ vector unsigned __int128 __ATTRS_o_ai 16392 vec_revb(vector unsigned __int128 __a) { 16393 vector unsigned char __indices = 16394 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 16395 return (vector unsigned __int128)vec_perm((vector signed int)__a, 16396 (vector signed int)__a, 16397 __indices); 16398 } 16399 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 16400 16401 /* vec_xl */ 16402 16403 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 16404 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 16405 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 16406 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 16407 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 16408 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 16409 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 16410 16411 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset, 16412 const signed char *__ptr) { 16413 return *(unaligned_vec_schar *)(__ptr + __offset); 16414 } 16415 16416 static inline __ATTRS_o_ai vector unsigned char 16417 vec_xl(signed long long __offset, const unsigned char *__ptr) { 16418 return *(unaligned_vec_uchar*)(__ptr + __offset); 16419 } 16420 16421 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset, 16422 const signed short *__ptr) { 16423 signed char *__addr = (signed char *)__ptr + __offset; 16424 return *(unaligned_vec_sshort *)__addr; 16425 } 16426 16427 static inline __ATTRS_o_ai vector unsigned short 16428 vec_xl(signed long long __offset, const unsigned short *__ptr) { 16429 signed char *__addr = (signed char *)__ptr + __offset; 16430 return *(unaligned_vec_ushort *)__addr; 16431 } 16432 16433 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset, 16434 const signed int *__ptr) { 16435 signed char *__addr = (signed char *)__ptr + __offset; 16436 return *(unaligned_vec_sint *)__addr; 16437 } 16438 16439 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset, 16440 const unsigned int *__ptr) { 16441 signed char *__addr = (signed char *)__ptr + __offset; 16442 return *(unaligned_vec_uint *)__addr; 16443 } 16444 16445 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset, 16446 const float *__ptr) { 16447 signed char *__addr = (signed char *)__ptr + __offset; 16448 return *(unaligned_vec_float *)__addr; 16449 } 16450 16451 #ifdef __VSX__ 16452 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 16453 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 16454 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 16455 16456 static inline __ATTRS_o_ai vector signed long long 16457 vec_xl(signed long long __offset, const signed long long *__ptr) { 16458 signed char *__addr = (signed char *)__ptr + __offset; 16459 return *(unaligned_vec_sll *)__addr; 16460 } 16461 16462 static inline __ATTRS_o_ai vector unsigned long long 16463 vec_xl(signed long long __offset, const unsigned long long *__ptr) { 16464 signed char *__addr = (signed char *)__ptr + __offset; 16465 return *(unaligned_vec_ull *)__addr; 16466 } 16467 16468 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset, 16469 const double *__ptr) { 16470 signed char *__addr = (signed char *)__ptr + __offset; 16471 return *(unaligned_vec_double *)__addr; 16472 } 16473 #endif 16474 16475 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16476 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 16477 typedef vector unsigned __int128 unaligned_vec_ui128 16478 __attribute__((aligned(1))); 16479 static inline __ATTRS_o_ai vector signed __int128 16480 vec_xl(signed long long __offset, const signed __int128 *__ptr) { 16481 signed char *__addr = (signed char *)__ptr + __offset; 16482 return *(unaligned_vec_si128 *)__addr; 16483 } 16484 16485 static inline __ATTRS_o_ai vector unsigned __int128 16486 vec_xl(signed long long __offset, const unsigned __int128 *__ptr) { 16487 signed char *__addr = (signed char *)__ptr + __offset; 16488 return *(unaligned_vec_ui128 *)__addr; 16489 } 16490 #endif 16491 16492 /* vec_xl_be */ 16493 16494 #ifdef __LITTLE_ENDIAN__ 16495 static __inline__ vector signed char __ATTRS_o_ai 16496 vec_xl_be(signed long long __offset, const signed char *__ptr) { 16497 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16498 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 16499 13, 12, 11, 10, 9, 8); 16500 } 16501 16502 static __inline__ vector unsigned char __ATTRS_o_ai 16503 vec_xl_be(signed long long __offset, const unsigned char *__ptr) { 16504 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16505 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 16506 13, 12, 11, 10, 9, 8); 16507 } 16508 16509 static __inline__ vector signed short __ATTRS_o_ai 16510 vec_xl_be(signed long long __offset, const signed short *__ptr) { 16511 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16512 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 16513 } 16514 16515 static __inline__ vector unsigned short __ATTRS_o_ai 16516 vec_xl_be(signed long long __offset, const unsigned short *__ptr) { 16517 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16518 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 16519 } 16520 16521 static __inline__ vector signed int __ATTRS_o_ai 16522 vec_xl_be(signed long long __offset, const signed int *__ptr) { 16523 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 16524 } 16525 16526 static __inline__ vector unsigned int __ATTRS_o_ai 16527 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 16528 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 16529 } 16530 16531 static __inline__ vector float __ATTRS_o_ai 16532 vec_xl_be(signed long long __offset, const float *__ptr) { 16533 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 16534 } 16535 16536 #ifdef __VSX__ 16537 static __inline__ vector signed long long __ATTRS_o_ai 16538 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 16539 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16540 } 16541 16542 static __inline__ vector unsigned long long __ATTRS_o_ai 16543 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 16544 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16545 } 16546 16547 static __inline__ vector double __ATTRS_o_ai 16548 vec_xl_be(signed long long __offset, const double *__ptr) { 16549 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 16550 } 16551 #endif 16552 16553 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16554 static __inline__ vector signed __int128 __ATTRS_o_ai 16555 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 16556 return vec_xl(__offset, __ptr); 16557 } 16558 16559 static __inline__ vector unsigned __int128 __ATTRS_o_ai 16560 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 16561 return vec_xl(__offset, __ptr); 16562 } 16563 #endif 16564 #else 16565 #define vec_xl_be vec_xl 16566 #endif 16567 16568 /* vec_xst */ 16569 16570 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec, 16571 signed long long __offset, 16572 signed char *__ptr) { 16573 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 16574 } 16575 16576 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec, 16577 signed long long __offset, 16578 unsigned char *__ptr) { 16579 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 16580 } 16581 16582 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec, 16583 signed long long __offset, 16584 signed short *__ptr) { 16585 signed char *__addr = (signed char *)__ptr + __offset; 16586 *(unaligned_vec_sshort *)__addr = __vec; 16587 } 16588 16589 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 16590 signed long long __offset, 16591 unsigned short *__ptr) { 16592 signed char *__addr = (signed char *)__ptr + __offset; 16593 *(unaligned_vec_ushort *)__addr = __vec; 16594 } 16595 16596 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 16597 signed long long __offset, 16598 signed int *__ptr) { 16599 signed char *__addr = (signed char *)__ptr + __offset; 16600 *(unaligned_vec_sint *)__addr = __vec; 16601 } 16602 16603 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec, 16604 signed long long __offset, 16605 unsigned int *__ptr) { 16606 signed char *__addr = (signed char *)__ptr + __offset; 16607 *(unaligned_vec_uint *)__addr = __vec; 16608 } 16609 16610 static inline __ATTRS_o_ai void vec_xst(vector float __vec, 16611 signed long long __offset, 16612 float *__ptr) { 16613 signed char *__addr = (signed char *)__ptr + __offset; 16614 *(unaligned_vec_float *)__addr = __vec; 16615 } 16616 16617 #ifdef __VSX__ 16618 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 16619 signed long long __offset, 16620 signed long long *__ptr) { 16621 signed char *__addr = (signed char *)__ptr + __offset; 16622 *(unaligned_vec_sll *)__addr = __vec; 16623 } 16624 16625 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 16626 signed long long __offset, 16627 unsigned long long *__ptr) { 16628 signed char *__addr = (signed char *)__ptr + __offset; 16629 *(unaligned_vec_ull *)__addr = __vec; 16630 } 16631 16632 static inline __ATTRS_o_ai void vec_xst(vector double __vec, 16633 signed long long __offset, 16634 double *__ptr) { 16635 signed char *__addr = (signed char *)__ptr + __offset; 16636 *(unaligned_vec_double *)__addr = __vec; 16637 } 16638 #endif 16639 16640 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16641 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 16642 signed long long __offset, 16643 signed __int128 *__ptr) { 16644 signed char *__addr = (signed char *)__ptr + __offset; 16645 *(unaligned_vec_si128 *)__addr = __vec; 16646 } 16647 16648 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 16649 signed long long __offset, 16650 unsigned __int128 *__ptr) { 16651 signed char *__addr = (signed char *)__ptr + __offset; 16652 *(unaligned_vec_ui128 *)__addr = __vec; 16653 } 16654 #endif 16655 16656 /* vec_xst_be */ 16657 16658 #ifdef __LITTLE_ENDIAN__ 16659 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 16660 signed long long __offset, 16661 signed char *__ptr) { 16662 vector signed char __tmp = 16663 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 16664 13, 12, 11, 10, 9, 8); 16665 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 16666 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 16667 } 16668 16669 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 16670 signed long long __offset, 16671 unsigned char *__ptr) { 16672 vector unsigned char __tmp = 16673 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 16674 13, 12, 11, 10, 9, 8); 16675 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 16676 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 16677 } 16678 16679 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 16680 signed long long __offset, 16681 signed short *__ptr) { 16682 vector signed short __tmp = 16683 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 16684 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 16685 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 16686 } 16687 16688 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 16689 signed long long __offset, 16690 unsigned short *__ptr) { 16691 vector unsigned short __tmp = 16692 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 16693 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 16694 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 16695 } 16696 16697 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 16698 signed long long __offset, 16699 signed int *__ptr) { 16700 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 16701 } 16702 16703 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 16704 signed long long __offset, 16705 unsigned int *__ptr) { 16706 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 16707 } 16708 16709 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 16710 signed long long __offset, 16711 float *__ptr) { 16712 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 16713 } 16714 16715 #ifdef __VSX__ 16716 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 16717 signed long long __offset, 16718 signed long long *__ptr) { 16719 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 16720 } 16721 16722 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 16723 signed long long __offset, 16724 unsigned long long *__ptr) { 16725 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 16726 } 16727 16728 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 16729 signed long long __offset, 16730 double *__ptr) { 16731 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 16732 } 16733 #endif 16734 16735 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16736 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 16737 signed long long __offset, 16738 signed __int128 *__ptr) { 16739 vec_xst(__vec, __offset, __ptr); 16740 } 16741 16742 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 16743 signed long long __offset, 16744 unsigned __int128 *__ptr) { 16745 vec_xst(__vec, __offset, __ptr); 16746 } 16747 #endif 16748 #else 16749 #define vec_xst_be vec_xst 16750 #endif 16751 16752 #ifdef __POWER9_VECTOR__ 16753 #define vec_test_data_class(__a, __b) \ 16754 _Generic( \ 16755 (__a), vector float \ 16756 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 16757 vector double \ 16758 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 16759 (__b))) 16760 16761 #endif /* #ifdef __POWER9_VECTOR__ */ 16762 16763 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 16764 return -__a; 16765 } 16766 16767 #ifdef __VSX__ 16768 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 16769 return -__a; 16770 } 16771 16772 #endif 16773 16774 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16775 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 16776 return -__a; 16777 } 16778 #endif 16779 16780 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 16781 return -__a; 16782 } 16783 16784 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 16785 return -__a; 16786 } 16787 16788 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 16789 return -__a; 16790 } 16791 16792 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 16793 return - vec_abs(__a); 16794 } 16795 16796 #ifdef __VSX__ 16797 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 16798 return - vec_abs(__a); 16799 } 16800 16801 #endif 16802 16803 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16804 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 16805 return __builtin_altivec_vminsd(__a, -__a); 16806 } 16807 #endif 16808 16809 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 16810 return __builtin_altivec_vminsw(__a, -__a); 16811 } 16812 16813 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 16814 return __builtin_altivec_vminsh(__a, -__a); 16815 } 16816 16817 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 16818 return __builtin_altivec_vminsb(__a, -__a); 16819 } 16820 16821 #ifdef __POWER10_VECTOR__ 16822 /* vec_pdep */ 16823 16824 static __inline__ vector unsigned long long __ATTRS_o_ai 16825 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 16826 return __builtin_altivec_vpdepd(__a, __b); 16827 } 16828 16829 /* vec_pext */ 16830 16831 static __inline__ vector unsigned long long __ATTRS_o_ai 16832 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 16833 return __builtin_altivec_vpextd(__a, __b); 16834 } 16835 16836 /* vec_cfuge */ 16837 16838 static __inline__ vector unsigned long long __ATTRS_o_ai 16839 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 16840 return __builtin_altivec_vcfuged(__a, __b); 16841 } 16842 16843 /* vec_gnb */ 16844 16845 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 16846 16847 /* vec_ternarylogic */ 16848 #ifdef __VSX__ 16849 #define vec_ternarylogic(__a, __b, __c, __imm) \ 16850 _Generic((__a), vector unsigned char \ 16851 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 16852 (vector unsigned long long)(__b), \ 16853 (vector unsigned long long)(__c), (__imm)), \ 16854 vector unsigned short \ 16855 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 16856 (vector unsigned long long)(__b), \ 16857 (vector unsigned long long)(__c), (__imm)), \ 16858 vector unsigned int \ 16859 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 16860 (vector unsigned long long)(__b), \ 16861 (vector unsigned long long)(__c), (__imm)), \ 16862 vector unsigned long long \ 16863 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 16864 (vector unsigned long long)(__b), \ 16865 (vector unsigned long long)(__c), (__imm)), \ 16866 vector unsigned __int128 \ 16867 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 16868 (vector unsigned long long)(__b), \ 16869 (vector unsigned long long)(__c), (__imm))) 16870 #endif /* __VSX__ */ 16871 16872 /* vec_genpcvm */ 16873 16874 #ifdef __VSX__ 16875 #define vec_genpcvm(__a, __imm) \ 16876 _Generic((__a), vector unsigned char \ 16877 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ 16878 vector unsigned short \ 16879 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ 16880 vector unsigned int \ 16881 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ 16882 vector unsigned long long \ 16883 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) 16884 #endif /* __VSX__ */ 16885 16886 /* vec_clrl */ 16887 16888 static __inline__ vector signed char __ATTRS_o_ai 16889 vec_clrl(vector signed char __a, unsigned int __n) { 16890 #ifdef __LITTLE_ENDIAN__ 16891 return __builtin_altivec_vclrrb(__a, __n); 16892 #else 16893 return __builtin_altivec_vclrlb( __a, __n); 16894 #endif 16895 } 16896 16897 static __inline__ vector unsigned char __ATTRS_o_ai 16898 vec_clrl(vector unsigned char __a, unsigned int __n) { 16899 #ifdef __LITTLE_ENDIAN__ 16900 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 16901 #else 16902 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 16903 #endif 16904 } 16905 16906 /* vec_clrr */ 16907 16908 static __inline__ vector signed char __ATTRS_o_ai 16909 vec_clrr(vector signed char __a, unsigned int __n) { 16910 #ifdef __LITTLE_ENDIAN__ 16911 return __builtin_altivec_vclrlb(__a, __n); 16912 #else 16913 return __builtin_altivec_vclrrb( __a, __n); 16914 #endif 16915 } 16916 16917 static __inline__ vector unsigned char __ATTRS_o_ai 16918 vec_clrr(vector unsigned char __a, unsigned int __n) { 16919 #ifdef __LITTLE_ENDIAN__ 16920 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 16921 #else 16922 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 16923 #endif 16924 } 16925 16926 /* vec_cntlzm */ 16927 16928 static __inline__ vector unsigned long long __ATTRS_o_ai 16929 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 16930 return __builtin_altivec_vclzdm(__a, __b); 16931 } 16932 16933 /* vec_cnttzm */ 16934 16935 static __inline__ vector unsigned long long __ATTRS_o_ai 16936 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 16937 return __builtin_altivec_vctzdm(__a, __b); 16938 } 16939 16940 /* vec_sldbi */ 16941 16942 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) 16943 16944 /* vec_srdbi */ 16945 16946 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) 16947 16948 /* vec_insertl */ 16949 16950 static __inline__ vector unsigned char __ATTRS_o_ai 16951 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 16952 #ifdef __LITTLE_ENDIAN__ 16953 return __builtin_altivec_vinsbrx(__b, __c, __a); 16954 #else 16955 return __builtin_altivec_vinsblx(__b, __c, __a); 16956 #endif 16957 } 16958 16959 static __inline__ vector unsigned short __ATTRS_o_ai 16960 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 16961 #ifdef __LITTLE_ENDIAN__ 16962 return __builtin_altivec_vinshrx(__b, __c, __a); 16963 #else 16964 return __builtin_altivec_vinshlx(__b, __c, __a); 16965 #endif 16966 } 16967 16968 static __inline__ vector unsigned int __ATTRS_o_ai 16969 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 16970 #ifdef __LITTLE_ENDIAN__ 16971 return __builtin_altivec_vinswrx(__b, __c, __a); 16972 #else 16973 return __builtin_altivec_vinswlx(__b, __c, __a); 16974 #endif 16975 } 16976 16977 static __inline__ vector unsigned long long __ATTRS_o_ai 16978 vec_insertl(unsigned long long __a, vector unsigned long long __b, 16979 unsigned int __c) { 16980 #ifdef __LITTLE_ENDIAN__ 16981 return __builtin_altivec_vinsdrx(__b, __c, __a); 16982 #else 16983 return __builtin_altivec_vinsdlx(__b, __c, __a); 16984 #endif 16985 } 16986 16987 static __inline__ vector unsigned char __ATTRS_o_ai 16988 vec_insertl(vector unsigned char __a, vector unsigned char __b, 16989 unsigned int __c) { 16990 #ifdef __LITTLE_ENDIAN__ 16991 return __builtin_altivec_vinsbvrx(__b, __c, __a); 16992 #else 16993 return __builtin_altivec_vinsbvlx(__b, __c, __a); 16994 #endif 16995 } 16996 16997 static __inline__ vector unsigned short __ATTRS_o_ai 16998 vec_insertl(vector unsigned short __a, vector unsigned short __b, 16999 unsigned int __c) { 17000 #ifdef __LITTLE_ENDIAN__ 17001 return __builtin_altivec_vinshvrx(__b, __c, __a); 17002 #else 17003 return __builtin_altivec_vinshvlx(__b, __c, __a); 17004 #endif 17005 } 17006 17007 static __inline__ vector unsigned int __ATTRS_o_ai 17008 vec_insertl(vector unsigned int __a, vector unsigned int __b, 17009 unsigned int __c) { 17010 #ifdef __LITTLE_ENDIAN__ 17011 return __builtin_altivec_vinswvrx(__b, __c, __a); 17012 #else 17013 return __builtin_altivec_vinswvlx(__b, __c, __a); 17014 #endif 17015 } 17016 17017 /* vec_inserth */ 17018 17019 static __inline__ vector unsigned char __ATTRS_o_ai 17020 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 17021 #ifdef __LITTLE_ENDIAN__ 17022 return __builtin_altivec_vinsblx(__b, __c, __a); 17023 #else 17024 return __builtin_altivec_vinsbrx(__b, __c, __a); 17025 #endif 17026 } 17027 17028 static __inline__ vector unsigned short __ATTRS_o_ai 17029 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 17030 #ifdef __LITTLE_ENDIAN__ 17031 return __builtin_altivec_vinshlx(__b, __c, __a); 17032 #else 17033 return __builtin_altivec_vinshrx(__b, __c, __a); 17034 #endif 17035 } 17036 17037 static __inline__ vector unsigned int __ATTRS_o_ai 17038 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 17039 #ifdef __LITTLE_ENDIAN__ 17040 return __builtin_altivec_vinswlx(__b, __c, __a); 17041 #else 17042 return __builtin_altivec_vinswrx(__b, __c, __a); 17043 #endif 17044 } 17045 17046 static __inline__ vector unsigned long long __ATTRS_o_ai 17047 vec_inserth(unsigned long long __a, vector unsigned long long __b, 17048 unsigned int __c) { 17049 #ifdef __LITTLE_ENDIAN__ 17050 return __builtin_altivec_vinsdlx(__b, __c, __a); 17051 #else 17052 return __builtin_altivec_vinsdrx(__b, __c, __a); 17053 #endif 17054 } 17055 17056 static __inline__ vector unsigned char __ATTRS_o_ai 17057 vec_inserth(vector unsigned char __a, vector unsigned char __b, 17058 unsigned int __c) { 17059 #ifdef __LITTLE_ENDIAN__ 17060 return __builtin_altivec_vinsbvlx(__b, __c, __a); 17061 #else 17062 return __builtin_altivec_vinsbvrx(__b, __c, __a); 17063 #endif 17064 } 17065 17066 static __inline__ vector unsigned short __ATTRS_o_ai 17067 vec_inserth(vector unsigned short __a, vector unsigned short __b, 17068 unsigned int __c) { 17069 #ifdef __LITTLE_ENDIAN__ 17070 return __builtin_altivec_vinshvlx(__b, __c, __a); 17071 #else 17072 return __builtin_altivec_vinshvrx(__b, __c, __a); 17073 #endif 17074 } 17075 17076 static __inline__ vector unsigned int __ATTRS_o_ai 17077 vec_inserth(vector unsigned int __a, vector unsigned int __b, 17078 unsigned int __c) { 17079 #ifdef __LITTLE_ENDIAN__ 17080 return __builtin_altivec_vinswvlx(__b, __c, __a); 17081 #else 17082 return __builtin_altivec_vinswvrx(__b, __c, __a); 17083 #endif 17084 } 17085 17086 #ifdef __VSX__ 17087 17088 /* vec_permx */ 17089 17090 #define vec_permx(__a, __b, __c, __d) \ 17091 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) 17092 17093 /* vec_blendv */ 17094 17095 static __inline__ vector signed char __ATTRS_o_ai 17096 vec_blendv(vector signed char __a, vector signed char __b, 17097 vector unsigned char __c) { 17098 return __builtin_vsx_xxblendvb(__a, __b, __c); 17099 } 17100 17101 static __inline__ vector unsigned char __ATTRS_o_ai 17102 vec_blendv(vector unsigned char __a, vector unsigned char __b, 17103 vector unsigned char __c) { 17104 return __builtin_vsx_xxblendvb(__a, __b, __c); 17105 } 17106 17107 static __inline__ vector signed short __ATTRS_o_ai 17108 vec_blendv(vector signed short __a, vector signed short __b, 17109 vector unsigned short __c) { 17110 return __builtin_vsx_xxblendvh(__a, __b, __c); 17111 } 17112 17113 static __inline__ vector unsigned short __ATTRS_o_ai 17114 vec_blendv(vector unsigned short __a, vector unsigned short __b, 17115 vector unsigned short __c) { 17116 return __builtin_vsx_xxblendvh(__a, __b, __c); 17117 } 17118 17119 static __inline__ vector signed int __ATTRS_o_ai 17120 vec_blendv(vector signed int __a, vector signed int __b, 17121 vector unsigned int __c) { 17122 return __builtin_vsx_xxblendvw(__a, __b, __c); 17123 } 17124 17125 static __inline__ vector unsigned int __ATTRS_o_ai 17126 vec_blendv(vector unsigned int __a, vector unsigned int __b, 17127 vector unsigned int __c) { 17128 return __builtin_vsx_xxblendvw(__a, __b, __c); 17129 } 17130 17131 static __inline__ vector signed long long __ATTRS_o_ai 17132 vec_blendv(vector signed long long __a, vector signed long long __b, 17133 vector unsigned long long __c) { 17134 return __builtin_vsx_xxblendvd(__a, __b, __c); 17135 } 17136 17137 static __inline__ vector unsigned long long __ATTRS_o_ai 17138 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 17139 vector unsigned long long __c) { 17140 return __builtin_vsx_xxblendvd(__a, __b, __c); 17141 } 17142 17143 static __inline__ vector float __ATTRS_o_ai 17144 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 17145 return __builtin_vsx_xxblendvw(__a, __b, __c); 17146 } 17147 17148 static __inline__ vector double __ATTRS_o_ai 17149 vec_blendv(vector double __a, vector double __b, 17150 vector unsigned long long __c) { 17151 return __builtin_vsx_xxblendvd(__a, __b, __c); 17152 } 17153 17154 /* vec_splati */ 17155 17156 #define vec_splati(__a) \ 17157 _Generic((__a), signed int \ 17158 : ((vector signed int)__a), unsigned int \ 17159 : ((vector unsigned int)__a), float \ 17160 : ((vector float)__a)) 17161 17162 /* vec_spatid */ 17163 17164 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 17165 return ((vector double)((double)__a)); 17166 } 17167 17168 /* vec_splati_ins */ 17169 17170 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 17171 vector signed int __a, const unsigned int __b, const signed int __c) { 17172 #ifdef __LITTLE_ENDIAN__ 17173 __a[1 - __b] = __c; 17174 __a[3 - __b] = __c; 17175 #else 17176 __a[__b] = __c; 17177 __a[2 + __b] = __c; 17178 #endif 17179 return __a; 17180 } 17181 17182 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 17183 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 17184 #ifdef __LITTLE_ENDIAN__ 17185 __a[1 - __b] = __c; 17186 __a[3 - __b] = __c; 17187 #else 17188 __a[__b] = __c; 17189 __a[2 + __b] = __c; 17190 #endif 17191 return __a; 17192 } 17193 17194 static __inline__ vector float __ATTRS_o_ai 17195 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 17196 #ifdef __LITTLE_ENDIAN__ 17197 __a[1 - __b] = __c; 17198 __a[3 - __b] = __c; 17199 #else 17200 __a[__b] = __c; 17201 __a[2 + __b] = __c; 17202 #endif 17203 return __a; 17204 } 17205 17206 /* vec_test_lsbb_all_ones */ 17207 17208 static __inline__ int __ATTRS_o_ai 17209 vec_test_lsbb_all_ones(vector unsigned char __a) { 17210 return __builtin_vsx_xvtlsbb(__a, 1); 17211 } 17212 17213 /* vec_test_lsbb_all_zeros */ 17214 17215 static __inline__ int __ATTRS_o_ai 17216 vec_test_lsbb_all_zeros(vector unsigned char __a) { 17217 return __builtin_vsx_xvtlsbb(__a, 0); 17218 } 17219 #endif /* __VSX__ */ 17220 #endif /* __POWER10_VECTOR__ */ 17221 17222 #undef __ATTRS_o_ai 17223 17224 #endif /* __ALTIVEC_H */ 17225