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 __POWER10_VECTOR__ 1713 static __inline__ vector bool __int128 __ATTRS_o_ai 1714 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { 1715 return (vector bool __int128)__builtin_altivec_vcmpequq( 1716 (vector bool __int128)__a, (vector bool __int128)__b); 1717 } 1718 1719 static __inline__ vector bool __int128 __ATTRS_o_ai 1720 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1721 return (vector bool __int128)__builtin_altivec_vcmpequq( 1722 (vector bool __int128)__a, (vector bool __int128)__b); 1723 } 1724 #endif 1725 1726 #ifdef __POWER9_VECTOR__ 1727 /* vec_cmpne */ 1728 1729 static __inline__ vector bool char __ATTRS_o_ai 1730 vec_cmpne(vector bool char __a, vector bool char __b) { 1731 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1732 (vector char)__b); 1733 } 1734 1735 static __inline__ vector bool char __ATTRS_o_ai 1736 vec_cmpne(vector signed char __a, vector signed char __b) { 1737 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1738 (vector char)__b); 1739 } 1740 1741 static __inline__ vector bool char __ATTRS_o_ai 1742 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1743 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1744 (vector char)__b); 1745 } 1746 1747 static __inline__ vector bool short __ATTRS_o_ai 1748 vec_cmpne(vector bool short __a, vector bool short __b) { 1749 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1750 (vector short)__b); 1751 } 1752 1753 static __inline__ vector bool short __ATTRS_o_ai 1754 vec_cmpne(vector signed short __a, vector signed short __b) { 1755 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1756 (vector short)__b); 1757 } 1758 1759 static __inline__ vector bool short __ATTRS_o_ai 1760 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1761 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1762 (vector short)__b); 1763 } 1764 1765 static __inline__ vector bool int __ATTRS_o_ai 1766 vec_cmpne(vector bool int __a, vector bool int __b) { 1767 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1768 (vector int)__b); 1769 } 1770 1771 static __inline__ vector bool int __ATTRS_o_ai 1772 vec_cmpne(vector signed int __a, vector signed int __b) { 1773 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1774 (vector int)__b); 1775 } 1776 1777 static __inline__ vector bool int __ATTRS_o_ai 1778 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1779 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1780 (vector int)__b); 1781 } 1782 1783 static __inline__ vector bool int __ATTRS_o_ai 1784 vec_cmpne(vector float __a, vector float __b) { 1785 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1786 (vector int)__b); 1787 } 1788 1789 #ifdef __POWER10_VECTOR__ 1790 static __inline__ vector bool __int128 __ATTRS_o_ai 1791 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1792 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1793 (vector bool __int128)__a, (vector bool __int128)__b)); 1794 } 1795 1796 static __inline__ vector bool __int128 __ATTRS_o_ai 1797 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { 1798 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1799 (vector bool __int128)__a, (vector bool __int128)__b)); 1800 } 1801 #endif 1802 1803 /* vec_cmpnez */ 1804 1805 static __inline__ vector bool char __ATTRS_o_ai 1806 vec_cmpnez(vector signed char __a, vector signed char __b) { 1807 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1808 (vector char)__b); 1809 } 1810 1811 static __inline__ vector bool char __ATTRS_o_ai 1812 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1813 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1814 (vector char)__b); 1815 } 1816 1817 static __inline__ vector bool short __ATTRS_o_ai 1818 vec_cmpnez(vector signed short __a, vector signed short __b) { 1819 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1820 (vector short)__b); 1821 } 1822 1823 static __inline__ vector bool short __ATTRS_o_ai 1824 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1825 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1826 (vector short)__b); 1827 } 1828 1829 static __inline__ vector bool int __ATTRS_o_ai 1830 vec_cmpnez(vector signed int __a, vector signed int __b) { 1831 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1832 (vector int)__b); 1833 } 1834 1835 static __inline__ vector bool int __ATTRS_o_ai 1836 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1837 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1838 (vector int)__b); 1839 } 1840 1841 static __inline__ signed int __ATTRS_o_ai 1842 vec_cntlz_lsbb(vector signed char __a) { 1843 #ifdef __LITTLE_ENDIAN__ 1844 return __builtin_altivec_vctzlsbb(__a); 1845 #else 1846 return __builtin_altivec_vclzlsbb(__a); 1847 #endif 1848 } 1849 1850 static __inline__ signed int __ATTRS_o_ai 1851 vec_cntlz_lsbb(vector unsigned char __a) { 1852 #ifdef __LITTLE_ENDIAN__ 1853 return __builtin_altivec_vctzlsbb(__a); 1854 #else 1855 return __builtin_altivec_vclzlsbb(__a); 1856 #endif 1857 } 1858 1859 static __inline__ signed int __ATTRS_o_ai 1860 vec_cnttz_lsbb(vector signed char __a) { 1861 #ifdef __LITTLE_ENDIAN__ 1862 return __builtin_altivec_vclzlsbb(__a); 1863 #else 1864 return __builtin_altivec_vctzlsbb(__a); 1865 #endif 1866 } 1867 1868 static __inline__ signed int __ATTRS_o_ai 1869 vec_cnttz_lsbb(vector unsigned char __a) { 1870 #ifdef __LITTLE_ENDIAN__ 1871 return __builtin_altivec_vclzlsbb(__a); 1872 #else 1873 return __builtin_altivec_vctzlsbb(__a); 1874 #endif 1875 } 1876 1877 static __inline__ vector unsigned int __ATTRS_o_ai 1878 vec_parity_lsbb(vector unsigned int __a) { 1879 return __builtin_altivec_vprtybw(__a); 1880 } 1881 1882 static __inline__ vector unsigned int __ATTRS_o_ai 1883 vec_parity_lsbb(vector signed int __a) { 1884 return __builtin_altivec_vprtybw(__a); 1885 } 1886 1887 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1888 vec_parity_lsbb(vector unsigned __int128 __a) { 1889 return __builtin_altivec_vprtybq(__a); 1890 } 1891 1892 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1893 vec_parity_lsbb(vector signed __int128 __a) { 1894 return __builtin_altivec_vprtybq(__a); 1895 } 1896 1897 static __inline__ vector unsigned long long __ATTRS_o_ai 1898 vec_parity_lsbb(vector unsigned long long __a) { 1899 return __builtin_altivec_vprtybd(__a); 1900 } 1901 1902 static __inline__ vector unsigned long long __ATTRS_o_ai 1903 vec_parity_lsbb(vector signed long long __a) { 1904 return __builtin_altivec_vprtybd(__a); 1905 } 1906 1907 #else 1908 /* vec_cmpne */ 1909 1910 static __inline__ vector bool char __ATTRS_o_ai 1911 vec_cmpne(vector bool char __a, vector bool char __b) { 1912 return ~(vec_cmpeq(__a, __b)); 1913 } 1914 1915 static __inline__ vector bool char __ATTRS_o_ai 1916 vec_cmpne(vector signed char __a, vector signed char __b) { 1917 return ~(vec_cmpeq(__a, __b)); 1918 } 1919 1920 static __inline__ vector bool char __ATTRS_o_ai 1921 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1922 return ~(vec_cmpeq(__a, __b)); 1923 } 1924 1925 static __inline__ vector bool short __ATTRS_o_ai 1926 vec_cmpne(vector bool short __a, vector bool short __b) { 1927 return ~(vec_cmpeq(__a, __b)); 1928 } 1929 1930 static __inline__ vector bool short __ATTRS_o_ai 1931 vec_cmpne(vector signed short __a, vector signed short __b) { 1932 return ~(vec_cmpeq(__a, __b)); 1933 } 1934 1935 static __inline__ vector bool short __ATTRS_o_ai 1936 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1937 return ~(vec_cmpeq(__a, __b)); 1938 } 1939 1940 static __inline__ vector bool int __ATTRS_o_ai 1941 vec_cmpne(vector bool int __a, vector bool int __b) { 1942 return ~(vec_cmpeq(__a, __b)); 1943 } 1944 1945 static __inline__ vector bool int __ATTRS_o_ai 1946 vec_cmpne(vector signed int __a, vector signed int __b) { 1947 return ~(vec_cmpeq(__a, __b)); 1948 } 1949 1950 static __inline__ vector bool int __ATTRS_o_ai 1951 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1952 return ~(vec_cmpeq(__a, __b)); 1953 } 1954 1955 static __inline__ vector bool int __ATTRS_o_ai 1956 vec_cmpne(vector float __a, vector float __b) { 1957 return ~(vec_cmpeq(__a, __b)); 1958 } 1959 #endif 1960 1961 #ifdef __POWER8_VECTOR__ 1962 static __inline__ vector bool long long __ATTRS_o_ai 1963 vec_cmpne(vector bool long long __a, vector bool long long __b) { 1964 return (vector bool long long) 1965 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1966 } 1967 1968 static __inline__ vector bool long long __ATTRS_o_ai 1969 vec_cmpne(vector signed long long __a, vector signed long long __b) { 1970 return (vector bool long long) 1971 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1972 } 1973 1974 static __inline__ vector bool long long __ATTRS_o_ai 1975 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 1976 return (vector bool long long) 1977 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1978 } 1979 #endif 1980 1981 #ifdef __VSX__ 1982 static __inline__ vector bool long long __ATTRS_o_ai 1983 vec_cmpne(vector double __a, vector double __b) { 1984 return (vector bool long long) 1985 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 1986 } 1987 #endif 1988 1989 /* vec_cmpgt */ 1990 1991 static __inline__ vector bool char __ATTRS_o_ai 1992 vec_cmpgt(vector signed char __a, vector signed char __b) { 1993 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 1994 } 1995 1996 static __inline__ vector bool char __ATTRS_o_ai 1997 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 1998 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 1999 } 2000 2001 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 2002 vector short __b) { 2003 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2004 } 2005 2006 static __inline__ vector bool short __ATTRS_o_ai 2007 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 2008 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2009 } 2010 2011 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 2012 vector int __b) { 2013 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2014 } 2015 2016 static __inline__ vector bool int __ATTRS_o_ai 2017 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 2018 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2019 } 2020 2021 #ifdef __POWER8_VECTOR__ 2022 static __inline__ vector bool long long __ATTRS_o_ai 2023 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2024 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 2025 } 2026 2027 static __inline__ vector bool long long __ATTRS_o_ai 2028 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2029 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2030 } 2031 #endif 2032 2033 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2034 vector float __b) { 2035 #ifdef __VSX__ 2036 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2037 #else 2038 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2039 #endif 2040 } 2041 2042 #ifdef __VSX__ 2043 static __inline__ vector bool long long __ATTRS_o_ai 2044 vec_cmpgt(vector double __a, vector double __b) { 2045 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2046 } 2047 #endif 2048 2049 #ifdef __POWER10_VECTOR__ 2050 static __inline__ vector bool __int128 __ATTRS_o_ai 2051 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { 2052 return (vector bool __int128)__builtin_altivec_vcmpgtsq( 2053 (vector bool __int128)__a, (vector bool __int128)__b); 2054 } 2055 2056 static __inline__ vector bool __int128 __ATTRS_o_ai 2057 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2058 return (vector bool __int128)__builtin_altivec_vcmpgtuq( 2059 (vector bool __int128)__a, (vector bool __int128)__b); 2060 } 2061 #endif 2062 2063 /* vec_cmpge */ 2064 2065 static __inline__ vector bool char __ATTRS_o_ai 2066 vec_cmpge(vector signed char __a, vector signed char __b) { 2067 return ~(vec_cmpgt(__b, __a)); 2068 } 2069 2070 static __inline__ vector bool char __ATTRS_o_ai 2071 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2072 return ~(vec_cmpgt(__b, __a)); 2073 } 2074 2075 static __inline__ vector bool short __ATTRS_o_ai 2076 vec_cmpge(vector signed short __a, vector signed short __b) { 2077 return ~(vec_cmpgt(__b, __a)); 2078 } 2079 2080 static __inline__ vector bool short __ATTRS_o_ai 2081 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2082 return ~(vec_cmpgt(__b, __a)); 2083 } 2084 2085 static __inline__ vector bool int __ATTRS_o_ai 2086 vec_cmpge(vector signed int __a, vector signed int __b) { 2087 return ~(vec_cmpgt(__b, __a)); 2088 } 2089 2090 static __inline__ vector bool int __ATTRS_o_ai 2091 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2092 return ~(vec_cmpgt(__b, __a)); 2093 } 2094 2095 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2096 vector float __b) { 2097 #ifdef __VSX__ 2098 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2099 #else 2100 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2101 #endif 2102 } 2103 2104 #ifdef __VSX__ 2105 static __inline__ vector bool long long __ATTRS_o_ai 2106 vec_cmpge(vector double __a, vector double __b) { 2107 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2108 } 2109 #endif 2110 2111 #ifdef __POWER8_VECTOR__ 2112 static __inline__ vector bool long long __ATTRS_o_ai 2113 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2114 return ~(vec_cmpgt(__b, __a)); 2115 } 2116 2117 static __inline__ vector bool long long __ATTRS_o_ai 2118 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2119 return ~(vec_cmpgt(__b, __a)); 2120 } 2121 #endif 2122 2123 #ifdef __POWER10_VECTOR__ 2124 static __inline__ vector bool __int128 __ATTRS_o_ai 2125 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { 2126 return ~(vec_cmpgt(__b, __a)); 2127 } 2128 2129 static __inline__ vector bool __int128 __ATTRS_o_ai 2130 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2131 return ~(vec_cmpgt(__b, __a)); 2132 } 2133 #endif 2134 2135 /* vec_vcmpgefp */ 2136 2137 static __inline__ vector bool int __attribute__((__always_inline__)) 2138 vec_vcmpgefp(vector float __a, vector float __b) { 2139 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2140 } 2141 2142 /* vec_vcmpgtsb */ 2143 2144 static __inline__ vector bool char __attribute__((__always_inline__)) 2145 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2146 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2147 } 2148 2149 /* vec_vcmpgtub */ 2150 2151 static __inline__ vector bool char __attribute__((__always_inline__)) 2152 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2153 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2154 } 2155 2156 /* vec_vcmpgtsh */ 2157 2158 static __inline__ vector bool short __attribute__((__always_inline__)) 2159 vec_vcmpgtsh(vector short __a, vector short __b) { 2160 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2161 } 2162 2163 /* vec_vcmpgtuh */ 2164 2165 static __inline__ vector bool short __attribute__((__always_inline__)) 2166 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2167 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2168 } 2169 2170 /* vec_vcmpgtsw */ 2171 2172 static __inline__ vector bool int __attribute__((__always_inline__)) 2173 vec_vcmpgtsw(vector int __a, vector int __b) { 2174 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2175 } 2176 2177 /* vec_vcmpgtuw */ 2178 2179 static __inline__ vector bool int __attribute__((__always_inline__)) 2180 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2181 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2182 } 2183 2184 /* vec_vcmpgtfp */ 2185 2186 static __inline__ vector bool int __attribute__((__always_inline__)) 2187 vec_vcmpgtfp(vector float __a, vector float __b) { 2188 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2189 } 2190 2191 /* vec_cmple */ 2192 2193 static __inline__ vector bool char __ATTRS_o_ai 2194 vec_cmple(vector signed char __a, vector signed char __b) { 2195 return vec_cmpge(__b, __a); 2196 } 2197 2198 static __inline__ vector bool char __ATTRS_o_ai 2199 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2200 return vec_cmpge(__b, __a); 2201 } 2202 2203 static __inline__ vector bool short __ATTRS_o_ai 2204 vec_cmple(vector signed short __a, vector signed short __b) { 2205 return vec_cmpge(__b, __a); 2206 } 2207 2208 static __inline__ vector bool short __ATTRS_o_ai 2209 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2210 return vec_cmpge(__b, __a); 2211 } 2212 2213 static __inline__ vector bool int __ATTRS_o_ai 2214 vec_cmple(vector signed int __a, vector signed int __b) { 2215 return vec_cmpge(__b, __a); 2216 } 2217 2218 static __inline__ vector bool int __ATTRS_o_ai 2219 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2220 return vec_cmpge(__b, __a); 2221 } 2222 2223 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2224 vector float __b) { 2225 return vec_cmpge(__b, __a); 2226 } 2227 2228 #ifdef __VSX__ 2229 static __inline__ vector bool long long __ATTRS_o_ai 2230 vec_cmple(vector double __a, vector double __b) { 2231 return vec_cmpge(__b, __a); 2232 } 2233 #endif 2234 2235 #ifdef __POWER8_VECTOR__ 2236 static __inline__ vector bool long long __ATTRS_o_ai 2237 vec_cmple(vector signed long long __a, vector signed long long __b) { 2238 return vec_cmpge(__b, __a); 2239 } 2240 2241 static __inline__ vector bool long long __ATTRS_o_ai 2242 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2243 return vec_cmpge(__b, __a); 2244 } 2245 #endif 2246 2247 #ifdef __POWER10_VECTOR__ 2248 static __inline__ vector bool __int128 __ATTRS_o_ai 2249 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { 2250 return vec_cmpge(__b, __a); 2251 } 2252 2253 static __inline__ vector bool __int128 __ATTRS_o_ai 2254 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2255 return vec_cmpge(__b, __a); 2256 } 2257 #endif 2258 2259 /* vec_cmplt */ 2260 2261 static __inline__ vector bool char __ATTRS_o_ai 2262 vec_cmplt(vector signed char __a, vector signed char __b) { 2263 return vec_cmpgt(__b, __a); 2264 } 2265 2266 static __inline__ vector bool char __ATTRS_o_ai 2267 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2268 return vec_cmpgt(__b, __a); 2269 } 2270 2271 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2272 vector short __b) { 2273 return vec_cmpgt(__b, __a); 2274 } 2275 2276 static __inline__ vector bool short __ATTRS_o_ai 2277 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2278 return vec_cmpgt(__b, __a); 2279 } 2280 2281 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2282 vector int __b) { 2283 return vec_cmpgt(__b, __a); 2284 } 2285 2286 static __inline__ vector bool int __ATTRS_o_ai 2287 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2288 return vec_cmpgt(__b, __a); 2289 } 2290 2291 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2292 vector float __b) { 2293 return vec_cmpgt(__b, __a); 2294 } 2295 2296 #ifdef __VSX__ 2297 static __inline__ vector bool long long __ATTRS_o_ai 2298 vec_cmplt(vector double __a, vector double __b) { 2299 return vec_cmpgt(__b, __a); 2300 } 2301 #endif 2302 2303 #ifdef __POWER10_VECTOR__ 2304 static __inline__ vector bool __int128 __ATTRS_o_ai 2305 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { 2306 return vec_cmpgt(__b, __a); 2307 } 2308 2309 static __inline__ vector bool __int128 __ATTRS_o_ai 2310 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2311 return vec_cmpgt(__b, __a); 2312 } 2313 #endif 2314 2315 #ifdef __POWER8_VECTOR__ 2316 static __inline__ vector bool long long __ATTRS_o_ai 2317 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2318 return vec_cmpgt(__b, __a); 2319 } 2320 2321 static __inline__ vector bool long long __ATTRS_o_ai 2322 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2323 return vec_cmpgt(__b, __a); 2324 } 2325 2326 /* vec_popcnt */ 2327 2328 static __inline__ vector signed char __ATTRS_o_ai 2329 vec_popcnt(vector signed char __a) { 2330 return __builtin_altivec_vpopcntb(__a); 2331 } 2332 static __inline__ vector unsigned char __ATTRS_o_ai 2333 vec_popcnt(vector unsigned char __a) { 2334 return __builtin_altivec_vpopcntb(__a); 2335 } 2336 static __inline__ vector signed short __ATTRS_o_ai 2337 vec_popcnt(vector signed short __a) { 2338 return __builtin_altivec_vpopcnth(__a); 2339 } 2340 static __inline__ vector unsigned short __ATTRS_o_ai 2341 vec_popcnt(vector unsigned short __a) { 2342 return __builtin_altivec_vpopcnth(__a); 2343 } 2344 static __inline__ vector signed int __ATTRS_o_ai 2345 vec_popcnt(vector signed int __a) { 2346 return __builtin_altivec_vpopcntw(__a); 2347 } 2348 static __inline__ vector unsigned int __ATTRS_o_ai 2349 vec_popcnt(vector unsigned int __a) { 2350 return __builtin_altivec_vpopcntw(__a); 2351 } 2352 static __inline__ vector signed long long __ATTRS_o_ai 2353 vec_popcnt(vector signed long long __a) { 2354 return __builtin_altivec_vpopcntd(__a); 2355 } 2356 static __inline__ vector unsigned long long __ATTRS_o_ai 2357 vec_popcnt(vector unsigned long long __a) { 2358 return __builtin_altivec_vpopcntd(__a); 2359 } 2360 2361 /* vec_cntlz */ 2362 2363 static __inline__ vector signed char __ATTRS_o_ai 2364 vec_cntlz(vector signed char __a) { 2365 return __builtin_altivec_vclzb(__a); 2366 } 2367 static __inline__ vector unsigned char __ATTRS_o_ai 2368 vec_cntlz(vector unsigned char __a) { 2369 return __builtin_altivec_vclzb(__a); 2370 } 2371 static __inline__ vector signed short __ATTRS_o_ai 2372 vec_cntlz(vector signed short __a) { 2373 return __builtin_altivec_vclzh(__a); 2374 } 2375 static __inline__ vector unsigned short __ATTRS_o_ai 2376 vec_cntlz(vector unsigned short __a) { 2377 return __builtin_altivec_vclzh(__a); 2378 } 2379 static __inline__ vector signed int __ATTRS_o_ai 2380 vec_cntlz(vector signed int __a) { 2381 return __builtin_altivec_vclzw(__a); 2382 } 2383 static __inline__ vector unsigned int __ATTRS_o_ai 2384 vec_cntlz(vector unsigned int __a) { 2385 return __builtin_altivec_vclzw(__a); 2386 } 2387 static __inline__ vector signed long long __ATTRS_o_ai 2388 vec_cntlz(vector signed long long __a) { 2389 return __builtin_altivec_vclzd(__a); 2390 } 2391 static __inline__ vector unsigned long long __ATTRS_o_ai 2392 vec_cntlz(vector unsigned long long __a) { 2393 return __builtin_altivec_vclzd(__a); 2394 } 2395 #endif 2396 2397 #ifdef __POWER9_VECTOR__ 2398 2399 /* vec_cnttz */ 2400 2401 static __inline__ vector signed char __ATTRS_o_ai 2402 vec_cnttz(vector signed char __a) { 2403 return __builtin_altivec_vctzb(__a); 2404 } 2405 static __inline__ vector unsigned char __ATTRS_o_ai 2406 vec_cnttz(vector unsigned char __a) { 2407 return __builtin_altivec_vctzb(__a); 2408 } 2409 static __inline__ vector signed short __ATTRS_o_ai 2410 vec_cnttz(vector signed short __a) { 2411 return __builtin_altivec_vctzh(__a); 2412 } 2413 static __inline__ vector unsigned short __ATTRS_o_ai 2414 vec_cnttz(vector unsigned short __a) { 2415 return __builtin_altivec_vctzh(__a); 2416 } 2417 static __inline__ vector signed int __ATTRS_o_ai 2418 vec_cnttz(vector signed int __a) { 2419 return __builtin_altivec_vctzw(__a); 2420 } 2421 static __inline__ vector unsigned int __ATTRS_o_ai 2422 vec_cnttz(vector unsigned int __a) { 2423 return __builtin_altivec_vctzw(__a); 2424 } 2425 static __inline__ vector signed long long __ATTRS_o_ai 2426 vec_cnttz(vector signed long long __a) { 2427 return __builtin_altivec_vctzd(__a); 2428 } 2429 static __inline__ vector unsigned long long __ATTRS_o_ai 2430 vec_cnttz(vector unsigned long long __a) { 2431 return __builtin_altivec_vctzd(__a); 2432 } 2433 2434 /* vec_first_match_index */ 2435 2436 static __inline__ unsigned __ATTRS_o_ai 2437 vec_first_match_index(vector signed char __a, vector signed char __b) { 2438 vector unsigned long long __res = 2439 #ifdef __LITTLE_ENDIAN__ 2440 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2441 #else 2442 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2443 #endif 2444 if (__res[0] == 64) { 2445 return (__res[1] + 64) >> 3; 2446 } 2447 return __res[0] >> 3; 2448 } 2449 2450 static __inline__ unsigned __ATTRS_o_ai 2451 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2452 vector unsigned long long __res = 2453 #ifdef __LITTLE_ENDIAN__ 2454 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2455 #else 2456 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2457 #endif 2458 if (__res[0] == 64) { 2459 return (__res[1] + 64) >> 3; 2460 } 2461 return __res[0] >> 3; 2462 } 2463 2464 static __inline__ unsigned __ATTRS_o_ai 2465 vec_first_match_index(vector signed short __a, vector signed short __b) { 2466 vector unsigned long long __res = 2467 #ifdef __LITTLE_ENDIAN__ 2468 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2469 #else 2470 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2471 #endif 2472 if (__res[0] == 64) { 2473 return (__res[1] + 64) >> 4; 2474 } 2475 return __res[0] >> 4; 2476 } 2477 2478 static __inline__ unsigned __ATTRS_o_ai 2479 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2480 vector unsigned long long __res = 2481 #ifdef __LITTLE_ENDIAN__ 2482 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2483 #else 2484 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2485 #endif 2486 if (__res[0] == 64) { 2487 return (__res[1] + 64) >> 4; 2488 } 2489 return __res[0] >> 4; 2490 } 2491 2492 static __inline__ unsigned __ATTRS_o_ai 2493 vec_first_match_index(vector signed int __a, vector signed int __b) { 2494 vector unsigned long long __res = 2495 #ifdef __LITTLE_ENDIAN__ 2496 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2497 #else 2498 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2499 #endif 2500 if (__res[0] == 64) { 2501 return (__res[1] + 64) >> 5; 2502 } 2503 return __res[0] >> 5; 2504 } 2505 2506 static __inline__ unsigned __ATTRS_o_ai 2507 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2508 vector unsigned long long __res = 2509 #ifdef __LITTLE_ENDIAN__ 2510 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2511 #else 2512 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2513 #endif 2514 if (__res[0] == 64) { 2515 return (__res[1] + 64) >> 5; 2516 } 2517 return __res[0] >> 5; 2518 } 2519 2520 /* vec_first_match_or_eos_index */ 2521 2522 static __inline__ unsigned __ATTRS_o_ai 2523 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2524 /* Compare the result of the comparison of two vectors with either and OR the 2525 result. Either the elements are equal or one will equal the comparison 2526 result if either is zero. 2527 */ 2528 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2529 vector bool char __tmp2 = __tmp1 | 2530 vec_cmpeq((vector signed char)__tmp1, __a) | 2531 vec_cmpeq((vector signed char)__tmp1, __b); 2532 2533 vector unsigned long long __res = 2534 #ifdef __LITTLE_ENDIAN__ 2535 vec_cnttz((vector unsigned long long)__tmp2); 2536 #else 2537 vec_cntlz((vector unsigned long long)__tmp2); 2538 #endif 2539 if (__res[0] == 64) { 2540 return (__res[1] + 64) >> 3; 2541 } 2542 return __res[0] >> 3; 2543 } 2544 2545 static __inline__ unsigned __ATTRS_o_ai 2546 vec_first_match_or_eos_index(vector unsigned char __a, 2547 vector unsigned char __b) { 2548 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2549 vector bool char __tmp2 = __tmp1 | 2550 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2551 vec_cmpeq((vector unsigned char)__tmp1, __b); 2552 2553 vector unsigned long long __res = 2554 #ifdef __LITTLE_ENDIAN__ 2555 vec_cnttz((vector unsigned long long)__tmp2); 2556 #else 2557 vec_cntlz((vector unsigned long long)__tmp2); 2558 #endif 2559 if (__res[0] == 64) { 2560 return (__res[1] + 64) >> 3; 2561 } 2562 return __res[0] >> 3; 2563 } 2564 2565 static __inline__ unsigned __ATTRS_o_ai 2566 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2567 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2568 vector bool short __tmp2 = __tmp1 | 2569 vec_cmpeq((vector signed short)__tmp1, __a) | 2570 vec_cmpeq((vector signed short)__tmp1, __b); 2571 2572 vector unsigned long long __res = 2573 #ifdef __LITTLE_ENDIAN__ 2574 vec_cnttz((vector unsigned long long)__tmp2); 2575 #else 2576 vec_cntlz((vector unsigned long long)__tmp2); 2577 #endif 2578 if (__res[0] == 64) { 2579 return (__res[1] + 64) >> 4; 2580 } 2581 return __res[0] >> 4; 2582 } 2583 2584 static __inline__ unsigned __ATTRS_o_ai 2585 vec_first_match_or_eos_index(vector unsigned short __a, 2586 vector unsigned short __b) { 2587 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2588 vector bool short __tmp2 = __tmp1 | 2589 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2590 vec_cmpeq((vector unsigned short)__tmp1, __b); 2591 2592 vector unsigned long long __res = 2593 #ifdef __LITTLE_ENDIAN__ 2594 vec_cnttz((vector unsigned long long)__tmp2); 2595 #else 2596 vec_cntlz((vector unsigned long long)__tmp2); 2597 #endif 2598 if (__res[0] == 64) { 2599 return (__res[1] + 64) >> 4; 2600 } 2601 return __res[0] >> 4; 2602 } 2603 2604 static __inline__ unsigned __ATTRS_o_ai 2605 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2606 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2607 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2608 vec_cmpeq((vector signed int)__tmp1, __b); 2609 2610 vector unsigned long long __res = 2611 #ifdef __LITTLE_ENDIAN__ 2612 vec_cnttz((vector unsigned long long)__tmp2); 2613 #else 2614 vec_cntlz((vector unsigned long long)__tmp2); 2615 #endif 2616 if (__res[0] == 64) { 2617 return (__res[1] + 64) >> 5; 2618 } 2619 return __res[0] >> 5; 2620 } 2621 2622 static __inline__ unsigned __ATTRS_o_ai 2623 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2624 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2625 vector bool int __tmp2 = __tmp1 | 2626 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2627 vec_cmpeq((vector unsigned int)__tmp1, __b); 2628 2629 vector unsigned long long __res = 2630 #ifdef __LITTLE_ENDIAN__ 2631 vec_cnttz((vector unsigned long long)__tmp2); 2632 #else 2633 vec_cntlz((vector unsigned long long)__tmp2); 2634 #endif 2635 if (__res[0] == 64) { 2636 return (__res[1] + 64) >> 5; 2637 } 2638 return __res[0] >> 5; 2639 } 2640 2641 /* vec_first_mismatch_index */ 2642 2643 static __inline__ unsigned __ATTRS_o_ai 2644 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2645 vector unsigned long long __res = 2646 #ifdef __LITTLE_ENDIAN__ 2647 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2648 #else 2649 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2650 #endif 2651 if (__res[0] == 64) { 2652 return (__res[1] + 64) >> 3; 2653 } 2654 return __res[0] >> 3; 2655 } 2656 2657 static __inline__ unsigned __ATTRS_o_ai 2658 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2659 vector unsigned long long __res = 2660 #ifdef __LITTLE_ENDIAN__ 2661 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2662 #else 2663 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2664 #endif 2665 if (__res[0] == 64) { 2666 return (__res[1] + 64) >> 3; 2667 } 2668 return __res[0] >> 3; 2669 } 2670 2671 static __inline__ unsigned __ATTRS_o_ai 2672 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2673 vector unsigned long long __res = 2674 #ifdef __LITTLE_ENDIAN__ 2675 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2676 #else 2677 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2678 #endif 2679 if (__res[0] == 64) { 2680 return (__res[1] + 64) >> 4; 2681 } 2682 return __res[0] >> 4; 2683 } 2684 2685 static __inline__ unsigned __ATTRS_o_ai 2686 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2687 vector unsigned long long __res = 2688 #ifdef __LITTLE_ENDIAN__ 2689 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2690 #else 2691 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2692 #endif 2693 if (__res[0] == 64) { 2694 return (__res[1] + 64) >> 4; 2695 } 2696 return __res[0] >> 4; 2697 } 2698 2699 static __inline__ unsigned __ATTRS_o_ai 2700 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2701 vector unsigned long long __res = 2702 #ifdef __LITTLE_ENDIAN__ 2703 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2704 #else 2705 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2706 #endif 2707 if (__res[0] == 64) { 2708 return (__res[1] + 64) >> 5; 2709 } 2710 return __res[0] >> 5; 2711 } 2712 2713 static __inline__ unsigned __ATTRS_o_ai 2714 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2715 vector unsigned long long __res = 2716 #ifdef __LITTLE_ENDIAN__ 2717 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2718 #else 2719 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2720 #endif 2721 if (__res[0] == 64) { 2722 return (__res[1] + 64) >> 5; 2723 } 2724 return __res[0] >> 5; 2725 } 2726 2727 /* vec_first_mismatch_or_eos_index */ 2728 2729 static __inline__ unsigned __ATTRS_o_ai 2730 vec_first_mismatch_or_eos_index(vector signed char __a, 2731 vector signed char __b) { 2732 vector unsigned long long __res = 2733 #ifdef __LITTLE_ENDIAN__ 2734 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2735 #else 2736 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2737 #endif 2738 if (__res[0] == 64) { 2739 return (__res[1] + 64) >> 3; 2740 } 2741 return __res[0] >> 3; 2742 } 2743 2744 static __inline__ unsigned __ATTRS_o_ai 2745 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2746 vector unsigned char __b) { 2747 vector unsigned long long __res = 2748 #ifdef __LITTLE_ENDIAN__ 2749 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2750 #else 2751 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2752 #endif 2753 if (__res[0] == 64) { 2754 return (__res[1] + 64) >> 3; 2755 } 2756 return __res[0] >> 3; 2757 } 2758 2759 static __inline__ unsigned __ATTRS_o_ai 2760 vec_first_mismatch_or_eos_index(vector signed short __a, 2761 vector signed short __b) { 2762 vector unsigned long long __res = 2763 #ifdef __LITTLE_ENDIAN__ 2764 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2765 #else 2766 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2767 #endif 2768 if (__res[0] == 64) { 2769 return (__res[1] + 64) >> 4; 2770 } 2771 return __res[0] >> 4; 2772 } 2773 2774 static __inline__ unsigned __ATTRS_o_ai 2775 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2776 vector unsigned short __b) { 2777 vector unsigned long long __res = 2778 #ifdef __LITTLE_ENDIAN__ 2779 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2780 #else 2781 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2782 #endif 2783 if (__res[0] == 64) { 2784 return (__res[1] + 64) >> 4; 2785 } 2786 return __res[0] >> 4; 2787 } 2788 2789 static __inline__ unsigned __ATTRS_o_ai 2790 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2791 vector unsigned long long __res = 2792 #ifdef __LITTLE_ENDIAN__ 2793 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2794 #else 2795 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2796 #endif 2797 if (__res[0] == 64) { 2798 return (__res[1] + 64) >> 5; 2799 } 2800 return __res[0] >> 5; 2801 } 2802 2803 static __inline__ unsigned __ATTRS_o_ai 2804 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2805 vector unsigned int __b) { 2806 vector unsigned long long __res = 2807 #ifdef __LITTLE_ENDIAN__ 2808 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2809 #else 2810 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2811 #endif 2812 if (__res[0] == 64) { 2813 return (__res[1] + 64) >> 5; 2814 } 2815 return __res[0] >> 5; 2816 } 2817 2818 static __inline__ vector double __ATTRS_o_ai 2819 vec_insert_exp(vector double __a, vector unsigned long long __b) { 2820 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 2821 } 2822 2823 static __inline__ vector double __ATTRS_o_ai 2824 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 2825 return __builtin_vsx_xviexpdp(__a,__b); 2826 } 2827 2828 static __inline__ vector float __ATTRS_o_ai 2829 vec_insert_exp(vector float __a, vector unsigned int __b) { 2830 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 2831 } 2832 2833 static __inline__ vector float __ATTRS_o_ai 2834 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 2835 return __builtin_vsx_xviexpsp(__a,__b); 2836 } 2837 2838 #if defined(__powerpc64__) 2839 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 2840 size_t __b) { 2841 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 2842 } 2843 2844 static __inline__ vector unsigned char __ATTRS_o_ai 2845 vec_xl_len(const unsigned char *__a, size_t __b) { 2846 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 2847 } 2848 2849 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 2850 size_t __b) { 2851 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 2852 } 2853 2854 static __inline__ vector unsigned short __ATTRS_o_ai 2855 vec_xl_len(const unsigned short *__a, size_t __b) { 2856 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 2857 } 2858 2859 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 2860 size_t __b) { 2861 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 2862 } 2863 2864 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 2865 size_t __b) { 2866 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 2867 } 2868 2869 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 2870 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 2871 } 2872 2873 static __inline__ vector signed __int128 __ATTRS_o_ai 2874 vec_xl_len(const signed __int128 *__a, size_t __b) { 2875 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 2876 } 2877 2878 static __inline__ vector unsigned __int128 __ATTRS_o_ai 2879 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 2880 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 2881 } 2882 2883 static __inline__ vector signed long long __ATTRS_o_ai 2884 vec_xl_len(const signed long long *__a, size_t __b) { 2885 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 2886 } 2887 2888 static __inline__ vector unsigned long long __ATTRS_o_ai 2889 vec_xl_len(const unsigned long long *__a, size_t __b) { 2890 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 2891 } 2892 2893 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 2894 size_t __b) { 2895 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 2896 } 2897 2898 static __inline__ vector unsigned char __ATTRS_o_ai 2899 vec_xl_len_r(const unsigned char *__a, size_t __b) { 2900 vector unsigned char __res = 2901 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 2902 #ifdef __LITTLE_ENDIAN__ 2903 vector unsigned char __mask = 2904 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 2905 __res = (vector unsigned char)__builtin_altivec_vperm_4si( 2906 (vector int)__res, (vector int)__res, __mask); 2907 #endif 2908 return __res; 2909 } 2910 2911 // vec_xst_len 2912 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 2913 unsigned char *__b, 2914 size_t __c) { 2915 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2916 } 2917 2918 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, 2919 signed char *__b, size_t __c) { 2920 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2921 } 2922 2923 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a, 2924 signed short *__b, size_t __c) { 2925 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2926 } 2927 2928 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, 2929 unsigned short *__b, 2930 size_t __c) { 2931 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2932 } 2933 2934 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 2935 signed int *__b, size_t __c) { 2936 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2937 } 2938 2939 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, 2940 unsigned int *__b, size_t __c) { 2941 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2942 } 2943 2944 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, 2945 size_t __c) { 2946 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2947 } 2948 2949 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 2950 signed __int128 *__b, 2951 size_t __c) { 2952 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2953 } 2954 2955 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, 2956 unsigned __int128 *__b, 2957 size_t __c) { 2958 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2959 } 2960 2961 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 2962 signed long long *__b, 2963 size_t __c) { 2964 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2965 } 2966 2967 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 2968 unsigned long long *__b, 2969 size_t __c) { 2970 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2971 } 2972 2973 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, 2974 size_t __c) { 2975 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 2976 } 2977 2978 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, 2979 unsigned char *__b, 2980 size_t __c) { 2981 #ifdef __LITTLE_ENDIAN__ 2982 vector unsigned char __mask = 2983 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 2984 vector unsigned char __res = 2985 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); 2986 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 2987 #else 2988 return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56)); 2989 #endif 2990 } 2991 #endif 2992 #endif 2993 2994 /* vec_cpsgn */ 2995 2996 #ifdef __VSX__ 2997 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 2998 vector float __b) { 2999 return __builtin_vsx_xvcpsgnsp(__b, __a); 3000 } 3001 3002 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 3003 vector double __b) { 3004 return __builtin_vsx_xvcpsgndp(__b, __a); 3005 } 3006 #endif 3007 3008 /* vec_ctf */ 3009 3010 #ifdef __VSX__ 3011 #define vec_ctf(__a, __b) \ 3012 _Generic((__a), vector int \ 3013 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3014 vector unsigned int \ 3015 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3016 (__b)), \ 3017 vector unsigned long long \ 3018 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3019 vector double) * \ 3020 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3021 << 52)), \ 3022 vector signed long long \ 3023 : (__builtin_convertvector((vector signed long long)(__a), \ 3024 vector double) * \ 3025 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3026 << 52))) 3027 #else 3028 #define vec_ctf(__a, __b) \ 3029 _Generic((__a), vector int \ 3030 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3031 vector unsigned int \ 3032 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3033 (__b))) 3034 #endif 3035 3036 /* vec_vcfsx */ 3037 3038 #define vec_vcfux __builtin_altivec_vcfux 3039 3040 /* vec_vcfux */ 3041 3042 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 3043 3044 /* vec_cts */ 3045 3046 #ifdef __VSX__ 3047 #define vec_cts(__a, __b) \ 3048 _Generic((__a), vector float \ 3049 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3050 vector double \ 3051 : __extension__({ \ 3052 vector double __ret = \ 3053 (vector double)(__a) * \ 3054 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3055 << 52); \ 3056 __builtin_convertvector(__ret, vector signed long long); \ 3057 })) 3058 #else 3059 #define vec_cts __builtin_altivec_vctsxs 3060 #endif 3061 3062 /* vec_vctsxs */ 3063 3064 #define vec_vctsxs __builtin_altivec_vctsxs 3065 3066 /* vec_ctu */ 3067 3068 #ifdef __VSX__ 3069 #define vec_ctu(__a, __b) \ 3070 _Generic((__a), vector float \ 3071 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3072 vector double \ 3073 : __extension__({ \ 3074 vector double __ret = \ 3075 (vector double)(__a) * \ 3076 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3077 << 52); \ 3078 __builtin_convertvector(__ret, vector unsigned long long); \ 3079 })) 3080 #else 3081 #define vec_ctu __builtin_altivec_vctuxs 3082 #endif 3083 3084 /* vec_vctuxs */ 3085 3086 #define vec_vctuxs __builtin_altivec_vctuxs 3087 3088 /* vec_signext */ 3089 3090 #ifdef __POWER9_VECTOR__ 3091 static __inline__ vector signed int __ATTRS_o_ai 3092 vec_signexti(vector signed char __a) { 3093 return __builtin_altivec_vextsb2w(__a); 3094 } 3095 3096 static __inline__ vector signed int __ATTRS_o_ai 3097 vec_signexti(vector signed short __a) { 3098 return __builtin_altivec_vextsh2w(__a); 3099 } 3100 3101 static __inline__ vector signed long long __ATTRS_o_ai 3102 vec_signextll(vector signed char __a) { 3103 return __builtin_altivec_vextsb2d(__a); 3104 } 3105 3106 static __inline__ vector signed long long __ATTRS_o_ai 3107 vec_signextll(vector signed short __a) { 3108 return __builtin_altivec_vextsh2d(__a); 3109 } 3110 3111 static __inline__ vector signed long long __ATTRS_o_ai 3112 vec_signextll(vector signed int __a) { 3113 return __builtin_altivec_vextsw2d(__a); 3114 } 3115 #endif 3116 3117 #ifdef __POWER10_VECTOR__ 3118 static __inline__ vector signed __int128 __ATTRS_o_ai 3119 vec_signextq(vector signed long long __a) { 3120 return __builtin_altivec_vextsd2q(__a); 3121 } 3122 #endif 3123 3124 /* vec_signed */ 3125 3126 static __inline__ vector signed int __ATTRS_o_ai 3127 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3128 3129 static __inline__ vector signed int __ATTRS_o_ai 3130 vec_signed(vector float __a) { 3131 return __builtin_convertvector(__a, vector signed int); 3132 } 3133 3134 #ifdef __VSX__ 3135 static __inline__ vector signed long long __ATTRS_o_ai 3136 vec_signed(vector double __a) { 3137 return __builtin_convertvector(__a, vector signed long long); 3138 } 3139 3140 static __inline__ vector signed int __attribute__((__always_inline__)) 3141 vec_signed2(vector double __a, vector double __b) { 3142 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3143 } 3144 3145 static __inline__ vector signed int __ATTRS_o_ai 3146 vec_signede(vector double __a) { 3147 #ifdef __LITTLE_ENDIAN__ 3148 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3149 return vec_sld(__ret, __ret, 12); 3150 #else 3151 return __builtin_vsx_xvcvdpsxws(__a); 3152 #endif 3153 } 3154 3155 static __inline__ vector signed int __ATTRS_o_ai 3156 vec_signedo(vector double __a) { 3157 #ifdef __LITTLE_ENDIAN__ 3158 return __builtin_vsx_xvcvdpsxws(__a); 3159 #else 3160 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3161 return vec_sld(__ret, __ret, 12); 3162 #endif 3163 } 3164 #endif 3165 3166 /* vec_unsigned */ 3167 3168 static __inline__ vector unsigned int __ATTRS_o_ai 3169 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3170 3171 static __inline__ vector unsigned int __ATTRS_o_ai 3172 vec_unsigned(vector float __a) { 3173 return __builtin_convertvector(__a, vector unsigned int); 3174 } 3175 3176 #ifdef __VSX__ 3177 static __inline__ vector unsigned long long __ATTRS_o_ai 3178 vec_unsigned(vector double __a) { 3179 return __builtin_convertvector(__a, vector unsigned long long); 3180 } 3181 3182 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3183 vec_unsigned2(vector double __a, vector double __b) { 3184 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3185 } 3186 3187 static __inline__ vector unsigned int __ATTRS_o_ai 3188 vec_unsignede(vector double __a) { 3189 #ifdef __LITTLE_ENDIAN__ 3190 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3191 return vec_sld(__ret, __ret, 12); 3192 #else 3193 return __builtin_vsx_xvcvdpuxws(__a); 3194 #endif 3195 } 3196 3197 static __inline__ vector unsigned int __ATTRS_o_ai 3198 vec_unsignedo(vector double __a) { 3199 #ifdef __LITTLE_ENDIAN__ 3200 return __builtin_vsx_xvcvdpuxws(__a); 3201 #else 3202 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3203 return vec_sld(__ret, __ret, 12); 3204 #endif 3205 } 3206 #endif 3207 3208 /* vec_float */ 3209 3210 static __inline__ vector float __ATTRS_o_ai 3211 vec_sld(vector float, vector float, unsigned const int __c); 3212 3213 static __inline__ vector float __ATTRS_o_ai 3214 vec_float(vector signed int __a) { 3215 return __builtin_convertvector(__a, vector float); 3216 } 3217 3218 static __inline__ vector float __ATTRS_o_ai 3219 vec_float(vector unsigned int __a) { 3220 return __builtin_convertvector(__a, vector float); 3221 } 3222 3223 #ifdef __VSX__ 3224 static __inline__ vector float __ATTRS_o_ai 3225 vec_float2(vector signed long long __a, vector signed long long __b) { 3226 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3227 } 3228 3229 static __inline__ vector float __ATTRS_o_ai 3230 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3231 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3232 } 3233 3234 static __inline__ vector float __ATTRS_o_ai 3235 vec_float2(vector double __a, vector double __b) { 3236 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3237 } 3238 3239 static __inline__ vector float __ATTRS_o_ai 3240 vec_floate(vector signed long long __a) { 3241 #ifdef __LITTLE_ENDIAN__ 3242 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3243 return vec_sld(__ret, __ret, 12); 3244 #else 3245 return __builtin_vsx_xvcvsxdsp(__a); 3246 #endif 3247 } 3248 3249 static __inline__ vector float __ATTRS_o_ai 3250 vec_floate(vector unsigned long long __a) { 3251 #ifdef __LITTLE_ENDIAN__ 3252 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3253 return vec_sld(__ret, __ret, 12); 3254 #else 3255 return __builtin_vsx_xvcvuxdsp(__a); 3256 #endif 3257 } 3258 3259 static __inline__ vector float __ATTRS_o_ai 3260 vec_floate(vector double __a) { 3261 #ifdef __LITTLE_ENDIAN__ 3262 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3263 return vec_sld(__ret, __ret, 12); 3264 #else 3265 return __builtin_vsx_xvcvdpsp(__a); 3266 #endif 3267 } 3268 3269 static __inline__ vector float __ATTRS_o_ai 3270 vec_floato(vector signed long long __a) { 3271 #ifdef __LITTLE_ENDIAN__ 3272 return __builtin_vsx_xvcvsxdsp(__a); 3273 #else 3274 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3275 return vec_sld(__ret, __ret, 12); 3276 #endif 3277 } 3278 3279 static __inline__ vector float __ATTRS_o_ai 3280 vec_floato(vector unsigned long long __a) { 3281 #ifdef __LITTLE_ENDIAN__ 3282 return __builtin_vsx_xvcvuxdsp(__a); 3283 #else 3284 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3285 return vec_sld(__ret, __ret, 12); 3286 #endif 3287 } 3288 3289 static __inline__ vector float __ATTRS_o_ai 3290 vec_floato(vector double __a) { 3291 #ifdef __LITTLE_ENDIAN__ 3292 return __builtin_vsx_xvcvdpsp(__a); 3293 #else 3294 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3295 return vec_sld(__ret, __ret, 12); 3296 #endif 3297 } 3298 #endif 3299 3300 /* vec_double */ 3301 3302 #ifdef __VSX__ 3303 static __inline__ vector double __ATTRS_o_ai 3304 vec_double(vector signed long long __a) { 3305 return __builtin_convertvector(__a, vector double); 3306 } 3307 3308 static __inline__ vector double __ATTRS_o_ai 3309 vec_double(vector unsigned long long __a) { 3310 return __builtin_convertvector(__a, vector double); 3311 } 3312 3313 static __inline__ vector double __ATTRS_o_ai 3314 vec_doublee(vector signed int __a) { 3315 #ifdef __LITTLE_ENDIAN__ 3316 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3317 #else 3318 return __builtin_vsx_xvcvsxwdp(__a); 3319 #endif 3320 } 3321 3322 static __inline__ vector double __ATTRS_o_ai 3323 vec_doublee(vector unsigned int __a) { 3324 #ifdef __LITTLE_ENDIAN__ 3325 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3326 #else 3327 return __builtin_vsx_xvcvuxwdp(__a); 3328 #endif 3329 } 3330 3331 static __inline__ vector double __ATTRS_o_ai 3332 vec_doublee(vector float __a) { 3333 #ifdef __LITTLE_ENDIAN__ 3334 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3335 #else 3336 return __builtin_vsx_xvcvspdp(__a); 3337 #endif 3338 } 3339 3340 static __inline__ vector double __ATTRS_o_ai 3341 vec_doubleh(vector signed int __a) { 3342 vector double __ret = {__a[0], __a[1]}; 3343 return __ret; 3344 } 3345 3346 static __inline__ vector double __ATTRS_o_ai 3347 vec_doubleh(vector unsigned int __a) { 3348 vector double __ret = {__a[0], __a[1]}; 3349 return __ret; 3350 } 3351 3352 static __inline__ vector double __ATTRS_o_ai 3353 vec_doubleh(vector float __a) { 3354 vector double __ret = {__a[0], __a[1]}; 3355 return __ret; 3356 } 3357 3358 static __inline__ vector double __ATTRS_o_ai 3359 vec_doublel(vector signed int __a) { 3360 vector double __ret = {__a[2], __a[3]}; 3361 return __ret; 3362 } 3363 3364 static __inline__ vector double __ATTRS_o_ai 3365 vec_doublel(vector unsigned int __a) { 3366 vector double __ret = {__a[2], __a[3]}; 3367 return __ret; 3368 } 3369 3370 static __inline__ vector double __ATTRS_o_ai 3371 vec_doublel(vector float __a) { 3372 vector double __ret = {__a[2], __a[3]}; 3373 return __ret; 3374 } 3375 3376 static __inline__ vector double __ATTRS_o_ai 3377 vec_doubleo(vector signed int __a) { 3378 #ifdef __LITTLE_ENDIAN__ 3379 return __builtin_vsx_xvcvsxwdp(__a); 3380 #else 3381 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3382 #endif 3383 } 3384 3385 static __inline__ vector double __ATTRS_o_ai 3386 vec_doubleo(vector unsigned int __a) { 3387 #ifdef __LITTLE_ENDIAN__ 3388 return __builtin_vsx_xvcvuxwdp(__a); 3389 #else 3390 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3391 #endif 3392 } 3393 3394 static __inline__ vector double __ATTRS_o_ai 3395 vec_doubleo(vector float __a) { 3396 #ifdef __LITTLE_ENDIAN__ 3397 return __builtin_vsx_xvcvspdp(__a); 3398 #else 3399 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3400 #endif 3401 } 3402 #endif 3403 3404 /* vec_div */ 3405 3406 /* Integer vector divides (vectors are scalarized, elements divided 3407 and the vectors reassembled). 3408 */ 3409 static __inline__ vector signed char __ATTRS_o_ai 3410 vec_div(vector signed char __a, vector signed char __b) { 3411 return __a / __b; 3412 } 3413 3414 static __inline__ vector unsigned char __ATTRS_o_ai 3415 vec_div(vector unsigned char __a, vector unsigned char __b) { 3416 return __a / __b; 3417 } 3418 3419 static __inline__ vector signed short __ATTRS_o_ai 3420 vec_div(vector signed short __a, vector signed short __b) { 3421 return __a / __b; 3422 } 3423 3424 static __inline__ vector unsigned short __ATTRS_o_ai 3425 vec_div(vector unsigned short __a, vector unsigned short __b) { 3426 return __a / __b; 3427 } 3428 3429 static __inline__ vector signed int __ATTRS_o_ai 3430 vec_div(vector signed int __a, vector signed int __b) { 3431 return __a / __b; 3432 } 3433 3434 static __inline__ vector unsigned int __ATTRS_o_ai 3435 vec_div(vector unsigned int __a, vector unsigned int __b) { 3436 return __a / __b; 3437 } 3438 3439 #ifdef __VSX__ 3440 static __inline__ vector signed long long __ATTRS_o_ai 3441 vec_div(vector signed long long __a, vector signed long long __b) { 3442 return __a / __b; 3443 } 3444 3445 static __inline__ vector unsigned long long __ATTRS_o_ai 3446 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3447 return __a / __b; 3448 } 3449 3450 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3451 vector float __b) { 3452 return __a / __b; 3453 } 3454 3455 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3456 vector double __b) { 3457 return __a / __b; 3458 } 3459 #endif 3460 3461 /* vec_dive */ 3462 3463 #ifdef __POWER10_VECTOR__ 3464 static __inline__ vector signed int __ATTRS_o_ai 3465 vec_dive(vector signed int __a, vector signed int __b) { 3466 return __builtin_altivec_vdivesw(__a, __b); 3467 } 3468 3469 static __inline__ vector unsigned int __ATTRS_o_ai 3470 vec_dive(vector unsigned int __a, vector unsigned int __b) { 3471 return __builtin_altivec_vdiveuw(__a, __b); 3472 } 3473 3474 static __inline__ vector signed long long __ATTRS_o_ai 3475 vec_dive(vector signed long long __a, vector signed long long __b) { 3476 return __builtin_altivec_vdivesd(__a, __b); 3477 } 3478 3479 static __inline__ vector unsigned long long __ATTRS_o_ai 3480 vec_dive(vector unsigned long long __a, vector unsigned long long __b) { 3481 return __builtin_altivec_vdiveud(__a, __b); 3482 } 3483 3484 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3485 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3486 return __builtin_altivec_vdiveuq(__a, __b); 3487 } 3488 3489 static __inline__ vector signed __int128 __ATTRS_o_ai 3490 vec_dive(vector signed __int128 __a, vector signed __int128 __b) { 3491 return __builtin_altivec_vdivesq(__a, __b); 3492 } 3493 #endif 3494 3495 #ifdef __POWER10_VECTOR__ 3496 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3497 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3498 return __a / __b; 3499 } 3500 3501 static __inline__ vector signed __int128 __ATTRS_o_ai 3502 vec_div(vector signed __int128 __a, vector signed __int128 __b) { 3503 return __a / __b; 3504 } 3505 #endif /* __POWER10_VECTOR__ */ 3506 3507 /* vec_xvtdiv */ 3508 3509 #ifdef __VSX__ 3510 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, 3511 vector double __b) { 3512 return __builtin_vsx_xvtdivdp(__a, __b); 3513 } 3514 3515 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, 3516 vector float __b) { 3517 return __builtin_vsx_xvtdivsp(__a, __b); 3518 } 3519 #endif 3520 3521 /* vec_dss */ 3522 3523 #define vec_dss __builtin_altivec_dss 3524 3525 /* vec_dssall */ 3526 3527 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3528 __builtin_altivec_dssall(); 3529 } 3530 3531 /* vec_dst */ 3532 #define vec_dst(__PTR, __CW, __STR) \ 3533 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) 3534 3535 /* vec_dstst */ 3536 #define vec_dstst(__PTR, __CW, __STR) \ 3537 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) 3538 3539 /* vec_dststt */ 3540 #define vec_dststt(__PTR, __CW, __STR) \ 3541 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) 3542 3543 /* vec_dstt */ 3544 #define vec_dstt(__PTR, __CW, __STR) \ 3545 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) 3546 3547 /* vec_eqv */ 3548 3549 #ifdef __POWER8_VECTOR__ 3550 static __inline__ vector signed char __ATTRS_o_ai 3551 vec_eqv(vector signed char __a, vector signed char __b) { 3552 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3553 (vector unsigned int)__b); 3554 } 3555 3556 static __inline__ vector unsigned char __ATTRS_o_ai 3557 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3558 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3559 (vector unsigned int)__b); 3560 } 3561 3562 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3563 vector bool char __b) { 3564 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3565 (vector unsigned int)__b); 3566 } 3567 3568 static __inline__ vector signed short __ATTRS_o_ai 3569 vec_eqv(vector signed short __a, vector signed short __b) { 3570 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3571 (vector unsigned int)__b); 3572 } 3573 3574 static __inline__ vector unsigned short __ATTRS_o_ai 3575 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3576 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3577 (vector unsigned int)__b); 3578 } 3579 3580 static __inline__ vector bool short __ATTRS_o_ai 3581 vec_eqv(vector bool short __a, vector bool short __b) { 3582 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3583 (vector unsigned int)__b); 3584 } 3585 3586 static __inline__ vector signed int __ATTRS_o_ai 3587 vec_eqv(vector signed int __a, vector signed int __b) { 3588 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3589 (vector unsigned int)__b); 3590 } 3591 3592 static __inline__ vector unsigned int __ATTRS_o_ai 3593 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3594 return __builtin_vsx_xxleqv(__a, __b); 3595 } 3596 3597 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3598 vector bool int __b) { 3599 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3600 (vector unsigned int)__b); 3601 } 3602 3603 static __inline__ vector signed long long __ATTRS_o_ai 3604 vec_eqv(vector signed long long __a, vector signed long long __b) { 3605 return (vector signed long long)__builtin_vsx_xxleqv( 3606 (vector unsigned int)__a, (vector unsigned int)__b); 3607 } 3608 3609 static __inline__ vector unsigned long long __ATTRS_o_ai 3610 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3611 return (vector unsigned long long)__builtin_vsx_xxleqv( 3612 (vector unsigned int)__a, (vector unsigned int)__b); 3613 } 3614 3615 static __inline__ vector bool long long __ATTRS_o_ai 3616 vec_eqv(vector bool long long __a, vector bool long long __b) { 3617 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3618 (vector unsigned int)__b); 3619 } 3620 3621 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3622 vector float __b) { 3623 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3624 (vector unsigned int)__b); 3625 } 3626 3627 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3628 vector double __b) { 3629 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3630 (vector unsigned int)__b); 3631 } 3632 #endif 3633 3634 /* vec_expte */ 3635 3636 static __inline__ vector float __attribute__((__always_inline__)) 3637 vec_expte(vector float __a) { 3638 return __builtin_altivec_vexptefp(__a); 3639 } 3640 3641 /* vec_vexptefp */ 3642 3643 static __inline__ vector float __attribute__((__always_inline__)) 3644 vec_vexptefp(vector float __a) { 3645 return __builtin_altivec_vexptefp(__a); 3646 } 3647 3648 /* vec_floor */ 3649 3650 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 3651 #ifdef __VSX__ 3652 return __builtin_vsx_xvrspim(__a); 3653 #else 3654 return __builtin_altivec_vrfim(__a); 3655 #endif 3656 } 3657 3658 #ifdef __VSX__ 3659 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 3660 return __builtin_vsx_xvrdpim(__a); 3661 } 3662 #endif 3663 3664 /* vec_vrfim */ 3665 3666 static __inline__ vector float __attribute__((__always_inline__)) 3667 vec_vrfim(vector float __a) { 3668 return __builtin_altivec_vrfim(__a); 3669 } 3670 3671 /* vec_ld */ 3672 3673 static __inline__ vector signed char __ATTRS_o_ai 3674 vec_ld(int __a, const vector signed char *__b) { 3675 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3676 } 3677 3678 static __inline__ vector signed char __ATTRS_o_ai 3679 vec_ld(int __a, const signed char *__b) { 3680 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3681 } 3682 3683 static __inline__ vector unsigned char __ATTRS_o_ai 3684 vec_ld(int __a, const vector unsigned char *__b) { 3685 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3686 } 3687 3688 static __inline__ vector unsigned char __ATTRS_o_ai 3689 vec_ld(int __a, const unsigned char *__b) { 3690 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3691 } 3692 3693 static __inline__ vector bool char __ATTRS_o_ai 3694 vec_ld(int __a, const vector bool char *__b) { 3695 return (vector bool char)__builtin_altivec_lvx(__a, __b); 3696 } 3697 3698 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, 3699 const vector short *__b) { 3700 return (vector short)__builtin_altivec_lvx(__a, __b); 3701 } 3702 3703 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) { 3704 return (vector short)__builtin_altivec_lvx(__a, __b); 3705 } 3706 3707 static __inline__ vector unsigned short __ATTRS_o_ai 3708 vec_ld(int __a, const vector unsigned short *__b) { 3709 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3710 } 3711 3712 static __inline__ vector unsigned short __ATTRS_o_ai 3713 vec_ld(int __a, const unsigned short *__b) { 3714 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3715 } 3716 3717 static __inline__ vector bool short __ATTRS_o_ai 3718 vec_ld(int __a, const vector bool short *__b) { 3719 return (vector bool short)__builtin_altivec_lvx(__a, __b); 3720 } 3721 3722 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a, 3723 const vector pixel *__b) { 3724 return (vector pixel)__builtin_altivec_lvx(__a, __b); 3725 } 3726 3727 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, 3728 const vector int *__b) { 3729 return (vector int)__builtin_altivec_lvx(__a, __b); 3730 } 3731 3732 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) { 3733 return (vector int)__builtin_altivec_lvx(__a, __b); 3734 } 3735 3736 static __inline__ vector unsigned int __ATTRS_o_ai 3737 vec_ld(int __a, const vector unsigned int *__b) { 3738 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3739 } 3740 3741 static __inline__ vector unsigned int __ATTRS_o_ai 3742 vec_ld(int __a, const unsigned int *__b) { 3743 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3744 } 3745 3746 static __inline__ vector bool int __ATTRS_o_ai 3747 vec_ld(int __a, const vector bool int *__b) { 3748 return (vector bool int)__builtin_altivec_lvx(__a, __b); 3749 } 3750 3751 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, 3752 const vector float *__b) { 3753 return (vector float)__builtin_altivec_lvx(__a, __b); 3754 } 3755 3756 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) { 3757 return (vector float)__builtin_altivec_lvx(__a, __b); 3758 } 3759 3760 /* vec_lvx */ 3761 3762 static __inline__ vector signed char __ATTRS_o_ai 3763 vec_lvx(int __a, const vector signed char *__b) { 3764 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3765 } 3766 3767 static __inline__ vector signed char __ATTRS_o_ai 3768 vec_lvx(int __a, const signed char *__b) { 3769 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3770 } 3771 3772 static __inline__ vector unsigned char __ATTRS_o_ai 3773 vec_lvx(int __a, const vector unsigned char *__b) { 3774 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3775 } 3776 3777 static __inline__ vector unsigned char __ATTRS_o_ai 3778 vec_lvx(int __a, const unsigned char *__b) { 3779 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 3780 } 3781 3782 static __inline__ vector bool char __ATTRS_o_ai 3783 vec_lvx(int __a, const vector bool char *__b) { 3784 return (vector bool char)__builtin_altivec_lvx(__a, __b); 3785 } 3786 3787 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, 3788 const vector short *__b) { 3789 return (vector short)__builtin_altivec_lvx(__a, __b); 3790 } 3791 3792 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) { 3793 return (vector short)__builtin_altivec_lvx(__a, __b); 3794 } 3795 3796 static __inline__ vector unsigned short __ATTRS_o_ai 3797 vec_lvx(int __a, const vector unsigned short *__b) { 3798 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3799 } 3800 3801 static __inline__ vector unsigned short __ATTRS_o_ai 3802 vec_lvx(int __a, const unsigned short *__b) { 3803 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 3804 } 3805 3806 static __inline__ vector bool short __ATTRS_o_ai 3807 vec_lvx(int __a, const vector bool short *__b) { 3808 return (vector bool short)__builtin_altivec_lvx(__a, __b); 3809 } 3810 3811 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a, 3812 const vector pixel *__b) { 3813 return (vector pixel)__builtin_altivec_lvx(__a, __b); 3814 } 3815 3816 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, 3817 const vector int *__b) { 3818 return (vector int)__builtin_altivec_lvx(__a, __b); 3819 } 3820 3821 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) { 3822 return (vector int)__builtin_altivec_lvx(__a, __b); 3823 } 3824 3825 static __inline__ vector unsigned int __ATTRS_o_ai 3826 vec_lvx(int __a, const vector unsigned int *__b) { 3827 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3828 } 3829 3830 static __inline__ vector unsigned int __ATTRS_o_ai 3831 vec_lvx(int __a, const unsigned int *__b) { 3832 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 3833 } 3834 3835 static __inline__ vector bool int __ATTRS_o_ai 3836 vec_lvx(int __a, const vector bool int *__b) { 3837 return (vector bool int)__builtin_altivec_lvx(__a, __b); 3838 } 3839 3840 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, 3841 const vector float *__b) { 3842 return (vector float)__builtin_altivec_lvx(__a, __b); 3843 } 3844 3845 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) { 3846 return (vector float)__builtin_altivec_lvx(__a, __b); 3847 } 3848 3849 /* vec_lde */ 3850 3851 static __inline__ vector signed char __ATTRS_o_ai 3852 vec_lde(int __a, const signed char *__b) { 3853 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 3854 } 3855 3856 static __inline__ vector unsigned char __ATTRS_o_ai 3857 vec_lde(int __a, const unsigned char *__b) { 3858 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 3859 } 3860 3861 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) { 3862 return (vector short)__builtin_altivec_lvehx(__a, __b); 3863 } 3864 3865 static __inline__ vector unsigned short __ATTRS_o_ai 3866 vec_lde(int __a, const unsigned short *__b) { 3867 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 3868 } 3869 3870 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) { 3871 return (vector int)__builtin_altivec_lvewx(__a, __b); 3872 } 3873 3874 static __inline__ vector unsigned int __ATTRS_o_ai 3875 vec_lde(int __a, const unsigned int *__b) { 3876 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 3877 } 3878 3879 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) { 3880 return (vector float)__builtin_altivec_lvewx(__a, __b); 3881 } 3882 3883 /* vec_lvebx */ 3884 3885 static __inline__ vector signed char __ATTRS_o_ai 3886 vec_lvebx(int __a, const signed char *__b) { 3887 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 3888 } 3889 3890 static __inline__ vector unsigned char __ATTRS_o_ai 3891 vec_lvebx(int __a, const unsigned char *__b) { 3892 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 3893 } 3894 3895 /* vec_lvehx */ 3896 3897 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a, 3898 const short *__b) { 3899 return (vector short)__builtin_altivec_lvehx(__a, __b); 3900 } 3901 3902 static __inline__ vector unsigned short __ATTRS_o_ai 3903 vec_lvehx(int __a, const unsigned short *__b) { 3904 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 3905 } 3906 3907 /* vec_lvewx */ 3908 3909 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) { 3910 return (vector int)__builtin_altivec_lvewx(__a, __b); 3911 } 3912 3913 static __inline__ vector unsigned int __ATTRS_o_ai 3914 vec_lvewx(int __a, const unsigned int *__b) { 3915 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 3916 } 3917 3918 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a, 3919 const float *__b) { 3920 return (vector float)__builtin_altivec_lvewx(__a, __b); 3921 } 3922 3923 /* vec_ldl */ 3924 3925 static __inline__ vector signed char __ATTRS_o_ai 3926 vec_ldl(int __a, const vector signed char *__b) { 3927 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 3928 } 3929 3930 static __inline__ vector signed char __ATTRS_o_ai 3931 vec_ldl(int __a, const signed char *__b) { 3932 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 3933 } 3934 3935 static __inline__ vector unsigned char __ATTRS_o_ai 3936 vec_ldl(int __a, const vector unsigned char *__b) { 3937 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 3938 } 3939 3940 static __inline__ vector unsigned char __ATTRS_o_ai 3941 vec_ldl(int __a, const unsigned char *__b) { 3942 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 3943 } 3944 3945 static __inline__ vector bool char __ATTRS_o_ai 3946 vec_ldl(int __a, const vector bool char *__b) { 3947 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 3948 } 3949 3950 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, 3951 const vector short *__b) { 3952 return (vector short)__builtin_altivec_lvxl(__a, __b); 3953 } 3954 3955 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) { 3956 return (vector short)__builtin_altivec_lvxl(__a, __b); 3957 } 3958 3959 static __inline__ vector unsigned short __ATTRS_o_ai 3960 vec_ldl(int __a, const vector unsigned short *__b) { 3961 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 3962 } 3963 3964 static __inline__ vector unsigned short __ATTRS_o_ai 3965 vec_ldl(int __a, const unsigned short *__b) { 3966 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 3967 } 3968 3969 static __inline__ vector bool short __ATTRS_o_ai 3970 vec_ldl(int __a, const vector bool short *__b) { 3971 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 3972 } 3973 3974 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a, 3975 const vector pixel *__b) { 3976 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 3977 } 3978 3979 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, 3980 const vector int *__b) { 3981 return (vector int)__builtin_altivec_lvxl(__a, __b); 3982 } 3983 3984 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) { 3985 return (vector int)__builtin_altivec_lvxl(__a, __b); 3986 } 3987 3988 static __inline__ vector unsigned int __ATTRS_o_ai 3989 vec_ldl(int __a, const vector unsigned int *__b) { 3990 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 3991 } 3992 3993 static __inline__ vector unsigned int __ATTRS_o_ai 3994 vec_ldl(int __a, const unsigned int *__b) { 3995 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 3996 } 3997 3998 static __inline__ vector bool int __ATTRS_o_ai 3999 vec_ldl(int __a, const vector bool int *__b) { 4000 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4001 } 4002 4003 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, 4004 const vector float *__b) { 4005 return (vector float)__builtin_altivec_lvxl(__a, __b); 4006 } 4007 4008 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) { 4009 return (vector float)__builtin_altivec_lvxl(__a, __b); 4010 } 4011 4012 /* vec_lvxl */ 4013 4014 static __inline__ vector signed char __ATTRS_o_ai 4015 vec_lvxl(int __a, const vector signed char *__b) { 4016 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4017 } 4018 4019 static __inline__ vector signed char __ATTRS_o_ai 4020 vec_lvxl(int __a, const signed char *__b) { 4021 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4022 } 4023 4024 static __inline__ vector unsigned char __ATTRS_o_ai 4025 vec_lvxl(int __a, const vector unsigned char *__b) { 4026 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4027 } 4028 4029 static __inline__ vector unsigned char __ATTRS_o_ai 4030 vec_lvxl(int __a, const unsigned char *__b) { 4031 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4032 } 4033 4034 static __inline__ vector bool char __ATTRS_o_ai 4035 vec_lvxl(int __a, const vector bool char *__b) { 4036 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4037 } 4038 4039 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 4040 const vector short *__b) { 4041 return (vector short)__builtin_altivec_lvxl(__a, __b); 4042 } 4043 4044 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 4045 const short *__b) { 4046 return (vector short)__builtin_altivec_lvxl(__a, __b); 4047 } 4048 4049 static __inline__ vector unsigned short __ATTRS_o_ai 4050 vec_lvxl(int __a, const vector unsigned short *__b) { 4051 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4052 } 4053 4054 static __inline__ vector unsigned short __ATTRS_o_ai 4055 vec_lvxl(int __a, const unsigned short *__b) { 4056 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4057 } 4058 4059 static __inline__ vector bool short __ATTRS_o_ai 4060 vec_lvxl(int __a, const vector bool short *__b) { 4061 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4062 } 4063 4064 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a, 4065 const vector pixel *__b) { 4066 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 4067 } 4068 4069 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, 4070 const vector int *__b) { 4071 return (vector int)__builtin_altivec_lvxl(__a, __b); 4072 } 4073 4074 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) { 4075 return (vector int)__builtin_altivec_lvxl(__a, __b); 4076 } 4077 4078 static __inline__ vector unsigned int __ATTRS_o_ai 4079 vec_lvxl(int __a, const vector unsigned int *__b) { 4080 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4081 } 4082 4083 static __inline__ vector unsigned int __ATTRS_o_ai 4084 vec_lvxl(int __a, const unsigned int *__b) { 4085 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4086 } 4087 4088 static __inline__ vector bool int __ATTRS_o_ai 4089 vec_lvxl(int __a, const vector bool int *__b) { 4090 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4091 } 4092 4093 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 4094 const vector float *__b) { 4095 return (vector float)__builtin_altivec_lvxl(__a, __b); 4096 } 4097 4098 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 4099 const float *__b) { 4100 return (vector float)__builtin_altivec_lvxl(__a, __b); 4101 } 4102 4103 /* vec_loge */ 4104 4105 static __inline__ vector float __attribute__((__always_inline__)) 4106 vec_loge(vector float __a) { 4107 return __builtin_altivec_vlogefp(__a); 4108 } 4109 4110 /* vec_vlogefp */ 4111 4112 static __inline__ vector float __attribute__((__always_inline__)) 4113 vec_vlogefp(vector float __a) { 4114 return __builtin_altivec_vlogefp(__a); 4115 } 4116 4117 /* vec_lvsl */ 4118 4119 #ifdef __LITTLE_ENDIAN__ 4120 static __inline__ vector unsigned char __ATTRS_o_ai 4121 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4122 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 4123 vector unsigned char mask = 4124 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4125 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4126 7, 6, 5, 4, 3, 2, 1, 0}; 4127 return vec_perm(mask, mask, reverse); 4128 } 4129 #else 4130 static __inline__ vector unsigned char __ATTRS_o_ai 4131 vec_lvsl(int __a, const signed char *__b) { 4132 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4133 } 4134 #endif 4135 4136 #ifdef __LITTLE_ENDIAN__ 4137 static __inline__ vector unsigned char __ATTRS_o_ai 4138 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4139 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 4140 vector unsigned char mask = 4141 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4142 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4143 7, 6, 5, 4, 3, 2, 1, 0}; 4144 return vec_perm(mask, mask, reverse); 4145 } 4146 #else 4147 static __inline__ vector unsigned char __ATTRS_o_ai 4148 vec_lvsl(int __a, const unsigned char *__b) { 4149 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4150 } 4151 #endif 4152 4153 #ifdef __LITTLE_ENDIAN__ 4154 static __inline__ vector unsigned char __ATTRS_o_ai 4155 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4156 loads/stores"))) vec_lvsl(int __a, const short *__b) { 4157 vector unsigned char mask = 4158 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4159 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4160 7, 6, 5, 4, 3, 2, 1, 0}; 4161 return vec_perm(mask, mask, reverse); 4162 } 4163 #else 4164 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4165 const short *__b) { 4166 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4167 } 4168 #endif 4169 4170 #ifdef __LITTLE_ENDIAN__ 4171 static __inline__ vector unsigned char __ATTRS_o_ai 4172 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4173 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4174 vector unsigned char mask = 4175 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4176 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4177 7, 6, 5, 4, 3, 2, 1, 0}; 4178 return vec_perm(mask, mask, reverse); 4179 } 4180 #else 4181 static __inline__ vector unsigned char __ATTRS_o_ai 4182 vec_lvsl(int __a, const unsigned short *__b) { 4183 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4184 } 4185 #endif 4186 4187 #ifdef __LITTLE_ENDIAN__ 4188 static __inline__ vector unsigned char __ATTRS_o_ai 4189 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4190 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4191 vector unsigned char mask = 4192 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4193 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4194 7, 6, 5, 4, 3, 2, 1, 0}; 4195 return vec_perm(mask, mask, reverse); 4196 } 4197 #else 4198 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4199 const int *__b) { 4200 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4201 } 4202 #endif 4203 4204 #ifdef __LITTLE_ENDIAN__ 4205 static __inline__ vector unsigned char __ATTRS_o_ai 4206 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4207 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4208 vector unsigned char mask = 4209 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4210 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4211 7, 6, 5, 4, 3, 2, 1, 0}; 4212 return vec_perm(mask, mask, reverse); 4213 } 4214 #else 4215 static __inline__ vector unsigned char __ATTRS_o_ai 4216 vec_lvsl(int __a, const unsigned int *__b) { 4217 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4218 } 4219 #endif 4220 4221 #ifdef __LITTLE_ENDIAN__ 4222 static __inline__ vector unsigned char __ATTRS_o_ai 4223 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4224 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4225 vector unsigned char mask = 4226 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4227 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4228 7, 6, 5, 4, 3, 2, 1, 0}; 4229 return vec_perm(mask, mask, reverse); 4230 } 4231 #else 4232 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4233 const float *__b) { 4234 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4235 } 4236 #endif 4237 4238 /* vec_lvsr */ 4239 4240 #ifdef __LITTLE_ENDIAN__ 4241 static __inline__ vector unsigned char __ATTRS_o_ai 4242 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4243 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4244 vector unsigned char mask = 4245 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4246 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4247 7, 6, 5, 4, 3, 2, 1, 0}; 4248 return vec_perm(mask, mask, reverse); 4249 } 4250 #else 4251 static __inline__ vector unsigned char __ATTRS_o_ai 4252 vec_lvsr(int __a, const signed char *__b) { 4253 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4254 } 4255 #endif 4256 4257 #ifdef __LITTLE_ENDIAN__ 4258 static __inline__ vector unsigned char __ATTRS_o_ai 4259 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4260 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4261 vector unsigned char mask = 4262 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4263 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4264 7, 6, 5, 4, 3, 2, 1, 0}; 4265 return vec_perm(mask, mask, reverse); 4266 } 4267 #else 4268 static __inline__ vector unsigned char __ATTRS_o_ai 4269 vec_lvsr(int __a, const unsigned char *__b) { 4270 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4271 } 4272 #endif 4273 4274 #ifdef __LITTLE_ENDIAN__ 4275 static __inline__ vector unsigned char __ATTRS_o_ai 4276 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4277 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4278 vector unsigned char mask = 4279 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4280 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4281 7, 6, 5, 4, 3, 2, 1, 0}; 4282 return vec_perm(mask, mask, reverse); 4283 } 4284 #else 4285 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4286 const short *__b) { 4287 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4288 } 4289 #endif 4290 4291 #ifdef __LITTLE_ENDIAN__ 4292 static __inline__ vector unsigned char __ATTRS_o_ai 4293 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4294 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4295 vector unsigned char mask = 4296 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4297 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4298 7, 6, 5, 4, 3, 2, 1, 0}; 4299 return vec_perm(mask, mask, reverse); 4300 } 4301 #else 4302 static __inline__ vector unsigned char __ATTRS_o_ai 4303 vec_lvsr(int __a, const unsigned short *__b) { 4304 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4305 } 4306 #endif 4307 4308 #ifdef __LITTLE_ENDIAN__ 4309 static __inline__ vector unsigned char __ATTRS_o_ai 4310 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4311 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4312 vector unsigned char mask = 4313 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4314 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4315 7, 6, 5, 4, 3, 2, 1, 0}; 4316 return vec_perm(mask, mask, reverse); 4317 } 4318 #else 4319 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4320 const int *__b) { 4321 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4322 } 4323 #endif 4324 4325 #ifdef __LITTLE_ENDIAN__ 4326 static __inline__ vector unsigned char __ATTRS_o_ai 4327 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4328 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4329 vector unsigned char mask = 4330 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4331 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4332 7, 6, 5, 4, 3, 2, 1, 0}; 4333 return vec_perm(mask, mask, reverse); 4334 } 4335 #else 4336 static __inline__ vector unsigned char __ATTRS_o_ai 4337 vec_lvsr(int __a, const unsigned int *__b) { 4338 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4339 } 4340 #endif 4341 4342 #ifdef __LITTLE_ENDIAN__ 4343 static __inline__ vector unsigned char __ATTRS_o_ai 4344 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4345 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4346 vector unsigned char mask = 4347 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4348 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4349 7, 6, 5, 4, 3, 2, 1, 0}; 4350 return vec_perm(mask, mask, reverse); 4351 } 4352 #else 4353 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4354 const float *__b) { 4355 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4356 } 4357 #endif 4358 4359 /* vec_madd */ 4360 static __inline__ vector signed short __ATTRS_o_ai 4361 vec_mladd(vector signed short, vector signed short, vector signed short); 4362 static __inline__ vector signed short __ATTRS_o_ai 4363 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4364 static __inline__ vector signed short __ATTRS_o_ai 4365 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4366 static __inline__ vector unsigned short __ATTRS_o_ai 4367 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4368 4369 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4370 vector signed short __a, vector signed short __b, vector signed short __c) { 4371 return vec_mladd(__a, __b, __c); 4372 } 4373 4374 static __inline__ vector signed short __ATTRS_o_ai 4375 vec_madd(vector signed short __a, vector unsigned short __b, 4376 vector unsigned short __c) { 4377 return vec_mladd(__a, __b, __c); 4378 } 4379 4380 static __inline__ vector signed short __ATTRS_o_ai 4381 vec_madd(vector unsigned short __a, vector signed short __b, 4382 vector signed short __c) { 4383 return vec_mladd(__a, __b, __c); 4384 } 4385 4386 static __inline__ vector unsigned short __ATTRS_o_ai 4387 vec_madd(vector unsigned short __a, vector unsigned short __b, 4388 vector unsigned short __c) { 4389 return vec_mladd(__a, __b, __c); 4390 } 4391 4392 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4393 vector float __b, 4394 vector float __c) { 4395 #ifdef __VSX__ 4396 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4397 #else 4398 return __builtin_altivec_vmaddfp(__a, __b, __c); 4399 #endif 4400 } 4401 4402 #ifdef __VSX__ 4403 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4404 vector double __b, 4405 vector double __c) { 4406 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4407 } 4408 #endif 4409 4410 /* vec_vmaddfp */ 4411 4412 static __inline__ vector float __attribute__((__always_inline__)) 4413 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4414 return __builtin_altivec_vmaddfp(__a, __b, __c); 4415 } 4416 4417 /* vec_madds */ 4418 4419 static __inline__ vector signed short __attribute__((__always_inline__)) 4420 vec_madds(vector signed short __a, vector signed short __b, 4421 vector signed short __c) { 4422 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4423 } 4424 4425 /* vec_vmhaddshs */ 4426 static __inline__ vector signed short __attribute__((__always_inline__)) 4427 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4428 vector signed short __c) { 4429 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4430 } 4431 4432 /* vec_msub */ 4433 4434 #ifdef __VSX__ 4435 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4436 vector float __b, 4437 vector float __c) { 4438 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4439 } 4440 4441 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4442 vector double __b, 4443 vector double __c) { 4444 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4445 } 4446 #endif 4447 4448 /* vec_max */ 4449 4450 static __inline__ vector signed char __ATTRS_o_ai 4451 vec_max(vector signed char __a, vector signed char __b) { 4452 return __builtin_altivec_vmaxsb(__a, __b); 4453 } 4454 4455 static __inline__ vector signed char __ATTRS_o_ai 4456 vec_max(vector bool char __a, vector signed char __b) { 4457 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4458 } 4459 4460 static __inline__ vector signed char __ATTRS_o_ai 4461 vec_max(vector signed char __a, vector bool char __b) { 4462 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4463 } 4464 4465 static __inline__ vector unsigned char __ATTRS_o_ai 4466 vec_max(vector unsigned char __a, vector unsigned char __b) { 4467 return __builtin_altivec_vmaxub(__a, __b); 4468 } 4469 4470 static __inline__ vector unsigned char __ATTRS_o_ai 4471 vec_max(vector bool char __a, vector unsigned char __b) { 4472 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4473 } 4474 4475 static __inline__ vector unsigned char __ATTRS_o_ai 4476 vec_max(vector unsigned char __a, vector bool char __b) { 4477 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4478 } 4479 4480 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4481 vector short __b) { 4482 return __builtin_altivec_vmaxsh(__a, __b); 4483 } 4484 4485 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4486 vector short __b) { 4487 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4488 } 4489 4490 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4491 vector bool short __b) { 4492 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4493 } 4494 4495 static __inline__ vector unsigned short __ATTRS_o_ai 4496 vec_max(vector unsigned short __a, vector unsigned short __b) { 4497 return __builtin_altivec_vmaxuh(__a, __b); 4498 } 4499 4500 static __inline__ vector unsigned short __ATTRS_o_ai 4501 vec_max(vector bool short __a, vector unsigned short __b) { 4502 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4503 } 4504 4505 static __inline__ vector unsigned short __ATTRS_o_ai 4506 vec_max(vector unsigned short __a, vector bool short __b) { 4507 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4508 } 4509 4510 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4511 vector int __b) { 4512 return __builtin_altivec_vmaxsw(__a, __b); 4513 } 4514 4515 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4516 vector int __b) { 4517 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4518 } 4519 4520 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4521 vector bool int __b) { 4522 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4523 } 4524 4525 static __inline__ vector unsigned int __ATTRS_o_ai 4526 vec_max(vector unsigned int __a, vector unsigned int __b) { 4527 return __builtin_altivec_vmaxuw(__a, __b); 4528 } 4529 4530 static __inline__ vector unsigned int __ATTRS_o_ai 4531 vec_max(vector bool int __a, vector unsigned int __b) { 4532 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4533 } 4534 4535 static __inline__ vector unsigned int __ATTRS_o_ai 4536 vec_max(vector unsigned int __a, vector bool int __b) { 4537 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4538 } 4539 4540 #ifdef __POWER8_VECTOR__ 4541 static __inline__ vector signed long long __ATTRS_o_ai 4542 vec_max(vector signed long long __a, vector signed long long __b) { 4543 return __builtin_altivec_vmaxsd(__a, __b); 4544 } 4545 4546 static __inline__ vector signed long long __ATTRS_o_ai 4547 vec_max(vector bool long long __a, vector signed long long __b) { 4548 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4549 } 4550 4551 static __inline__ vector signed long long __ATTRS_o_ai 4552 vec_max(vector signed long long __a, vector bool long long __b) { 4553 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4554 } 4555 4556 static __inline__ vector unsigned long long __ATTRS_o_ai 4557 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4558 return __builtin_altivec_vmaxud(__a, __b); 4559 } 4560 4561 static __inline__ vector unsigned long long __ATTRS_o_ai 4562 vec_max(vector bool long long __a, vector unsigned long long __b) { 4563 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4564 } 4565 4566 static __inline__ vector unsigned long long __ATTRS_o_ai 4567 vec_max(vector unsigned long long __a, vector bool long long __b) { 4568 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4569 } 4570 #endif 4571 4572 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4573 vector float __b) { 4574 #ifdef __VSX__ 4575 return __builtin_vsx_xvmaxsp(__a, __b); 4576 #else 4577 return __builtin_altivec_vmaxfp(__a, __b); 4578 #endif 4579 } 4580 4581 #ifdef __VSX__ 4582 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4583 vector double __b) { 4584 return __builtin_vsx_xvmaxdp(__a, __b); 4585 } 4586 #endif 4587 4588 /* vec_vmaxsb */ 4589 4590 static __inline__ vector signed char __ATTRS_o_ai 4591 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4592 return __builtin_altivec_vmaxsb(__a, __b); 4593 } 4594 4595 static __inline__ vector signed char __ATTRS_o_ai 4596 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4597 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4598 } 4599 4600 static __inline__ vector signed char __ATTRS_o_ai 4601 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4602 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4603 } 4604 4605 /* vec_vmaxub */ 4606 4607 static __inline__ vector unsigned char __ATTRS_o_ai 4608 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4609 return __builtin_altivec_vmaxub(__a, __b); 4610 } 4611 4612 static __inline__ vector unsigned char __ATTRS_o_ai 4613 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4614 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4615 } 4616 4617 static __inline__ vector unsigned char __ATTRS_o_ai 4618 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4619 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4620 } 4621 4622 /* vec_vmaxsh */ 4623 4624 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4625 vector short __b) { 4626 return __builtin_altivec_vmaxsh(__a, __b); 4627 } 4628 4629 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 4630 vector short __b) { 4631 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4632 } 4633 4634 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4635 vector bool short __b) { 4636 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4637 } 4638 4639 /* vec_vmaxuh */ 4640 4641 static __inline__ vector unsigned short __ATTRS_o_ai 4642 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 4643 return __builtin_altivec_vmaxuh(__a, __b); 4644 } 4645 4646 static __inline__ vector unsigned short __ATTRS_o_ai 4647 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 4648 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4649 } 4650 4651 static __inline__ vector unsigned short __ATTRS_o_ai 4652 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 4653 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4654 } 4655 4656 /* vec_vmaxsw */ 4657 4658 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4659 vector int __b) { 4660 return __builtin_altivec_vmaxsw(__a, __b); 4661 } 4662 4663 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 4664 vector int __b) { 4665 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4666 } 4667 4668 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4669 vector bool int __b) { 4670 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4671 } 4672 4673 /* vec_vmaxuw */ 4674 4675 static __inline__ vector unsigned int __ATTRS_o_ai 4676 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 4677 return __builtin_altivec_vmaxuw(__a, __b); 4678 } 4679 4680 static __inline__ vector unsigned int __ATTRS_o_ai 4681 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 4682 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4683 } 4684 4685 static __inline__ vector unsigned int __ATTRS_o_ai 4686 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 4687 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4688 } 4689 4690 /* vec_vmaxfp */ 4691 4692 static __inline__ vector float __attribute__((__always_inline__)) 4693 vec_vmaxfp(vector float __a, vector float __b) { 4694 #ifdef __VSX__ 4695 return __builtin_vsx_xvmaxsp(__a, __b); 4696 #else 4697 return __builtin_altivec_vmaxfp(__a, __b); 4698 #endif 4699 } 4700 4701 /* vec_mergeh */ 4702 4703 static __inline__ vector signed char __ATTRS_o_ai 4704 vec_mergeh(vector signed char __a, vector signed char __b) { 4705 return vec_perm(__a, __b, 4706 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4707 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4708 0x06, 0x16, 0x07, 0x17)); 4709 } 4710 4711 static __inline__ vector unsigned char __ATTRS_o_ai 4712 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 4713 return vec_perm(__a, __b, 4714 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4715 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4716 0x06, 0x16, 0x07, 0x17)); 4717 } 4718 4719 static __inline__ vector bool char __ATTRS_o_ai 4720 vec_mergeh(vector bool char __a, vector bool char __b) { 4721 return vec_perm(__a, __b, 4722 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4723 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4724 0x06, 0x16, 0x07, 0x17)); 4725 } 4726 4727 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 4728 vector short __b) { 4729 return vec_perm(__a, __b, 4730 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4731 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4732 0x06, 0x07, 0x16, 0x17)); 4733 } 4734 4735 static __inline__ vector unsigned short __ATTRS_o_ai 4736 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 4737 return vec_perm(__a, __b, 4738 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4739 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4740 0x06, 0x07, 0x16, 0x17)); 4741 } 4742 4743 static __inline__ vector bool short __ATTRS_o_ai 4744 vec_mergeh(vector bool short __a, vector bool short __b) { 4745 return vec_perm(__a, __b, 4746 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4747 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4748 0x06, 0x07, 0x16, 0x17)); 4749 } 4750 4751 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 4752 vector pixel __b) { 4753 return vec_perm(__a, __b, 4754 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4755 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4756 0x06, 0x07, 0x16, 0x17)); 4757 } 4758 4759 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 4760 vector int __b) { 4761 return vec_perm(__a, __b, 4762 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4763 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4764 0x14, 0x15, 0x16, 0x17)); 4765 } 4766 4767 static __inline__ vector unsigned int __ATTRS_o_ai 4768 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 4769 return vec_perm(__a, __b, 4770 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4771 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4772 0x14, 0x15, 0x16, 0x17)); 4773 } 4774 4775 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 4776 vector bool int __b) { 4777 return vec_perm(__a, __b, 4778 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4779 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4780 0x14, 0x15, 0x16, 0x17)); 4781 } 4782 4783 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 4784 vector float __b) { 4785 return vec_perm(__a, __b, 4786 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4787 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4788 0x14, 0x15, 0x16, 0x17)); 4789 } 4790 4791 #ifdef __VSX__ 4792 static __inline__ vector signed long long __ATTRS_o_ai 4793 vec_mergeh(vector signed long long __a, vector signed long long __b) { 4794 return vec_perm(__a, __b, 4795 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4796 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4797 0x14, 0x15, 0x16, 0x17)); 4798 } 4799 4800 static __inline__ vector signed long long __ATTRS_o_ai 4801 vec_mergeh(vector signed long long __a, vector bool long long __b) { 4802 return vec_perm(__a, (vector signed long long)__b, 4803 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4804 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4805 0x14, 0x15, 0x16, 0x17)); 4806 } 4807 4808 static __inline__ vector signed long long __ATTRS_o_ai 4809 vec_mergeh(vector bool long long __a, vector signed long long __b) { 4810 return vec_perm((vector signed long long)__a, __b, 4811 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4812 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4813 0x14, 0x15, 0x16, 0x17)); 4814 } 4815 4816 static __inline__ vector unsigned long long __ATTRS_o_ai 4817 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 4818 return vec_perm(__a, __b, 4819 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4820 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4821 0x14, 0x15, 0x16, 0x17)); 4822 } 4823 4824 static __inline__ vector unsigned long long __ATTRS_o_ai 4825 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 4826 return vec_perm(__a, (vector unsigned long long)__b, 4827 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4828 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4829 0x14, 0x15, 0x16, 0x17)); 4830 } 4831 4832 static __inline__ vector unsigned long long __ATTRS_o_ai 4833 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 4834 return vec_perm((vector unsigned long long)__a, __b, 4835 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4836 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4837 0x14, 0x15, 0x16, 0x17)); 4838 } 4839 4840 static __inline__ vector bool long long __ATTRS_o_ai 4841 vec_mergeh(vector bool long long __a, vector bool long long __b) { 4842 return vec_perm(__a, __b, 4843 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4844 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4845 0x14, 0x15, 0x16, 0x17)); 4846 } 4847 4848 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 4849 vector double __b) { 4850 return vec_perm(__a, __b, 4851 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4852 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4853 0x14, 0x15, 0x16, 0x17)); 4854 } 4855 static __inline__ vector double __ATTRS_o_ai 4856 vec_mergeh(vector double __a, vector bool long long __b) { 4857 return vec_perm(__a, (vector double)__b, 4858 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4859 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4860 0x14, 0x15, 0x16, 0x17)); 4861 } 4862 static __inline__ vector double __ATTRS_o_ai 4863 vec_mergeh(vector bool long long __a, vector double __b) { 4864 return vec_perm((vector double)__a, __b, 4865 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 4866 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 4867 0x14, 0x15, 0x16, 0x17)); 4868 } 4869 #endif 4870 4871 /* vec_vmrghb */ 4872 4873 #define __builtin_altivec_vmrghb vec_vmrghb 4874 4875 static __inline__ vector signed char __ATTRS_o_ai 4876 vec_vmrghb(vector signed char __a, vector signed char __b) { 4877 return vec_perm(__a, __b, 4878 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4879 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4880 0x06, 0x16, 0x07, 0x17)); 4881 } 4882 4883 static __inline__ vector unsigned char __ATTRS_o_ai 4884 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 4885 return vec_perm(__a, __b, 4886 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4887 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4888 0x06, 0x16, 0x07, 0x17)); 4889 } 4890 4891 static __inline__ vector bool char __ATTRS_o_ai 4892 vec_vmrghb(vector bool char __a, vector bool char __b) { 4893 return vec_perm(__a, __b, 4894 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 4895 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 4896 0x06, 0x16, 0x07, 0x17)); 4897 } 4898 4899 /* vec_vmrghh */ 4900 4901 #define __builtin_altivec_vmrghh vec_vmrghh 4902 4903 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 4904 vector short __b) { 4905 return vec_perm(__a, __b, 4906 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4907 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4908 0x06, 0x07, 0x16, 0x17)); 4909 } 4910 4911 static __inline__ vector unsigned short __ATTRS_o_ai 4912 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 4913 return vec_perm(__a, __b, 4914 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4915 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4916 0x06, 0x07, 0x16, 0x17)); 4917 } 4918 4919 static __inline__ vector bool short __ATTRS_o_ai 4920 vec_vmrghh(vector bool short __a, vector bool short __b) { 4921 return vec_perm(__a, __b, 4922 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4923 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4924 0x06, 0x07, 0x16, 0x17)); 4925 } 4926 4927 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 4928 vector pixel __b) { 4929 return vec_perm(__a, __b, 4930 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 4931 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 4932 0x06, 0x07, 0x16, 0x17)); 4933 } 4934 4935 /* vec_vmrghw */ 4936 4937 #define __builtin_altivec_vmrghw vec_vmrghw 4938 4939 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 4940 vector int __b) { 4941 return vec_perm(__a, __b, 4942 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4943 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4944 0x14, 0x15, 0x16, 0x17)); 4945 } 4946 4947 static __inline__ vector unsigned int __ATTRS_o_ai 4948 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 4949 return vec_perm(__a, __b, 4950 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4951 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4952 0x14, 0x15, 0x16, 0x17)); 4953 } 4954 4955 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 4956 vector bool int __b) { 4957 return vec_perm(__a, __b, 4958 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4959 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4960 0x14, 0x15, 0x16, 0x17)); 4961 } 4962 4963 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 4964 vector float __b) { 4965 return vec_perm(__a, __b, 4966 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 4967 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 4968 0x14, 0x15, 0x16, 0x17)); 4969 } 4970 4971 /* vec_mergel */ 4972 4973 static __inline__ vector signed char __ATTRS_o_ai 4974 vec_mergel(vector signed char __a, vector signed char __b) { 4975 return vec_perm(__a, __b, 4976 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4977 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4978 0x0E, 0x1E, 0x0F, 0x1F)); 4979 } 4980 4981 static __inline__ vector unsigned char __ATTRS_o_ai 4982 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 4983 return vec_perm(__a, __b, 4984 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4985 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4986 0x0E, 0x1E, 0x0F, 0x1F)); 4987 } 4988 4989 static __inline__ vector bool char __ATTRS_o_ai 4990 vec_mergel(vector bool char __a, vector bool char __b) { 4991 return vec_perm(__a, __b, 4992 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 4993 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 4994 0x0E, 0x1E, 0x0F, 0x1F)); 4995 } 4996 4997 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 4998 vector short __b) { 4999 return vec_perm(__a, __b, 5000 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5001 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5002 0x0E, 0x0F, 0x1E, 0x1F)); 5003 } 5004 5005 static __inline__ vector unsigned short __ATTRS_o_ai 5006 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 5007 return vec_perm(__a, __b, 5008 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5009 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5010 0x0E, 0x0F, 0x1E, 0x1F)); 5011 } 5012 5013 static __inline__ vector bool short __ATTRS_o_ai 5014 vec_mergel(vector bool short __a, vector bool short __b) { 5015 return vec_perm(__a, __b, 5016 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5017 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5018 0x0E, 0x0F, 0x1E, 0x1F)); 5019 } 5020 5021 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 5022 vector pixel __b) { 5023 return vec_perm(__a, __b, 5024 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5025 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5026 0x0E, 0x0F, 0x1E, 0x1F)); 5027 } 5028 5029 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 5030 vector int __b) { 5031 return vec_perm(__a, __b, 5032 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5033 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5034 0x1C, 0x1D, 0x1E, 0x1F)); 5035 } 5036 5037 static __inline__ vector unsigned int __ATTRS_o_ai 5038 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 5039 return vec_perm(__a, __b, 5040 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5041 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5042 0x1C, 0x1D, 0x1E, 0x1F)); 5043 } 5044 5045 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 5046 vector bool int __b) { 5047 return vec_perm(__a, __b, 5048 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5049 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5050 0x1C, 0x1D, 0x1E, 0x1F)); 5051 } 5052 5053 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 5054 vector float __b) { 5055 return vec_perm(__a, __b, 5056 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5057 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5058 0x1C, 0x1D, 0x1E, 0x1F)); 5059 } 5060 5061 #ifdef __VSX__ 5062 static __inline__ vector signed long long __ATTRS_o_ai 5063 vec_mergel(vector signed long long __a, vector signed long long __b) { 5064 return vec_perm(__a, __b, 5065 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5066 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5067 0x1C, 0x1D, 0x1E, 0x1F)); 5068 } 5069 static __inline__ vector signed long long __ATTRS_o_ai 5070 vec_mergel(vector signed long long __a, vector bool long long __b) { 5071 return vec_perm(__a, (vector signed long long)__b, 5072 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5073 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5074 0x1C, 0x1D, 0x1E, 0x1F)); 5075 } 5076 static __inline__ vector signed long long __ATTRS_o_ai 5077 vec_mergel(vector bool long long __a, vector signed long long __b) { 5078 return vec_perm((vector signed long long)__a, __b, 5079 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5080 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5081 0x1C, 0x1D, 0x1E, 0x1F)); 5082 } 5083 static __inline__ vector unsigned long long __ATTRS_o_ai 5084 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 5085 return vec_perm(__a, __b, 5086 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5087 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5088 0x1C, 0x1D, 0x1E, 0x1F)); 5089 } 5090 static __inline__ vector unsigned long long __ATTRS_o_ai 5091 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 5092 return vec_perm(__a, (vector unsigned long long)__b, 5093 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5094 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5095 0x1C, 0x1D, 0x1E, 0x1F)); 5096 } 5097 static __inline__ vector unsigned long long __ATTRS_o_ai 5098 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 5099 return vec_perm((vector unsigned long long)__a, __b, 5100 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5101 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5102 0x1C, 0x1D, 0x1E, 0x1F)); 5103 } 5104 static __inline__ vector bool long long __ATTRS_o_ai 5105 vec_mergel(vector bool long long __a, vector bool long long __b) { 5106 return vec_perm(__a, __b, 5107 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5108 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5109 0x1C, 0x1D, 0x1E, 0x1F)); 5110 } 5111 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 5112 vector double __b) { 5113 return vec_perm(__a, __b, 5114 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5115 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5116 0x1C, 0x1D, 0x1E, 0x1F)); 5117 } 5118 static __inline__ vector double __ATTRS_o_ai 5119 vec_mergel(vector double __a, vector bool long long __b) { 5120 return vec_perm(__a, (vector double)__b, 5121 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5122 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5123 0x1C, 0x1D, 0x1E, 0x1F)); 5124 } 5125 static __inline__ vector double __ATTRS_o_ai 5126 vec_mergel(vector bool long long __a, vector double __b) { 5127 return vec_perm((vector double)__a, __b, 5128 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5129 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5130 0x1C, 0x1D, 0x1E, 0x1F)); 5131 } 5132 #endif 5133 5134 /* vec_vmrglb */ 5135 5136 #define __builtin_altivec_vmrglb vec_vmrglb 5137 5138 static __inline__ vector signed char __ATTRS_o_ai 5139 vec_vmrglb(vector signed char __a, vector signed char __b) { 5140 return vec_perm(__a, __b, 5141 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5142 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5143 0x0E, 0x1E, 0x0F, 0x1F)); 5144 } 5145 5146 static __inline__ vector unsigned char __ATTRS_o_ai 5147 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 5148 return vec_perm(__a, __b, 5149 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5150 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5151 0x0E, 0x1E, 0x0F, 0x1F)); 5152 } 5153 5154 static __inline__ vector bool char __ATTRS_o_ai 5155 vec_vmrglb(vector bool char __a, vector bool char __b) { 5156 return vec_perm(__a, __b, 5157 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5158 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5159 0x0E, 0x1E, 0x0F, 0x1F)); 5160 } 5161 5162 /* vec_vmrglh */ 5163 5164 #define __builtin_altivec_vmrglh vec_vmrglh 5165 5166 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 5167 vector short __b) { 5168 return vec_perm(__a, __b, 5169 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5170 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5171 0x0E, 0x0F, 0x1E, 0x1F)); 5172 } 5173 5174 static __inline__ vector unsigned short __ATTRS_o_ai 5175 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5176 return vec_perm(__a, __b, 5177 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5178 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5179 0x0E, 0x0F, 0x1E, 0x1F)); 5180 } 5181 5182 static __inline__ vector bool short __ATTRS_o_ai 5183 vec_vmrglh(vector bool short __a, vector bool short __b) { 5184 return vec_perm(__a, __b, 5185 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5186 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5187 0x0E, 0x0F, 0x1E, 0x1F)); 5188 } 5189 5190 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5191 vector pixel __b) { 5192 return vec_perm(__a, __b, 5193 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5194 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5195 0x0E, 0x0F, 0x1E, 0x1F)); 5196 } 5197 5198 /* vec_vmrglw */ 5199 5200 #define __builtin_altivec_vmrglw vec_vmrglw 5201 5202 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5203 vector int __b) { 5204 return vec_perm(__a, __b, 5205 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5206 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5207 0x1C, 0x1D, 0x1E, 0x1F)); 5208 } 5209 5210 static __inline__ vector unsigned int __ATTRS_o_ai 5211 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5212 return vec_perm(__a, __b, 5213 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5214 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5215 0x1C, 0x1D, 0x1E, 0x1F)); 5216 } 5217 5218 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5219 vector bool int __b) { 5220 return vec_perm(__a, __b, 5221 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5222 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5223 0x1C, 0x1D, 0x1E, 0x1F)); 5224 } 5225 5226 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5227 vector float __b) { 5228 return vec_perm(__a, __b, 5229 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5230 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5231 0x1C, 0x1D, 0x1E, 0x1F)); 5232 } 5233 5234 #ifdef __POWER8_VECTOR__ 5235 /* vec_mergee */ 5236 5237 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5238 vector bool int __b) { 5239 return vec_perm(__a, __b, 5240 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5241 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5242 0x18, 0x19, 0x1A, 0x1B)); 5243 } 5244 5245 static __inline__ vector signed int __ATTRS_o_ai 5246 vec_mergee(vector signed int __a, vector signed int __b) { 5247 return vec_perm(__a, __b, 5248 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5249 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5250 0x18, 0x19, 0x1A, 0x1B)); 5251 } 5252 5253 static __inline__ vector unsigned int __ATTRS_o_ai 5254 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5255 return vec_perm(__a, __b, 5256 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5257 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5258 0x18, 0x19, 0x1A, 0x1B)); 5259 } 5260 5261 static __inline__ vector bool long long __ATTRS_o_ai 5262 vec_mergee(vector bool long long __a, vector bool long long __b) { 5263 return vec_mergeh(__a, __b); 5264 } 5265 5266 static __inline__ vector signed long long __ATTRS_o_ai 5267 vec_mergee(vector signed long long __a, vector signed long long __b) { 5268 return vec_mergeh(__a, __b); 5269 } 5270 5271 static __inline__ vector unsigned long long __ATTRS_o_ai 5272 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5273 return vec_mergeh(__a, __b); 5274 } 5275 5276 static __inline__ vector float __ATTRS_o_ai 5277 vec_mergee(vector float __a, vector float __b) { 5278 return vec_perm(__a, __b, 5279 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5280 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5281 0x18, 0x19, 0x1A, 0x1B)); 5282 } 5283 5284 static __inline__ vector double __ATTRS_o_ai 5285 vec_mergee(vector double __a, vector double __b) { 5286 return vec_mergeh(__a, __b); 5287 } 5288 5289 /* vec_mergeo */ 5290 5291 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5292 vector bool int __b) { 5293 return vec_perm(__a, __b, 5294 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5295 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5296 0x1C, 0x1D, 0x1E, 0x1F)); 5297 } 5298 5299 static __inline__ vector signed int __ATTRS_o_ai 5300 vec_mergeo(vector signed int __a, vector signed int __b) { 5301 return vec_perm(__a, __b, 5302 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5303 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5304 0x1C, 0x1D, 0x1E, 0x1F)); 5305 } 5306 5307 static __inline__ vector unsigned int __ATTRS_o_ai 5308 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5309 return vec_perm(__a, __b, 5310 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5311 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5312 0x1C, 0x1D, 0x1E, 0x1F)); 5313 } 5314 5315 static __inline__ vector bool long long __ATTRS_o_ai 5316 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5317 return vec_mergel(__a, __b); 5318 } 5319 5320 static __inline__ vector signed long long __ATTRS_o_ai 5321 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5322 return vec_mergel(__a, __b); 5323 } 5324 5325 static __inline__ vector unsigned long long __ATTRS_o_ai 5326 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5327 return vec_mergel(__a, __b); 5328 } 5329 5330 static __inline__ vector float __ATTRS_o_ai 5331 vec_mergeo(vector float __a, vector float __b) { 5332 return vec_perm(__a, __b, 5333 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5334 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5335 0x1C, 0x1D, 0x1E, 0x1F)); 5336 } 5337 5338 static __inline__ vector double __ATTRS_o_ai 5339 vec_mergeo(vector double __a, vector double __b) { 5340 return vec_mergel(__a, __b); 5341 } 5342 5343 #endif 5344 5345 /* vec_mfvscr */ 5346 5347 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5348 vec_mfvscr(void) { 5349 return __builtin_altivec_mfvscr(); 5350 } 5351 5352 /* vec_min */ 5353 5354 static __inline__ vector signed char __ATTRS_o_ai 5355 vec_min(vector signed char __a, vector signed char __b) { 5356 return __builtin_altivec_vminsb(__a, __b); 5357 } 5358 5359 static __inline__ vector signed char __ATTRS_o_ai 5360 vec_min(vector bool char __a, vector signed char __b) { 5361 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5362 } 5363 5364 static __inline__ vector signed char __ATTRS_o_ai 5365 vec_min(vector signed char __a, vector bool char __b) { 5366 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5367 } 5368 5369 static __inline__ vector unsigned char __ATTRS_o_ai 5370 vec_min(vector unsigned char __a, vector unsigned char __b) { 5371 return __builtin_altivec_vminub(__a, __b); 5372 } 5373 5374 static __inline__ vector unsigned char __ATTRS_o_ai 5375 vec_min(vector bool char __a, vector unsigned char __b) { 5376 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5377 } 5378 5379 static __inline__ vector unsigned char __ATTRS_o_ai 5380 vec_min(vector unsigned char __a, vector bool char __b) { 5381 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5382 } 5383 5384 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5385 vector short __b) { 5386 return __builtin_altivec_vminsh(__a, __b); 5387 } 5388 5389 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5390 vector short __b) { 5391 return __builtin_altivec_vminsh((vector short)__a, __b); 5392 } 5393 5394 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5395 vector bool short __b) { 5396 return __builtin_altivec_vminsh(__a, (vector short)__b); 5397 } 5398 5399 static __inline__ vector unsigned short __ATTRS_o_ai 5400 vec_min(vector unsigned short __a, vector unsigned short __b) { 5401 return __builtin_altivec_vminuh(__a, __b); 5402 } 5403 5404 static __inline__ vector unsigned short __ATTRS_o_ai 5405 vec_min(vector bool short __a, vector unsigned short __b) { 5406 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5407 } 5408 5409 static __inline__ vector unsigned short __ATTRS_o_ai 5410 vec_min(vector unsigned short __a, vector bool short __b) { 5411 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5412 } 5413 5414 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5415 vector int __b) { 5416 return __builtin_altivec_vminsw(__a, __b); 5417 } 5418 5419 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5420 vector int __b) { 5421 return __builtin_altivec_vminsw((vector int)__a, __b); 5422 } 5423 5424 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5425 vector bool int __b) { 5426 return __builtin_altivec_vminsw(__a, (vector int)__b); 5427 } 5428 5429 static __inline__ vector unsigned int __ATTRS_o_ai 5430 vec_min(vector unsigned int __a, vector unsigned int __b) { 5431 return __builtin_altivec_vminuw(__a, __b); 5432 } 5433 5434 static __inline__ vector unsigned int __ATTRS_o_ai 5435 vec_min(vector bool int __a, vector unsigned int __b) { 5436 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5437 } 5438 5439 static __inline__ vector unsigned int __ATTRS_o_ai 5440 vec_min(vector unsigned int __a, vector bool int __b) { 5441 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5442 } 5443 5444 #ifdef __POWER8_VECTOR__ 5445 static __inline__ vector signed long long __ATTRS_o_ai 5446 vec_min(vector signed long long __a, vector signed long long __b) { 5447 return __builtin_altivec_vminsd(__a, __b); 5448 } 5449 5450 static __inline__ vector signed long long __ATTRS_o_ai 5451 vec_min(vector bool long long __a, vector signed long long __b) { 5452 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5453 } 5454 5455 static __inline__ vector signed long long __ATTRS_o_ai 5456 vec_min(vector signed long long __a, vector bool long long __b) { 5457 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5458 } 5459 5460 static __inline__ vector unsigned long long __ATTRS_o_ai 5461 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5462 return __builtin_altivec_vminud(__a, __b); 5463 } 5464 5465 static __inline__ vector unsigned long long __ATTRS_o_ai 5466 vec_min(vector bool long long __a, vector unsigned long long __b) { 5467 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5468 } 5469 5470 static __inline__ vector unsigned long long __ATTRS_o_ai 5471 vec_min(vector unsigned long long __a, vector bool long long __b) { 5472 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5473 } 5474 #endif 5475 5476 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5477 vector float __b) { 5478 #ifdef __VSX__ 5479 return __builtin_vsx_xvminsp(__a, __b); 5480 #else 5481 return __builtin_altivec_vminfp(__a, __b); 5482 #endif 5483 } 5484 5485 #ifdef __VSX__ 5486 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5487 vector double __b) { 5488 return __builtin_vsx_xvmindp(__a, __b); 5489 } 5490 #endif 5491 5492 /* vec_vminsb */ 5493 5494 static __inline__ vector signed char __ATTRS_o_ai 5495 vec_vminsb(vector signed char __a, vector signed char __b) { 5496 return __builtin_altivec_vminsb(__a, __b); 5497 } 5498 5499 static __inline__ vector signed char __ATTRS_o_ai 5500 vec_vminsb(vector bool char __a, vector signed char __b) { 5501 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5502 } 5503 5504 static __inline__ vector signed char __ATTRS_o_ai 5505 vec_vminsb(vector signed char __a, vector bool char __b) { 5506 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5507 } 5508 5509 /* vec_vminub */ 5510 5511 static __inline__ vector unsigned char __ATTRS_o_ai 5512 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5513 return __builtin_altivec_vminub(__a, __b); 5514 } 5515 5516 static __inline__ vector unsigned char __ATTRS_o_ai 5517 vec_vminub(vector bool char __a, vector unsigned char __b) { 5518 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5519 } 5520 5521 static __inline__ vector unsigned char __ATTRS_o_ai 5522 vec_vminub(vector unsigned char __a, vector bool char __b) { 5523 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5524 } 5525 5526 /* vec_vminsh */ 5527 5528 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5529 vector short __b) { 5530 return __builtin_altivec_vminsh(__a, __b); 5531 } 5532 5533 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5534 vector short __b) { 5535 return __builtin_altivec_vminsh((vector short)__a, __b); 5536 } 5537 5538 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5539 vector bool short __b) { 5540 return __builtin_altivec_vminsh(__a, (vector short)__b); 5541 } 5542 5543 /* vec_vminuh */ 5544 5545 static __inline__ vector unsigned short __ATTRS_o_ai 5546 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5547 return __builtin_altivec_vminuh(__a, __b); 5548 } 5549 5550 static __inline__ vector unsigned short __ATTRS_o_ai 5551 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5552 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5553 } 5554 5555 static __inline__ vector unsigned short __ATTRS_o_ai 5556 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5557 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5558 } 5559 5560 /* vec_vminsw */ 5561 5562 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5563 vector int __b) { 5564 return __builtin_altivec_vminsw(__a, __b); 5565 } 5566 5567 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5568 vector int __b) { 5569 return __builtin_altivec_vminsw((vector int)__a, __b); 5570 } 5571 5572 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5573 vector bool int __b) { 5574 return __builtin_altivec_vminsw(__a, (vector int)__b); 5575 } 5576 5577 /* vec_vminuw */ 5578 5579 static __inline__ vector unsigned int __ATTRS_o_ai 5580 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5581 return __builtin_altivec_vminuw(__a, __b); 5582 } 5583 5584 static __inline__ vector unsigned int __ATTRS_o_ai 5585 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5586 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5587 } 5588 5589 static __inline__ vector unsigned int __ATTRS_o_ai 5590 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5591 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5592 } 5593 5594 /* vec_vminfp */ 5595 5596 static __inline__ vector float __attribute__((__always_inline__)) 5597 vec_vminfp(vector float __a, vector float __b) { 5598 #ifdef __VSX__ 5599 return __builtin_vsx_xvminsp(__a, __b); 5600 #else 5601 return __builtin_altivec_vminfp(__a, __b); 5602 #endif 5603 } 5604 5605 /* vec_mladd */ 5606 5607 #define __builtin_altivec_vmladduhm vec_mladd 5608 5609 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5610 vector short __b, 5611 vector short __c) { 5612 return __a * __b + __c; 5613 } 5614 5615 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5616 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5617 return __a * (vector short)__b + (vector short)__c; 5618 } 5619 5620 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5621 vector short __b, 5622 vector short __c) { 5623 return (vector short)__a * __b + __c; 5624 } 5625 5626 static __inline__ vector unsigned short __ATTRS_o_ai 5627 vec_mladd(vector unsigned short __a, vector unsigned short __b, 5628 vector unsigned short __c) { 5629 return __a * __b + __c; 5630 } 5631 5632 /* vec_vmladduhm */ 5633 5634 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 5635 vector short __b, 5636 vector short __c) { 5637 return __a * __b + __c; 5638 } 5639 5640 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 5641 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5642 return __a * (vector short)__b + (vector short)__c; 5643 } 5644 5645 static __inline__ vector short __ATTRS_o_ai 5646 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 5647 return (vector short)__a * __b + __c; 5648 } 5649 5650 static __inline__ vector unsigned short __ATTRS_o_ai 5651 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 5652 vector unsigned short __c) { 5653 return __a * __b + __c; 5654 } 5655 5656 /* vec_mradds */ 5657 5658 static __inline__ vector short __attribute__((__always_inline__)) 5659 vec_mradds(vector short __a, vector short __b, vector short __c) { 5660 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5661 } 5662 5663 /* vec_vmhraddshs */ 5664 5665 static __inline__ vector short __attribute__((__always_inline__)) 5666 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 5667 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5668 } 5669 5670 /* vec_msum */ 5671 5672 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 5673 vector unsigned char __b, 5674 vector int __c) { 5675 return __builtin_altivec_vmsummbm(__a, __b, __c); 5676 } 5677 5678 static __inline__ vector unsigned int __ATTRS_o_ai 5679 vec_msum(vector unsigned char __a, vector unsigned char __b, 5680 vector unsigned int __c) { 5681 return __builtin_altivec_vmsumubm(__a, __b, __c); 5682 } 5683 5684 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 5685 vector short __b, 5686 vector int __c) { 5687 return __builtin_altivec_vmsumshm(__a, __b, __c); 5688 } 5689 5690 static __inline__ vector unsigned int __ATTRS_o_ai 5691 vec_msum(vector unsigned short __a, vector unsigned short __b, 5692 vector unsigned int __c) { 5693 return __builtin_altivec_vmsumuhm(__a, __b, __c); 5694 } 5695 5696 /* vec_msumc */ 5697 5698 #ifdef __POWER10_VECTOR__ 5699 static __inline__ vector unsigned __int128 __ATTRS_o_ai 5700 vec_msumc(vector unsigned long long __a, vector unsigned long long __b, 5701 vector unsigned __int128 __c) { 5702 return __builtin_altivec_vmsumcud(__a, __b, __c); 5703 } 5704 #endif 5705 5706 /* vec_vmsummbm */ 5707 5708 static __inline__ vector int __attribute__((__always_inline__)) 5709 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 5710 return __builtin_altivec_vmsummbm(__a, __b, __c); 5711 } 5712 5713 /* vec_vmsumubm */ 5714 5715 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5716 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 5717 vector unsigned int __c) { 5718 return __builtin_altivec_vmsumubm(__a, __b, __c); 5719 } 5720 5721 /* vec_vmsumshm */ 5722 5723 static __inline__ vector int __attribute__((__always_inline__)) 5724 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 5725 return __builtin_altivec_vmsumshm(__a, __b, __c); 5726 } 5727 5728 /* vec_vmsumuhm */ 5729 5730 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5731 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 5732 vector unsigned int __c) { 5733 return __builtin_altivec_vmsumuhm(__a, __b, __c); 5734 } 5735 5736 /* vec_msums */ 5737 5738 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 5739 vector short __b, 5740 vector int __c) { 5741 return __builtin_altivec_vmsumshs(__a, __b, __c); 5742 } 5743 5744 static __inline__ vector unsigned int __ATTRS_o_ai 5745 vec_msums(vector unsigned short __a, vector unsigned short __b, 5746 vector unsigned int __c) { 5747 return __builtin_altivec_vmsumuhs(__a, __b, __c); 5748 } 5749 5750 /* vec_vmsumshs */ 5751 5752 static __inline__ vector int __attribute__((__always_inline__)) 5753 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 5754 return __builtin_altivec_vmsumshs(__a, __b, __c); 5755 } 5756 5757 /* vec_vmsumuhs */ 5758 5759 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5760 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 5761 vector unsigned int __c) { 5762 return __builtin_altivec_vmsumuhs(__a, __b, __c); 5763 } 5764 5765 /* vec_mtvscr */ 5766 5767 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 5768 __builtin_altivec_mtvscr((vector int)__a); 5769 } 5770 5771 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 5772 __builtin_altivec_mtvscr((vector int)__a); 5773 } 5774 5775 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 5776 __builtin_altivec_mtvscr((vector int)__a); 5777 } 5778 5779 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 5780 __builtin_altivec_mtvscr((vector int)__a); 5781 } 5782 5783 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 5784 __builtin_altivec_mtvscr((vector int)__a); 5785 } 5786 5787 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 5788 __builtin_altivec_mtvscr((vector int)__a); 5789 } 5790 5791 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 5792 __builtin_altivec_mtvscr((vector int)__a); 5793 } 5794 5795 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 5796 __builtin_altivec_mtvscr((vector int)__a); 5797 } 5798 5799 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 5800 __builtin_altivec_mtvscr((vector int)__a); 5801 } 5802 5803 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 5804 __builtin_altivec_mtvscr((vector int)__a); 5805 } 5806 5807 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 5808 __builtin_altivec_mtvscr((vector int)__a); 5809 } 5810 5811 /* vec_mul */ 5812 5813 /* Integer vector multiplication will involve multiplication of the odd/even 5814 elements separately, then truncating the results and moving to the 5815 result vector. 5816 */ 5817 static __inline__ vector signed char __ATTRS_o_ai 5818 vec_mul(vector signed char __a, vector signed char __b) { 5819 return __a * __b; 5820 } 5821 5822 static __inline__ vector unsigned char __ATTRS_o_ai 5823 vec_mul(vector unsigned char __a, vector unsigned char __b) { 5824 return __a * __b; 5825 } 5826 5827 static __inline__ vector signed short __ATTRS_o_ai 5828 vec_mul(vector signed short __a, vector signed short __b) { 5829 return __a * __b; 5830 } 5831 5832 static __inline__ vector unsigned short __ATTRS_o_ai 5833 vec_mul(vector unsigned short __a, vector unsigned short __b) { 5834 return __a * __b; 5835 } 5836 5837 static __inline__ vector signed int __ATTRS_o_ai 5838 vec_mul(vector signed int __a, vector signed int __b) { 5839 return __a * __b; 5840 } 5841 5842 static __inline__ vector unsigned int __ATTRS_o_ai 5843 vec_mul(vector unsigned int __a, vector unsigned int __b) { 5844 return __a * __b; 5845 } 5846 5847 #ifdef __VSX__ 5848 static __inline__ vector signed long long __ATTRS_o_ai 5849 vec_mul(vector signed long long __a, vector signed long long __b) { 5850 return __a * __b; 5851 } 5852 5853 static __inline__ vector unsigned long long __ATTRS_o_ai 5854 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 5855 return __a * __b; 5856 } 5857 #endif 5858 5859 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 5860 vector float __b) { 5861 return __a * __b; 5862 } 5863 5864 #ifdef __VSX__ 5865 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 5866 vector double __b) { 5867 return __a * __b; 5868 } 5869 #endif 5870 5871 /* The vmulos* and vmules* instructions have a big endian bias, so 5872 we must reverse the meaning of "even" and "odd" for little endian. */ 5873 5874 /* vec_mule */ 5875 5876 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 5877 vector signed char __b) { 5878 #ifdef __LITTLE_ENDIAN__ 5879 return __builtin_altivec_vmulosb(__a, __b); 5880 #else 5881 return __builtin_altivec_vmulesb(__a, __b); 5882 #endif 5883 } 5884 5885 static __inline__ vector unsigned short __ATTRS_o_ai 5886 vec_mule(vector unsigned char __a, vector unsigned char __b) { 5887 #ifdef __LITTLE_ENDIAN__ 5888 return __builtin_altivec_vmuloub(__a, __b); 5889 #else 5890 return __builtin_altivec_vmuleub(__a, __b); 5891 #endif 5892 } 5893 5894 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 5895 vector short __b) { 5896 #ifdef __LITTLE_ENDIAN__ 5897 return __builtin_altivec_vmulosh(__a, __b); 5898 #else 5899 return __builtin_altivec_vmulesh(__a, __b); 5900 #endif 5901 } 5902 5903 static __inline__ vector unsigned int __ATTRS_o_ai 5904 vec_mule(vector unsigned short __a, vector unsigned short __b) { 5905 #ifdef __LITTLE_ENDIAN__ 5906 return __builtin_altivec_vmulouh(__a, __b); 5907 #else 5908 return __builtin_altivec_vmuleuh(__a, __b); 5909 #endif 5910 } 5911 5912 #ifdef __POWER8_VECTOR__ 5913 static __inline__ vector signed long long __ATTRS_o_ai 5914 vec_mule(vector signed int __a, vector signed int __b) { 5915 #ifdef __LITTLE_ENDIAN__ 5916 return __builtin_altivec_vmulosw(__a, __b); 5917 #else 5918 return __builtin_altivec_vmulesw(__a, __b); 5919 #endif 5920 } 5921 5922 static __inline__ vector unsigned long long __ATTRS_o_ai 5923 vec_mule(vector unsigned int __a, vector unsigned int __b) { 5924 #ifdef __LITTLE_ENDIAN__ 5925 return __builtin_altivec_vmulouw(__a, __b); 5926 #else 5927 return __builtin_altivec_vmuleuw(__a, __b); 5928 #endif 5929 } 5930 #endif 5931 5932 #ifdef __POWER10_VECTOR__ 5933 static __inline__ vector signed __int128 __ATTRS_o_ai 5934 vec_mule(vector signed long long __a, vector signed long long __b) { 5935 #ifdef __LITTLE_ENDIAN__ 5936 return __builtin_altivec_vmulosd(__a, __b); 5937 #else 5938 return __builtin_altivec_vmulesd(__a, __b); 5939 #endif 5940 } 5941 5942 static __inline__ vector unsigned __int128 __ATTRS_o_ai 5943 vec_mule(vector unsigned long long __a, vector unsigned long long __b) { 5944 #ifdef __LITTLE_ENDIAN__ 5945 return __builtin_altivec_vmuloud(__a, __b); 5946 #else 5947 return __builtin_altivec_vmuleud(__a, __b); 5948 #endif 5949 } 5950 #endif 5951 5952 /* vec_vmulesb */ 5953 5954 static __inline__ vector short __attribute__((__always_inline__)) 5955 vec_vmulesb(vector signed char __a, vector signed char __b) { 5956 #ifdef __LITTLE_ENDIAN__ 5957 return __builtin_altivec_vmulosb(__a, __b); 5958 #else 5959 return __builtin_altivec_vmulesb(__a, __b); 5960 #endif 5961 } 5962 5963 /* vec_vmuleub */ 5964 5965 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5966 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 5967 #ifdef __LITTLE_ENDIAN__ 5968 return __builtin_altivec_vmuloub(__a, __b); 5969 #else 5970 return __builtin_altivec_vmuleub(__a, __b); 5971 #endif 5972 } 5973 5974 /* vec_vmulesh */ 5975 5976 static __inline__ vector int __attribute__((__always_inline__)) 5977 vec_vmulesh(vector short __a, vector short __b) { 5978 #ifdef __LITTLE_ENDIAN__ 5979 return __builtin_altivec_vmulosh(__a, __b); 5980 #else 5981 return __builtin_altivec_vmulesh(__a, __b); 5982 #endif 5983 } 5984 5985 /* vec_vmuleuh */ 5986 5987 static __inline__ vector unsigned int __attribute__((__always_inline__)) 5988 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 5989 #ifdef __LITTLE_ENDIAN__ 5990 return __builtin_altivec_vmulouh(__a, __b); 5991 #else 5992 return __builtin_altivec_vmuleuh(__a, __b); 5993 #endif 5994 } 5995 5996 /* vec_mulh */ 5997 5998 #ifdef __POWER10_VECTOR__ 5999 static __inline__ vector signed int __ATTRS_o_ai 6000 vec_mulh(vector signed int __a, vector signed int __b) { 6001 return __builtin_altivec_vmulhsw(__a, __b); 6002 } 6003 6004 static __inline__ vector unsigned int __ATTRS_o_ai 6005 vec_mulh(vector unsigned int __a, vector unsigned int __b) { 6006 return __builtin_altivec_vmulhuw(__a, __b); 6007 } 6008 6009 static __inline__ vector signed long long __ATTRS_o_ai 6010 vec_mulh(vector signed long long __a, vector signed long long __b) { 6011 return __builtin_altivec_vmulhsd(__a, __b); 6012 } 6013 6014 static __inline__ vector unsigned long long __ATTRS_o_ai 6015 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { 6016 return __builtin_altivec_vmulhud(__a, __b); 6017 } 6018 #endif 6019 6020 /* vec_mulo */ 6021 6022 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 6023 vector signed char __b) { 6024 #ifdef __LITTLE_ENDIAN__ 6025 return __builtin_altivec_vmulesb(__a, __b); 6026 #else 6027 return __builtin_altivec_vmulosb(__a, __b); 6028 #endif 6029 } 6030 6031 static __inline__ vector unsigned short __ATTRS_o_ai 6032 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 6033 #ifdef __LITTLE_ENDIAN__ 6034 return __builtin_altivec_vmuleub(__a, __b); 6035 #else 6036 return __builtin_altivec_vmuloub(__a, __b); 6037 #endif 6038 } 6039 6040 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 6041 vector short __b) { 6042 #ifdef __LITTLE_ENDIAN__ 6043 return __builtin_altivec_vmulesh(__a, __b); 6044 #else 6045 return __builtin_altivec_vmulosh(__a, __b); 6046 #endif 6047 } 6048 6049 static __inline__ vector unsigned int __ATTRS_o_ai 6050 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 6051 #ifdef __LITTLE_ENDIAN__ 6052 return __builtin_altivec_vmuleuh(__a, __b); 6053 #else 6054 return __builtin_altivec_vmulouh(__a, __b); 6055 #endif 6056 } 6057 6058 #ifdef __POWER8_VECTOR__ 6059 static __inline__ vector signed long long __ATTRS_o_ai 6060 vec_mulo(vector signed int __a, vector signed int __b) { 6061 #ifdef __LITTLE_ENDIAN__ 6062 return __builtin_altivec_vmulesw(__a, __b); 6063 #else 6064 return __builtin_altivec_vmulosw(__a, __b); 6065 #endif 6066 } 6067 6068 static __inline__ vector unsigned long long __ATTRS_o_ai 6069 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 6070 #ifdef __LITTLE_ENDIAN__ 6071 return __builtin_altivec_vmuleuw(__a, __b); 6072 #else 6073 return __builtin_altivec_vmulouw(__a, __b); 6074 #endif 6075 } 6076 #endif 6077 6078 #ifdef __POWER10_VECTOR__ 6079 static __inline__ vector signed __int128 __ATTRS_o_ai 6080 vec_mulo(vector signed long long __a, vector signed long long __b) { 6081 #ifdef __LITTLE_ENDIAN__ 6082 return __builtin_altivec_vmulesd(__a, __b); 6083 #else 6084 return __builtin_altivec_vmulosd(__a, __b); 6085 #endif 6086 } 6087 6088 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6089 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { 6090 #ifdef __LITTLE_ENDIAN__ 6091 return __builtin_altivec_vmuleud(__a, __b); 6092 #else 6093 return __builtin_altivec_vmuloud(__a, __b); 6094 #endif 6095 } 6096 #endif 6097 6098 /* vec_vmulosb */ 6099 6100 static __inline__ vector short __attribute__((__always_inline__)) 6101 vec_vmulosb(vector signed char __a, vector signed char __b) { 6102 #ifdef __LITTLE_ENDIAN__ 6103 return __builtin_altivec_vmulesb(__a, __b); 6104 #else 6105 return __builtin_altivec_vmulosb(__a, __b); 6106 #endif 6107 } 6108 6109 /* vec_vmuloub */ 6110 6111 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6112 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 6113 #ifdef __LITTLE_ENDIAN__ 6114 return __builtin_altivec_vmuleub(__a, __b); 6115 #else 6116 return __builtin_altivec_vmuloub(__a, __b); 6117 #endif 6118 } 6119 6120 /* vec_vmulosh */ 6121 6122 static __inline__ vector int __attribute__((__always_inline__)) 6123 vec_vmulosh(vector short __a, vector short __b) { 6124 #ifdef __LITTLE_ENDIAN__ 6125 return __builtin_altivec_vmulesh(__a, __b); 6126 #else 6127 return __builtin_altivec_vmulosh(__a, __b); 6128 #endif 6129 } 6130 6131 /* vec_vmulouh */ 6132 6133 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6134 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 6135 #ifdef __LITTLE_ENDIAN__ 6136 return __builtin_altivec_vmuleuh(__a, __b); 6137 #else 6138 return __builtin_altivec_vmulouh(__a, __b); 6139 #endif 6140 } 6141 6142 /* vec_nand */ 6143 6144 #ifdef __POWER8_VECTOR__ 6145 static __inline__ vector signed char __ATTRS_o_ai 6146 vec_nand(vector signed char __a, vector signed char __b) { 6147 return ~(__a & __b); 6148 } 6149 6150 static __inline__ vector signed char __ATTRS_o_ai 6151 vec_nand(vector signed char __a, vector bool char __b) { 6152 return ~(__a & __b); 6153 } 6154 6155 static __inline__ vector signed char __ATTRS_o_ai 6156 vec_nand(vector bool char __a, vector signed char __b) { 6157 return ~(__a & __b); 6158 } 6159 6160 static __inline__ vector unsigned char __ATTRS_o_ai 6161 vec_nand(vector unsigned char __a, vector unsigned char __b) { 6162 return ~(__a & __b); 6163 } 6164 6165 static __inline__ vector unsigned char __ATTRS_o_ai 6166 vec_nand(vector unsigned char __a, vector bool char __b) { 6167 return ~(__a & __b); 6168 } 6169 6170 static __inline__ vector unsigned char __ATTRS_o_ai 6171 vec_nand(vector bool char __a, vector unsigned char __b) { 6172 return ~(__a & __b); 6173 } 6174 6175 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 6176 vector bool char __b) { 6177 return ~(__a & __b); 6178 } 6179 6180 static __inline__ vector signed short __ATTRS_o_ai 6181 vec_nand(vector signed short __a, vector signed short __b) { 6182 return ~(__a & __b); 6183 } 6184 6185 static __inline__ vector signed short __ATTRS_o_ai 6186 vec_nand(vector signed short __a, vector bool short __b) { 6187 return ~(__a & __b); 6188 } 6189 6190 static __inline__ vector signed short __ATTRS_o_ai 6191 vec_nand(vector bool short __a, vector signed short __b) { 6192 return ~(__a & __b); 6193 } 6194 6195 static __inline__ vector unsigned short __ATTRS_o_ai 6196 vec_nand(vector unsigned short __a, vector unsigned short __b) { 6197 return ~(__a & __b); 6198 } 6199 6200 static __inline__ vector unsigned short __ATTRS_o_ai 6201 vec_nand(vector unsigned short __a, vector bool short __b) { 6202 return ~(__a & __b); 6203 } 6204 6205 static __inline__ vector bool short __ATTRS_o_ai 6206 vec_nand(vector bool short __a, vector bool short __b) { 6207 return ~(__a & __b); 6208 } 6209 6210 static __inline__ vector signed int __ATTRS_o_ai 6211 vec_nand(vector signed int __a, vector signed int __b) { 6212 return ~(__a & __b); 6213 } 6214 6215 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 6216 vector bool int __b) { 6217 return ~(__a & __b); 6218 } 6219 6220 static __inline__ vector signed int __ATTRS_o_ai 6221 vec_nand(vector bool int __a, vector signed int __b) { 6222 return ~(__a & __b); 6223 } 6224 6225 static __inline__ vector unsigned int __ATTRS_o_ai 6226 vec_nand(vector unsigned int __a, vector unsigned int __b) { 6227 return ~(__a & __b); 6228 } 6229 6230 static __inline__ vector unsigned int __ATTRS_o_ai 6231 vec_nand(vector unsigned int __a, vector bool int __b) { 6232 return ~(__a & __b); 6233 } 6234 6235 static __inline__ vector unsigned int __ATTRS_o_ai 6236 vec_nand(vector bool int __a, vector unsigned int __b) { 6237 return ~(__a & __b); 6238 } 6239 6240 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 6241 vector bool int __b) { 6242 return ~(__a & __b); 6243 } 6244 6245 static __inline__ vector float __ATTRS_o_ai 6246 vec_nand(vector float __a, vector float __b) { 6247 return (vector float)(~((vector unsigned int)__a & 6248 (vector unsigned int)__b)); 6249 } 6250 6251 static __inline__ vector signed long long __ATTRS_o_ai 6252 vec_nand(vector signed long long __a, vector signed long long __b) { 6253 return ~(__a & __b); 6254 } 6255 6256 static __inline__ vector signed long long __ATTRS_o_ai 6257 vec_nand(vector signed long long __a, vector bool long long __b) { 6258 return ~(__a & __b); 6259 } 6260 6261 static __inline__ vector signed long long __ATTRS_o_ai 6262 vec_nand(vector bool long long __a, vector signed long long __b) { 6263 return ~(__a & __b); 6264 } 6265 6266 static __inline__ vector unsigned long long __ATTRS_o_ai 6267 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6268 return ~(__a & __b); 6269 } 6270 6271 static __inline__ vector unsigned long long __ATTRS_o_ai 6272 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6273 return ~(__a & __b); 6274 } 6275 6276 static __inline__ vector unsigned long long __ATTRS_o_ai 6277 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6278 return ~(__a & __b); 6279 } 6280 6281 static __inline__ vector bool long long __ATTRS_o_ai 6282 vec_nand(vector bool long long __a, vector bool long long __b) { 6283 return ~(__a & __b); 6284 } 6285 6286 static __inline__ vector double __ATTRS_o_ai 6287 vec_nand(vector double __a, vector double __b) { 6288 return (vector double)(~((vector unsigned long long)__a & 6289 (vector unsigned long long)__b)); 6290 } 6291 6292 #endif 6293 6294 /* vec_nmadd */ 6295 6296 #ifdef __VSX__ 6297 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6298 vector float __b, 6299 vector float __c) { 6300 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6301 } 6302 6303 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6304 vector double __b, 6305 vector double __c) { 6306 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6307 } 6308 #endif 6309 6310 /* vec_nmsub */ 6311 6312 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6313 vector float __b, 6314 vector float __c) { 6315 #ifdef __VSX__ 6316 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6317 #else 6318 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6319 #endif 6320 } 6321 6322 #ifdef __VSX__ 6323 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6324 vector double __b, 6325 vector double __c) { 6326 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6327 } 6328 #endif 6329 6330 /* vec_vnmsubfp */ 6331 6332 static __inline__ vector float __attribute__((__always_inline__)) 6333 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6334 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6335 } 6336 6337 /* vec_nor */ 6338 6339 #define __builtin_altivec_vnor vec_nor 6340 6341 static __inline__ vector signed char __ATTRS_o_ai 6342 vec_nor(vector signed char __a, vector signed char __b) { 6343 return ~(__a | __b); 6344 } 6345 6346 static __inline__ vector unsigned char __ATTRS_o_ai 6347 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6348 return ~(__a | __b); 6349 } 6350 6351 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6352 vector bool char __b) { 6353 return ~(__a | __b); 6354 } 6355 6356 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6357 vector short __b) { 6358 return ~(__a | __b); 6359 } 6360 6361 static __inline__ vector unsigned short __ATTRS_o_ai 6362 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6363 return ~(__a | __b); 6364 } 6365 6366 static __inline__ vector bool short __ATTRS_o_ai 6367 vec_nor(vector bool short __a, vector bool short __b) { 6368 return ~(__a | __b); 6369 } 6370 6371 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6372 vector int __b) { 6373 return ~(__a | __b); 6374 } 6375 6376 static __inline__ vector unsigned int __ATTRS_o_ai 6377 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6378 return ~(__a | __b); 6379 } 6380 6381 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6382 vector bool int __b) { 6383 return ~(__a | __b); 6384 } 6385 6386 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6387 vector float __b) { 6388 vector unsigned int __res = 6389 ~((vector unsigned int)__a | (vector unsigned int)__b); 6390 return (vector float)__res; 6391 } 6392 6393 #ifdef __VSX__ 6394 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6395 vector double __b) { 6396 vector unsigned long long __res = 6397 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6398 return (vector double)__res; 6399 } 6400 #endif 6401 6402 /* vec_vnor */ 6403 6404 static __inline__ vector signed char __ATTRS_o_ai 6405 vec_vnor(vector signed char __a, vector signed char __b) { 6406 return ~(__a | __b); 6407 } 6408 6409 static __inline__ vector unsigned char __ATTRS_o_ai 6410 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6411 return ~(__a | __b); 6412 } 6413 6414 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6415 vector bool char __b) { 6416 return ~(__a | __b); 6417 } 6418 6419 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6420 vector short __b) { 6421 return ~(__a | __b); 6422 } 6423 6424 static __inline__ vector unsigned short __ATTRS_o_ai 6425 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6426 return ~(__a | __b); 6427 } 6428 6429 static __inline__ vector bool short __ATTRS_o_ai 6430 vec_vnor(vector bool short __a, vector bool short __b) { 6431 return ~(__a | __b); 6432 } 6433 6434 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6435 vector int __b) { 6436 return ~(__a | __b); 6437 } 6438 6439 static __inline__ vector unsigned int __ATTRS_o_ai 6440 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6441 return ~(__a | __b); 6442 } 6443 6444 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6445 vector bool int __b) { 6446 return ~(__a | __b); 6447 } 6448 6449 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6450 vector float __b) { 6451 vector unsigned int __res = 6452 ~((vector unsigned int)__a | (vector unsigned int)__b); 6453 return (vector float)__res; 6454 } 6455 6456 #ifdef __VSX__ 6457 static __inline__ vector signed long long __ATTRS_o_ai 6458 vec_nor(vector signed long long __a, vector signed long long __b) { 6459 return ~(__a | __b); 6460 } 6461 6462 static __inline__ vector unsigned long long __ATTRS_o_ai 6463 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6464 return ~(__a | __b); 6465 } 6466 6467 static __inline__ vector bool long long __ATTRS_o_ai 6468 vec_nor(vector bool long long __a, vector bool long long __b) { 6469 return ~(__a | __b); 6470 } 6471 #endif 6472 6473 /* vec_or */ 6474 6475 #define __builtin_altivec_vor vec_or 6476 6477 static __inline__ vector signed char __ATTRS_o_ai 6478 vec_or(vector signed char __a, vector signed char __b) { 6479 return __a | __b; 6480 } 6481 6482 static __inline__ vector signed char __ATTRS_o_ai 6483 vec_or(vector bool char __a, vector signed char __b) { 6484 return (vector signed char)__a | __b; 6485 } 6486 6487 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6488 vector bool char __b) { 6489 return __a | (vector signed char)__b; 6490 } 6491 6492 static __inline__ vector unsigned char __ATTRS_o_ai 6493 vec_or(vector unsigned char __a, vector unsigned char __b) { 6494 return __a | __b; 6495 } 6496 6497 static __inline__ vector unsigned char __ATTRS_o_ai 6498 vec_or(vector bool char __a, vector unsigned char __b) { 6499 return (vector unsigned char)__a | __b; 6500 } 6501 6502 static __inline__ vector unsigned char __ATTRS_o_ai 6503 vec_or(vector unsigned char __a, vector bool char __b) { 6504 return __a | (vector unsigned char)__b; 6505 } 6506 6507 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6508 vector bool char __b) { 6509 return __a | __b; 6510 } 6511 6512 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6513 vector short __b) { 6514 return __a | __b; 6515 } 6516 6517 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6518 vector short __b) { 6519 return (vector short)__a | __b; 6520 } 6521 6522 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6523 vector bool short __b) { 6524 return __a | (vector short)__b; 6525 } 6526 6527 static __inline__ vector unsigned short __ATTRS_o_ai 6528 vec_or(vector unsigned short __a, vector unsigned short __b) { 6529 return __a | __b; 6530 } 6531 6532 static __inline__ vector unsigned short __ATTRS_o_ai 6533 vec_or(vector bool short __a, vector unsigned short __b) { 6534 return (vector unsigned short)__a | __b; 6535 } 6536 6537 static __inline__ vector unsigned short __ATTRS_o_ai 6538 vec_or(vector unsigned short __a, vector bool short __b) { 6539 return __a | (vector unsigned short)__b; 6540 } 6541 6542 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6543 vector bool short __b) { 6544 return __a | __b; 6545 } 6546 6547 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6548 vector int __b) { 6549 return __a | __b; 6550 } 6551 6552 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6553 vector int __b) { 6554 return (vector int)__a | __b; 6555 } 6556 6557 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6558 vector bool int __b) { 6559 return __a | (vector int)__b; 6560 } 6561 6562 static __inline__ vector unsigned int __ATTRS_o_ai 6563 vec_or(vector unsigned int __a, vector unsigned int __b) { 6564 return __a | __b; 6565 } 6566 6567 static __inline__ vector unsigned int __ATTRS_o_ai 6568 vec_or(vector bool int __a, vector unsigned int __b) { 6569 return (vector unsigned int)__a | __b; 6570 } 6571 6572 static __inline__ vector unsigned int __ATTRS_o_ai 6573 vec_or(vector unsigned int __a, vector bool int __b) { 6574 return __a | (vector unsigned int)__b; 6575 } 6576 6577 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6578 vector bool int __b) { 6579 return __a | __b; 6580 } 6581 6582 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6583 vector float __b) { 6584 vector unsigned int __res = 6585 (vector unsigned int)__a | (vector unsigned int)__b; 6586 return (vector float)__res; 6587 } 6588 6589 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6590 vector float __b) { 6591 vector unsigned int __res = 6592 (vector unsigned int)__a | (vector unsigned int)__b; 6593 return (vector float)__res; 6594 } 6595 6596 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6597 vector bool int __b) { 6598 vector unsigned int __res = 6599 (vector unsigned int)__a | (vector unsigned int)__b; 6600 return (vector float)__res; 6601 } 6602 6603 #ifdef __VSX__ 6604 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6605 vector double __b) { 6606 return (vector double)((vector unsigned long long)__a | 6607 (vector unsigned long long)__b); 6608 } 6609 6610 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6611 vector bool long long __b) { 6612 return (vector double)((vector unsigned long long)__a | 6613 (vector unsigned long long)__b); 6614 } 6615 6616 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6617 vector double __b) { 6618 return (vector double)((vector unsigned long long)__a | 6619 (vector unsigned long long)__b); 6620 } 6621 6622 static __inline__ vector signed long long __ATTRS_o_ai 6623 vec_or(vector signed long long __a, vector signed long long __b) { 6624 return __a | __b; 6625 } 6626 6627 static __inline__ vector signed long long __ATTRS_o_ai 6628 vec_or(vector bool long long __a, vector signed long long __b) { 6629 return (vector signed long long)__a | __b; 6630 } 6631 6632 static __inline__ vector signed long long __ATTRS_o_ai 6633 vec_or(vector signed long long __a, vector bool long long __b) { 6634 return __a | (vector signed long long)__b; 6635 } 6636 6637 static __inline__ vector unsigned long long __ATTRS_o_ai 6638 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 6639 return __a | __b; 6640 } 6641 6642 static __inline__ vector unsigned long long __ATTRS_o_ai 6643 vec_or(vector bool long long __a, vector unsigned long long __b) { 6644 return (vector unsigned long long)__a | __b; 6645 } 6646 6647 static __inline__ vector unsigned long long __ATTRS_o_ai 6648 vec_or(vector unsigned long long __a, vector bool long long __b) { 6649 return __a | (vector unsigned long long)__b; 6650 } 6651 6652 static __inline__ vector bool long long __ATTRS_o_ai 6653 vec_or(vector bool long long __a, vector bool long long __b) { 6654 return __a | __b; 6655 } 6656 #endif 6657 6658 #ifdef __POWER8_VECTOR__ 6659 static __inline__ vector signed char __ATTRS_o_ai 6660 vec_orc(vector signed char __a, vector signed char __b) { 6661 return __a | ~__b; 6662 } 6663 6664 static __inline__ vector signed char __ATTRS_o_ai 6665 vec_orc(vector signed char __a, vector bool char __b) { 6666 return __a | ~__b; 6667 } 6668 6669 static __inline__ vector signed char __ATTRS_o_ai 6670 vec_orc(vector bool char __a, vector signed char __b) { 6671 return __a | ~__b; 6672 } 6673 6674 static __inline__ vector unsigned char __ATTRS_o_ai 6675 vec_orc(vector unsigned char __a, vector unsigned char __b) { 6676 return __a | ~__b; 6677 } 6678 6679 static __inline__ vector unsigned char __ATTRS_o_ai 6680 vec_orc(vector unsigned char __a, vector bool char __b) { 6681 return __a | ~__b; 6682 } 6683 6684 static __inline__ vector unsigned char __ATTRS_o_ai 6685 vec_orc(vector bool char __a, vector unsigned char __b) { 6686 return __a | ~__b; 6687 } 6688 6689 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 6690 vector bool char __b) { 6691 return __a | ~__b; 6692 } 6693 6694 static __inline__ vector signed short __ATTRS_o_ai 6695 vec_orc(vector signed short __a, vector signed short __b) { 6696 return __a | ~__b; 6697 } 6698 6699 static __inline__ vector signed short __ATTRS_o_ai 6700 vec_orc(vector signed short __a, vector bool short __b) { 6701 return __a | ~__b; 6702 } 6703 6704 static __inline__ vector signed short __ATTRS_o_ai 6705 vec_orc(vector bool short __a, vector signed short __b) { 6706 return __a | ~__b; 6707 } 6708 6709 static __inline__ vector unsigned short __ATTRS_o_ai 6710 vec_orc(vector unsigned short __a, vector unsigned short __b) { 6711 return __a | ~__b; 6712 } 6713 6714 static __inline__ vector unsigned short __ATTRS_o_ai 6715 vec_orc(vector unsigned short __a, vector bool short __b) { 6716 return __a | ~__b; 6717 } 6718 6719 static __inline__ vector unsigned short __ATTRS_o_ai 6720 vec_orc(vector bool short __a, vector unsigned short __b) { 6721 return __a | ~__b; 6722 } 6723 6724 static __inline__ vector bool short __ATTRS_o_ai 6725 vec_orc(vector bool short __a, vector bool short __b) { 6726 return __a | ~__b; 6727 } 6728 6729 static __inline__ vector signed int __ATTRS_o_ai 6730 vec_orc(vector signed int __a, vector signed int __b) { 6731 return __a | ~__b; 6732 } 6733 6734 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 6735 vector bool int __b) { 6736 return __a | ~__b; 6737 } 6738 6739 static __inline__ vector signed int __ATTRS_o_ai 6740 vec_orc(vector bool int __a, vector signed int __b) { 6741 return __a | ~__b; 6742 } 6743 6744 static __inline__ vector unsigned int __ATTRS_o_ai 6745 vec_orc(vector unsigned int __a, vector unsigned int __b) { 6746 return __a | ~__b; 6747 } 6748 6749 static __inline__ vector unsigned int __ATTRS_o_ai 6750 vec_orc(vector unsigned int __a, vector bool int __b) { 6751 return __a | ~__b; 6752 } 6753 6754 static __inline__ vector unsigned int __ATTRS_o_ai 6755 vec_orc(vector bool int __a, vector unsigned int __b) { 6756 return __a | ~__b; 6757 } 6758 6759 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 6760 vector bool int __b) { 6761 return __a | ~__b; 6762 } 6763 6764 static __inline__ vector float __ATTRS_o_ai 6765 vec_orc(vector bool int __a, vector float __b) { 6766 return (vector float)(__a | ~(vector unsigned int)__b); 6767 } 6768 6769 static __inline__ vector float __ATTRS_o_ai 6770 vec_orc(vector float __a, vector bool int __b) { 6771 return (vector float)((vector unsigned int)__a | ~__b); 6772 } 6773 6774 static __inline__ vector signed long long __ATTRS_o_ai 6775 vec_orc(vector signed long long __a, vector signed long long __b) { 6776 return __a | ~__b; 6777 } 6778 6779 static __inline__ vector signed long long __ATTRS_o_ai 6780 vec_orc(vector signed long long __a, vector bool long long __b) { 6781 return __a | ~__b; 6782 } 6783 6784 static __inline__ vector signed long long __ATTRS_o_ai 6785 vec_orc(vector bool long long __a, vector signed long long __b) { 6786 return __a | ~__b; 6787 } 6788 6789 static __inline__ vector unsigned long long __ATTRS_o_ai 6790 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 6791 return __a | ~__b; 6792 } 6793 6794 static __inline__ vector unsigned long long __ATTRS_o_ai 6795 vec_orc(vector unsigned long long __a, vector bool long long __b) { 6796 return __a | ~__b; 6797 } 6798 6799 static __inline__ vector unsigned long long __ATTRS_o_ai 6800 vec_orc(vector bool long long __a, vector unsigned long long __b) { 6801 return __a | ~__b; 6802 } 6803 6804 static __inline__ vector bool long long __ATTRS_o_ai 6805 vec_orc(vector bool long long __a, vector bool long long __b) { 6806 return __a | ~__b; 6807 } 6808 6809 static __inline__ vector double __ATTRS_o_ai 6810 vec_orc(vector double __a, vector bool long long __b) { 6811 return (vector double)((vector unsigned long long)__a | ~__b); 6812 } 6813 6814 static __inline__ vector double __ATTRS_o_ai 6815 vec_orc(vector bool long long __a, vector double __b) { 6816 return (vector double)(__a | ~(vector unsigned long long)__b); 6817 } 6818 #endif 6819 6820 /* vec_vor */ 6821 6822 static __inline__ vector signed char __ATTRS_o_ai 6823 vec_vor(vector signed char __a, vector signed char __b) { 6824 return __a | __b; 6825 } 6826 6827 static __inline__ vector signed char __ATTRS_o_ai 6828 vec_vor(vector bool char __a, vector signed char __b) { 6829 return (vector signed char)__a | __b; 6830 } 6831 6832 static __inline__ vector signed char __ATTRS_o_ai 6833 vec_vor(vector signed char __a, vector bool char __b) { 6834 return __a | (vector signed char)__b; 6835 } 6836 6837 static __inline__ vector unsigned char __ATTRS_o_ai 6838 vec_vor(vector unsigned char __a, vector unsigned char __b) { 6839 return __a | __b; 6840 } 6841 6842 static __inline__ vector unsigned char __ATTRS_o_ai 6843 vec_vor(vector bool char __a, vector unsigned char __b) { 6844 return (vector unsigned char)__a | __b; 6845 } 6846 6847 static __inline__ vector unsigned char __ATTRS_o_ai 6848 vec_vor(vector unsigned char __a, vector bool char __b) { 6849 return __a | (vector unsigned char)__b; 6850 } 6851 6852 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 6853 vector bool char __b) { 6854 return __a | __b; 6855 } 6856 6857 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 6858 vector short __b) { 6859 return __a | __b; 6860 } 6861 6862 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 6863 vector short __b) { 6864 return (vector short)__a | __b; 6865 } 6866 6867 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 6868 vector bool short __b) { 6869 return __a | (vector short)__b; 6870 } 6871 6872 static __inline__ vector unsigned short __ATTRS_o_ai 6873 vec_vor(vector unsigned short __a, vector unsigned short __b) { 6874 return __a | __b; 6875 } 6876 6877 static __inline__ vector unsigned short __ATTRS_o_ai 6878 vec_vor(vector bool short __a, vector unsigned short __b) { 6879 return (vector unsigned short)__a | __b; 6880 } 6881 6882 static __inline__ vector unsigned short __ATTRS_o_ai 6883 vec_vor(vector unsigned short __a, vector bool short __b) { 6884 return __a | (vector unsigned short)__b; 6885 } 6886 6887 static __inline__ vector bool short __ATTRS_o_ai 6888 vec_vor(vector bool short __a, vector bool short __b) { 6889 return __a | __b; 6890 } 6891 6892 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 6893 vector int __b) { 6894 return __a | __b; 6895 } 6896 6897 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 6898 vector int __b) { 6899 return (vector int)__a | __b; 6900 } 6901 6902 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 6903 vector bool int __b) { 6904 return __a | (vector int)__b; 6905 } 6906 6907 static __inline__ vector unsigned int __ATTRS_o_ai 6908 vec_vor(vector unsigned int __a, vector unsigned int __b) { 6909 return __a | __b; 6910 } 6911 6912 static __inline__ vector unsigned int __ATTRS_o_ai 6913 vec_vor(vector bool int __a, vector unsigned int __b) { 6914 return (vector unsigned int)__a | __b; 6915 } 6916 6917 static __inline__ vector unsigned int __ATTRS_o_ai 6918 vec_vor(vector unsigned int __a, vector bool int __b) { 6919 return __a | (vector unsigned int)__b; 6920 } 6921 6922 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 6923 vector bool int __b) { 6924 return __a | __b; 6925 } 6926 6927 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 6928 vector float __b) { 6929 vector unsigned int __res = 6930 (vector unsigned int)__a | (vector unsigned int)__b; 6931 return (vector float)__res; 6932 } 6933 6934 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 6935 vector float __b) { 6936 vector unsigned int __res = 6937 (vector unsigned int)__a | (vector unsigned int)__b; 6938 return (vector float)__res; 6939 } 6940 6941 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 6942 vector bool int __b) { 6943 vector unsigned int __res = 6944 (vector unsigned int)__a | (vector unsigned int)__b; 6945 return (vector float)__res; 6946 } 6947 6948 #ifdef __VSX__ 6949 static __inline__ vector signed long long __ATTRS_o_ai 6950 vec_vor(vector signed long long __a, vector signed long long __b) { 6951 return __a | __b; 6952 } 6953 6954 static __inline__ vector signed long long __ATTRS_o_ai 6955 vec_vor(vector bool long long __a, vector signed long long __b) { 6956 return (vector signed long long)__a | __b; 6957 } 6958 6959 static __inline__ vector signed long long __ATTRS_o_ai 6960 vec_vor(vector signed long long __a, vector bool long long __b) { 6961 return __a | (vector signed long long)__b; 6962 } 6963 6964 static __inline__ vector unsigned long long __ATTRS_o_ai 6965 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 6966 return __a | __b; 6967 } 6968 6969 static __inline__ vector unsigned long long __ATTRS_o_ai 6970 vec_vor(vector bool long long __a, vector unsigned long long __b) { 6971 return (vector unsigned long long)__a | __b; 6972 } 6973 6974 static __inline__ vector unsigned long long __ATTRS_o_ai 6975 vec_vor(vector unsigned long long __a, vector bool long long __b) { 6976 return __a | (vector unsigned long long)__b; 6977 } 6978 6979 static __inline__ vector bool long long __ATTRS_o_ai 6980 vec_vor(vector bool long long __a, vector bool long long __b) { 6981 return __a | __b; 6982 } 6983 #endif 6984 6985 /* vec_pack */ 6986 6987 /* The various vector pack instructions have a big-endian bias, so for 6988 little endian we must handle reversed element numbering. */ 6989 6990 static __inline__ vector signed char __ATTRS_o_ai 6991 vec_pack(vector signed short __a, vector signed short __b) { 6992 #ifdef __LITTLE_ENDIAN__ 6993 return (vector signed char)vec_perm( 6994 __a, __b, 6995 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 6996 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 6997 #else 6998 return (vector signed char)vec_perm( 6999 __a, __b, 7000 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7001 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7002 #endif 7003 } 7004 7005 static __inline__ vector unsigned char __ATTRS_o_ai 7006 vec_pack(vector unsigned short __a, vector unsigned short __b) { 7007 #ifdef __LITTLE_ENDIAN__ 7008 return (vector unsigned char)vec_perm( 7009 __a, __b, 7010 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7011 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7012 #else 7013 return (vector unsigned char)vec_perm( 7014 __a, __b, 7015 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7016 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7017 #endif 7018 } 7019 7020 static __inline__ vector bool char __ATTRS_o_ai 7021 vec_pack(vector bool short __a, vector bool short __b) { 7022 #ifdef __LITTLE_ENDIAN__ 7023 return (vector bool char)vec_perm( 7024 __a, __b, 7025 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7026 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7027 #else 7028 return (vector bool char)vec_perm( 7029 __a, __b, 7030 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7031 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7032 #endif 7033 } 7034 7035 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 7036 vector int __b) { 7037 #ifdef __LITTLE_ENDIAN__ 7038 return (vector short)vec_perm( 7039 __a, __b, 7040 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7041 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7042 #else 7043 return (vector short)vec_perm( 7044 __a, __b, 7045 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7046 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7047 #endif 7048 } 7049 7050 static __inline__ vector unsigned short __ATTRS_o_ai 7051 vec_pack(vector unsigned int __a, vector unsigned int __b) { 7052 #ifdef __LITTLE_ENDIAN__ 7053 return (vector unsigned short)vec_perm( 7054 __a, __b, 7055 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7056 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7057 #else 7058 return (vector unsigned short)vec_perm( 7059 __a, __b, 7060 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7061 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7062 #endif 7063 } 7064 7065 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 7066 vector bool int __b) { 7067 #ifdef __LITTLE_ENDIAN__ 7068 return (vector bool short)vec_perm( 7069 __a, __b, 7070 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7071 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7072 #else 7073 return (vector bool short)vec_perm( 7074 __a, __b, 7075 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7076 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7077 #endif 7078 } 7079 7080 #ifdef __VSX__ 7081 static __inline__ vector signed int __ATTRS_o_ai 7082 vec_pack(vector signed long long __a, vector signed long long __b) { 7083 #ifdef __LITTLE_ENDIAN__ 7084 return (vector signed int)vec_perm( 7085 __a, __b, 7086 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7087 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7088 #else 7089 return (vector signed int)vec_perm( 7090 __a, __b, 7091 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7092 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7093 #endif 7094 } 7095 static __inline__ vector unsigned int __ATTRS_o_ai 7096 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 7097 #ifdef __LITTLE_ENDIAN__ 7098 return (vector unsigned int)vec_perm( 7099 __a, __b, 7100 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7101 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7102 #else 7103 return (vector unsigned int)vec_perm( 7104 __a, __b, 7105 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7106 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7107 #endif 7108 } 7109 7110 static __inline__ vector bool int __ATTRS_o_ai 7111 vec_pack(vector bool long long __a, vector bool long long __b) { 7112 #ifdef __LITTLE_ENDIAN__ 7113 return (vector bool int)vec_perm( 7114 __a, __b, 7115 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7116 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7117 #else 7118 return (vector bool int)vec_perm( 7119 __a, __b, 7120 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7121 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7122 #endif 7123 } 7124 7125 static __inline__ vector float __ATTRS_o_ai 7126 vec_pack(vector double __a, vector double __b) { 7127 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 7128 } 7129 #endif 7130 7131 #ifdef __POWER9_VECTOR__ 7132 static __inline__ vector unsigned short __ATTRS_o_ai 7133 vec_pack_to_short_fp32(vector float __a, vector float __b) { 7134 vector float __resa = __builtin_vsx_xvcvsphp(__a); 7135 vector float __resb = __builtin_vsx_xvcvsphp(__b); 7136 #ifdef __LITTLE_ENDIAN__ 7137 return (vector unsigned short)vec_mergee(__resa, __resb); 7138 #else 7139 return (vector unsigned short)vec_mergeo(__resa, __resb); 7140 #endif 7141 } 7142 7143 #endif 7144 /* vec_vpkuhum */ 7145 7146 #define __builtin_altivec_vpkuhum vec_vpkuhum 7147 7148 static __inline__ vector signed char __ATTRS_o_ai 7149 vec_vpkuhum(vector signed short __a, vector signed short __b) { 7150 #ifdef __LITTLE_ENDIAN__ 7151 return (vector signed char)vec_perm( 7152 __a, __b, 7153 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7154 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7155 #else 7156 return (vector signed char)vec_perm( 7157 __a, __b, 7158 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7159 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7160 #endif 7161 } 7162 7163 static __inline__ vector unsigned char __ATTRS_o_ai 7164 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 7165 #ifdef __LITTLE_ENDIAN__ 7166 return (vector unsigned char)vec_perm( 7167 __a, __b, 7168 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7169 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7170 #else 7171 return (vector unsigned char)vec_perm( 7172 __a, __b, 7173 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7174 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7175 #endif 7176 } 7177 7178 static __inline__ vector bool char __ATTRS_o_ai 7179 vec_vpkuhum(vector bool short __a, vector bool short __b) { 7180 #ifdef __LITTLE_ENDIAN__ 7181 return (vector bool char)vec_perm( 7182 __a, __b, 7183 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7184 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7185 #else 7186 return (vector bool char)vec_perm( 7187 __a, __b, 7188 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7189 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7190 #endif 7191 } 7192 7193 /* vec_vpkuwum */ 7194 7195 #define __builtin_altivec_vpkuwum vec_vpkuwum 7196 7197 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 7198 vector int __b) { 7199 #ifdef __LITTLE_ENDIAN__ 7200 return (vector short)vec_perm( 7201 __a, __b, 7202 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7203 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7204 #else 7205 return (vector short)vec_perm( 7206 __a, __b, 7207 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7208 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7209 #endif 7210 } 7211 7212 static __inline__ vector unsigned short __ATTRS_o_ai 7213 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 7214 #ifdef __LITTLE_ENDIAN__ 7215 return (vector unsigned short)vec_perm( 7216 __a, __b, 7217 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7218 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7219 #else 7220 return (vector unsigned short)vec_perm( 7221 __a, __b, 7222 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7223 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7224 #endif 7225 } 7226 7227 static __inline__ vector bool short __ATTRS_o_ai 7228 vec_vpkuwum(vector bool int __a, vector bool int __b) { 7229 #ifdef __LITTLE_ENDIAN__ 7230 return (vector bool short)vec_perm( 7231 __a, __b, 7232 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7233 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7234 #else 7235 return (vector bool short)vec_perm( 7236 __a, __b, 7237 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7238 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7239 #endif 7240 } 7241 7242 /* vec_vpkudum */ 7243 7244 #ifdef __POWER8_VECTOR__ 7245 #define __builtin_altivec_vpkudum vec_vpkudum 7246 7247 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7248 vector long long __b) { 7249 #ifdef __LITTLE_ENDIAN__ 7250 return (vector int)vec_perm( 7251 __a, __b, 7252 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7253 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7254 #else 7255 return (vector int)vec_perm( 7256 __a, __b, 7257 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7258 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7259 #endif 7260 } 7261 7262 static __inline__ vector unsigned int __ATTRS_o_ai 7263 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7264 #ifdef __LITTLE_ENDIAN__ 7265 return (vector unsigned int)vec_perm( 7266 __a, __b, 7267 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7268 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7269 #else 7270 return (vector unsigned int)vec_perm( 7271 __a, __b, 7272 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7273 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7274 #endif 7275 } 7276 7277 static __inline__ vector bool int __ATTRS_o_ai 7278 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7279 #ifdef __LITTLE_ENDIAN__ 7280 return (vector bool int)vec_perm( 7281 (vector long long)__a, (vector long long)__b, 7282 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7283 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7284 #else 7285 return (vector bool int)vec_perm( 7286 (vector long long)__a, (vector long long)__b, 7287 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7288 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7289 #endif 7290 } 7291 #endif 7292 7293 /* vec_packpx */ 7294 7295 static __inline__ vector pixel __attribute__((__always_inline__)) 7296 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7297 #ifdef __LITTLE_ENDIAN__ 7298 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7299 #else 7300 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7301 #endif 7302 } 7303 7304 /* vec_vpkpx */ 7305 7306 static __inline__ vector pixel __attribute__((__always_inline__)) 7307 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7308 #ifdef __LITTLE_ENDIAN__ 7309 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7310 #else 7311 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7312 #endif 7313 } 7314 7315 /* vec_packs */ 7316 7317 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7318 vector short __b) { 7319 #ifdef __LITTLE_ENDIAN__ 7320 return __builtin_altivec_vpkshss(__b, __a); 7321 #else 7322 return __builtin_altivec_vpkshss(__a, __b); 7323 #endif 7324 } 7325 7326 static __inline__ vector unsigned char __ATTRS_o_ai 7327 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7328 #ifdef __LITTLE_ENDIAN__ 7329 return __builtin_altivec_vpkuhus(__b, __a); 7330 #else 7331 return __builtin_altivec_vpkuhus(__a, __b); 7332 #endif 7333 } 7334 7335 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7336 vector int __b) { 7337 #ifdef __LITTLE_ENDIAN__ 7338 return __builtin_altivec_vpkswss(__b, __a); 7339 #else 7340 return __builtin_altivec_vpkswss(__a, __b); 7341 #endif 7342 } 7343 7344 static __inline__ vector unsigned short __ATTRS_o_ai 7345 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7346 #ifdef __LITTLE_ENDIAN__ 7347 return __builtin_altivec_vpkuwus(__b, __a); 7348 #else 7349 return __builtin_altivec_vpkuwus(__a, __b); 7350 #endif 7351 } 7352 7353 #ifdef __POWER8_VECTOR__ 7354 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7355 vector long long __b) { 7356 #ifdef __LITTLE_ENDIAN__ 7357 return __builtin_altivec_vpksdss(__b, __a); 7358 #else 7359 return __builtin_altivec_vpksdss(__a, __b); 7360 #endif 7361 } 7362 7363 static __inline__ vector unsigned int __ATTRS_o_ai 7364 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7365 #ifdef __LITTLE_ENDIAN__ 7366 return __builtin_altivec_vpkudus(__b, __a); 7367 #else 7368 return __builtin_altivec_vpkudus(__a, __b); 7369 #endif 7370 } 7371 #endif 7372 7373 /* vec_vpkshss */ 7374 7375 static __inline__ vector signed char __attribute__((__always_inline__)) 7376 vec_vpkshss(vector short __a, vector short __b) { 7377 #ifdef __LITTLE_ENDIAN__ 7378 return __builtin_altivec_vpkshss(__b, __a); 7379 #else 7380 return __builtin_altivec_vpkshss(__a, __b); 7381 #endif 7382 } 7383 7384 /* vec_vpksdss */ 7385 7386 #ifdef __POWER8_VECTOR__ 7387 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7388 vector long long __b) { 7389 #ifdef __LITTLE_ENDIAN__ 7390 return __builtin_altivec_vpksdss(__b, __a); 7391 #else 7392 return __builtin_altivec_vpksdss(__a, __b); 7393 #endif 7394 } 7395 #endif 7396 7397 /* vec_vpkuhus */ 7398 7399 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7400 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7401 #ifdef __LITTLE_ENDIAN__ 7402 return __builtin_altivec_vpkuhus(__b, __a); 7403 #else 7404 return __builtin_altivec_vpkuhus(__a, __b); 7405 #endif 7406 } 7407 7408 /* vec_vpkudus */ 7409 7410 #ifdef __POWER8_VECTOR__ 7411 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7412 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7413 #ifdef __LITTLE_ENDIAN__ 7414 return __builtin_altivec_vpkudus(__b, __a); 7415 #else 7416 return __builtin_altivec_vpkudus(__a, __b); 7417 #endif 7418 } 7419 #endif 7420 7421 /* vec_vpkswss */ 7422 7423 static __inline__ vector signed short __attribute__((__always_inline__)) 7424 vec_vpkswss(vector int __a, vector int __b) { 7425 #ifdef __LITTLE_ENDIAN__ 7426 return __builtin_altivec_vpkswss(__b, __a); 7427 #else 7428 return __builtin_altivec_vpkswss(__a, __b); 7429 #endif 7430 } 7431 7432 /* vec_vpkuwus */ 7433 7434 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7435 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7436 #ifdef __LITTLE_ENDIAN__ 7437 return __builtin_altivec_vpkuwus(__b, __a); 7438 #else 7439 return __builtin_altivec_vpkuwus(__a, __b); 7440 #endif 7441 } 7442 7443 /* vec_packsu */ 7444 7445 static __inline__ vector unsigned char __ATTRS_o_ai 7446 vec_packsu(vector short __a, vector short __b) { 7447 #ifdef __LITTLE_ENDIAN__ 7448 return __builtin_altivec_vpkshus(__b, __a); 7449 #else 7450 return __builtin_altivec_vpkshus(__a, __b); 7451 #endif 7452 } 7453 7454 static __inline__ vector unsigned char __ATTRS_o_ai 7455 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7456 #ifdef __LITTLE_ENDIAN__ 7457 return __builtin_altivec_vpkuhus(__b, __a); 7458 #else 7459 return __builtin_altivec_vpkuhus(__a, __b); 7460 #endif 7461 } 7462 7463 static __inline__ vector unsigned short __ATTRS_o_ai 7464 vec_packsu(vector int __a, vector int __b) { 7465 #ifdef __LITTLE_ENDIAN__ 7466 return __builtin_altivec_vpkswus(__b, __a); 7467 #else 7468 return __builtin_altivec_vpkswus(__a, __b); 7469 #endif 7470 } 7471 7472 static __inline__ vector unsigned short __ATTRS_o_ai 7473 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7474 #ifdef __LITTLE_ENDIAN__ 7475 return __builtin_altivec_vpkuwus(__b, __a); 7476 #else 7477 return __builtin_altivec_vpkuwus(__a, __b); 7478 #endif 7479 } 7480 7481 #ifdef __POWER8_VECTOR__ 7482 static __inline__ vector unsigned int __ATTRS_o_ai 7483 vec_packsu(vector long long __a, vector long long __b) { 7484 #ifdef __LITTLE_ENDIAN__ 7485 return __builtin_altivec_vpksdus(__b, __a); 7486 #else 7487 return __builtin_altivec_vpksdus(__a, __b); 7488 #endif 7489 } 7490 7491 static __inline__ vector unsigned int __ATTRS_o_ai 7492 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7493 #ifdef __LITTLE_ENDIAN__ 7494 return __builtin_altivec_vpkudus(__b, __a); 7495 #else 7496 return __builtin_altivec_vpkudus(__a, __b); 7497 #endif 7498 } 7499 #endif 7500 7501 /* vec_vpkshus */ 7502 7503 static __inline__ vector unsigned char __ATTRS_o_ai 7504 vec_vpkshus(vector short __a, vector short __b) { 7505 #ifdef __LITTLE_ENDIAN__ 7506 return __builtin_altivec_vpkshus(__b, __a); 7507 #else 7508 return __builtin_altivec_vpkshus(__a, __b); 7509 #endif 7510 } 7511 7512 static __inline__ vector unsigned char __ATTRS_o_ai 7513 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7514 #ifdef __LITTLE_ENDIAN__ 7515 return __builtin_altivec_vpkuhus(__b, __a); 7516 #else 7517 return __builtin_altivec_vpkuhus(__a, __b); 7518 #endif 7519 } 7520 7521 /* vec_vpkswus */ 7522 7523 static __inline__ vector unsigned short __ATTRS_o_ai 7524 vec_vpkswus(vector int __a, vector int __b) { 7525 #ifdef __LITTLE_ENDIAN__ 7526 return __builtin_altivec_vpkswus(__b, __a); 7527 #else 7528 return __builtin_altivec_vpkswus(__a, __b); 7529 #endif 7530 } 7531 7532 static __inline__ vector unsigned short __ATTRS_o_ai 7533 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7534 #ifdef __LITTLE_ENDIAN__ 7535 return __builtin_altivec_vpkuwus(__b, __a); 7536 #else 7537 return __builtin_altivec_vpkuwus(__a, __b); 7538 #endif 7539 } 7540 7541 /* vec_vpksdus */ 7542 7543 #ifdef __POWER8_VECTOR__ 7544 static __inline__ vector unsigned int __ATTRS_o_ai 7545 vec_vpksdus(vector long long __a, vector long long __b) { 7546 #ifdef __LITTLE_ENDIAN__ 7547 return __builtin_altivec_vpksdus(__b, __a); 7548 #else 7549 return __builtin_altivec_vpksdus(__a, __b); 7550 #endif 7551 } 7552 #endif 7553 7554 /* vec_perm */ 7555 7556 // The vperm instruction is defined architecturally with a big-endian bias. 7557 // For little endian, we swap the input operands and invert the permute 7558 // control vector. Only the rightmost 5 bits matter, so we could use 7559 // a vector of all 31s instead of all 255s to perform the inversion. 7560 // However, when the PCV is not a constant, using 255 has an advantage 7561 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7562 // later, possibly a vec_nand). 7563 7564 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7565 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7566 #ifdef __LITTLE_ENDIAN__ 7567 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7568 255, 255, 255, 255, 255, 255, 255, 255}; 7569 __d = vec_xor(__c, __d); 7570 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7571 (vector int)__a, __d); 7572 #else 7573 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7574 (vector int)__b, __c); 7575 #endif 7576 } 7577 7578 static __inline__ vector unsigned char __ATTRS_o_ai 7579 vec_perm(vector unsigned char __a, vector unsigned char __b, 7580 vector unsigned char __c) { 7581 #ifdef __LITTLE_ENDIAN__ 7582 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7583 255, 255, 255, 255, 255, 255, 255, 255}; 7584 __d = vec_xor(__c, __d); 7585 return (vector unsigned char)__builtin_altivec_vperm_4si( 7586 (vector int)__b, (vector int)__a, __d); 7587 #else 7588 return (vector unsigned char)__builtin_altivec_vperm_4si( 7589 (vector int)__a, (vector int)__b, __c); 7590 #endif 7591 } 7592 7593 static __inline__ vector bool char __ATTRS_o_ai 7594 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7595 #ifdef __LITTLE_ENDIAN__ 7596 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7597 255, 255, 255, 255, 255, 255, 255, 255}; 7598 __d = vec_xor(__c, __d); 7599 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 7600 (vector int)__a, __d); 7601 #else 7602 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7603 (vector int)__b, __c); 7604 #endif 7605 } 7606 7607 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7608 vector signed short __b, 7609 vector unsigned char __c) { 7610 #ifdef __LITTLE_ENDIAN__ 7611 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7612 255, 255, 255, 255, 255, 255, 255, 255}; 7613 __d = vec_xor(__c, __d); 7614 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 7615 (vector int)__a, __d); 7616 #else 7617 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 7618 (vector int)__b, __c); 7619 #endif 7620 } 7621 7622 static __inline__ vector unsigned short __ATTRS_o_ai 7623 vec_perm(vector unsigned short __a, vector unsigned short __b, 7624 vector unsigned char __c) { 7625 #ifdef __LITTLE_ENDIAN__ 7626 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7627 255, 255, 255, 255, 255, 255, 255, 255}; 7628 __d = vec_xor(__c, __d); 7629 return (vector unsigned short)__builtin_altivec_vperm_4si( 7630 (vector int)__b, (vector int)__a, __d); 7631 #else 7632 return (vector unsigned short)__builtin_altivec_vperm_4si( 7633 (vector int)__a, (vector int)__b, __c); 7634 #endif 7635 } 7636 7637 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 7638 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7639 #ifdef __LITTLE_ENDIAN__ 7640 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7641 255, 255, 255, 255, 255, 255, 255, 255}; 7642 __d = vec_xor(__c, __d); 7643 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 7644 (vector int)__a, __d); 7645 #else 7646 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 7647 (vector int)__b, __c); 7648 #endif 7649 } 7650 7651 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 7652 vector pixel __b, 7653 vector unsigned char __c) { 7654 #ifdef __LITTLE_ENDIAN__ 7655 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7656 255, 255, 255, 255, 255, 255, 255, 255}; 7657 __d = vec_xor(__c, __d); 7658 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 7659 (vector int)__a, __d); 7660 #else 7661 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 7662 (vector int)__b, __c); 7663 #endif 7664 } 7665 7666 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 7667 vector signed int __b, 7668 vector unsigned char __c) { 7669 #ifdef __LITTLE_ENDIAN__ 7670 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7671 255, 255, 255, 255, 255, 255, 255, 255}; 7672 __d = vec_xor(__c, __d); 7673 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 7674 #else 7675 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 7676 #endif 7677 } 7678 7679 static __inline__ vector unsigned int __ATTRS_o_ai 7680 vec_perm(vector unsigned int __a, vector unsigned int __b, 7681 vector unsigned char __c) { 7682 #ifdef __LITTLE_ENDIAN__ 7683 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7684 255, 255, 255, 255, 255, 255, 255, 255}; 7685 __d = vec_xor(__c, __d); 7686 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 7687 (vector int)__a, __d); 7688 #else 7689 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 7690 (vector int)__b, __c); 7691 #endif 7692 } 7693 7694 static __inline__ vector bool int __ATTRS_o_ai 7695 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 7696 #ifdef __LITTLE_ENDIAN__ 7697 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7698 255, 255, 255, 255, 255, 255, 255, 255}; 7699 __d = vec_xor(__c, __d); 7700 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 7701 (vector int)__a, __d); 7702 #else 7703 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 7704 (vector int)__b, __c); 7705 #endif 7706 } 7707 7708 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 7709 vector float __b, 7710 vector unsigned char __c) { 7711 #ifdef __LITTLE_ENDIAN__ 7712 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7713 255, 255, 255, 255, 255, 255, 255, 255}; 7714 __d = vec_xor(__c, __d); 7715 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 7716 (vector int)__a, __d); 7717 #else 7718 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 7719 (vector int)__b, __c); 7720 #endif 7721 } 7722 7723 #ifdef __VSX__ 7724 static __inline__ vector long long __ATTRS_o_ai 7725 vec_perm(vector signed long long __a, vector signed long long __b, 7726 vector unsigned char __c) { 7727 #ifdef __LITTLE_ENDIAN__ 7728 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7729 255, 255, 255, 255, 255, 255, 255, 255}; 7730 __d = vec_xor(__c, __d); 7731 return (vector signed long long)__builtin_altivec_vperm_4si( 7732 (vector int)__b, (vector int)__a, __d); 7733 #else 7734 return (vector signed long long)__builtin_altivec_vperm_4si( 7735 (vector int)__a, (vector int)__b, __c); 7736 #endif 7737 } 7738 7739 static __inline__ vector unsigned long long __ATTRS_o_ai 7740 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 7741 vector unsigned char __c) { 7742 #ifdef __LITTLE_ENDIAN__ 7743 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7744 255, 255, 255, 255, 255, 255, 255, 255}; 7745 __d = vec_xor(__c, __d); 7746 return (vector unsigned long long)__builtin_altivec_vperm_4si( 7747 (vector int)__b, (vector int)__a, __d); 7748 #else 7749 return (vector unsigned long long)__builtin_altivec_vperm_4si( 7750 (vector int)__a, (vector int)__b, __c); 7751 #endif 7752 } 7753 7754 static __inline__ vector bool long long __ATTRS_o_ai 7755 vec_perm(vector bool long long __a, vector bool long long __b, 7756 vector unsigned char __c) { 7757 #ifdef __LITTLE_ENDIAN__ 7758 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7759 255, 255, 255, 255, 255, 255, 255, 255}; 7760 __d = vec_xor(__c, __d); 7761 return (vector bool long long)__builtin_altivec_vperm_4si( 7762 (vector int)__b, (vector int)__a, __d); 7763 #else 7764 return (vector bool long long)__builtin_altivec_vperm_4si( 7765 (vector int)__a, (vector int)__b, __c); 7766 #endif 7767 } 7768 7769 static __inline__ vector double __ATTRS_o_ai 7770 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 7771 #ifdef __LITTLE_ENDIAN__ 7772 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7773 255, 255, 255, 255, 255, 255, 255, 255}; 7774 __d = vec_xor(__c, __d); 7775 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 7776 (vector int)__a, __d); 7777 #else 7778 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 7779 (vector int)__b, __c); 7780 #endif 7781 } 7782 #endif 7783 7784 /* vec_vperm */ 7785 7786 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 7787 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7788 return vec_perm(__a, __b, __c); 7789 } 7790 7791 static __inline__ vector unsigned char __ATTRS_o_ai 7792 vec_vperm(vector unsigned char __a, vector unsigned char __b, 7793 vector unsigned char __c) { 7794 return vec_perm(__a, __b, __c); 7795 } 7796 7797 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 7798 vector bool char __a, vector bool char __b, vector unsigned char __c) { 7799 return vec_perm(__a, __b, __c); 7800 } 7801 7802 static __inline__ vector short __ATTRS_o_ai 7803 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 7804 return vec_perm(__a, __b, __c); 7805 } 7806 7807 static __inline__ vector unsigned short __ATTRS_o_ai 7808 vec_vperm(vector unsigned short __a, vector unsigned short __b, 7809 vector unsigned char __c) { 7810 return vec_perm(__a, __b, __c); 7811 } 7812 7813 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 7814 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7815 return vec_perm(__a, __b, __c); 7816 } 7817 7818 static __inline__ vector pixel __ATTRS_o_ai 7819 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 7820 return vec_perm(__a, __b, __c); 7821 } 7822 7823 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 7824 vector int __b, 7825 vector unsigned char __c) { 7826 return vec_perm(__a, __b, __c); 7827 } 7828 7829 static __inline__ vector unsigned int __ATTRS_o_ai 7830 vec_vperm(vector unsigned int __a, vector unsigned int __b, 7831 vector unsigned char __c) { 7832 return vec_perm(__a, __b, __c); 7833 } 7834 7835 static __inline__ vector bool int __ATTRS_o_ai 7836 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 7837 return vec_perm(__a, __b, __c); 7838 } 7839 7840 static __inline__ vector float __ATTRS_o_ai 7841 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 7842 return vec_perm(__a, __b, __c); 7843 } 7844 7845 #ifdef __VSX__ 7846 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 7847 vector long long __a, vector long long __b, vector unsigned char __c) { 7848 return vec_perm(__a, __b, __c); 7849 } 7850 7851 static __inline__ vector unsigned long long __ATTRS_o_ai 7852 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 7853 vector unsigned char __c) { 7854 return vec_perm(__a, __b, __c); 7855 } 7856 7857 static __inline__ vector double __ATTRS_o_ai 7858 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 7859 return vec_perm(__a, __b, __c); 7860 } 7861 #endif 7862 7863 /* vec_re */ 7864 7865 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 7866 #ifdef __VSX__ 7867 return __builtin_vsx_xvresp(__a); 7868 #else 7869 return __builtin_altivec_vrefp(__a); 7870 #endif 7871 } 7872 7873 #ifdef __VSX__ 7874 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 7875 return __builtin_vsx_xvredp(__a); 7876 } 7877 #endif 7878 7879 /* vec_vrefp */ 7880 7881 static __inline__ vector float __attribute__((__always_inline__)) 7882 vec_vrefp(vector float __a) { 7883 return __builtin_altivec_vrefp(__a); 7884 } 7885 7886 /* vec_rl */ 7887 7888 static __inline__ vector signed char __ATTRS_o_ai 7889 vec_rl(vector signed char __a, vector unsigned char __b) { 7890 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 7891 } 7892 7893 static __inline__ vector unsigned char __ATTRS_o_ai 7894 vec_rl(vector unsigned char __a, vector unsigned char __b) { 7895 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 7896 } 7897 7898 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 7899 vector unsigned short __b) { 7900 return __builtin_altivec_vrlh(__a, __b); 7901 } 7902 7903 static __inline__ vector unsigned short __ATTRS_o_ai 7904 vec_rl(vector unsigned short __a, vector unsigned short __b) { 7905 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 7906 } 7907 7908 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 7909 vector unsigned int __b) { 7910 return __builtin_altivec_vrlw(__a, __b); 7911 } 7912 7913 static __inline__ vector unsigned int __ATTRS_o_ai 7914 vec_rl(vector unsigned int __a, vector unsigned int __b) { 7915 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 7916 } 7917 7918 #ifdef __POWER8_VECTOR__ 7919 static __inline__ vector signed long long __ATTRS_o_ai 7920 vec_rl(vector signed long long __a, vector unsigned long long __b) { 7921 return __builtin_altivec_vrld(__a, __b); 7922 } 7923 7924 static __inline__ vector unsigned long long __ATTRS_o_ai 7925 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 7926 return __builtin_altivec_vrld(__a, __b); 7927 } 7928 #endif 7929 7930 #ifdef __POWER10_VECTOR__ 7931 static __inline__ vector signed __int128 __ATTRS_o_ai 7932 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { 7933 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a)); 7934 } 7935 7936 static __inline__ vector unsigned __int128 __ATTRS_o_ai 7937 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 7938 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); 7939 } 7940 #endif 7941 7942 /* vec_rlmi */ 7943 #ifdef __POWER9_VECTOR__ 7944 static __inline__ vector unsigned int __ATTRS_o_ai 7945 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 7946 vector unsigned int __c) { 7947 return __builtin_altivec_vrlwmi(__a, __c, __b); 7948 } 7949 7950 static __inline__ vector unsigned long long __ATTRS_o_ai 7951 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 7952 vector unsigned long long __c) { 7953 return __builtin_altivec_vrldmi(__a, __c, __b); 7954 } 7955 #endif 7956 7957 #ifdef __POWER10_VECTOR__ 7958 static __inline__ vector unsigned __int128 __ATTRS_o_ai 7959 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, 7960 vector unsigned __int128 __c) { 7961 return __builtin_altivec_vrlqmi(__a, __c, __b); 7962 } 7963 7964 static __inline__ vector signed __int128 __ATTRS_o_ai 7965 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, 7966 vector signed __int128 __c) { 7967 return __builtin_altivec_vrlqmi(__a, __c, __b); 7968 } 7969 #endif 7970 7971 /* vec_rlnm */ 7972 #ifdef __POWER9_VECTOR__ 7973 static __inline__ vector unsigned int __ATTRS_o_ai 7974 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 7975 vector unsigned int __c) { 7976 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 7977 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 7978 } 7979 7980 static __inline__ vector unsigned long long __ATTRS_o_ai 7981 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 7982 vector unsigned long long __c) { 7983 vector unsigned long long OneByte = { 0x8, 0x8 }; 7984 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 7985 } 7986 #endif 7987 7988 #ifdef __POWER10_VECTOR__ 7989 static __inline__ vector unsigned __int128 __ATTRS_o_ai 7990 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, 7991 vector unsigned __int128 __c) { 7992 // Merge __b and __c using an appropriate shuffle. 7993 vector unsigned char TmpB = (vector unsigned char)__b; 7994 vector unsigned char TmpC = (vector unsigned char)__c; 7995 vector unsigned char MaskAndShift = 7996 #ifdef __LITTLE_ENDIAN__ 7997 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 7998 1, -1, -1, -1, -1, -1); 7999 #else 8000 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8001 -1, -1, -1, -1, -1, -1, -1); 8002 #endif 8003 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8004 } 8005 8006 static __inline__ vector signed __int128 __ATTRS_o_ai 8007 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, 8008 vector signed __int128 __c) { 8009 // Merge __b and __c using an appropriate shuffle. 8010 vector unsigned char TmpB = (vector unsigned char)__b; 8011 vector unsigned char TmpC = (vector unsigned char)__c; 8012 vector unsigned char MaskAndShift = 8013 #ifdef __LITTLE_ENDIAN__ 8014 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8015 1, -1, -1, -1, -1, -1); 8016 #else 8017 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8018 -1, -1, -1, -1, -1, -1, -1); 8019 #endif 8020 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8021 } 8022 #endif 8023 8024 /* vec_vrlb */ 8025 8026 static __inline__ vector signed char __ATTRS_o_ai 8027 vec_vrlb(vector signed char __a, vector unsigned char __b) { 8028 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8029 } 8030 8031 static __inline__ vector unsigned char __ATTRS_o_ai 8032 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 8033 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8034 } 8035 8036 /* vec_vrlh */ 8037 8038 static __inline__ vector short __ATTRS_o_ai 8039 vec_vrlh(vector short __a, vector unsigned short __b) { 8040 return __builtin_altivec_vrlh(__a, __b); 8041 } 8042 8043 static __inline__ vector unsigned short __ATTRS_o_ai 8044 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 8045 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8046 } 8047 8048 /* vec_vrlw */ 8049 8050 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 8051 vector unsigned int __b) { 8052 return __builtin_altivec_vrlw(__a, __b); 8053 } 8054 8055 static __inline__ vector unsigned int __ATTRS_o_ai 8056 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 8057 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8058 } 8059 8060 /* vec_round */ 8061 8062 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 8063 #ifdef __VSX__ 8064 return __builtin_vsx_xvrspi(__a); 8065 #else 8066 return __builtin_altivec_vrfin(__a); 8067 #endif 8068 } 8069 8070 #ifdef __VSX__ 8071 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8072 return __builtin_vsx_xvrdpi(__a); 8073 } 8074 8075 /* vec_rint */ 8076 8077 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 8078 return __builtin_vsx_xvrspic(__a); 8079 } 8080 8081 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 8082 return __builtin_vsx_xvrdpic(__a); 8083 } 8084 8085 /* vec_nearbyint */ 8086 8087 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 8088 return __builtin_vsx_xvrspi(__a); 8089 } 8090 8091 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 8092 return __builtin_vsx_xvrdpi(__a); 8093 } 8094 #endif 8095 8096 /* vec_vrfin */ 8097 8098 static __inline__ vector float __attribute__((__always_inline__)) 8099 vec_vrfin(vector float __a) { 8100 return __builtin_altivec_vrfin(__a); 8101 } 8102 8103 /* vec_sqrt */ 8104 8105 #ifdef __VSX__ 8106 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 8107 return __builtin_vsx_xvsqrtsp(__a); 8108 } 8109 8110 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 8111 return __builtin_vsx_xvsqrtdp(__a); 8112 } 8113 #endif 8114 8115 /* vec_rsqrte */ 8116 8117 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 8118 #ifdef __VSX__ 8119 return __builtin_vsx_xvrsqrtesp(__a); 8120 #else 8121 return __builtin_altivec_vrsqrtefp(__a); 8122 #endif 8123 } 8124 8125 #ifdef __VSX__ 8126 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 8127 return __builtin_vsx_xvrsqrtedp(__a); 8128 } 8129 #endif 8130 8131 /* vec_vrsqrtefp */ 8132 8133 static __inline__ __vector float __attribute__((__always_inline__)) 8134 vec_vrsqrtefp(vector float __a) { 8135 return __builtin_altivec_vrsqrtefp(__a); 8136 } 8137 8138 /* vec_xvtsqrt */ 8139 8140 #ifdef __VSX__ 8141 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { 8142 return __builtin_vsx_xvtsqrtdp(__a); 8143 } 8144 8145 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { 8146 return __builtin_vsx_xvtsqrtsp(__a); 8147 } 8148 #endif 8149 8150 /* vec_sel */ 8151 8152 #define __builtin_altivec_vsel_4si vec_sel 8153 8154 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 8155 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8156 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8157 } 8158 8159 static __inline__ vector signed char __ATTRS_o_ai 8160 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 8161 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8162 } 8163 8164 static __inline__ vector unsigned char __ATTRS_o_ai 8165 vec_sel(vector unsigned char __a, vector unsigned char __b, 8166 vector unsigned char __c) { 8167 return (__a & ~__c) | (__b & __c); 8168 } 8169 8170 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 8171 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8172 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8173 } 8174 8175 static __inline__ vector bool char __ATTRS_o_ai 8176 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8177 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8178 } 8179 8180 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 8181 vector bool char __b, 8182 vector bool char __c) { 8183 return (__a & ~__c) | (__b & __c); 8184 } 8185 8186 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8187 vector short __b, 8188 vector unsigned short __c) { 8189 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8190 } 8191 8192 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8193 vector short __b, 8194 vector bool short __c) { 8195 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8196 } 8197 8198 static __inline__ vector unsigned short __ATTRS_o_ai 8199 vec_sel(vector unsigned short __a, vector unsigned short __b, 8200 vector unsigned short __c) { 8201 return (__a & ~__c) | (__b & __c); 8202 } 8203 8204 static __inline__ vector unsigned short __ATTRS_o_ai 8205 vec_sel(vector unsigned short __a, vector unsigned short __b, 8206 vector bool short __c) { 8207 return (__a & ~(vector unsigned short)__c) | 8208 (__b & (vector unsigned short)__c); 8209 } 8210 8211 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 8212 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8213 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8214 } 8215 8216 static __inline__ vector bool short __ATTRS_o_ai 8217 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 8218 return (__a & ~__c) | (__b & __c); 8219 } 8220 8221 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8222 vector int __b, 8223 vector unsigned int __c) { 8224 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8225 } 8226 8227 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8228 vector int __b, 8229 vector bool int __c) { 8230 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8231 } 8232 8233 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 8234 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8235 return (__a & ~__c) | (__b & __c); 8236 } 8237 8238 static __inline__ vector unsigned int __ATTRS_o_ai 8239 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8240 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8241 } 8242 8243 static __inline__ vector bool int __ATTRS_o_ai 8244 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8245 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8246 } 8247 8248 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 8249 vector bool int __b, 8250 vector bool int __c) { 8251 return (__a & ~__c) | (__b & __c); 8252 } 8253 8254 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8255 vector float __b, 8256 vector unsigned int __c) { 8257 vector int __res = ((vector int)__a & ~(vector int)__c) | 8258 ((vector int)__b & (vector int)__c); 8259 return (vector float)__res; 8260 } 8261 8262 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8263 vector float __b, 8264 vector bool int __c) { 8265 vector int __res = ((vector int)__a & ~(vector int)__c) | 8266 ((vector int)__b & (vector int)__c); 8267 return (vector float)__res; 8268 } 8269 8270 #ifdef __VSX__ 8271 static __inline__ vector double __ATTRS_o_ai 8272 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 8273 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8274 ((vector long long)__b & (vector long long)__c); 8275 return (vector double)__res; 8276 } 8277 8278 static __inline__ vector double __ATTRS_o_ai 8279 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 8280 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8281 ((vector long long)__b & (vector long long)__c); 8282 return (vector double)__res; 8283 } 8284 8285 static __inline__ vector bool long long __ATTRS_o_ai 8286 vec_sel(vector bool long long __a, vector bool long long __b, 8287 vector bool long long __c) { 8288 return (__a & ~__c) | (__b & __c); 8289 } 8290 8291 static __inline__ vector bool long long __ATTRS_o_ai 8292 vec_sel(vector bool long long __a, vector bool long long __b, 8293 vector unsigned long long __c) { 8294 return (__a & ~(vector bool long long)__c) | 8295 (__b & (vector bool long long)__c); 8296 } 8297 8298 static __inline__ vector signed long long __ATTRS_o_ai 8299 vec_sel(vector signed long long __a, vector signed long long __b, 8300 vector bool long long __c) { 8301 return (__a & ~(vector signed long long)__c) | 8302 (__b & (vector signed long long)__c); 8303 } 8304 8305 static __inline__ vector signed long long __ATTRS_o_ai 8306 vec_sel(vector signed long long __a, vector signed long long __b, 8307 vector unsigned long long __c) { 8308 return (__a & ~(vector signed long long)__c) | 8309 (__b & (vector signed long long)__c); 8310 } 8311 8312 static __inline__ vector unsigned long long __ATTRS_o_ai 8313 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8314 vector bool long long __c) { 8315 return (__a & ~(vector unsigned long long)__c) | 8316 (__b & (vector unsigned long long)__c); 8317 } 8318 8319 static __inline__ vector unsigned long long __ATTRS_o_ai 8320 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8321 vector unsigned long long __c) { 8322 return (__a & ~__c) | (__b & __c); 8323 } 8324 #endif 8325 8326 /* vec_vsel */ 8327 8328 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 8329 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8330 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8331 } 8332 8333 static __inline__ vector signed char __ATTRS_o_ai 8334 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 8335 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8336 } 8337 8338 static __inline__ vector unsigned char __ATTRS_o_ai 8339 vec_vsel(vector unsigned char __a, vector unsigned char __b, 8340 vector unsigned char __c) { 8341 return (__a & ~__c) | (__b & __c); 8342 } 8343 8344 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 8345 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8346 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8347 } 8348 8349 static __inline__ vector bool char __ATTRS_o_ai 8350 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8351 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8352 } 8353 8354 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 8355 vector bool char __b, 8356 vector bool char __c) { 8357 return (__a & ~__c) | (__b & __c); 8358 } 8359 8360 static __inline__ vector short __ATTRS_o_ai 8361 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8362 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8363 } 8364 8365 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8366 vector short __b, 8367 vector bool short __c) { 8368 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8369 } 8370 8371 static __inline__ vector unsigned short __ATTRS_o_ai 8372 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8373 vector unsigned short __c) { 8374 return (__a & ~__c) | (__b & __c); 8375 } 8376 8377 static __inline__ vector unsigned short __ATTRS_o_ai 8378 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8379 vector bool short __c) { 8380 return (__a & ~(vector unsigned short)__c) | 8381 (__b & (vector unsigned short)__c); 8382 } 8383 8384 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8385 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8386 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8387 } 8388 8389 static __inline__ vector bool short __ATTRS_o_ai 8390 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8391 return (__a & ~__c) | (__b & __c); 8392 } 8393 8394 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8395 vector int __b, 8396 vector unsigned int __c) { 8397 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8398 } 8399 8400 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8401 vector int __b, 8402 vector bool int __c) { 8403 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8404 } 8405 8406 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8407 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8408 return (__a & ~__c) | (__b & __c); 8409 } 8410 8411 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8412 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8413 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8414 } 8415 8416 static __inline__ vector bool int __ATTRS_o_ai 8417 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8418 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8419 } 8420 8421 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8422 vector bool int __b, 8423 vector bool int __c) { 8424 return (__a & ~__c) | (__b & __c); 8425 } 8426 8427 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8428 vector float __b, 8429 vector unsigned int __c) { 8430 vector int __res = ((vector int)__a & ~(vector int)__c) | 8431 ((vector int)__b & (vector int)__c); 8432 return (vector float)__res; 8433 } 8434 8435 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8436 vector float __b, 8437 vector bool int __c) { 8438 vector int __res = ((vector int)__a & ~(vector int)__c) | 8439 ((vector int)__b & (vector int)__c); 8440 return (vector float)__res; 8441 } 8442 8443 /* vec_sl */ 8444 8445 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8446 // than the length of __a. 8447 static __inline__ vector unsigned char __ATTRS_o_ai 8448 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8449 return __a << (__b % 8450 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8451 } 8452 8453 static __inline__ vector signed char __ATTRS_o_ai 8454 vec_sl(vector signed char __a, vector unsigned char __b) { 8455 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8456 } 8457 8458 static __inline__ vector unsigned short __ATTRS_o_ai 8459 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8460 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8461 __CHAR_BIT__)); 8462 } 8463 8464 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8465 vector unsigned short __b) { 8466 return (vector short)vec_sl((vector unsigned short)__a, __b); 8467 } 8468 8469 static __inline__ vector unsigned int __ATTRS_o_ai 8470 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8471 return __a << (__b % 8472 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8473 } 8474 8475 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8476 vector unsigned int __b) { 8477 return (vector int)vec_sl((vector unsigned int)__a, __b); 8478 } 8479 8480 #ifdef __POWER8_VECTOR__ 8481 static __inline__ vector unsigned long long __ATTRS_o_ai 8482 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8483 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8484 __CHAR_BIT__)); 8485 } 8486 8487 static __inline__ vector long long __ATTRS_o_ai 8488 vec_sl(vector long long __a, vector unsigned long long __b) { 8489 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8490 } 8491 #endif 8492 8493 /* vec_vslb */ 8494 8495 #define __builtin_altivec_vslb vec_vslb 8496 8497 static __inline__ vector signed char __ATTRS_o_ai 8498 vec_vslb(vector signed char __a, vector unsigned char __b) { 8499 return vec_sl(__a, __b); 8500 } 8501 8502 static __inline__ vector unsigned char __ATTRS_o_ai 8503 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8504 return vec_sl(__a, __b); 8505 } 8506 8507 /* vec_vslh */ 8508 8509 #define __builtin_altivec_vslh vec_vslh 8510 8511 static __inline__ vector short __ATTRS_o_ai 8512 vec_vslh(vector short __a, vector unsigned short __b) { 8513 return vec_sl(__a, __b); 8514 } 8515 8516 static __inline__ vector unsigned short __ATTRS_o_ai 8517 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8518 return vec_sl(__a, __b); 8519 } 8520 8521 /* vec_vslw */ 8522 8523 #define __builtin_altivec_vslw vec_vslw 8524 8525 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8526 vector unsigned int __b) { 8527 return vec_sl(__a, __b); 8528 } 8529 8530 static __inline__ vector unsigned int __ATTRS_o_ai 8531 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 8532 return vec_sl(__a, __b); 8533 } 8534 8535 /* vec_sld */ 8536 8537 #define __builtin_altivec_vsldoi_4si vec_sld 8538 8539 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 8540 vector signed char __a, vector signed char __b, unsigned const int __c) { 8541 unsigned char __d = __c & 0x0F; 8542 #ifdef __LITTLE_ENDIAN__ 8543 return vec_perm( 8544 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8545 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8546 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8547 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8548 #else 8549 return vec_perm( 8550 __a, __b, 8551 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8552 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8553 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8554 #endif 8555 } 8556 8557 static __inline__ vector unsigned char __ATTRS_o_ai 8558 vec_sld(vector unsigned char __a, vector unsigned char __b, 8559 unsigned const int __c) { 8560 unsigned char __d = __c & 0x0F; 8561 #ifdef __LITTLE_ENDIAN__ 8562 return vec_perm( 8563 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8564 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8565 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8566 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8567 #else 8568 return vec_perm( 8569 __a, __b, 8570 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8571 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8572 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8573 #endif 8574 } 8575 8576 static __inline__ vector bool char __ATTRS_o_ai 8577 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 8578 unsigned char __d = __c & 0x0F; 8579 #ifdef __LITTLE_ENDIAN__ 8580 return vec_perm( 8581 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8582 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8583 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8584 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8585 #else 8586 return vec_perm( 8587 __a, __b, 8588 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8589 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8590 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8591 #endif 8592 } 8593 8594 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 8595 vector signed short __a, vector signed short __b, unsigned const int __c) { 8596 unsigned char __d = __c & 0x0F; 8597 #ifdef __LITTLE_ENDIAN__ 8598 return vec_perm( 8599 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8600 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8601 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8602 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8603 #else 8604 return vec_perm( 8605 __a, __b, 8606 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8607 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8608 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8609 #endif 8610 } 8611 8612 static __inline__ vector unsigned short __ATTRS_o_ai 8613 vec_sld(vector unsigned short __a, vector unsigned short __b, 8614 unsigned const int __c) { 8615 unsigned char __d = __c & 0x0F; 8616 #ifdef __LITTLE_ENDIAN__ 8617 return vec_perm( 8618 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8619 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8620 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8621 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8622 #else 8623 return vec_perm( 8624 __a, __b, 8625 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8626 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8627 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8628 #endif 8629 } 8630 8631 static __inline__ vector bool short __ATTRS_o_ai 8632 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 8633 unsigned char __d = __c & 0x0F; 8634 #ifdef __LITTLE_ENDIAN__ 8635 return vec_perm( 8636 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8637 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8638 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8639 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8640 #else 8641 return vec_perm( 8642 __a, __b, 8643 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8644 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8645 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8646 #endif 8647 } 8648 8649 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 8650 vector pixel __b, 8651 unsigned const int __c) { 8652 unsigned char __d = __c & 0x0F; 8653 #ifdef __LITTLE_ENDIAN__ 8654 return vec_perm( 8655 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8656 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8657 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8658 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8659 #else 8660 return vec_perm( 8661 __a, __b, 8662 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8663 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8664 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8665 #endif 8666 } 8667 8668 static __inline__ vector signed int __ATTRS_o_ai 8669 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 8670 unsigned char __d = __c & 0x0F; 8671 #ifdef __LITTLE_ENDIAN__ 8672 return vec_perm( 8673 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8674 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8675 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8676 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8677 #else 8678 return vec_perm( 8679 __a, __b, 8680 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8681 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8682 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8683 #endif 8684 } 8685 8686 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 8687 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 8688 unsigned char __d = __c & 0x0F; 8689 #ifdef __LITTLE_ENDIAN__ 8690 return vec_perm( 8691 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8692 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8693 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8694 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8695 #else 8696 return vec_perm( 8697 __a, __b, 8698 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8699 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8700 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8701 #endif 8702 } 8703 8704 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 8705 vector bool int __b, 8706 unsigned const int __c) { 8707 unsigned char __d = __c & 0x0F; 8708 #ifdef __LITTLE_ENDIAN__ 8709 return vec_perm( 8710 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8711 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8712 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8713 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8714 #else 8715 return vec_perm( 8716 __a, __b, 8717 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8718 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8719 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8720 #endif 8721 } 8722 8723 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 8724 vector float __b, 8725 unsigned const int __c) { 8726 unsigned char __d = __c & 0x0F; 8727 #ifdef __LITTLE_ENDIAN__ 8728 return vec_perm( 8729 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8730 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8731 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8732 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8733 #else 8734 return vec_perm( 8735 __a, __b, 8736 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8737 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8738 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8739 #endif 8740 } 8741 8742 #ifdef __VSX__ 8743 static __inline__ vector bool long long __ATTRS_o_ai 8744 vec_sld(vector bool long long __a, vector bool long long __b, 8745 unsigned const int __c) { 8746 unsigned char __d = __c & 0x0F; 8747 #ifdef __LITTLE_ENDIAN__ 8748 return vec_perm( 8749 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8750 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8751 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8752 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8753 #else 8754 return vec_perm( 8755 __a, __b, 8756 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8757 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8758 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8759 #endif 8760 } 8761 8762 static __inline__ vector signed long long __ATTRS_o_ai 8763 vec_sld(vector signed long long __a, vector signed long long __b, 8764 unsigned const int __c) { 8765 unsigned char __d = __c & 0x0F; 8766 #ifdef __LITTLE_ENDIAN__ 8767 return vec_perm( 8768 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8769 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8770 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8771 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8772 #else 8773 return vec_perm( 8774 __a, __b, 8775 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8776 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8777 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8778 #endif 8779 } 8780 8781 static __inline__ vector unsigned long long __ATTRS_o_ai 8782 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 8783 unsigned const int __c) { 8784 unsigned char __d = __c & 0x0F; 8785 #ifdef __LITTLE_ENDIAN__ 8786 return vec_perm( 8787 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8788 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8789 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8790 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8791 #else 8792 return vec_perm( 8793 __a, __b, 8794 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8795 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8796 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8797 #endif 8798 } 8799 8800 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 8801 vector double __b, 8802 unsigned const int __c) { 8803 unsigned char __d = __c & 0x0F; 8804 #ifdef __LITTLE_ENDIAN__ 8805 return vec_perm( 8806 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8807 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8808 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8809 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8810 #else 8811 return vec_perm( 8812 __a, __b, 8813 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8814 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8815 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8816 #endif 8817 } 8818 #endif 8819 8820 /* vec_sldw */ 8821 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 8822 vector signed char __a, vector signed char __b, unsigned const int __c) { 8823 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8824 } 8825 8826 static __inline__ vector unsigned char __ATTRS_o_ai 8827 vec_sldw(vector unsigned char __a, vector unsigned char __b, 8828 unsigned const int __c) { 8829 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8830 } 8831 8832 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 8833 vector signed short __a, vector signed short __b, unsigned const int __c) { 8834 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8835 } 8836 8837 static __inline__ vector unsigned short __ATTRS_o_ai 8838 vec_sldw(vector unsigned short __a, vector unsigned short __b, 8839 unsigned const int __c) { 8840 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8841 } 8842 8843 static __inline__ vector signed int __ATTRS_o_ai 8844 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 8845 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8846 } 8847 8848 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 8849 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 8850 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8851 } 8852 8853 #ifdef __VSX__ 8854 static __inline__ vector signed long long __ATTRS_o_ai 8855 vec_sldw(vector signed long long __a, vector signed long long __b, 8856 unsigned const int __c) { 8857 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8858 } 8859 8860 static __inline__ vector unsigned long long __ATTRS_o_ai 8861 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 8862 unsigned const int __c) { 8863 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 8864 } 8865 #endif 8866 8867 #ifdef __POWER9_VECTOR__ 8868 /* vec_slv */ 8869 static __inline__ vector unsigned char __ATTRS_o_ai 8870 vec_slv(vector unsigned char __a, vector unsigned char __b) { 8871 return __builtin_altivec_vslv(__a, __b); 8872 } 8873 8874 /* vec_srv */ 8875 static __inline__ vector unsigned char __ATTRS_o_ai 8876 vec_srv(vector unsigned char __a, vector unsigned char __b) { 8877 return __builtin_altivec_vsrv(__a, __b); 8878 } 8879 #endif 8880 8881 /* vec_vsldoi */ 8882 8883 static __inline__ vector signed char __ATTRS_o_ai 8884 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 8885 unsigned char __d = __c & 0x0F; 8886 #ifdef __LITTLE_ENDIAN__ 8887 return vec_perm( 8888 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8889 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8890 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8891 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8892 #else 8893 return vec_perm( 8894 __a, __b, 8895 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8896 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8897 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8898 #endif 8899 } 8900 8901 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 8902 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 8903 unsigned char __d = __c & 0x0F; 8904 #ifdef __LITTLE_ENDIAN__ 8905 return vec_perm( 8906 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8907 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8908 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8909 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8910 #else 8911 return vec_perm( 8912 __a, __b, 8913 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8914 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8915 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8916 #endif 8917 } 8918 8919 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 8920 vector short __b, 8921 unsigned char __c) { 8922 unsigned char __d = __c & 0x0F; 8923 #ifdef __LITTLE_ENDIAN__ 8924 return vec_perm( 8925 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8926 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8927 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8928 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8929 #else 8930 return vec_perm( 8931 __a, __b, 8932 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8933 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8934 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8935 #endif 8936 } 8937 8938 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 8939 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 8940 unsigned char __d = __c & 0x0F; 8941 #ifdef __LITTLE_ENDIAN__ 8942 return vec_perm( 8943 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8944 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8945 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8946 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8947 #else 8948 return vec_perm( 8949 __a, __b, 8950 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8951 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8952 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8953 #endif 8954 } 8955 8956 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 8957 vector pixel __b, 8958 unsigned char __c) { 8959 unsigned char __d = __c & 0x0F; 8960 #ifdef __LITTLE_ENDIAN__ 8961 return vec_perm( 8962 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8963 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8964 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8965 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8966 #else 8967 return vec_perm( 8968 __a, __b, 8969 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8970 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8971 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8972 #endif 8973 } 8974 8975 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 8976 vector int __b, 8977 unsigned char __c) { 8978 unsigned char __d = __c & 0x0F; 8979 #ifdef __LITTLE_ENDIAN__ 8980 return vec_perm( 8981 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8982 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8983 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8984 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8985 #else 8986 return vec_perm( 8987 __a, __b, 8988 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8989 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8990 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8991 #endif 8992 } 8993 8994 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 8995 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 8996 unsigned char __d = __c & 0x0F; 8997 #ifdef __LITTLE_ENDIAN__ 8998 return vec_perm( 8999 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9000 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9001 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9002 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9003 #else 9004 return vec_perm( 9005 __a, __b, 9006 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9007 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9008 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9009 #endif 9010 } 9011 9012 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 9013 vector float __b, 9014 unsigned char __c) { 9015 unsigned char __d = __c & 0x0F; 9016 #ifdef __LITTLE_ENDIAN__ 9017 return vec_perm( 9018 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9019 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9020 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9021 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9022 #else 9023 return vec_perm( 9024 __a, __b, 9025 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9026 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9027 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9028 #endif 9029 } 9030 9031 /* vec_sll */ 9032 9033 static __inline__ vector signed char __ATTRS_o_ai 9034 vec_sll(vector signed char __a, vector unsigned char __b) { 9035 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9036 (vector int)__b); 9037 } 9038 9039 static __inline__ vector signed char __ATTRS_o_ai 9040 vec_sll(vector signed char __a, vector unsigned short __b) { 9041 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9042 (vector int)__b); 9043 } 9044 9045 static __inline__ vector signed char __ATTRS_o_ai 9046 vec_sll(vector signed char __a, vector unsigned int __b) { 9047 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9048 (vector int)__b); 9049 } 9050 9051 static __inline__ vector unsigned char __ATTRS_o_ai 9052 vec_sll(vector unsigned char __a, vector unsigned char __b) { 9053 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9054 (vector int)__b); 9055 } 9056 9057 static __inline__ vector unsigned char __ATTRS_o_ai 9058 vec_sll(vector unsigned char __a, vector unsigned short __b) { 9059 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9060 (vector int)__b); 9061 } 9062 9063 static __inline__ vector unsigned char __ATTRS_o_ai 9064 vec_sll(vector unsigned char __a, vector unsigned int __b) { 9065 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9066 (vector int)__b); 9067 } 9068 9069 static __inline__ vector bool char __ATTRS_o_ai 9070 vec_sll(vector bool char __a, vector unsigned char __b) { 9071 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9072 (vector int)__b); 9073 } 9074 9075 static __inline__ vector bool char __ATTRS_o_ai 9076 vec_sll(vector bool char __a, vector unsigned short __b) { 9077 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9078 (vector int)__b); 9079 } 9080 9081 static __inline__ vector bool char __ATTRS_o_ai 9082 vec_sll(vector bool char __a, vector unsigned int __b) { 9083 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9084 (vector int)__b); 9085 } 9086 9087 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9088 vector unsigned char __b) { 9089 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9090 } 9091 9092 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9093 vector unsigned short __b) { 9094 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9095 } 9096 9097 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9098 vector unsigned int __b) { 9099 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9100 } 9101 9102 static __inline__ vector unsigned short __ATTRS_o_ai 9103 vec_sll(vector unsigned short __a, vector unsigned char __b) { 9104 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9105 (vector int)__b); 9106 } 9107 9108 static __inline__ vector unsigned short __ATTRS_o_ai 9109 vec_sll(vector unsigned short __a, vector unsigned short __b) { 9110 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9111 (vector int)__b); 9112 } 9113 9114 static __inline__ vector unsigned short __ATTRS_o_ai 9115 vec_sll(vector unsigned short __a, vector unsigned int __b) { 9116 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9117 (vector int)__b); 9118 } 9119 9120 static __inline__ vector bool short __ATTRS_o_ai 9121 vec_sll(vector bool short __a, vector unsigned char __b) { 9122 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9123 (vector int)__b); 9124 } 9125 9126 static __inline__ vector bool short __ATTRS_o_ai 9127 vec_sll(vector bool short __a, vector unsigned short __b) { 9128 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9129 (vector int)__b); 9130 } 9131 9132 static __inline__ vector bool short __ATTRS_o_ai 9133 vec_sll(vector bool short __a, vector unsigned int __b) { 9134 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9135 (vector int)__b); 9136 } 9137 9138 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9139 vector unsigned char __b) { 9140 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9141 } 9142 9143 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9144 vector unsigned short __b) { 9145 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9146 } 9147 9148 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9149 vector unsigned int __b) { 9150 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9151 } 9152 9153 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9154 vector unsigned char __b) { 9155 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9156 } 9157 9158 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9159 vector unsigned short __b) { 9160 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9161 } 9162 9163 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9164 vector unsigned int __b) { 9165 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9166 } 9167 9168 static __inline__ vector unsigned int __ATTRS_o_ai 9169 vec_sll(vector unsigned int __a, vector unsigned char __b) { 9170 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9171 (vector int)__b); 9172 } 9173 9174 static __inline__ vector unsigned int __ATTRS_o_ai 9175 vec_sll(vector unsigned int __a, vector unsigned short __b) { 9176 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9177 (vector int)__b); 9178 } 9179 9180 static __inline__ vector unsigned int __ATTRS_o_ai 9181 vec_sll(vector unsigned int __a, vector unsigned int __b) { 9182 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9183 (vector int)__b); 9184 } 9185 9186 static __inline__ vector bool int __ATTRS_o_ai 9187 vec_sll(vector bool int __a, vector unsigned char __b) { 9188 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9189 (vector int)__b); 9190 } 9191 9192 static __inline__ vector bool int __ATTRS_o_ai 9193 vec_sll(vector bool int __a, vector unsigned short __b) { 9194 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9195 (vector int)__b); 9196 } 9197 9198 static __inline__ vector bool int __ATTRS_o_ai 9199 vec_sll(vector bool int __a, vector unsigned int __b) { 9200 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9201 (vector int)__b); 9202 } 9203 9204 #ifdef __VSX__ 9205 static __inline__ vector signed long long __ATTRS_o_ai 9206 vec_sll(vector signed long long __a, vector unsigned char __b) { 9207 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 9208 (vector int)__b); 9209 } 9210 9211 static __inline__ vector unsigned long long __ATTRS_o_ai 9212 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 9213 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 9214 (vector int)__b); 9215 } 9216 #endif 9217 9218 /* vec_vsl */ 9219 9220 static __inline__ vector signed char __ATTRS_o_ai 9221 vec_vsl(vector signed char __a, vector unsigned char __b) { 9222 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9223 (vector int)__b); 9224 } 9225 9226 static __inline__ vector signed char __ATTRS_o_ai 9227 vec_vsl(vector signed char __a, vector unsigned short __b) { 9228 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9229 (vector int)__b); 9230 } 9231 9232 static __inline__ vector signed char __ATTRS_o_ai 9233 vec_vsl(vector signed char __a, vector unsigned int __b) { 9234 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9235 (vector int)__b); 9236 } 9237 9238 static __inline__ vector unsigned char __ATTRS_o_ai 9239 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 9240 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9241 (vector int)__b); 9242 } 9243 9244 static __inline__ vector unsigned char __ATTRS_o_ai 9245 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 9246 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9247 (vector int)__b); 9248 } 9249 9250 static __inline__ vector unsigned char __ATTRS_o_ai 9251 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 9252 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9253 (vector int)__b); 9254 } 9255 9256 static __inline__ vector bool char __ATTRS_o_ai 9257 vec_vsl(vector bool char __a, vector unsigned char __b) { 9258 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9259 (vector int)__b); 9260 } 9261 9262 static __inline__ vector bool char __ATTRS_o_ai 9263 vec_vsl(vector bool char __a, vector unsigned short __b) { 9264 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9265 (vector int)__b); 9266 } 9267 9268 static __inline__ vector bool char __ATTRS_o_ai 9269 vec_vsl(vector bool char __a, vector unsigned int __b) { 9270 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9271 (vector int)__b); 9272 } 9273 9274 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9275 vector unsigned char __b) { 9276 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9277 } 9278 9279 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9280 vector unsigned short __b) { 9281 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9282 } 9283 9284 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9285 vector unsigned int __b) { 9286 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9287 } 9288 9289 static __inline__ vector unsigned short __ATTRS_o_ai 9290 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 9291 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9292 (vector int)__b); 9293 } 9294 9295 static __inline__ vector unsigned short __ATTRS_o_ai 9296 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 9297 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9298 (vector int)__b); 9299 } 9300 9301 static __inline__ vector unsigned short __ATTRS_o_ai 9302 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 9303 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9304 (vector int)__b); 9305 } 9306 9307 static __inline__ vector bool short __ATTRS_o_ai 9308 vec_vsl(vector bool short __a, vector unsigned char __b) { 9309 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9310 (vector int)__b); 9311 } 9312 9313 static __inline__ vector bool short __ATTRS_o_ai 9314 vec_vsl(vector bool short __a, vector unsigned short __b) { 9315 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9316 (vector int)__b); 9317 } 9318 9319 static __inline__ vector bool short __ATTRS_o_ai 9320 vec_vsl(vector bool short __a, vector unsigned int __b) { 9321 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9322 (vector int)__b); 9323 } 9324 9325 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9326 vector unsigned char __b) { 9327 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9328 } 9329 9330 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9331 vector unsigned short __b) { 9332 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9333 } 9334 9335 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9336 vector unsigned int __b) { 9337 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9338 } 9339 9340 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9341 vector unsigned char __b) { 9342 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9343 } 9344 9345 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9346 vector unsigned short __b) { 9347 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9348 } 9349 9350 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9351 vector unsigned int __b) { 9352 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9353 } 9354 9355 static __inline__ vector unsigned int __ATTRS_o_ai 9356 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 9357 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9358 (vector int)__b); 9359 } 9360 9361 static __inline__ vector unsigned int __ATTRS_o_ai 9362 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9363 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9364 (vector int)__b); 9365 } 9366 9367 static __inline__ vector unsigned int __ATTRS_o_ai 9368 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9369 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9370 (vector int)__b); 9371 } 9372 9373 static __inline__ vector bool int __ATTRS_o_ai 9374 vec_vsl(vector bool int __a, vector unsigned char __b) { 9375 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9376 (vector int)__b); 9377 } 9378 9379 static __inline__ vector bool int __ATTRS_o_ai 9380 vec_vsl(vector bool int __a, vector unsigned short __b) { 9381 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9382 (vector int)__b); 9383 } 9384 9385 static __inline__ vector bool int __ATTRS_o_ai 9386 vec_vsl(vector bool int __a, vector unsigned int __b) { 9387 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9388 (vector int)__b); 9389 } 9390 9391 /* vec_slo */ 9392 9393 static __inline__ vector signed char __ATTRS_o_ai 9394 vec_slo(vector signed char __a, vector signed char __b) { 9395 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9396 (vector int)__b); 9397 } 9398 9399 static __inline__ vector signed char __ATTRS_o_ai 9400 vec_slo(vector signed char __a, vector unsigned char __b) { 9401 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9402 (vector int)__b); 9403 } 9404 9405 static __inline__ vector unsigned char __ATTRS_o_ai 9406 vec_slo(vector unsigned char __a, vector signed char __b) { 9407 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9408 (vector int)__b); 9409 } 9410 9411 static __inline__ vector unsigned char __ATTRS_o_ai 9412 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9413 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9414 (vector int)__b); 9415 } 9416 9417 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9418 vector signed char __b) { 9419 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9420 } 9421 9422 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9423 vector unsigned char __b) { 9424 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9425 } 9426 9427 static __inline__ vector unsigned short __ATTRS_o_ai 9428 vec_slo(vector unsigned short __a, vector signed char __b) { 9429 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9430 (vector int)__b); 9431 } 9432 9433 static __inline__ vector unsigned short __ATTRS_o_ai 9434 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9435 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9436 (vector int)__b); 9437 } 9438 9439 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9440 vector signed char __b) { 9441 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9442 } 9443 9444 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9445 vector unsigned char __b) { 9446 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9447 } 9448 9449 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9450 vector signed char __b) { 9451 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9452 } 9453 9454 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9455 vector unsigned char __b) { 9456 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9457 } 9458 9459 static __inline__ vector unsigned int __ATTRS_o_ai 9460 vec_slo(vector unsigned int __a, vector signed char __b) { 9461 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9462 (vector int)__b); 9463 } 9464 9465 static __inline__ vector unsigned int __ATTRS_o_ai 9466 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9467 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9468 (vector int)__b); 9469 } 9470 9471 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9472 vector signed char __b) { 9473 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9474 } 9475 9476 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9477 vector unsigned char __b) { 9478 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9479 } 9480 9481 #ifdef __VSX__ 9482 static __inline__ vector signed long long __ATTRS_o_ai 9483 vec_slo(vector signed long long __a, vector signed char __b) { 9484 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9485 (vector int)__b); 9486 } 9487 9488 static __inline__ vector signed long long __ATTRS_o_ai 9489 vec_slo(vector signed long long __a, vector unsigned char __b) { 9490 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9491 (vector int)__b); 9492 } 9493 9494 static __inline__ vector unsigned long long __ATTRS_o_ai 9495 vec_slo(vector unsigned long long __a, vector signed char __b) { 9496 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9497 (vector int)__b); 9498 } 9499 9500 static __inline__ vector unsigned long long __ATTRS_o_ai 9501 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9502 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9503 (vector int)__b); 9504 } 9505 #endif 9506 9507 /* vec_vslo */ 9508 9509 static __inline__ vector signed char __ATTRS_o_ai 9510 vec_vslo(vector signed char __a, vector signed char __b) { 9511 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9512 (vector int)__b); 9513 } 9514 9515 static __inline__ vector signed char __ATTRS_o_ai 9516 vec_vslo(vector signed char __a, vector unsigned char __b) { 9517 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9518 (vector int)__b); 9519 } 9520 9521 static __inline__ vector unsigned char __ATTRS_o_ai 9522 vec_vslo(vector unsigned char __a, vector signed char __b) { 9523 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9524 (vector int)__b); 9525 } 9526 9527 static __inline__ vector unsigned char __ATTRS_o_ai 9528 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 9529 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9530 (vector int)__b); 9531 } 9532 9533 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9534 vector signed char __b) { 9535 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9536 } 9537 9538 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9539 vector unsigned char __b) { 9540 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9541 } 9542 9543 static __inline__ vector unsigned short __ATTRS_o_ai 9544 vec_vslo(vector unsigned short __a, vector signed char __b) { 9545 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9546 (vector int)__b); 9547 } 9548 9549 static __inline__ vector unsigned short __ATTRS_o_ai 9550 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 9551 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9552 (vector int)__b); 9553 } 9554 9555 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9556 vector signed char __b) { 9557 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9558 } 9559 9560 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9561 vector unsigned char __b) { 9562 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9563 } 9564 9565 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9566 vector signed char __b) { 9567 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9568 } 9569 9570 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9571 vector unsigned char __b) { 9572 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9573 } 9574 9575 static __inline__ vector unsigned int __ATTRS_o_ai 9576 vec_vslo(vector unsigned int __a, vector signed char __b) { 9577 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9578 (vector int)__b); 9579 } 9580 9581 static __inline__ vector unsigned int __ATTRS_o_ai 9582 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 9583 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9584 (vector int)__b); 9585 } 9586 9587 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9588 vector signed char __b) { 9589 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9590 } 9591 9592 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9593 vector unsigned char __b) { 9594 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9595 } 9596 9597 /* vec_splat */ 9598 9599 static __inline__ vector signed char __ATTRS_o_ai 9600 vec_splat(vector signed char __a, unsigned const int __b) { 9601 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9602 } 9603 9604 static __inline__ vector unsigned char __ATTRS_o_ai 9605 vec_splat(vector unsigned char __a, unsigned const int __b) { 9606 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9607 } 9608 9609 static __inline__ vector bool char __ATTRS_o_ai 9610 vec_splat(vector bool char __a, unsigned const int __b) { 9611 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9612 } 9613 9614 static __inline__ vector signed short __ATTRS_o_ai 9615 vec_splat(vector signed short __a, unsigned const int __b) { 9616 unsigned char b0 = (__b & 0x07) * 2; 9617 unsigned char b1 = b0 + 1; 9618 return vec_perm(__a, __a, 9619 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9620 b0, b1, b0, b1, b0, b1)); 9621 } 9622 9623 static __inline__ vector unsigned short __ATTRS_o_ai 9624 vec_splat(vector unsigned short __a, unsigned const int __b) { 9625 unsigned char b0 = (__b & 0x07) * 2; 9626 unsigned char b1 = b0 + 1; 9627 return vec_perm(__a, __a, 9628 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9629 b0, b1, b0, b1, b0, b1)); 9630 } 9631 9632 static __inline__ vector bool short __ATTRS_o_ai 9633 vec_splat(vector bool short __a, unsigned const int __b) { 9634 unsigned char b0 = (__b & 0x07) * 2; 9635 unsigned char b1 = b0 + 1; 9636 return vec_perm(__a, __a, 9637 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9638 b0, b1, b0, b1, b0, b1)); 9639 } 9640 9641 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 9642 unsigned const int __b) { 9643 unsigned char b0 = (__b & 0x07) * 2; 9644 unsigned char b1 = b0 + 1; 9645 return vec_perm(__a, __a, 9646 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 9647 b0, b1, b0, b1, b0, b1)); 9648 } 9649 9650 static __inline__ vector signed int __ATTRS_o_ai 9651 vec_splat(vector signed int __a, unsigned const int __b) { 9652 unsigned char b0 = (__b & 0x03) * 4; 9653 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9654 return vec_perm(__a, __a, 9655 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9656 b2, b3, b0, b1, b2, b3)); 9657 } 9658 9659 static __inline__ vector unsigned int __ATTRS_o_ai 9660 vec_splat(vector unsigned int __a, unsigned const int __b) { 9661 unsigned char b0 = (__b & 0x03) * 4; 9662 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9663 return vec_perm(__a, __a, 9664 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9665 b2, b3, b0, b1, b2, b3)); 9666 } 9667 9668 static __inline__ vector bool int __ATTRS_o_ai 9669 vec_splat(vector bool int __a, unsigned const int __b) { 9670 unsigned char b0 = (__b & 0x03) * 4; 9671 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9672 return vec_perm(__a, __a, 9673 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9674 b2, b3, b0, b1, b2, b3)); 9675 } 9676 9677 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 9678 unsigned const int __b) { 9679 unsigned char b0 = (__b & 0x03) * 4; 9680 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 9681 return vec_perm(__a, __a, 9682 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 9683 b2, b3, b0, b1, b2, b3)); 9684 } 9685 9686 #ifdef __VSX__ 9687 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 9688 unsigned const int __b) { 9689 unsigned char b0 = (__b & 0x01) * 8; 9690 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9691 b6 = b0 + 6, b7 = b0 + 7; 9692 return vec_perm(__a, __a, 9693 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9694 b2, b3, b4, b5, b6, b7)); 9695 } 9696 static __inline__ vector bool long long __ATTRS_o_ai 9697 vec_splat(vector bool long long __a, unsigned const int __b) { 9698 unsigned char b0 = (__b & 0x01) * 8; 9699 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9700 b6 = b0 + 6, b7 = b0 + 7; 9701 return vec_perm(__a, __a, 9702 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9703 b2, b3, b4, b5, b6, b7)); 9704 } 9705 static __inline__ vector signed long long __ATTRS_o_ai 9706 vec_splat(vector signed long long __a, unsigned const int __b) { 9707 unsigned char b0 = (__b & 0x01) * 8; 9708 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9709 b6 = b0 + 6, b7 = b0 + 7; 9710 return vec_perm(__a, __a, 9711 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9712 b2, b3, b4, b5, b6, b7)); 9713 } 9714 static __inline__ vector unsigned long long __ATTRS_o_ai 9715 vec_splat(vector unsigned long long __a, unsigned const int __b) { 9716 unsigned char b0 = (__b & 0x01) * 8; 9717 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 9718 b6 = b0 + 6, b7 = b0 + 7; 9719 return vec_perm(__a, __a, 9720 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 9721 b2, b3, b4, b5, b6, b7)); 9722 } 9723 #endif 9724 9725 /* vec_vspltb */ 9726 9727 #define __builtin_altivec_vspltb vec_vspltb 9728 9729 static __inline__ vector signed char __ATTRS_o_ai 9730 vec_vspltb(vector signed char __a, unsigned char __b) { 9731 return vec_perm(__a, __a, (vector unsigned char)(__b)); 9732 } 9733 9734 static __inline__ vector unsigned char __ATTRS_o_ai 9735 vec_vspltb(vector unsigned char __a, unsigned char __b) { 9736 return vec_perm(__a, __a, (vector unsigned char)(__b)); 9737 } 9738 9739 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 9740 unsigned char __b) { 9741 return vec_perm(__a, __a, (vector unsigned char)(__b)); 9742 } 9743 9744 /* vec_vsplth */ 9745 9746 #define __builtin_altivec_vsplth vec_vsplth 9747 9748 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 9749 unsigned char __b) { 9750 __b *= 2; 9751 unsigned char b1 = __b + 1; 9752 return vec_perm(__a, __a, 9753 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9754 __b, b1, __b, b1, __b, b1, __b, b1)); 9755 } 9756 9757 static __inline__ vector unsigned short __ATTRS_o_ai 9758 vec_vsplth(vector unsigned short __a, unsigned char __b) { 9759 __b *= 2; 9760 unsigned char b1 = __b + 1; 9761 return vec_perm(__a, __a, 9762 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9763 __b, b1, __b, b1, __b, b1, __b, b1)); 9764 } 9765 9766 static __inline__ vector bool short __ATTRS_o_ai 9767 vec_vsplth(vector bool short __a, unsigned char __b) { 9768 __b *= 2; 9769 unsigned char b1 = __b + 1; 9770 return vec_perm(__a, __a, 9771 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9772 __b, b1, __b, b1, __b, b1, __b, b1)); 9773 } 9774 9775 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 9776 unsigned char __b) { 9777 __b *= 2; 9778 unsigned char b1 = __b + 1; 9779 return vec_perm(__a, __a, 9780 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 9781 __b, b1, __b, b1, __b, b1, __b, b1)); 9782 } 9783 9784 /* vec_vspltw */ 9785 9786 #define __builtin_altivec_vspltw vec_vspltw 9787 9788 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 9789 unsigned char __b) { 9790 __b *= 4; 9791 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9792 return vec_perm(__a, __a, 9793 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9794 b1, b2, b3, __b, b1, b2, b3)); 9795 } 9796 9797 static __inline__ vector unsigned int __ATTRS_o_ai 9798 vec_vspltw(vector unsigned int __a, unsigned char __b) { 9799 __b *= 4; 9800 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9801 return vec_perm(__a, __a, 9802 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9803 b1, b2, b3, __b, b1, b2, b3)); 9804 } 9805 9806 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 9807 unsigned char __b) { 9808 __b *= 4; 9809 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9810 return vec_perm(__a, __a, 9811 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9812 b1, b2, b3, __b, b1, b2, b3)); 9813 } 9814 9815 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 9816 unsigned char __b) { 9817 __b *= 4; 9818 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 9819 return vec_perm(__a, __a, 9820 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 9821 b1, b2, b3, __b, b1, b2, b3)); 9822 } 9823 9824 /* vec_splat_s8 */ 9825 9826 #define __builtin_altivec_vspltisb vec_splat_s8 9827 9828 // FIXME: parameter should be treated as 5-bit signed literal 9829 static __inline__ vector signed char __ATTRS_o_ai 9830 vec_splat_s8(signed char __a) { 9831 return (vector signed char)(__a); 9832 } 9833 9834 /* vec_vspltisb */ 9835 9836 // FIXME: parameter should be treated as 5-bit signed literal 9837 static __inline__ vector signed char __ATTRS_o_ai 9838 vec_vspltisb(signed char __a) { 9839 return (vector signed char)(__a); 9840 } 9841 9842 /* vec_splat_s16 */ 9843 9844 #define __builtin_altivec_vspltish vec_splat_s16 9845 9846 // FIXME: parameter should be treated as 5-bit signed literal 9847 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 9848 return (vector short)(__a); 9849 } 9850 9851 /* vec_vspltish */ 9852 9853 // FIXME: parameter should be treated as 5-bit signed literal 9854 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 9855 return (vector short)(__a); 9856 } 9857 9858 /* vec_splat_s32 */ 9859 9860 #define __builtin_altivec_vspltisw vec_splat_s32 9861 9862 // FIXME: parameter should be treated as 5-bit signed literal 9863 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 9864 return (vector int)(__a); 9865 } 9866 9867 /* vec_vspltisw */ 9868 9869 // FIXME: parameter should be treated as 5-bit signed literal 9870 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 9871 return (vector int)(__a); 9872 } 9873 9874 /* vec_splat_u8 */ 9875 9876 // FIXME: parameter should be treated as 5-bit signed literal 9877 static __inline__ vector unsigned char __ATTRS_o_ai 9878 vec_splat_u8(unsigned char __a) { 9879 return (vector unsigned char)(__a); 9880 } 9881 9882 /* vec_splat_u16 */ 9883 9884 // FIXME: parameter should be treated as 5-bit signed literal 9885 static __inline__ vector unsigned short __ATTRS_o_ai 9886 vec_splat_u16(signed char __a) { 9887 return (vector unsigned short)(__a); 9888 } 9889 9890 /* vec_splat_u32 */ 9891 9892 // FIXME: parameter should be treated as 5-bit signed literal 9893 static __inline__ vector unsigned int __ATTRS_o_ai 9894 vec_splat_u32(signed char __a) { 9895 return (vector unsigned int)(__a); 9896 } 9897 9898 /* vec_sr */ 9899 9900 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 9901 // than the length of __a. 9902 static __inline__ vector unsigned char __ATTRS_o_ai 9903 vec_sr(vector unsigned char __a, vector unsigned char __b) { 9904 return __a >> 9905 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 9906 } 9907 9908 static __inline__ vector signed char __ATTRS_o_ai 9909 vec_sr(vector signed char __a, vector unsigned char __b) { 9910 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 9911 } 9912 9913 static __inline__ vector unsigned short __ATTRS_o_ai 9914 vec_sr(vector unsigned short __a, vector unsigned short __b) { 9915 return __a >> 9916 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 9917 } 9918 9919 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 9920 vector unsigned short __b) { 9921 return (vector short)vec_sr((vector unsigned short)__a, __b); 9922 } 9923 9924 static __inline__ vector unsigned int __ATTRS_o_ai 9925 vec_sr(vector unsigned int __a, vector unsigned int __b) { 9926 return __a >> 9927 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 9928 } 9929 9930 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 9931 vector unsigned int __b) { 9932 return (vector int)vec_sr((vector unsigned int)__a, __b); 9933 } 9934 9935 #ifdef __POWER8_VECTOR__ 9936 static __inline__ vector unsigned long long __ATTRS_o_ai 9937 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 9938 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 9939 __CHAR_BIT__)); 9940 } 9941 9942 static __inline__ vector long long __ATTRS_o_ai 9943 vec_sr(vector long long __a, vector unsigned long long __b) { 9944 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 9945 } 9946 #endif 9947 9948 /* vec_vsrb */ 9949 9950 #define __builtin_altivec_vsrb vec_vsrb 9951 9952 static __inline__ vector signed char __ATTRS_o_ai 9953 vec_vsrb(vector signed char __a, vector unsigned char __b) { 9954 return vec_sr(__a, __b); 9955 } 9956 9957 static __inline__ vector unsigned char __ATTRS_o_ai 9958 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 9959 return vec_sr(__a, __b); 9960 } 9961 9962 /* vec_vsrh */ 9963 9964 #define __builtin_altivec_vsrh vec_vsrh 9965 9966 static __inline__ vector short __ATTRS_o_ai 9967 vec_vsrh(vector short __a, vector unsigned short __b) { 9968 return vec_sr(__a, __b); 9969 } 9970 9971 static __inline__ vector unsigned short __ATTRS_o_ai 9972 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 9973 return vec_sr(__a, __b); 9974 } 9975 9976 /* vec_vsrw */ 9977 9978 #define __builtin_altivec_vsrw vec_vsrw 9979 9980 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 9981 vector unsigned int __b) { 9982 return vec_sr(__a, __b); 9983 } 9984 9985 static __inline__ vector unsigned int __ATTRS_o_ai 9986 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 9987 return vec_sr(__a, __b); 9988 } 9989 9990 /* vec_sra */ 9991 9992 static __inline__ vector signed char __ATTRS_o_ai 9993 vec_sra(vector signed char __a, vector unsigned char __b) { 9994 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 9995 } 9996 9997 static __inline__ vector unsigned char __ATTRS_o_ai 9998 vec_sra(vector unsigned char __a, vector unsigned char __b) { 9999 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10000 } 10001 10002 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 10003 vector unsigned short __b) { 10004 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10005 } 10006 10007 static __inline__ vector unsigned short __ATTRS_o_ai 10008 vec_sra(vector unsigned short __a, vector unsigned short __b) { 10009 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10010 } 10011 10012 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 10013 vector unsigned int __b) { 10014 return __builtin_altivec_vsraw(__a, __b); 10015 } 10016 10017 static __inline__ vector unsigned int __ATTRS_o_ai 10018 vec_sra(vector unsigned int __a, vector unsigned int __b) { 10019 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10020 } 10021 10022 #ifdef __POWER8_VECTOR__ 10023 static __inline__ vector signed long long __ATTRS_o_ai 10024 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10025 return __a >> __b; 10026 } 10027 10028 static __inline__ vector unsigned long long __ATTRS_o_ai 10029 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10030 return (vector unsigned long long)((vector signed long long)__a >> __b); 10031 } 10032 #endif 10033 10034 /* vec_vsrab */ 10035 10036 static __inline__ vector signed char __ATTRS_o_ai 10037 vec_vsrab(vector signed char __a, vector unsigned char __b) { 10038 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10039 } 10040 10041 static __inline__ vector unsigned char __ATTRS_o_ai 10042 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 10043 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10044 } 10045 10046 /* vec_vsrah */ 10047 10048 static __inline__ vector short __ATTRS_o_ai 10049 vec_vsrah(vector short __a, vector unsigned short __b) { 10050 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10051 } 10052 10053 static __inline__ vector unsigned short __ATTRS_o_ai 10054 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 10055 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10056 } 10057 10058 /* vec_vsraw */ 10059 10060 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 10061 vector unsigned int __b) { 10062 return __builtin_altivec_vsraw(__a, __b); 10063 } 10064 10065 static __inline__ vector unsigned int __ATTRS_o_ai 10066 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 10067 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10068 } 10069 10070 /* vec_srl */ 10071 10072 static __inline__ vector signed char __ATTRS_o_ai 10073 vec_srl(vector signed char __a, vector unsigned char __b) { 10074 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10075 (vector int)__b); 10076 } 10077 10078 static __inline__ vector signed char __ATTRS_o_ai 10079 vec_srl(vector signed char __a, vector unsigned short __b) { 10080 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10081 (vector int)__b); 10082 } 10083 10084 static __inline__ vector signed char __ATTRS_o_ai 10085 vec_srl(vector signed char __a, vector unsigned int __b) { 10086 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10087 (vector int)__b); 10088 } 10089 10090 static __inline__ vector unsigned char __ATTRS_o_ai 10091 vec_srl(vector unsigned char __a, vector unsigned char __b) { 10092 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10093 (vector int)__b); 10094 } 10095 10096 static __inline__ vector unsigned char __ATTRS_o_ai 10097 vec_srl(vector unsigned char __a, vector unsigned short __b) { 10098 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10099 (vector int)__b); 10100 } 10101 10102 static __inline__ vector unsigned char __ATTRS_o_ai 10103 vec_srl(vector unsigned char __a, vector unsigned int __b) { 10104 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10105 (vector int)__b); 10106 } 10107 10108 static __inline__ vector bool char __ATTRS_o_ai 10109 vec_srl(vector bool char __a, vector unsigned char __b) { 10110 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10111 (vector int)__b); 10112 } 10113 10114 static __inline__ vector bool char __ATTRS_o_ai 10115 vec_srl(vector bool char __a, vector unsigned short __b) { 10116 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10117 (vector int)__b); 10118 } 10119 10120 static __inline__ vector bool char __ATTRS_o_ai 10121 vec_srl(vector bool char __a, vector unsigned int __b) { 10122 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10123 (vector int)__b); 10124 } 10125 10126 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10127 vector unsigned char __b) { 10128 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10129 } 10130 10131 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10132 vector unsigned short __b) { 10133 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10134 } 10135 10136 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10137 vector unsigned int __b) { 10138 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10139 } 10140 10141 static __inline__ vector unsigned short __ATTRS_o_ai 10142 vec_srl(vector unsigned short __a, vector unsigned char __b) { 10143 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10144 (vector int)__b); 10145 } 10146 10147 static __inline__ vector unsigned short __ATTRS_o_ai 10148 vec_srl(vector unsigned short __a, vector unsigned short __b) { 10149 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10150 (vector int)__b); 10151 } 10152 10153 static __inline__ vector unsigned short __ATTRS_o_ai 10154 vec_srl(vector unsigned short __a, vector unsigned int __b) { 10155 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10156 (vector int)__b); 10157 } 10158 10159 static __inline__ vector bool short __ATTRS_o_ai 10160 vec_srl(vector bool short __a, vector unsigned char __b) { 10161 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10162 (vector int)__b); 10163 } 10164 10165 static __inline__ vector bool short __ATTRS_o_ai 10166 vec_srl(vector bool short __a, vector unsigned short __b) { 10167 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10168 (vector int)__b); 10169 } 10170 10171 static __inline__ vector bool short __ATTRS_o_ai 10172 vec_srl(vector bool short __a, vector unsigned int __b) { 10173 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10174 (vector int)__b); 10175 } 10176 10177 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10178 vector unsigned char __b) { 10179 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10180 } 10181 10182 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10183 vector unsigned short __b) { 10184 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10185 } 10186 10187 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10188 vector unsigned int __b) { 10189 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10190 } 10191 10192 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10193 vector unsigned char __b) { 10194 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10195 } 10196 10197 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10198 vector unsigned short __b) { 10199 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10200 } 10201 10202 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10203 vector unsigned int __b) { 10204 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10205 } 10206 10207 static __inline__ vector unsigned int __ATTRS_o_ai 10208 vec_srl(vector unsigned int __a, vector unsigned char __b) { 10209 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10210 (vector int)__b); 10211 } 10212 10213 static __inline__ vector unsigned int __ATTRS_o_ai 10214 vec_srl(vector unsigned int __a, vector unsigned short __b) { 10215 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10216 (vector int)__b); 10217 } 10218 10219 static __inline__ vector unsigned int __ATTRS_o_ai 10220 vec_srl(vector unsigned int __a, vector unsigned int __b) { 10221 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10222 (vector int)__b); 10223 } 10224 10225 static __inline__ vector bool int __ATTRS_o_ai 10226 vec_srl(vector bool int __a, vector unsigned char __b) { 10227 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10228 (vector int)__b); 10229 } 10230 10231 static __inline__ vector bool int __ATTRS_o_ai 10232 vec_srl(vector bool int __a, vector unsigned short __b) { 10233 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10234 (vector int)__b); 10235 } 10236 10237 static __inline__ vector bool int __ATTRS_o_ai 10238 vec_srl(vector bool int __a, vector unsigned int __b) { 10239 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10240 (vector int)__b); 10241 } 10242 10243 #ifdef __VSX__ 10244 static __inline__ vector signed long long __ATTRS_o_ai 10245 vec_srl(vector signed long long __a, vector unsigned char __b) { 10246 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 10247 (vector int)__b); 10248 } 10249 10250 static __inline__ vector unsigned long long __ATTRS_o_ai 10251 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 10252 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 10253 (vector int)__b); 10254 } 10255 #endif 10256 10257 /* vec_vsr */ 10258 10259 static __inline__ vector signed char __ATTRS_o_ai 10260 vec_vsr(vector signed char __a, vector unsigned char __b) { 10261 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10262 (vector int)__b); 10263 } 10264 10265 static __inline__ vector signed char __ATTRS_o_ai 10266 vec_vsr(vector signed char __a, vector unsigned short __b) { 10267 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10268 (vector int)__b); 10269 } 10270 10271 static __inline__ vector signed char __ATTRS_o_ai 10272 vec_vsr(vector signed char __a, vector unsigned int __b) { 10273 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10274 (vector int)__b); 10275 } 10276 10277 static __inline__ vector unsigned char __ATTRS_o_ai 10278 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 10279 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10280 (vector int)__b); 10281 } 10282 10283 static __inline__ vector unsigned char __ATTRS_o_ai 10284 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 10285 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10286 (vector int)__b); 10287 } 10288 10289 static __inline__ vector unsigned char __ATTRS_o_ai 10290 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 10291 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10292 (vector int)__b); 10293 } 10294 10295 static __inline__ vector bool char __ATTRS_o_ai 10296 vec_vsr(vector bool char __a, vector unsigned char __b) { 10297 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10298 (vector int)__b); 10299 } 10300 10301 static __inline__ vector bool char __ATTRS_o_ai 10302 vec_vsr(vector bool char __a, vector unsigned short __b) { 10303 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10304 (vector int)__b); 10305 } 10306 10307 static __inline__ vector bool char __ATTRS_o_ai 10308 vec_vsr(vector bool char __a, vector unsigned int __b) { 10309 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10310 (vector int)__b); 10311 } 10312 10313 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10314 vector unsigned char __b) { 10315 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10316 } 10317 10318 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10319 vector unsigned short __b) { 10320 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10321 } 10322 10323 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10324 vector unsigned int __b) { 10325 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10326 } 10327 10328 static __inline__ vector unsigned short __ATTRS_o_ai 10329 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 10330 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10331 (vector int)__b); 10332 } 10333 10334 static __inline__ vector unsigned short __ATTRS_o_ai 10335 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 10336 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10337 (vector int)__b); 10338 } 10339 10340 static __inline__ vector unsigned short __ATTRS_o_ai 10341 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 10342 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10343 (vector int)__b); 10344 } 10345 10346 static __inline__ vector bool short __ATTRS_o_ai 10347 vec_vsr(vector bool short __a, vector unsigned char __b) { 10348 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10349 (vector int)__b); 10350 } 10351 10352 static __inline__ vector bool short __ATTRS_o_ai 10353 vec_vsr(vector bool short __a, vector unsigned short __b) { 10354 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10355 (vector int)__b); 10356 } 10357 10358 static __inline__ vector bool short __ATTRS_o_ai 10359 vec_vsr(vector bool short __a, vector unsigned int __b) { 10360 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10361 (vector int)__b); 10362 } 10363 10364 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10365 vector unsigned char __b) { 10366 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10367 } 10368 10369 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10370 vector unsigned short __b) { 10371 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10372 } 10373 10374 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10375 vector unsigned int __b) { 10376 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10377 } 10378 10379 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10380 vector unsigned char __b) { 10381 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10382 } 10383 10384 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10385 vector unsigned short __b) { 10386 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10387 } 10388 10389 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10390 vector unsigned int __b) { 10391 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10392 } 10393 10394 static __inline__ vector unsigned int __ATTRS_o_ai 10395 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10396 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10397 (vector int)__b); 10398 } 10399 10400 static __inline__ vector unsigned int __ATTRS_o_ai 10401 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10402 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10403 (vector int)__b); 10404 } 10405 10406 static __inline__ vector unsigned int __ATTRS_o_ai 10407 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10408 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10409 (vector int)__b); 10410 } 10411 10412 static __inline__ vector bool int __ATTRS_o_ai 10413 vec_vsr(vector bool int __a, vector unsigned char __b) { 10414 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10415 (vector int)__b); 10416 } 10417 10418 static __inline__ vector bool int __ATTRS_o_ai 10419 vec_vsr(vector bool int __a, vector unsigned short __b) { 10420 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10421 (vector int)__b); 10422 } 10423 10424 static __inline__ vector bool int __ATTRS_o_ai 10425 vec_vsr(vector bool int __a, vector unsigned int __b) { 10426 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10427 (vector int)__b); 10428 } 10429 10430 /* vec_sro */ 10431 10432 static __inline__ vector signed char __ATTRS_o_ai 10433 vec_sro(vector signed char __a, vector signed char __b) { 10434 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10435 (vector int)__b); 10436 } 10437 10438 static __inline__ vector signed char __ATTRS_o_ai 10439 vec_sro(vector signed char __a, vector unsigned char __b) { 10440 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10441 (vector int)__b); 10442 } 10443 10444 static __inline__ vector unsigned char __ATTRS_o_ai 10445 vec_sro(vector unsigned char __a, vector signed char __b) { 10446 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10447 (vector int)__b); 10448 } 10449 10450 static __inline__ vector unsigned char __ATTRS_o_ai 10451 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10452 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10453 (vector int)__b); 10454 } 10455 10456 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10457 vector signed char __b) { 10458 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10459 } 10460 10461 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10462 vector unsigned char __b) { 10463 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10464 } 10465 10466 static __inline__ vector unsigned short __ATTRS_o_ai 10467 vec_sro(vector unsigned short __a, vector signed char __b) { 10468 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10469 (vector int)__b); 10470 } 10471 10472 static __inline__ vector unsigned short __ATTRS_o_ai 10473 vec_sro(vector unsigned short __a, vector unsigned char __b) { 10474 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10475 (vector int)__b); 10476 } 10477 10478 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10479 vector signed char __b) { 10480 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10481 } 10482 10483 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10484 vector unsigned char __b) { 10485 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10486 } 10487 10488 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10489 vector signed char __b) { 10490 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10491 } 10492 10493 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10494 vector unsigned char __b) { 10495 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10496 } 10497 10498 static __inline__ vector unsigned int __ATTRS_o_ai 10499 vec_sro(vector unsigned int __a, vector signed char __b) { 10500 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10501 (vector int)__b); 10502 } 10503 10504 static __inline__ vector unsigned int __ATTRS_o_ai 10505 vec_sro(vector unsigned int __a, vector unsigned char __b) { 10506 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10507 (vector int)__b); 10508 } 10509 10510 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10511 vector signed char __b) { 10512 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10513 } 10514 10515 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10516 vector unsigned char __b) { 10517 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10518 } 10519 10520 #ifdef __VSX__ 10521 static __inline__ vector signed long long __ATTRS_o_ai 10522 vec_sro(vector signed long long __a, vector signed char __b) { 10523 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10524 (vector int)__b); 10525 } 10526 10527 static __inline__ vector signed long long __ATTRS_o_ai 10528 vec_sro(vector signed long long __a, vector unsigned char __b) { 10529 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10530 (vector int)__b); 10531 } 10532 10533 static __inline__ vector unsigned long long __ATTRS_o_ai 10534 vec_sro(vector unsigned long long __a, vector signed char __b) { 10535 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10536 (vector int)__b); 10537 } 10538 10539 static __inline__ vector unsigned long long __ATTRS_o_ai 10540 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 10541 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10542 (vector int)__b); 10543 } 10544 #endif 10545 10546 /* vec_vsro */ 10547 10548 static __inline__ vector signed char __ATTRS_o_ai 10549 vec_vsro(vector signed char __a, vector signed char __b) { 10550 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10551 (vector int)__b); 10552 } 10553 10554 static __inline__ vector signed char __ATTRS_o_ai 10555 vec_vsro(vector signed char __a, vector unsigned char __b) { 10556 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10557 (vector int)__b); 10558 } 10559 10560 static __inline__ vector unsigned char __ATTRS_o_ai 10561 vec_vsro(vector unsigned char __a, vector signed char __b) { 10562 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10563 (vector int)__b); 10564 } 10565 10566 static __inline__ vector unsigned char __ATTRS_o_ai 10567 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 10568 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10569 (vector int)__b); 10570 } 10571 10572 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 10573 vector signed char __b) { 10574 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10575 } 10576 10577 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 10578 vector unsigned char __b) { 10579 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10580 } 10581 10582 static __inline__ vector unsigned short __ATTRS_o_ai 10583 vec_vsro(vector unsigned short __a, vector signed char __b) { 10584 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10585 (vector int)__b); 10586 } 10587 10588 static __inline__ vector unsigned short __ATTRS_o_ai 10589 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 10590 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10591 (vector int)__b); 10592 } 10593 10594 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 10595 vector signed char __b) { 10596 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10597 } 10598 10599 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 10600 vector unsigned char __b) { 10601 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10602 } 10603 10604 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 10605 vector signed char __b) { 10606 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10607 } 10608 10609 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 10610 vector unsigned char __b) { 10611 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10612 } 10613 10614 static __inline__ vector unsigned int __ATTRS_o_ai 10615 vec_vsro(vector unsigned int __a, vector signed char __b) { 10616 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10617 (vector int)__b); 10618 } 10619 10620 static __inline__ vector unsigned int __ATTRS_o_ai 10621 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 10622 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10623 (vector int)__b); 10624 } 10625 10626 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 10627 vector signed char __b) { 10628 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10629 } 10630 10631 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 10632 vector unsigned char __b) { 10633 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10634 } 10635 10636 /* vec_st */ 10637 10638 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 10639 vector signed char *__c) { 10640 __builtin_altivec_stvx((vector int)__a, __b, __c); 10641 } 10642 10643 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 10644 signed char *__c) { 10645 __builtin_altivec_stvx((vector int)__a, __b, __c); 10646 } 10647 10648 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 10649 vector unsigned char *__c) { 10650 __builtin_altivec_stvx((vector int)__a, __b, __c); 10651 } 10652 10653 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 10654 unsigned char *__c) { 10655 __builtin_altivec_stvx((vector int)__a, __b, __c); 10656 } 10657 10658 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 10659 signed char *__c) { 10660 __builtin_altivec_stvx((vector int)__a, __b, __c); 10661 } 10662 10663 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 10664 unsigned char *__c) { 10665 __builtin_altivec_stvx((vector int)__a, __b, __c); 10666 } 10667 10668 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 10669 vector bool char *__c) { 10670 __builtin_altivec_stvx((vector int)__a, __b, __c); 10671 } 10672 10673 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 10674 vector short *__c) { 10675 __builtin_altivec_stvx((vector int)__a, __b, __c); 10676 } 10677 10678 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 10679 short *__c) { 10680 __builtin_altivec_stvx((vector int)__a, __b, __c); 10681 } 10682 10683 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 10684 vector unsigned short *__c) { 10685 __builtin_altivec_stvx((vector int)__a, __b, __c); 10686 } 10687 10688 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 10689 unsigned short *__c) { 10690 __builtin_altivec_stvx((vector int)__a, __b, __c); 10691 } 10692 10693 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 10694 short *__c) { 10695 __builtin_altivec_stvx((vector int)__a, __b, __c); 10696 } 10697 10698 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 10699 unsigned short *__c) { 10700 __builtin_altivec_stvx((vector int)__a, __b, __c); 10701 } 10702 10703 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 10704 vector bool short *__c) { 10705 __builtin_altivec_stvx((vector int)__a, __b, __c); 10706 } 10707 10708 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 10709 short *__c) { 10710 __builtin_altivec_stvx((vector int)__a, __b, __c); 10711 } 10712 10713 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 10714 unsigned short *__c) { 10715 __builtin_altivec_stvx((vector int)__a, __b, __c); 10716 } 10717 10718 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 10719 vector pixel *__c) { 10720 __builtin_altivec_stvx((vector int)__a, __b, __c); 10721 } 10722 10723 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, 10724 vector int *__c) { 10725 __builtin_altivec_stvx(__a, __b, __c); 10726 } 10727 10728 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) { 10729 __builtin_altivec_stvx(__a, __b, __c); 10730 } 10731 10732 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 10733 vector unsigned int *__c) { 10734 __builtin_altivec_stvx((vector int)__a, __b, __c); 10735 } 10736 10737 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 10738 unsigned int *__c) { 10739 __builtin_altivec_stvx((vector int)__a, __b, __c); 10740 } 10741 10742 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 10743 int *__c) { 10744 __builtin_altivec_stvx((vector int)__a, __b, __c); 10745 } 10746 10747 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 10748 unsigned int *__c) { 10749 __builtin_altivec_stvx((vector int)__a, __b, __c); 10750 } 10751 10752 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 10753 vector bool int *__c) { 10754 __builtin_altivec_stvx((vector int)__a, __b, __c); 10755 } 10756 10757 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 10758 vector float *__c) { 10759 __builtin_altivec_stvx((vector int)__a, __b, __c); 10760 } 10761 10762 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 10763 float *__c) { 10764 __builtin_altivec_stvx((vector int)__a, __b, __c); 10765 } 10766 10767 /* vec_stvx */ 10768 10769 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 10770 vector signed char *__c) { 10771 __builtin_altivec_stvx((vector int)__a, __b, __c); 10772 } 10773 10774 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 10775 signed char *__c) { 10776 __builtin_altivec_stvx((vector int)__a, __b, __c); 10777 } 10778 10779 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 10780 vector unsigned char *__c) { 10781 __builtin_altivec_stvx((vector int)__a, __b, __c); 10782 } 10783 10784 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 10785 unsigned char *__c) { 10786 __builtin_altivec_stvx((vector int)__a, __b, __c); 10787 } 10788 10789 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 10790 signed char *__c) { 10791 __builtin_altivec_stvx((vector int)__a, __b, __c); 10792 } 10793 10794 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 10795 unsigned char *__c) { 10796 __builtin_altivec_stvx((vector int)__a, __b, __c); 10797 } 10798 10799 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 10800 vector bool char *__c) { 10801 __builtin_altivec_stvx((vector int)__a, __b, __c); 10802 } 10803 10804 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 10805 vector short *__c) { 10806 __builtin_altivec_stvx((vector int)__a, __b, __c); 10807 } 10808 10809 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 10810 short *__c) { 10811 __builtin_altivec_stvx((vector int)__a, __b, __c); 10812 } 10813 10814 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 10815 vector unsigned short *__c) { 10816 __builtin_altivec_stvx((vector int)__a, __b, __c); 10817 } 10818 10819 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 10820 unsigned short *__c) { 10821 __builtin_altivec_stvx((vector int)__a, __b, __c); 10822 } 10823 10824 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 10825 short *__c) { 10826 __builtin_altivec_stvx((vector int)__a, __b, __c); 10827 } 10828 10829 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 10830 unsigned short *__c) { 10831 __builtin_altivec_stvx((vector int)__a, __b, __c); 10832 } 10833 10834 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 10835 vector bool short *__c) { 10836 __builtin_altivec_stvx((vector int)__a, __b, __c); 10837 } 10838 10839 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 10840 short *__c) { 10841 __builtin_altivec_stvx((vector int)__a, __b, __c); 10842 } 10843 10844 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 10845 unsigned short *__c) { 10846 __builtin_altivec_stvx((vector int)__a, __b, __c); 10847 } 10848 10849 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 10850 vector pixel *__c) { 10851 __builtin_altivec_stvx((vector int)__a, __b, __c); 10852 } 10853 10854 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 10855 vector int *__c) { 10856 __builtin_altivec_stvx(__a, __b, __c); 10857 } 10858 10859 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 10860 int *__c) { 10861 __builtin_altivec_stvx(__a, __b, __c); 10862 } 10863 10864 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 10865 vector unsigned int *__c) { 10866 __builtin_altivec_stvx((vector int)__a, __b, __c); 10867 } 10868 10869 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 10870 unsigned int *__c) { 10871 __builtin_altivec_stvx((vector int)__a, __b, __c); 10872 } 10873 10874 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 10875 int *__c) { 10876 __builtin_altivec_stvx((vector int)__a, __b, __c); 10877 } 10878 10879 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 10880 unsigned int *__c) { 10881 __builtin_altivec_stvx((vector int)__a, __b, __c); 10882 } 10883 10884 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 10885 vector bool int *__c) { 10886 __builtin_altivec_stvx((vector int)__a, __b, __c); 10887 } 10888 10889 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 10890 vector float *__c) { 10891 __builtin_altivec_stvx((vector int)__a, __b, __c); 10892 } 10893 10894 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 10895 float *__c) { 10896 __builtin_altivec_stvx((vector int)__a, __b, __c); 10897 } 10898 10899 /* vec_ste */ 10900 10901 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b, 10902 signed char *__c) { 10903 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10904 } 10905 10906 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b, 10907 unsigned char *__c) { 10908 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10909 } 10910 10911 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b, 10912 signed char *__c) { 10913 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10914 } 10915 10916 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __b, 10917 unsigned char *__c) { 10918 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10919 } 10920 10921 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, int __b, 10922 short *__c) { 10923 __builtin_altivec_stvehx(__a, __b, __c); 10924 } 10925 10926 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b, 10927 unsigned short *__c) { 10928 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10929 } 10930 10931 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 10932 short *__c) { 10933 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10934 } 10935 10936 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 10937 unsigned short *__c) { 10938 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10939 } 10940 10941 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, 10942 short *__c) { 10943 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10944 } 10945 10946 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, int __b, 10947 unsigned short *__c) { 10948 __builtin_altivec_stvehx((vector short)__a, __b, __c); 10949 } 10950 10951 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, int __b, int *__c) { 10952 __builtin_altivec_stvewx(__a, __b, __c); 10953 } 10954 10955 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b, 10956 unsigned int *__c) { 10957 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10958 } 10959 10960 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 10961 int *__c) { 10962 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10963 } 10964 10965 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 10966 unsigned int *__c) { 10967 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10968 } 10969 10970 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, int __b, 10971 float *__c) { 10972 __builtin_altivec_stvewx((vector int)__a, __b, __c); 10973 } 10974 10975 /* vec_stvebx */ 10976 10977 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b, 10978 signed char *__c) { 10979 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10980 } 10981 10982 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 10983 int __b, unsigned char *__c) { 10984 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10985 } 10986 10987 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b, 10988 signed char *__c) { 10989 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10990 } 10991 10992 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __b, 10993 unsigned char *__c) { 10994 __builtin_altivec_stvebx((vector char)__a, __b, __c); 10995 } 10996 10997 /* vec_stvehx */ 10998 10999 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, 11000 short *__c) { 11001 __builtin_altivec_stvehx(__a, __b, __c); 11002 } 11003 11004 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 11005 int __b, unsigned short *__c) { 11006 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11007 } 11008 11009 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 11010 short *__c) { 11011 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11012 } 11013 11014 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 11015 unsigned short *__c) { 11016 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11017 } 11018 11019 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, 11020 short *__c) { 11021 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11022 } 11023 11024 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __b, 11025 unsigned short *__c) { 11026 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11027 } 11028 11029 /* vec_stvewx */ 11030 11031 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, 11032 int *__c) { 11033 __builtin_altivec_stvewx(__a, __b, __c); 11034 } 11035 11036 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b, 11037 unsigned int *__c) { 11038 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11039 } 11040 11041 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 11042 int *__c) { 11043 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11044 } 11045 11046 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 11047 unsigned int *__c) { 11048 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11049 } 11050 11051 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, int __b, 11052 float *__c) { 11053 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11054 } 11055 11056 /* vec_stl */ 11057 11058 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11059 vector signed char *__c) { 11060 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11061 } 11062 11063 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11064 signed char *__c) { 11065 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11066 } 11067 11068 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11069 vector unsigned char *__c) { 11070 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11071 } 11072 11073 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11074 unsigned char *__c) { 11075 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11076 } 11077 11078 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11079 signed char *__c) { 11080 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11081 } 11082 11083 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11084 unsigned char *__c) { 11085 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11086 } 11087 11088 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11089 vector bool char *__c) { 11090 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11091 } 11092 11093 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11094 vector short *__c) { 11095 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11096 } 11097 11098 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11099 short *__c) { 11100 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11101 } 11102 11103 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11104 vector unsigned short *__c) { 11105 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11106 } 11107 11108 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11109 unsigned short *__c) { 11110 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11111 } 11112 11113 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11114 short *__c) { 11115 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11116 } 11117 11118 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11119 unsigned short *__c) { 11120 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11121 } 11122 11123 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11124 vector bool short *__c) { 11125 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11126 } 11127 11128 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11129 short *__c) { 11130 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11131 } 11132 11133 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11134 unsigned short *__c) { 11135 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11136 } 11137 11138 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11139 vector pixel *__c) { 11140 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11141 } 11142 11143 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 11144 vector int *__c) { 11145 __builtin_altivec_stvxl(__a, __b, __c); 11146 } 11147 11148 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 11149 __builtin_altivec_stvxl(__a, __b, __c); 11150 } 11151 11152 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11153 vector unsigned int *__c) { 11154 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11155 } 11156 11157 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11158 unsigned int *__c) { 11159 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11160 } 11161 11162 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11163 int *__c) { 11164 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11165 } 11166 11167 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11168 unsigned int *__c) { 11169 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11170 } 11171 11172 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11173 vector bool int *__c) { 11174 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11175 } 11176 11177 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11178 vector float *__c) { 11179 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11180 } 11181 11182 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11183 float *__c) { 11184 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11185 } 11186 11187 /* vec_stvxl */ 11188 11189 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11190 vector signed char *__c) { 11191 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11192 } 11193 11194 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11195 signed char *__c) { 11196 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11197 } 11198 11199 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11200 vector unsigned char *__c) { 11201 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11202 } 11203 11204 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11205 unsigned char *__c) { 11206 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11207 } 11208 11209 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11210 signed char *__c) { 11211 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11212 } 11213 11214 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11215 unsigned char *__c) { 11216 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11217 } 11218 11219 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11220 vector bool char *__c) { 11221 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11222 } 11223 11224 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11225 vector short *__c) { 11226 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11227 } 11228 11229 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11230 short *__c) { 11231 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11232 } 11233 11234 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11235 int __b, 11236 vector unsigned short *__c) { 11237 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11238 } 11239 11240 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11241 int __b, unsigned short *__c) { 11242 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11243 } 11244 11245 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11246 short *__c) { 11247 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11248 } 11249 11250 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11251 unsigned short *__c) { 11252 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11253 } 11254 11255 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11256 vector bool short *__c) { 11257 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11258 } 11259 11260 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11261 short *__c) { 11262 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11263 } 11264 11265 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11266 unsigned short *__c) { 11267 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11268 } 11269 11270 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11271 vector pixel *__c) { 11272 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11273 } 11274 11275 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11276 vector int *__c) { 11277 __builtin_altivec_stvxl(__a, __b, __c); 11278 } 11279 11280 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11281 int *__c) { 11282 __builtin_altivec_stvxl(__a, __b, __c); 11283 } 11284 11285 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11286 vector unsigned int *__c) { 11287 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11288 } 11289 11290 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11291 unsigned int *__c) { 11292 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11293 } 11294 11295 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11296 int *__c) { 11297 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11298 } 11299 11300 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11301 unsigned int *__c) { 11302 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11303 } 11304 11305 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11306 vector bool int *__c) { 11307 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11308 } 11309 11310 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11311 vector float *__c) { 11312 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11313 } 11314 11315 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11316 float *__c) { 11317 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11318 } 11319 11320 /* vec_sub */ 11321 11322 static __inline__ vector signed char __ATTRS_o_ai 11323 vec_sub(vector signed char __a, vector signed char __b) { 11324 return __a - __b; 11325 } 11326 11327 static __inline__ vector signed char __ATTRS_o_ai 11328 vec_sub(vector bool char __a, vector signed char __b) { 11329 return (vector signed char)__a - __b; 11330 } 11331 11332 static __inline__ vector signed char __ATTRS_o_ai 11333 vec_sub(vector signed char __a, vector bool char __b) { 11334 return __a - (vector signed char)__b; 11335 } 11336 11337 static __inline__ vector unsigned char __ATTRS_o_ai 11338 vec_sub(vector unsigned char __a, vector unsigned char __b) { 11339 return __a - __b; 11340 } 11341 11342 static __inline__ vector unsigned char __ATTRS_o_ai 11343 vec_sub(vector bool char __a, vector unsigned char __b) { 11344 return (vector unsigned char)__a - __b; 11345 } 11346 11347 static __inline__ vector unsigned char __ATTRS_o_ai 11348 vec_sub(vector unsigned char __a, vector bool char __b) { 11349 return __a - (vector unsigned char)__b; 11350 } 11351 11352 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11353 vector short __b) { 11354 return __a - __b; 11355 } 11356 11357 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 11358 vector short __b) { 11359 return (vector short)__a - __b; 11360 } 11361 11362 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11363 vector bool short __b) { 11364 return __a - (vector short)__b; 11365 } 11366 11367 static __inline__ vector unsigned short __ATTRS_o_ai 11368 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11369 return __a - __b; 11370 } 11371 11372 static __inline__ vector unsigned short __ATTRS_o_ai 11373 vec_sub(vector bool short __a, vector unsigned short __b) { 11374 return (vector unsigned short)__a - __b; 11375 } 11376 11377 static __inline__ vector unsigned short __ATTRS_o_ai 11378 vec_sub(vector unsigned short __a, vector bool short __b) { 11379 return __a - (vector unsigned short)__b; 11380 } 11381 11382 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11383 vector int __b) { 11384 return __a - __b; 11385 } 11386 11387 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11388 vector int __b) { 11389 return (vector int)__a - __b; 11390 } 11391 11392 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11393 vector bool int __b) { 11394 return __a - (vector int)__b; 11395 } 11396 11397 static __inline__ vector unsigned int __ATTRS_o_ai 11398 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11399 return __a - __b; 11400 } 11401 11402 static __inline__ vector unsigned int __ATTRS_o_ai 11403 vec_sub(vector bool int __a, vector unsigned int __b) { 11404 return (vector unsigned int)__a - __b; 11405 } 11406 11407 static __inline__ vector unsigned int __ATTRS_o_ai 11408 vec_sub(vector unsigned int __a, vector bool int __b) { 11409 return __a - (vector unsigned int)__b; 11410 } 11411 11412 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11413 static __inline__ vector signed __int128 __ATTRS_o_ai 11414 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11415 return __a - __b; 11416 } 11417 11418 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11419 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11420 return __a - __b; 11421 } 11422 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11423 11424 #ifdef __VSX__ 11425 static __inline__ vector signed long long __ATTRS_o_ai 11426 vec_sub(vector signed long long __a, vector signed long long __b) { 11427 return __a - __b; 11428 } 11429 11430 static __inline__ vector unsigned long long __ATTRS_o_ai 11431 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11432 return __a - __b; 11433 } 11434 11435 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11436 vector double __b) { 11437 return __a - __b; 11438 } 11439 #endif 11440 11441 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11442 vector float __b) { 11443 return __a - __b; 11444 } 11445 11446 /* vec_vsububm */ 11447 11448 #define __builtin_altivec_vsububm vec_vsububm 11449 11450 static __inline__ vector signed char __ATTRS_o_ai 11451 vec_vsububm(vector signed char __a, vector signed char __b) { 11452 return __a - __b; 11453 } 11454 11455 static __inline__ vector signed char __ATTRS_o_ai 11456 vec_vsububm(vector bool char __a, vector signed char __b) { 11457 return (vector signed char)__a - __b; 11458 } 11459 11460 static __inline__ vector signed char __ATTRS_o_ai 11461 vec_vsububm(vector signed char __a, vector bool char __b) { 11462 return __a - (vector signed char)__b; 11463 } 11464 11465 static __inline__ vector unsigned char __ATTRS_o_ai 11466 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 11467 return __a - __b; 11468 } 11469 11470 static __inline__ vector unsigned char __ATTRS_o_ai 11471 vec_vsububm(vector bool char __a, vector unsigned char __b) { 11472 return (vector unsigned char)__a - __b; 11473 } 11474 11475 static __inline__ vector unsigned char __ATTRS_o_ai 11476 vec_vsububm(vector unsigned char __a, vector bool char __b) { 11477 return __a - (vector unsigned char)__b; 11478 } 11479 11480 /* vec_vsubuhm */ 11481 11482 #define __builtin_altivec_vsubuhm vec_vsubuhm 11483 11484 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11485 vector short __b) { 11486 return __a - __b; 11487 } 11488 11489 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 11490 vector short __b) { 11491 return (vector short)__a - __b; 11492 } 11493 11494 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11495 vector bool short __b) { 11496 return __a - (vector short)__b; 11497 } 11498 11499 static __inline__ vector unsigned short __ATTRS_o_ai 11500 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 11501 return __a - __b; 11502 } 11503 11504 static __inline__ vector unsigned short __ATTRS_o_ai 11505 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 11506 return (vector unsigned short)__a - __b; 11507 } 11508 11509 static __inline__ vector unsigned short __ATTRS_o_ai 11510 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 11511 return __a - (vector unsigned short)__b; 11512 } 11513 11514 /* vec_vsubuwm */ 11515 11516 #define __builtin_altivec_vsubuwm vec_vsubuwm 11517 11518 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11519 vector int __b) { 11520 return __a - __b; 11521 } 11522 11523 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 11524 vector int __b) { 11525 return (vector int)__a - __b; 11526 } 11527 11528 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11529 vector bool int __b) { 11530 return __a - (vector int)__b; 11531 } 11532 11533 static __inline__ vector unsigned int __ATTRS_o_ai 11534 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 11535 return __a - __b; 11536 } 11537 11538 static __inline__ vector unsigned int __ATTRS_o_ai 11539 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 11540 return (vector unsigned int)__a - __b; 11541 } 11542 11543 static __inline__ vector unsigned int __ATTRS_o_ai 11544 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 11545 return __a - (vector unsigned int)__b; 11546 } 11547 11548 /* vec_vsubfp */ 11549 11550 #define __builtin_altivec_vsubfp vec_vsubfp 11551 11552 static __inline__ vector float __attribute__((__always_inline__)) 11553 vec_vsubfp(vector float __a, vector float __b) { 11554 return __a - __b; 11555 } 11556 11557 /* vec_subc */ 11558 11559 static __inline__ vector signed int __ATTRS_o_ai 11560 vec_subc(vector signed int __a, vector signed int __b) { 11561 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 11562 (vector unsigned int) __b); 11563 } 11564 11565 static __inline__ vector unsigned int __ATTRS_o_ai 11566 vec_subc(vector unsigned int __a, vector unsigned int __b) { 11567 return __builtin_altivec_vsubcuw(__a, __b); 11568 } 11569 11570 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11571 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11572 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11573 return __builtin_altivec_vsubcuq(__a, __b); 11574 } 11575 11576 static __inline__ vector signed __int128 __ATTRS_o_ai 11577 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 11578 return __builtin_altivec_vsubcuq(__a, __b); 11579 } 11580 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11581 11582 /* vec_vsubcuw */ 11583 11584 static __inline__ vector unsigned int __attribute__((__always_inline__)) 11585 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 11586 return __builtin_altivec_vsubcuw(__a, __b); 11587 } 11588 11589 /* vec_subs */ 11590 11591 static __inline__ vector signed char __ATTRS_o_ai 11592 vec_subs(vector signed char __a, vector signed char __b) { 11593 return __builtin_altivec_vsubsbs(__a, __b); 11594 } 11595 11596 static __inline__ vector signed char __ATTRS_o_ai 11597 vec_subs(vector bool char __a, vector signed char __b) { 11598 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 11599 } 11600 11601 static __inline__ vector signed char __ATTRS_o_ai 11602 vec_subs(vector signed char __a, vector bool char __b) { 11603 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 11604 } 11605 11606 static __inline__ vector unsigned char __ATTRS_o_ai 11607 vec_subs(vector unsigned char __a, vector unsigned char __b) { 11608 return __builtin_altivec_vsububs(__a, __b); 11609 } 11610 11611 static __inline__ vector unsigned char __ATTRS_o_ai 11612 vec_subs(vector bool char __a, vector unsigned char __b) { 11613 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 11614 } 11615 11616 static __inline__ vector unsigned char __ATTRS_o_ai 11617 vec_subs(vector unsigned char __a, vector bool char __b) { 11618 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 11619 } 11620 11621 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 11622 vector short __b) { 11623 return __builtin_altivec_vsubshs(__a, __b); 11624 } 11625 11626 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 11627 vector short __b) { 11628 return __builtin_altivec_vsubshs((vector short)__a, __b); 11629 } 11630 11631 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 11632 vector bool short __b) { 11633 return __builtin_altivec_vsubshs(__a, (vector short)__b); 11634 } 11635 11636 static __inline__ vector unsigned short __ATTRS_o_ai 11637 vec_subs(vector unsigned short __a, vector unsigned short __b) { 11638 return __builtin_altivec_vsubuhs(__a, __b); 11639 } 11640 11641 static __inline__ vector unsigned short __ATTRS_o_ai 11642 vec_subs(vector bool short __a, vector unsigned short __b) { 11643 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 11644 } 11645 11646 static __inline__ vector unsigned short __ATTRS_o_ai 11647 vec_subs(vector unsigned short __a, vector bool short __b) { 11648 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 11649 } 11650 11651 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 11652 vector int __b) { 11653 return __builtin_altivec_vsubsws(__a, __b); 11654 } 11655 11656 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 11657 vector int __b) { 11658 return __builtin_altivec_vsubsws((vector int)__a, __b); 11659 } 11660 11661 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 11662 vector bool int __b) { 11663 return __builtin_altivec_vsubsws(__a, (vector int)__b); 11664 } 11665 11666 static __inline__ vector unsigned int __ATTRS_o_ai 11667 vec_subs(vector unsigned int __a, vector unsigned int __b) { 11668 return __builtin_altivec_vsubuws(__a, __b); 11669 } 11670 11671 static __inline__ vector unsigned int __ATTRS_o_ai 11672 vec_subs(vector bool int __a, vector unsigned int __b) { 11673 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 11674 } 11675 11676 static __inline__ vector unsigned int __ATTRS_o_ai 11677 vec_subs(vector unsigned int __a, vector bool int __b) { 11678 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 11679 } 11680 11681 /* vec_vsubsbs */ 11682 11683 static __inline__ vector signed char __ATTRS_o_ai 11684 vec_vsubsbs(vector signed char __a, vector signed char __b) { 11685 return __builtin_altivec_vsubsbs(__a, __b); 11686 } 11687 11688 static __inline__ vector signed char __ATTRS_o_ai 11689 vec_vsubsbs(vector bool char __a, vector signed char __b) { 11690 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 11691 } 11692 11693 static __inline__ vector signed char __ATTRS_o_ai 11694 vec_vsubsbs(vector signed char __a, vector bool char __b) { 11695 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 11696 } 11697 11698 /* vec_vsububs */ 11699 11700 static __inline__ vector unsigned char __ATTRS_o_ai 11701 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 11702 return __builtin_altivec_vsububs(__a, __b); 11703 } 11704 11705 static __inline__ vector unsigned char __ATTRS_o_ai 11706 vec_vsububs(vector bool char __a, vector unsigned char __b) { 11707 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 11708 } 11709 11710 static __inline__ vector unsigned char __ATTRS_o_ai 11711 vec_vsububs(vector unsigned char __a, vector bool char __b) { 11712 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 11713 } 11714 11715 /* vec_vsubshs */ 11716 11717 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 11718 vector short __b) { 11719 return __builtin_altivec_vsubshs(__a, __b); 11720 } 11721 11722 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 11723 vector short __b) { 11724 return __builtin_altivec_vsubshs((vector short)__a, __b); 11725 } 11726 11727 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 11728 vector bool short __b) { 11729 return __builtin_altivec_vsubshs(__a, (vector short)__b); 11730 } 11731 11732 /* vec_vsubuhs */ 11733 11734 static __inline__ vector unsigned short __ATTRS_o_ai 11735 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 11736 return __builtin_altivec_vsubuhs(__a, __b); 11737 } 11738 11739 static __inline__ vector unsigned short __ATTRS_o_ai 11740 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 11741 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 11742 } 11743 11744 static __inline__ vector unsigned short __ATTRS_o_ai 11745 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 11746 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 11747 } 11748 11749 /* vec_vsubsws */ 11750 11751 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 11752 vector int __b) { 11753 return __builtin_altivec_vsubsws(__a, __b); 11754 } 11755 11756 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 11757 vector int __b) { 11758 return __builtin_altivec_vsubsws((vector int)__a, __b); 11759 } 11760 11761 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 11762 vector bool int __b) { 11763 return __builtin_altivec_vsubsws(__a, (vector int)__b); 11764 } 11765 11766 /* vec_vsubuws */ 11767 11768 static __inline__ vector unsigned int __ATTRS_o_ai 11769 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 11770 return __builtin_altivec_vsubuws(__a, __b); 11771 } 11772 11773 static __inline__ vector unsigned int __ATTRS_o_ai 11774 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 11775 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 11776 } 11777 11778 static __inline__ vector unsigned int __ATTRS_o_ai 11779 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 11780 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 11781 } 11782 11783 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11784 /* vec_vsubuqm */ 11785 11786 static __inline__ vector signed __int128 __ATTRS_o_ai 11787 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 11788 return __a - __b; 11789 } 11790 11791 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11792 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11793 return __a - __b; 11794 } 11795 11796 /* vec_vsubeuqm */ 11797 11798 11799 static __inline__ vector signed __int128 __ATTRS_o_ai 11800 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 11801 vector signed __int128 __c) { 11802 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11803 } 11804 11805 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11806 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 11807 vector unsigned __int128 __c) { 11808 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11809 } 11810 11811 static __inline__ vector signed __int128 __ATTRS_o_ai 11812 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 11813 vector signed __int128 __c) { 11814 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11815 } 11816 11817 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11818 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 11819 vector unsigned __int128 __c) { 11820 return __builtin_altivec_vsubeuqm(__a, __b, __c); 11821 } 11822 11823 /* vec_vsubcuq */ 11824 11825 static __inline__ vector signed __int128 __ATTRS_o_ai 11826 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 11827 return __builtin_altivec_vsubcuq(__a, __b); 11828 } 11829 11830 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11831 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11832 return __builtin_altivec_vsubcuq(__a, __b); 11833 } 11834 11835 /* vec_vsubecuq */ 11836 11837 static __inline__ vector signed __int128 __ATTRS_o_ai 11838 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 11839 vector signed __int128 __c) { 11840 return __builtin_altivec_vsubecuq(__a, __b, __c); 11841 } 11842 11843 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11844 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 11845 vector unsigned __int128 __c) { 11846 return __builtin_altivec_vsubecuq(__a, __b, __c); 11847 } 11848 11849 static __inline__ vector signed int __ATTRS_o_ai 11850 vec_subec(vector signed int __a, vector signed int __b, 11851 vector signed int __c) { 11852 return vec_addec(__a, ~__b, __c); 11853 } 11854 11855 static __inline__ vector unsigned int __ATTRS_o_ai 11856 vec_subec(vector unsigned int __a, vector unsigned int __b, 11857 vector unsigned int __c) { 11858 return vec_addec(__a, ~__b, __c); 11859 } 11860 11861 static __inline__ vector signed __int128 __ATTRS_o_ai 11862 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 11863 vector signed __int128 __c) { 11864 return __builtin_altivec_vsubecuq(__a, __b, __c); 11865 } 11866 11867 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11868 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 11869 vector unsigned __int128 __c) { 11870 return __builtin_altivec_vsubecuq(__a, __b, __c); 11871 } 11872 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 11873 11874 static __inline__ vector signed int __ATTRS_o_ai 11875 vec_sube(vector signed int __a, vector signed int __b, 11876 vector signed int __c) { 11877 vector signed int __mask = {1, 1, 1, 1}; 11878 vector signed int __carry = __c & __mask; 11879 return vec_adde(__a, ~__b, __carry); 11880 } 11881 11882 static __inline__ vector unsigned int __ATTRS_o_ai 11883 vec_sube(vector unsigned int __a, vector unsigned int __b, 11884 vector unsigned int __c) { 11885 vector unsigned int __mask = {1, 1, 1, 1}; 11886 vector unsigned int __carry = __c & __mask; 11887 return vec_adde(__a, ~__b, __carry); 11888 } 11889 /* vec_sum4s */ 11890 11891 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 11892 vector int __b) { 11893 return __builtin_altivec_vsum4sbs(__a, __b); 11894 } 11895 11896 static __inline__ vector unsigned int __ATTRS_o_ai 11897 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 11898 return __builtin_altivec_vsum4ubs(__a, __b); 11899 } 11900 11901 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 11902 vector int __b) { 11903 return __builtin_altivec_vsum4shs(__a, __b); 11904 } 11905 11906 /* vec_vsum4sbs */ 11907 11908 static __inline__ vector int __attribute__((__always_inline__)) 11909 vec_vsum4sbs(vector signed char __a, vector int __b) { 11910 return __builtin_altivec_vsum4sbs(__a, __b); 11911 } 11912 11913 /* vec_vsum4ubs */ 11914 11915 static __inline__ vector unsigned int __attribute__((__always_inline__)) 11916 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 11917 return __builtin_altivec_vsum4ubs(__a, __b); 11918 } 11919 11920 /* vec_vsum4shs */ 11921 11922 static __inline__ vector int __attribute__((__always_inline__)) 11923 vec_vsum4shs(vector signed short __a, vector int __b) { 11924 return __builtin_altivec_vsum4shs(__a, __b); 11925 } 11926 11927 /* vec_sum2s */ 11928 11929 /* The vsum2sws instruction has a big-endian bias, so that the second 11930 input vector and the result always reference big-endian elements 11931 1 and 3 (little-endian element 0 and 2). For ease of porting the 11932 programmer wants elements 1 and 3 in both cases, so for little 11933 endian we must perform some permutes. */ 11934 11935 static __inline__ vector signed int __attribute__((__always_inline__)) 11936 vec_sum2s(vector int __a, vector int __b) { 11937 #ifdef __LITTLE_ENDIAN__ 11938 vector int __c = (vector signed int)vec_perm( 11939 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11940 8, 9, 10, 11)); 11941 __c = __builtin_altivec_vsum2sws(__a, __c); 11942 return (vector signed int)vec_perm( 11943 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11944 8, 9, 10, 11)); 11945 #else 11946 return __builtin_altivec_vsum2sws(__a, __b); 11947 #endif 11948 } 11949 11950 /* vec_vsum2sws */ 11951 11952 static __inline__ vector signed int __attribute__((__always_inline__)) 11953 vec_vsum2sws(vector int __a, vector int __b) { 11954 #ifdef __LITTLE_ENDIAN__ 11955 vector int __c = (vector signed int)vec_perm( 11956 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11957 8, 9, 10, 11)); 11958 __c = __builtin_altivec_vsum2sws(__a, __c); 11959 return (vector signed int)vec_perm( 11960 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 11961 8, 9, 10, 11)); 11962 #else 11963 return __builtin_altivec_vsum2sws(__a, __b); 11964 #endif 11965 } 11966 11967 /* vec_sums */ 11968 11969 /* The vsumsws instruction has a big-endian bias, so that the second 11970 input vector and the result always reference big-endian element 3 11971 (little-endian element 0). For ease of porting the programmer 11972 wants element 3 in both cases, so for little endian we must perform 11973 some permutes. */ 11974 11975 static __inline__ vector signed int __attribute__((__always_inline__)) 11976 vec_sums(vector signed int __a, vector signed int __b) { 11977 #ifdef __LITTLE_ENDIAN__ 11978 __b = (vector signed int)vec_splat(__b, 3); 11979 __b = __builtin_altivec_vsumsws(__a, __b); 11980 return (vector signed int)(0, 0, 0, __b[0]); 11981 #else 11982 return __builtin_altivec_vsumsws(__a, __b); 11983 #endif 11984 } 11985 11986 /* vec_vsumsws */ 11987 11988 static __inline__ vector signed int __attribute__((__always_inline__)) 11989 vec_vsumsws(vector signed int __a, vector signed int __b) { 11990 #ifdef __LITTLE_ENDIAN__ 11991 __b = (vector signed int)vec_splat(__b, 3); 11992 __b = __builtin_altivec_vsumsws(__a, __b); 11993 return (vector signed int)(0, 0, 0, __b[0]); 11994 #else 11995 return __builtin_altivec_vsumsws(__a, __b); 11996 #endif 11997 } 11998 11999 /* vec_trunc */ 12000 12001 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 12002 #ifdef __VSX__ 12003 return __builtin_vsx_xvrspiz(__a); 12004 #else 12005 return __builtin_altivec_vrfiz(__a); 12006 #endif 12007 } 12008 12009 #ifdef __VSX__ 12010 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 12011 return __builtin_vsx_xvrdpiz(__a); 12012 } 12013 #endif 12014 12015 /* vec_vrfiz */ 12016 12017 static __inline__ vector float __attribute__((__always_inline__)) 12018 vec_vrfiz(vector float __a) { 12019 return __builtin_altivec_vrfiz(__a); 12020 } 12021 12022 /* vec_unpackh */ 12023 12024 /* The vector unpack instructions all have a big-endian bias, so for 12025 little endian we must reverse the meanings of "high" and "low." */ 12026 12027 static __inline__ vector short __ATTRS_o_ai 12028 vec_unpackh(vector signed char __a) { 12029 #ifdef __LITTLE_ENDIAN__ 12030 return __builtin_altivec_vupklsb((vector char)__a); 12031 #else 12032 return __builtin_altivec_vupkhsb((vector char)__a); 12033 #endif 12034 } 12035 12036 static __inline__ vector bool short __ATTRS_o_ai 12037 vec_unpackh(vector bool char __a) { 12038 #ifdef __LITTLE_ENDIAN__ 12039 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12040 #else 12041 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12042 #endif 12043 } 12044 12045 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 12046 #ifdef __LITTLE_ENDIAN__ 12047 return __builtin_altivec_vupklsh(__a); 12048 #else 12049 return __builtin_altivec_vupkhsh(__a); 12050 #endif 12051 } 12052 12053 static __inline__ vector bool int __ATTRS_o_ai 12054 vec_unpackh(vector bool short __a) { 12055 #ifdef __LITTLE_ENDIAN__ 12056 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12057 #else 12058 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12059 #endif 12060 } 12061 12062 static __inline__ vector unsigned int __ATTRS_o_ai 12063 vec_unpackh(vector pixel __a) { 12064 #ifdef __LITTLE_ENDIAN__ 12065 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12066 #else 12067 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12068 #endif 12069 } 12070 12071 #ifdef __POWER8_VECTOR__ 12072 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 12073 #ifdef __LITTLE_ENDIAN__ 12074 return __builtin_altivec_vupklsw(__a); 12075 #else 12076 return __builtin_altivec_vupkhsw(__a); 12077 #endif 12078 } 12079 12080 static __inline__ vector bool long long __ATTRS_o_ai 12081 vec_unpackh(vector bool int __a) { 12082 #ifdef __LITTLE_ENDIAN__ 12083 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12084 #else 12085 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12086 #endif 12087 } 12088 12089 static __inline__ vector double __ATTRS_o_ai 12090 vec_unpackh(vector float __a) { 12091 return (vector double)(__a[0], __a[1]); 12092 } 12093 #endif 12094 12095 /* vec_vupkhsb */ 12096 12097 static __inline__ vector short __ATTRS_o_ai 12098 vec_vupkhsb(vector signed char __a) { 12099 #ifdef __LITTLE_ENDIAN__ 12100 return __builtin_altivec_vupklsb((vector char)__a); 12101 #else 12102 return __builtin_altivec_vupkhsb((vector char)__a); 12103 #endif 12104 } 12105 12106 static __inline__ vector bool short __ATTRS_o_ai 12107 vec_vupkhsb(vector bool char __a) { 12108 #ifdef __LITTLE_ENDIAN__ 12109 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12110 #else 12111 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12112 #endif 12113 } 12114 12115 /* vec_vupkhsh */ 12116 12117 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 12118 #ifdef __LITTLE_ENDIAN__ 12119 return __builtin_altivec_vupklsh(__a); 12120 #else 12121 return __builtin_altivec_vupkhsh(__a); 12122 #endif 12123 } 12124 12125 static __inline__ vector bool int __ATTRS_o_ai 12126 vec_vupkhsh(vector bool short __a) { 12127 #ifdef __LITTLE_ENDIAN__ 12128 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12129 #else 12130 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12131 #endif 12132 } 12133 12134 static __inline__ vector unsigned int __ATTRS_o_ai 12135 vec_vupkhsh(vector pixel __a) { 12136 #ifdef __LITTLE_ENDIAN__ 12137 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12138 #else 12139 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12140 #endif 12141 } 12142 12143 /* vec_vupkhsw */ 12144 12145 #ifdef __POWER8_VECTOR__ 12146 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 12147 #ifdef __LITTLE_ENDIAN__ 12148 return __builtin_altivec_vupklsw(__a); 12149 #else 12150 return __builtin_altivec_vupkhsw(__a); 12151 #endif 12152 } 12153 12154 static __inline__ vector bool long long __ATTRS_o_ai 12155 vec_vupkhsw(vector bool int __a) { 12156 #ifdef __LITTLE_ENDIAN__ 12157 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12158 #else 12159 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12160 #endif 12161 } 12162 #endif 12163 12164 /* vec_unpackl */ 12165 12166 static __inline__ vector short __ATTRS_o_ai 12167 vec_unpackl(vector signed char __a) { 12168 #ifdef __LITTLE_ENDIAN__ 12169 return __builtin_altivec_vupkhsb((vector char)__a); 12170 #else 12171 return __builtin_altivec_vupklsb((vector char)__a); 12172 #endif 12173 } 12174 12175 static __inline__ vector bool short __ATTRS_o_ai 12176 vec_unpackl(vector bool char __a) { 12177 #ifdef __LITTLE_ENDIAN__ 12178 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12179 #else 12180 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12181 #endif 12182 } 12183 12184 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 12185 #ifdef __LITTLE_ENDIAN__ 12186 return __builtin_altivec_vupkhsh(__a); 12187 #else 12188 return __builtin_altivec_vupklsh(__a); 12189 #endif 12190 } 12191 12192 static __inline__ vector bool int __ATTRS_o_ai 12193 vec_unpackl(vector bool short __a) { 12194 #ifdef __LITTLE_ENDIAN__ 12195 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12196 #else 12197 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12198 #endif 12199 } 12200 12201 static __inline__ vector unsigned int __ATTRS_o_ai 12202 vec_unpackl(vector pixel __a) { 12203 #ifdef __LITTLE_ENDIAN__ 12204 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12205 #else 12206 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12207 #endif 12208 } 12209 12210 #ifdef __POWER8_VECTOR__ 12211 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 12212 #ifdef __LITTLE_ENDIAN__ 12213 return __builtin_altivec_vupkhsw(__a); 12214 #else 12215 return __builtin_altivec_vupklsw(__a); 12216 #endif 12217 } 12218 12219 static __inline__ vector bool long long __ATTRS_o_ai 12220 vec_unpackl(vector bool int __a) { 12221 #ifdef __LITTLE_ENDIAN__ 12222 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12223 #else 12224 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12225 #endif 12226 } 12227 12228 static __inline__ vector double __ATTRS_o_ai 12229 vec_unpackl(vector float __a) { 12230 return (vector double)(__a[2], __a[3]); 12231 } 12232 #endif 12233 12234 /* vec_vupklsb */ 12235 12236 static __inline__ vector short __ATTRS_o_ai 12237 vec_vupklsb(vector signed char __a) { 12238 #ifdef __LITTLE_ENDIAN__ 12239 return __builtin_altivec_vupkhsb((vector char)__a); 12240 #else 12241 return __builtin_altivec_vupklsb((vector char)__a); 12242 #endif 12243 } 12244 12245 static __inline__ vector bool short __ATTRS_o_ai 12246 vec_vupklsb(vector bool char __a) { 12247 #ifdef __LITTLE_ENDIAN__ 12248 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12249 #else 12250 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12251 #endif 12252 } 12253 12254 /* vec_vupklsh */ 12255 12256 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 12257 #ifdef __LITTLE_ENDIAN__ 12258 return __builtin_altivec_vupkhsh(__a); 12259 #else 12260 return __builtin_altivec_vupklsh(__a); 12261 #endif 12262 } 12263 12264 static __inline__ vector bool int __ATTRS_o_ai 12265 vec_vupklsh(vector bool short __a) { 12266 #ifdef __LITTLE_ENDIAN__ 12267 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12268 #else 12269 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12270 #endif 12271 } 12272 12273 static __inline__ vector unsigned int __ATTRS_o_ai 12274 vec_vupklsh(vector pixel __a) { 12275 #ifdef __LITTLE_ENDIAN__ 12276 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12277 #else 12278 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12279 #endif 12280 } 12281 12282 /* vec_vupklsw */ 12283 12284 #ifdef __POWER8_VECTOR__ 12285 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 12286 #ifdef __LITTLE_ENDIAN__ 12287 return __builtin_altivec_vupkhsw(__a); 12288 #else 12289 return __builtin_altivec_vupklsw(__a); 12290 #endif 12291 } 12292 12293 static __inline__ vector bool long long __ATTRS_o_ai 12294 vec_vupklsw(vector bool int __a) { 12295 #ifdef __LITTLE_ENDIAN__ 12296 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12297 #else 12298 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12299 #endif 12300 } 12301 #endif 12302 12303 /* vec_vsx_ld */ 12304 12305 #ifdef __VSX__ 12306 12307 static __inline__ vector bool int __ATTRS_o_ai 12308 vec_vsx_ld(int __a, const vector bool int *__b) { 12309 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 12310 } 12311 12312 static __inline__ vector signed int __ATTRS_o_ai 12313 vec_vsx_ld(int __a, const vector signed int *__b) { 12314 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12315 } 12316 12317 static __inline__ vector signed int __ATTRS_o_ai 12318 vec_vsx_ld(int __a, const signed int *__b) { 12319 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12320 } 12321 12322 static __inline__ vector unsigned int __ATTRS_o_ai 12323 vec_vsx_ld(int __a, const vector unsigned int *__b) { 12324 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12325 } 12326 12327 static __inline__ vector unsigned int __ATTRS_o_ai 12328 vec_vsx_ld(int __a, const unsigned int *__b) { 12329 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12330 } 12331 12332 static __inline__ vector float __ATTRS_o_ai 12333 vec_vsx_ld(int __a, const vector float *__b) { 12334 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12335 } 12336 12337 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 12338 const float *__b) { 12339 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12340 } 12341 12342 static __inline__ vector signed long long __ATTRS_o_ai 12343 vec_vsx_ld(int __a, const vector signed long long *__b) { 12344 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 12345 } 12346 12347 static __inline__ vector unsigned long long __ATTRS_o_ai 12348 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 12349 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 12350 } 12351 12352 static __inline__ vector double __ATTRS_o_ai 12353 vec_vsx_ld(int __a, const vector double *__b) { 12354 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12355 } 12356 12357 static __inline__ vector double __ATTRS_o_ai 12358 vec_vsx_ld(int __a, const double *__b) { 12359 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12360 } 12361 12362 static __inline__ vector bool short __ATTRS_o_ai 12363 vec_vsx_ld(int __a, const vector bool short *__b) { 12364 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12365 } 12366 12367 static __inline__ vector signed short __ATTRS_o_ai 12368 vec_vsx_ld(int __a, const vector signed short *__b) { 12369 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12370 } 12371 12372 static __inline__ vector signed short __ATTRS_o_ai 12373 vec_vsx_ld(int __a, const signed short *__b) { 12374 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12375 } 12376 12377 static __inline__ vector unsigned short __ATTRS_o_ai 12378 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12379 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12380 } 12381 12382 static __inline__ vector unsigned short __ATTRS_o_ai 12383 vec_vsx_ld(int __a, const unsigned short *__b) { 12384 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12385 } 12386 12387 static __inline__ vector bool char __ATTRS_o_ai 12388 vec_vsx_ld(int __a, const vector bool char *__b) { 12389 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12390 } 12391 12392 static __inline__ vector signed char __ATTRS_o_ai 12393 vec_vsx_ld(int __a, const vector signed char *__b) { 12394 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12395 } 12396 12397 static __inline__ vector signed char __ATTRS_o_ai 12398 vec_vsx_ld(int __a, const signed char *__b) { 12399 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12400 } 12401 12402 static __inline__ vector unsigned char __ATTRS_o_ai 12403 vec_vsx_ld(int __a, const vector unsigned char *__b) { 12404 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12405 } 12406 12407 static __inline__ vector unsigned char __ATTRS_o_ai 12408 vec_vsx_ld(int __a, const unsigned char *__b) { 12409 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12410 } 12411 12412 #endif 12413 12414 /* vec_vsx_st */ 12415 12416 #ifdef __VSX__ 12417 12418 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12419 vector bool int *__c) { 12420 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12421 } 12422 12423 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12424 signed int *__c) { 12425 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12426 } 12427 12428 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12429 unsigned int *__c) { 12430 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12431 } 12432 12433 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12434 vector signed int *__c) { 12435 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12436 } 12437 12438 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12439 signed int *__c) { 12440 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12441 } 12442 12443 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12444 vector unsigned int *__c) { 12445 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12446 } 12447 12448 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12449 unsigned int *__c) { 12450 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12451 } 12452 12453 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12454 vector float *__c) { 12455 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12456 } 12457 12458 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12459 float *__c) { 12460 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12461 } 12462 12463 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 12464 int __b, 12465 vector signed long long *__c) { 12466 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12467 } 12468 12469 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 12470 int __b, 12471 vector unsigned long long *__c) { 12472 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12473 } 12474 12475 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12476 vector double *__c) { 12477 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12478 } 12479 12480 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12481 double *__c) { 12482 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12483 } 12484 12485 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12486 vector bool short *__c) { 12487 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12488 } 12489 12490 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12491 signed short *__c) { 12492 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12493 } 12494 12495 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12496 unsigned short *__c) { 12497 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12498 } 12499 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 12500 vector signed short *__c) { 12501 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12502 } 12503 12504 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 12505 signed short *__c) { 12506 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12507 } 12508 12509 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 12510 int __b, 12511 vector unsigned short *__c) { 12512 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12513 } 12514 12515 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 12516 int __b, unsigned short *__c) { 12517 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12518 } 12519 12520 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 12521 vector bool char *__c) { 12522 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12523 } 12524 12525 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 12526 signed char *__c) { 12527 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12528 } 12529 12530 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 12531 unsigned char *__c) { 12532 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12533 } 12534 12535 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 12536 vector signed char *__c) { 12537 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12538 } 12539 12540 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 12541 signed char *__c) { 12542 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12543 } 12544 12545 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 12546 int __b, 12547 vector unsigned char *__c) { 12548 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12549 } 12550 12551 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 12552 int __b, unsigned char *__c) { 12553 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12554 } 12555 12556 #endif 12557 12558 #ifdef __VSX__ 12559 #define vec_xxpermdi __builtin_vsx_xxpermdi 12560 #define vec_xxsldwi __builtin_vsx_xxsldwi 12561 #endif 12562 12563 /* vec_xor */ 12564 12565 #define __builtin_altivec_vxor vec_xor 12566 12567 static __inline__ vector signed char __ATTRS_o_ai 12568 vec_xor(vector signed char __a, vector signed char __b) { 12569 return __a ^ __b; 12570 } 12571 12572 static __inline__ vector signed char __ATTRS_o_ai 12573 vec_xor(vector bool char __a, vector signed char __b) { 12574 return (vector signed char)__a ^ __b; 12575 } 12576 12577 static __inline__ vector signed char __ATTRS_o_ai 12578 vec_xor(vector signed char __a, vector bool char __b) { 12579 return __a ^ (vector signed char)__b; 12580 } 12581 12582 static __inline__ vector unsigned char __ATTRS_o_ai 12583 vec_xor(vector unsigned char __a, vector unsigned char __b) { 12584 return __a ^ __b; 12585 } 12586 12587 static __inline__ vector unsigned char __ATTRS_o_ai 12588 vec_xor(vector bool char __a, vector unsigned char __b) { 12589 return (vector unsigned char)__a ^ __b; 12590 } 12591 12592 static __inline__ vector unsigned char __ATTRS_o_ai 12593 vec_xor(vector unsigned char __a, vector bool char __b) { 12594 return __a ^ (vector unsigned char)__b; 12595 } 12596 12597 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 12598 vector bool char __b) { 12599 return __a ^ __b; 12600 } 12601 12602 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 12603 vector short __b) { 12604 return __a ^ __b; 12605 } 12606 12607 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 12608 vector short __b) { 12609 return (vector short)__a ^ __b; 12610 } 12611 12612 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 12613 vector bool short __b) { 12614 return __a ^ (vector short)__b; 12615 } 12616 12617 static __inline__ vector unsigned short __ATTRS_o_ai 12618 vec_xor(vector unsigned short __a, vector unsigned short __b) { 12619 return __a ^ __b; 12620 } 12621 12622 static __inline__ vector unsigned short __ATTRS_o_ai 12623 vec_xor(vector bool short __a, vector unsigned short __b) { 12624 return (vector unsigned short)__a ^ __b; 12625 } 12626 12627 static __inline__ vector unsigned short __ATTRS_o_ai 12628 vec_xor(vector unsigned short __a, vector bool short __b) { 12629 return __a ^ (vector unsigned short)__b; 12630 } 12631 12632 static __inline__ vector bool short __ATTRS_o_ai 12633 vec_xor(vector bool short __a, vector bool short __b) { 12634 return __a ^ __b; 12635 } 12636 12637 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 12638 vector int __b) { 12639 return __a ^ __b; 12640 } 12641 12642 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 12643 vector int __b) { 12644 return (vector int)__a ^ __b; 12645 } 12646 12647 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 12648 vector bool int __b) { 12649 return __a ^ (vector int)__b; 12650 } 12651 12652 static __inline__ vector unsigned int __ATTRS_o_ai 12653 vec_xor(vector unsigned int __a, vector unsigned int __b) { 12654 return __a ^ __b; 12655 } 12656 12657 static __inline__ vector unsigned int __ATTRS_o_ai 12658 vec_xor(vector bool int __a, vector unsigned int __b) { 12659 return (vector unsigned int)__a ^ __b; 12660 } 12661 12662 static __inline__ vector unsigned int __ATTRS_o_ai 12663 vec_xor(vector unsigned int __a, vector bool int __b) { 12664 return __a ^ (vector unsigned int)__b; 12665 } 12666 12667 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 12668 vector bool int __b) { 12669 return __a ^ __b; 12670 } 12671 12672 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 12673 vector float __b) { 12674 vector unsigned int __res = 12675 (vector unsigned int)__a ^ (vector unsigned int)__b; 12676 return (vector float)__res; 12677 } 12678 12679 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 12680 vector float __b) { 12681 vector unsigned int __res = 12682 (vector unsigned int)__a ^ (vector unsigned int)__b; 12683 return (vector float)__res; 12684 } 12685 12686 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 12687 vector bool int __b) { 12688 vector unsigned int __res = 12689 (vector unsigned int)__a ^ (vector unsigned int)__b; 12690 return (vector float)__res; 12691 } 12692 12693 #ifdef __VSX__ 12694 static __inline__ vector signed long long __ATTRS_o_ai 12695 vec_xor(vector signed long long __a, vector signed long long __b) { 12696 return __a ^ __b; 12697 } 12698 12699 static __inline__ vector signed long long __ATTRS_o_ai 12700 vec_xor(vector bool long long __a, vector signed long long __b) { 12701 return (vector signed long long)__a ^ __b; 12702 } 12703 12704 static __inline__ vector signed long long __ATTRS_o_ai 12705 vec_xor(vector signed long long __a, vector bool long long __b) { 12706 return __a ^ (vector signed long long)__b; 12707 } 12708 12709 static __inline__ vector unsigned long long __ATTRS_o_ai 12710 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 12711 return __a ^ __b; 12712 } 12713 12714 static __inline__ vector unsigned long long __ATTRS_o_ai 12715 vec_xor(vector bool long long __a, vector unsigned long long __b) { 12716 return (vector unsigned long long)__a ^ __b; 12717 } 12718 12719 static __inline__ vector unsigned long long __ATTRS_o_ai 12720 vec_xor(vector unsigned long long __a, vector bool long long __b) { 12721 return __a ^ (vector unsigned long long)__b; 12722 } 12723 12724 static __inline__ vector bool long long __ATTRS_o_ai 12725 vec_xor(vector bool long long __a, vector bool long long __b) { 12726 return __a ^ __b; 12727 } 12728 12729 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 12730 vector double __b) { 12731 return (vector double)((vector unsigned long long)__a ^ 12732 (vector unsigned long long)__b); 12733 } 12734 12735 static __inline__ vector double __ATTRS_o_ai 12736 vec_xor(vector double __a, vector bool long long __b) { 12737 return (vector double)((vector unsigned long long)__a ^ 12738 (vector unsigned long long)__b); 12739 } 12740 12741 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 12742 vector double __b) { 12743 return (vector double)((vector unsigned long long)__a ^ 12744 (vector unsigned long long)__b); 12745 } 12746 #endif 12747 12748 /* vec_vxor */ 12749 12750 static __inline__ vector signed char __ATTRS_o_ai 12751 vec_vxor(vector signed char __a, vector signed char __b) { 12752 return __a ^ __b; 12753 } 12754 12755 static __inline__ vector signed char __ATTRS_o_ai 12756 vec_vxor(vector bool char __a, vector signed char __b) { 12757 return (vector signed char)__a ^ __b; 12758 } 12759 12760 static __inline__ vector signed char __ATTRS_o_ai 12761 vec_vxor(vector signed char __a, vector bool char __b) { 12762 return __a ^ (vector signed char)__b; 12763 } 12764 12765 static __inline__ vector unsigned char __ATTRS_o_ai 12766 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 12767 return __a ^ __b; 12768 } 12769 12770 static __inline__ vector unsigned char __ATTRS_o_ai 12771 vec_vxor(vector bool char __a, vector unsigned char __b) { 12772 return (vector unsigned char)__a ^ __b; 12773 } 12774 12775 static __inline__ vector unsigned char __ATTRS_o_ai 12776 vec_vxor(vector unsigned char __a, vector bool char __b) { 12777 return __a ^ (vector unsigned char)__b; 12778 } 12779 12780 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 12781 vector bool char __b) { 12782 return __a ^ __b; 12783 } 12784 12785 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 12786 vector short __b) { 12787 return __a ^ __b; 12788 } 12789 12790 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 12791 vector short __b) { 12792 return (vector short)__a ^ __b; 12793 } 12794 12795 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 12796 vector bool short __b) { 12797 return __a ^ (vector short)__b; 12798 } 12799 12800 static __inline__ vector unsigned short __ATTRS_o_ai 12801 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 12802 return __a ^ __b; 12803 } 12804 12805 static __inline__ vector unsigned short __ATTRS_o_ai 12806 vec_vxor(vector bool short __a, vector unsigned short __b) { 12807 return (vector unsigned short)__a ^ __b; 12808 } 12809 12810 static __inline__ vector unsigned short __ATTRS_o_ai 12811 vec_vxor(vector unsigned short __a, vector bool short __b) { 12812 return __a ^ (vector unsigned short)__b; 12813 } 12814 12815 static __inline__ vector bool short __ATTRS_o_ai 12816 vec_vxor(vector bool short __a, vector bool short __b) { 12817 return __a ^ __b; 12818 } 12819 12820 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 12821 vector int __b) { 12822 return __a ^ __b; 12823 } 12824 12825 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 12826 vector int __b) { 12827 return (vector int)__a ^ __b; 12828 } 12829 12830 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 12831 vector bool int __b) { 12832 return __a ^ (vector int)__b; 12833 } 12834 12835 static __inline__ vector unsigned int __ATTRS_o_ai 12836 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 12837 return __a ^ __b; 12838 } 12839 12840 static __inline__ vector unsigned int __ATTRS_o_ai 12841 vec_vxor(vector bool int __a, vector unsigned int __b) { 12842 return (vector unsigned int)__a ^ __b; 12843 } 12844 12845 static __inline__ vector unsigned int __ATTRS_o_ai 12846 vec_vxor(vector unsigned int __a, vector bool int __b) { 12847 return __a ^ (vector unsigned int)__b; 12848 } 12849 12850 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 12851 vector bool int __b) { 12852 return __a ^ __b; 12853 } 12854 12855 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 12856 vector float __b) { 12857 vector unsigned int __res = 12858 (vector unsigned int)__a ^ (vector unsigned int)__b; 12859 return (vector float)__res; 12860 } 12861 12862 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 12863 vector float __b) { 12864 vector unsigned int __res = 12865 (vector unsigned int)__a ^ (vector unsigned int)__b; 12866 return (vector float)__res; 12867 } 12868 12869 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 12870 vector bool int __b) { 12871 vector unsigned int __res = 12872 (vector unsigned int)__a ^ (vector unsigned int)__b; 12873 return (vector float)__res; 12874 } 12875 12876 #ifdef __VSX__ 12877 static __inline__ vector signed long long __ATTRS_o_ai 12878 vec_vxor(vector signed long long __a, vector signed long long __b) { 12879 return __a ^ __b; 12880 } 12881 12882 static __inline__ vector signed long long __ATTRS_o_ai 12883 vec_vxor(vector bool long long __a, vector signed long long __b) { 12884 return (vector signed long long)__a ^ __b; 12885 } 12886 12887 static __inline__ vector signed long long __ATTRS_o_ai 12888 vec_vxor(vector signed long long __a, vector bool long long __b) { 12889 return __a ^ (vector signed long long)__b; 12890 } 12891 12892 static __inline__ vector unsigned long long __ATTRS_o_ai 12893 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 12894 return __a ^ __b; 12895 } 12896 12897 static __inline__ vector unsigned long long __ATTRS_o_ai 12898 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 12899 return (vector unsigned long long)__a ^ __b; 12900 } 12901 12902 static __inline__ vector unsigned long long __ATTRS_o_ai 12903 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 12904 return __a ^ (vector unsigned long long)__b; 12905 } 12906 12907 static __inline__ vector bool long long __ATTRS_o_ai 12908 vec_vxor(vector bool long long __a, vector bool long long __b) { 12909 return __a ^ __b; 12910 } 12911 #endif 12912 12913 /* ------------------------ extensions for CBEA ----------------------------- */ 12914 12915 /* vec_extract */ 12916 12917 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 12918 int __b) { 12919 return __a[__b]; 12920 } 12921 12922 static __inline__ unsigned char __ATTRS_o_ai 12923 vec_extract(vector unsigned char __a, int __b) { 12924 return __a[__b]; 12925 } 12926 12927 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 12928 int __b) { 12929 return __a[__b]; 12930 } 12931 12932 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 12933 int __b) { 12934 return __a[__b]; 12935 } 12936 12937 static __inline__ unsigned short __ATTRS_o_ai 12938 vec_extract(vector unsigned short __a, int __b) { 12939 return __a[__b]; 12940 } 12941 12942 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 12943 int __b) { 12944 return __a[__b]; 12945 } 12946 12947 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 12948 int __b) { 12949 return __a[__b]; 12950 } 12951 12952 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 12953 int __b) { 12954 return __a[__b]; 12955 } 12956 12957 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 12958 int __b) { 12959 return __a[__b]; 12960 } 12961 12962 #ifdef __VSX__ 12963 static __inline__ signed long long __ATTRS_o_ai 12964 vec_extract(vector signed long long __a, int __b) { 12965 return __a[__b]; 12966 } 12967 12968 static __inline__ unsigned long long __ATTRS_o_ai 12969 vec_extract(vector unsigned long long __a, int __b) { 12970 return __a[__b]; 12971 } 12972 12973 static __inline__ unsigned long long __ATTRS_o_ai 12974 vec_extract(vector bool long long __a, int __b) { 12975 return __a[__b]; 12976 } 12977 12978 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, int __b) { 12979 return __a[__b]; 12980 } 12981 #endif 12982 12983 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, int __b) { 12984 return __a[__b]; 12985 } 12986 12987 #ifdef __POWER9_VECTOR__ 12988 12989 #define vec_insert4b __builtin_vsx_insertword 12990 #define vec_extract4b __builtin_vsx_extractuword 12991 12992 /* vec_extract_exp */ 12993 12994 static __inline__ vector unsigned int __ATTRS_o_ai 12995 vec_extract_exp(vector float __a) { 12996 return __builtin_vsx_xvxexpsp(__a); 12997 } 12998 12999 static __inline__ vector unsigned long long __ATTRS_o_ai 13000 vec_extract_exp(vector double __a) { 13001 return __builtin_vsx_xvxexpdp(__a); 13002 } 13003 13004 /* vec_extract_sig */ 13005 13006 static __inline__ vector unsigned int __ATTRS_o_ai 13007 vec_extract_sig(vector float __a) { 13008 return __builtin_vsx_xvxsigsp(__a); 13009 } 13010 13011 static __inline__ vector unsigned long long __ATTRS_o_ai 13012 vec_extract_sig (vector double __a) { 13013 return __builtin_vsx_xvxsigdp(__a); 13014 } 13015 13016 static __inline__ vector float __ATTRS_o_ai 13017 vec_extract_fp32_from_shorth(vector unsigned short __a) { 13018 vector unsigned short __b = 13019 #ifdef __LITTLE_ENDIAN__ 13020 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 13021 #else 13022 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 13023 #endif 13024 return __builtin_vsx_xvcvhpsp(__b); 13025 } 13026 13027 static __inline__ vector float __ATTRS_o_ai 13028 vec_extract_fp32_from_shortl(vector unsigned short __a) { 13029 vector unsigned short __b = 13030 #ifdef __LITTLE_ENDIAN__ 13031 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 13032 #else 13033 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 13034 #endif 13035 return __builtin_vsx_xvcvhpsp(__b); 13036 } 13037 #endif /* __POWER9_VECTOR__ */ 13038 13039 /* vec_insert */ 13040 13041 static __inline__ vector signed char __ATTRS_o_ai 13042 vec_insert(signed char __a, vector signed char __b, int __c) { 13043 __b[__c] = __a; 13044 return __b; 13045 } 13046 13047 static __inline__ vector unsigned char __ATTRS_o_ai 13048 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 13049 __b[__c] = __a; 13050 return __b; 13051 } 13052 13053 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 13054 vector bool char __b, 13055 int __c) { 13056 __b[__c] = __a; 13057 return __b; 13058 } 13059 13060 static __inline__ vector signed short __ATTRS_o_ai 13061 vec_insert(signed short __a, vector signed short __b, int __c) { 13062 __b[__c] = __a; 13063 return __b; 13064 } 13065 13066 static __inline__ vector unsigned short __ATTRS_o_ai 13067 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 13068 __b[__c] = __a; 13069 return __b; 13070 } 13071 13072 static __inline__ vector bool short __ATTRS_o_ai 13073 vec_insert(unsigned short __a, vector bool short __b, int __c) { 13074 __b[__c] = __a; 13075 return __b; 13076 } 13077 13078 static __inline__ vector signed int __ATTRS_o_ai 13079 vec_insert(signed int __a, vector signed int __b, int __c) { 13080 __b[__c] = __a; 13081 return __b; 13082 } 13083 13084 static __inline__ vector unsigned int __ATTRS_o_ai 13085 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 13086 __b[__c] = __a; 13087 return __b; 13088 } 13089 13090 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 13091 vector bool int __b, 13092 int __c) { 13093 __b[__c] = __a; 13094 return __b; 13095 } 13096 13097 #ifdef __VSX__ 13098 static __inline__ vector signed long long __ATTRS_o_ai 13099 vec_insert(signed long long __a, vector signed long long __b, int __c) { 13100 __b[__c] = __a; 13101 return __b; 13102 } 13103 13104 static __inline__ vector unsigned long long __ATTRS_o_ai 13105 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 13106 __b[__c] = __a; 13107 return __b; 13108 } 13109 13110 static __inline__ vector bool long long __ATTRS_o_ai 13111 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 13112 __b[__c] = __a; 13113 return __b; 13114 } 13115 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 13116 vector double __b, 13117 int __c) { 13118 __b[__c] = __a; 13119 return __b; 13120 } 13121 #endif 13122 13123 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 13124 vector float __b, 13125 int __c) { 13126 __b[__c] = __a; 13127 return __b; 13128 } 13129 13130 /* vec_lvlx */ 13131 13132 static __inline__ vector signed char __ATTRS_o_ai 13133 vec_lvlx(int __a, const signed char *__b) { 13134 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13135 vec_lvsl(__a, __b)); 13136 } 13137 13138 static __inline__ vector signed char __ATTRS_o_ai 13139 vec_lvlx(int __a, const vector signed char *__b) { 13140 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13141 vec_lvsl(__a, (unsigned char *)__b)); 13142 } 13143 13144 static __inline__ vector unsigned char __ATTRS_o_ai 13145 vec_lvlx(int __a, const unsigned char *__b) { 13146 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13147 vec_lvsl(__a, __b)); 13148 } 13149 13150 static __inline__ vector unsigned char __ATTRS_o_ai 13151 vec_lvlx(int __a, const vector unsigned char *__b) { 13152 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13153 vec_lvsl(__a, (unsigned char *)__b)); 13154 } 13155 13156 static __inline__ vector bool char __ATTRS_o_ai 13157 vec_lvlx(int __a, const vector bool char *__b) { 13158 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 13159 vec_lvsl(__a, (unsigned char *)__b)); 13160 } 13161 13162 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13163 const short *__b) { 13164 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13165 } 13166 13167 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13168 const vector short *__b) { 13169 return vec_perm(vec_ld(__a, __b), (vector short)(0), 13170 vec_lvsl(__a, (unsigned char *)__b)); 13171 } 13172 13173 static __inline__ vector unsigned short __ATTRS_o_ai 13174 vec_lvlx(int __a, const unsigned short *__b) { 13175 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13176 vec_lvsl(__a, __b)); 13177 } 13178 13179 static __inline__ vector unsigned short __ATTRS_o_ai 13180 vec_lvlx(int __a, const vector unsigned short *__b) { 13181 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13182 vec_lvsl(__a, (unsigned char *)__b)); 13183 } 13184 13185 static __inline__ vector bool short __ATTRS_o_ai 13186 vec_lvlx(int __a, const vector bool short *__b) { 13187 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 13188 vec_lvsl(__a, (unsigned char *)__b)); 13189 } 13190 13191 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 13192 const vector pixel *__b) { 13193 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 13194 vec_lvsl(__a, (unsigned char *)__b)); 13195 } 13196 13197 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 13198 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13199 } 13200 13201 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 13202 const vector int *__b) { 13203 return vec_perm(vec_ld(__a, __b), (vector int)(0), 13204 vec_lvsl(__a, (unsigned char *)__b)); 13205 } 13206 13207 static __inline__ vector unsigned int __ATTRS_o_ai 13208 vec_lvlx(int __a, const unsigned int *__b) { 13209 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13210 vec_lvsl(__a, __b)); 13211 } 13212 13213 static __inline__ vector unsigned int __ATTRS_o_ai 13214 vec_lvlx(int __a, const vector unsigned int *__b) { 13215 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13216 vec_lvsl(__a, (unsigned char *)__b)); 13217 } 13218 13219 static __inline__ vector bool int __ATTRS_o_ai 13220 vec_lvlx(int __a, const vector bool int *__b) { 13221 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 13222 vec_lvsl(__a, (unsigned char *)__b)); 13223 } 13224 13225 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13226 const float *__b) { 13227 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13228 } 13229 13230 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13231 const vector float *__b) { 13232 return vec_perm(vec_ld(__a, __b), (vector float)(0), 13233 vec_lvsl(__a, (unsigned char *)__b)); 13234 } 13235 13236 /* vec_lvlxl */ 13237 13238 static __inline__ vector signed char __ATTRS_o_ai 13239 vec_lvlxl(int __a, const signed char *__b) { 13240 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13241 vec_lvsl(__a, __b)); 13242 } 13243 13244 static __inline__ vector signed char __ATTRS_o_ai 13245 vec_lvlxl(int __a, const vector signed char *__b) { 13246 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13247 vec_lvsl(__a, (unsigned char *)__b)); 13248 } 13249 13250 static __inline__ vector unsigned char __ATTRS_o_ai 13251 vec_lvlxl(int __a, const unsigned char *__b) { 13252 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13253 vec_lvsl(__a, __b)); 13254 } 13255 13256 static __inline__ vector unsigned char __ATTRS_o_ai 13257 vec_lvlxl(int __a, const vector unsigned char *__b) { 13258 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13259 vec_lvsl(__a, (unsigned char *)__b)); 13260 } 13261 13262 static __inline__ vector bool char __ATTRS_o_ai 13263 vec_lvlxl(int __a, const vector bool char *__b) { 13264 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 13265 vec_lvsl(__a, (unsigned char *)__b)); 13266 } 13267 13268 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13269 const short *__b) { 13270 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13271 } 13272 13273 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13274 const vector short *__b) { 13275 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 13276 vec_lvsl(__a, (unsigned char *)__b)); 13277 } 13278 13279 static __inline__ vector unsigned short __ATTRS_o_ai 13280 vec_lvlxl(int __a, const unsigned short *__b) { 13281 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13282 vec_lvsl(__a, __b)); 13283 } 13284 13285 static __inline__ vector unsigned short __ATTRS_o_ai 13286 vec_lvlxl(int __a, const vector unsigned short *__b) { 13287 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13288 vec_lvsl(__a, (unsigned char *)__b)); 13289 } 13290 13291 static __inline__ vector bool short __ATTRS_o_ai 13292 vec_lvlxl(int __a, const vector bool short *__b) { 13293 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 13294 vec_lvsl(__a, (unsigned char *)__b)); 13295 } 13296 13297 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 13298 const vector pixel *__b) { 13299 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 13300 vec_lvsl(__a, (unsigned char *)__b)); 13301 } 13302 13303 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 13304 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13305 } 13306 13307 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 13308 const vector int *__b) { 13309 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 13310 vec_lvsl(__a, (unsigned char *)__b)); 13311 } 13312 13313 static __inline__ vector unsigned int __ATTRS_o_ai 13314 vec_lvlxl(int __a, const unsigned int *__b) { 13315 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13316 vec_lvsl(__a, __b)); 13317 } 13318 13319 static __inline__ vector unsigned int __ATTRS_o_ai 13320 vec_lvlxl(int __a, const vector unsigned int *__b) { 13321 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13322 vec_lvsl(__a, (unsigned char *)__b)); 13323 } 13324 13325 static __inline__ vector bool int __ATTRS_o_ai 13326 vec_lvlxl(int __a, const vector bool int *__b) { 13327 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 13328 vec_lvsl(__a, (unsigned char *)__b)); 13329 } 13330 13331 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13332 const float *__b) { 13333 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13334 } 13335 13336 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13337 vector float *__b) { 13338 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 13339 vec_lvsl(__a, (unsigned char *)__b)); 13340 } 13341 13342 /* vec_lvrx */ 13343 13344 static __inline__ vector signed char __ATTRS_o_ai 13345 vec_lvrx(int __a, const signed char *__b) { 13346 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13347 vec_lvsl(__a, __b)); 13348 } 13349 13350 static __inline__ vector signed char __ATTRS_o_ai 13351 vec_lvrx(int __a, const vector signed char *__b) { 13352 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13353 vec_lvsl(__a, (unsigned char *)__b)); 13354 } 13355 13356 static __inline__ vector unsigned char __ATTRS_o_ai 13357 vec_lvrx(int __a, const unsigned char *__b) { 13358 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13359 vec_lvsl(__a, __b)); 13360 } 13361 13362 static __inline__ vector unsigned char __ATTRS_o_ai 13363 vec_lvrx(int __a, const vector unsigned char *__b) { 13364 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13365 vec_lvsl(__a, (unsigned char *)__b)); 13366 } 13367 13368 static __inline__ vector bool char __ATTRS_o_ai 13369 vec_lvrx(int __a, const vector bool char *__b) { 13370 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13371 vec_lvsl(__a, (unsigned char *)__b)); 13372 } 13373 13374 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13375 const short *__b) { 13376 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13377 } 13378 13379 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13380 const vector short *__b) { 13381 return vec_perm((vector short)(0), vec_ld(__a, __b), 13382 vec_lvsl(__a, (unsigned char *)__b)); 13383 } 13384 13385 static __inline__ vector unsigned short __ATTRS_o_ai 13386 vec_lvrx(int __a, const unsigned short *__b) { 13387 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13388 vec_lvsl(__a, __b)); 13389 } 13390 13391 static __inline__ vector unsigned short __ATTRS_o_ai 13392 vec_lvrx(int __a, const vector unsigned short *__b) { 13393 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13394 vec_lvsl(__a, (unsigned char *)__b)); 13395 } 13396 13397 static __inline__ vector bool short __ATTRS_o_ai 13398 vec_lvrx(int __a, const vector bool short *__b) { 13399 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 13400 vec_lvsl(__a, (unsigned char *)__b)); 13401 } 13402 13403 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 13404 const vector pixel *__b) { 13405 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 13406 vec_lvsl(__a, (unsigned char *)__b)); 13407 } 13408 13409 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 13410 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13411 } 13412 13413 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 13414 const vector int *__b) { 13415 return vec_perm((vector int)(0), vec_ld(__a, __b), 13416 vec_lvsl(__a, (unsigned char *)__b)); 13417 } 13418 13419 static __inline__ vector unsigned int __ATTRS_o_ai 13420 vec_lvrx(int __a, const unsigned int *__b) { 13421 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13422 vec_lvsl(__a, __b)); 13423 } 13424 13425 static __inline__ vector unsigned int __ATTRS_o_ai 13426 vec_lvrx(int __a, const vector unsigned int *__b) { 13427 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13428 vec_lvsl(__a, (unsigned char *)__b)); 13429 } 13430 13431 static __inline__ vector bool int __ATTRS_o_ai 13432 vec_lvrx(int __a, const vector bool int *__b) { 13433 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 13434 vec_lvsl(__a, (unsigned char *)__b)); 13435 } 13436 13437 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13438 const float *__b) { 13439 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13440 } 13441 13442 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13443 const vector float *__b) { 13444 return vec_perm((vector float)(0), vec_ld(__a, __b), 13445 vec_lvsl(__a, (unsigned char *)__b)); 13446 } 13447 13448 /* vec_lvrxl */ 13449 13450 static __inline__ vector signed char __ATTRS_o_ai 13451 vec_lvrxl(int __a, const signed char *__b) { 13452 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13453 vec_lvsl(__a, __b)); 13454 } 13455 13456 static __inline__ vector signed char __ATTRS_o_ai 13457 vec_lvrxl(int __a, const vector signed char *__b) { 13458 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13459 vec_lvsl(__a, (unsigned char *)__b)); 13460 } 13461 13462 static __inline__ vector unsigned char __ATTRS_o_ai 13463 vec_lvrxl(int __a, const unsigned char *__b) { 13464 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13465 vec_lvsl(__a, __b)); 13466 } 13467 13468 static __inline__ vector unsigned char __ATTRS_o_ai 13469 vec_lvrxl(int __a, const vector unsigned char *__b) { 13470 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13471 vec_lvsl(__a, (unsigned char *)__b)); 13472 } 13473 13474 static __inline__ vector bool char __ATTRS_o_ai 13475 vec_lvrxl(int __a, const vector bool char *__b) { 13476 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 13477 vec_lvsl(__a, (unsigned char *)__b)); 13478 } 13479 13480 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 13481 const short *__b) { 13482 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13483 } 13484 13485 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 13486 const vector short *__b) { 13487 return vec_perm((vector short)(0), vec_ldl(__a, __b), 13488 vec_lvsl(__a, (unsigned char *)__b)); 13489 } 13490 13491 static __inline__ vector unsigned short __ATTRS_o_ai 13492 vec_lvrxl(int __a, const unsigned short *__b) { 13493 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 13494 vec_lvsl(__a, __b)); 13495 } 13496 13497 static __inline__ vector unsigned short __ATTRS_o_ai 13498 vec_lvrxl(int __a, const vector unsigned short *__b) { 13499 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 13500 vec_lvsl(__a, (unsigned char *)__b)); 13501 } 13502 13503 static __inline__ vector bool short __ATTRS_o_ai 13504 vec_lvrxl(int __a, const vector bool short *__b) { 13505 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 13506 vec_lvsl(__a, (unsigned char *)__b)); 13507 } 13508 13509 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 13510 const vector pixel *__b) { 13511 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 13512 vec_lvsl(__a, (unsigned char *)__b)); 13513 } 13514 13515 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 13516 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13517 } 13518 13519 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 13520 const vector int *__b) { 13521 return vec_perm((vector int)(0), vec_ldl(__a, __b), 13522 vec_lvsl(__a, (unsigned char *)__b)); 13523 } 13524 13525 static __inline__ vector unsigned int __ATTRS_o_ai 13526 vec_lvrxl(int __a, const unsigned int *__b) { 13527 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 13528 vec_lvsl(__a, __b)); 13529 } 13530 13531 static __inline__ vector unsigned int __ATTRS_o_ai 13532 vec_lvrxl(int __a, const vector unsigned int *__b) { 13533 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 13534 vec_lvsl(__a, (unsigned char *)__b)); 13535 } 13536 13537 static __inline__ vector bool int __ATTRS_o_ai 13538 vec_lvrxl(int __a, const vector bool int *__b) { 13539 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 13540 vec_lvsl(__a, (unsigned char *)__b)); 13541 } 13542 13543 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 13544 const float *__b) { 13545 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13546 } 13547 13548 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 13549 const vector float *__b) { 13550 return vec_perm((vector float)(0), vec_ldl(__a, __b), 13551 vec_lvsl(__a, (unsigned char *)__b)); 13552 } 13553 13554 /* vec_stvlx */ 13555 13556 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 13557 signed char *__c) { 13558 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13559 __c); 13560 } 13561 13562 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 13563 vector signed char *__c) { 13564 return vec_st( 13565 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13566 __b, __c); 13567 } 13568 13569 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 13570 unsigned char *__c) { 13571 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13572 __c); 13573 } 13574 13575 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 13576 vector unsigned char *__c) { 13577 return vec_st( 13578 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13579 __b, __c); 13580 } 13581 13582 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 13583 vector bool char *__c) { 13584 return vec_st( 13585 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13586 __b, __c); 13587 } 13588 13589 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 13590 short *__c) { 13591 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13592 __c); 13593 } 13594 13595 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 13596 vector short *__c) { 13597 return vec_st( 13598 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13599 __b, __c); 13600 } 13601 13602 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 13603 int __b, unsigned short *__c) { 13604 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13605 __c); 13606 } 13607 13608 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 13609 int __b, 13610 vector unsigned short *__c) { 13611 return vec_st( 13612 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13613 __b, __c); 13614 } 13615 13616 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 13617 vector bool short *__c) { 13618 return vec_st( 13619 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13620 __b, __c); 13621 } 13622 13623 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 13624 vector pixel *__c) { 13625 return vec_st( 13626 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13627 __b, __c); 13628 } 13629 13630 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 13631 int *__c) { 13632 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13633 __c); 13634 } 13635 13636 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 13637 vector int *__c) { 13638 return vec_st( 13639 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13640 __b, __c); 13641 } 13642 13643 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 13644 unsigned int *__c) { 13645 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13646 __c); 13647 } 13648 13649 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 13650 vector unsigned int *__c) { 13651 return vec_st( 13652 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13653 __b, __c); 13654 } 13655 13656 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 13657 vector bool int *__c) { 13658 return vec_st( 13659 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13660 __b, __c); 13661 } 13662 13663 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 13664 vector float *__c) { 13665 return vec_st( 13666 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13667 __b, __c); 13668 } 13669 13670 /* vec_stvlxl */ 13671 13672 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 13673 signed char *__c) { 13674 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13675 __c); 13676 } 13677 13678 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 13679 vector signed char *__c) { 13680 return vec_stl( 13681 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13682 __b, __c); 13683 } 13684 13685 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 13686 int __b, unsigned char *__c) { 13687 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13688 __c); 13689 } 13690 13691 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 13692 int __b, 13693 vector unsigned char *__c) { 13694 return vec_stl( 13695 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13696 __b, __c); 13697 } 13698 13699 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 13700 vector bool char *__c) { 13701 return vec_stl( 13702 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13703 __b, __c); 13704 } 13705 13706 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 13707 short *__c) { 13708 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13709 __c); 13710 } 13711 13712 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 13713 vector short *__c) { 13714 return vec_stl( 13715 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13716 __b, __c); 13717 } 13718 13719 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 13720 int __b, unsigned short *__c) { 13721 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13722 __c); 13723 } 13724 13725 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 13726 int __b, 13727 vector unsigned short *__c) { 13728 return vec_stl( 13729 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13730 __b, __c); 13731 } 13732 13733 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 13734 vector bool short *__c) { 13735 return vec_stl( 13736 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13737 __b, __c); 13738 } 13739 13740 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 13741 vector pixel *__c) { 13742 return vec_stl( 13743 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13744 __b, __c); 13745 } 13746 13747 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 13748 int *__c) { 13749 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13750 __c); 13751 } 13752 13753 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 13754 vector int *__c) { 13755 return vec_stl( 13756 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13757 __b, __c); 13758 } 13759 13760 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 13761 unsigned int *__c) { 13762 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 13763 __c); 13764 } 13765 13766 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 13767 vector unsigned int *__c) { 13768 return vec_stl( 13769 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13770 __b, __c); 13771 } 13772 13773 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 13774 vector bool int *__c) { 13775 return vec_stl( 13776 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13777 __b, __c); 13778 } 13779 13780 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 13781 vector float *__c) { 13782 return vec_stl( 13783 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 13784 __b, __c); 13785 } 13786 13787 /* vec_stvrx */ 13788 13789 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 13790 signed char *__c) { 13791 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13792 __c); 13793 } 13794 13795 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 13796 vector signed char *__c) { 13797 return vec_st( 13798 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13799 __b, __c); 13800 } 13801 13802 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 13803 unsigned char *__c) { 13804 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13805 __c); 13806 } 13807 13808 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 13809 vector unsigned char *__c) { 13810 return vec_st( 13811 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13812 __b, __c); 13813 } 13814 13815 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 13816 vector bool char *__c) { 13817 return vec_st( 13818 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13819 __b, __c); 13820 } 13821 13822 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 13823 short *__c) { 13824 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13825 __c); 13826 } 13827 13828 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 13829 vector short *__c) { 13830 return vec_st( 13831 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13832 __b, __c); 13833 } 13834 13835 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 13836 int __b, unsigned short *__c) { 13837 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13838 __c); 13839 } 13840 13841 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 13842 int __b, 13843 vector unsigned short *__c) { 13844 return vec_st( 13845 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13846 __b, __c); 13847 } 13848 13849 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 13850 vector bool short *__c) { 13851 return vec_st( 13852 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13853 __b, __c); 13854 } 13855 13856 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 13857 vector pixel *__c) { 13858 return vec_st( 13859 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13860 __b, __c); 13861 } 13862 13863 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 13864 int *__c) { 13865 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13866 __c); 13867 } 13868 13869 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 13870 vector int *__c) { 13871 return vec_st( 13872 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13873 __b, __c); 13874 } 13875 13876 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 13877 unsigned int *__c) { 13878 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13879 __c); 13880 } 13881 13882 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 13883 vector unsigned int *__c) { 13884 return vec_st( 13885 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13886 __b, __c); 13887 } 13888 13889 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 13890 vector bool int *__c) { 13891 return vec_st( 13892 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13893 __b, __c); 13894 } 13895 13896 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 13897 vector float *__c) { 13898 return vec_st( 13899 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13900 __b, __c); 13901 } 13902 13903 /* vec_stvrxl */ 13904 13905 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 13906 signed char *__c) { 13907 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13908 __c); 13909 } 13910 13911 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 13912 vector signed char *__c) { 13913 return vec_stl( 13914 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13915 __b, __c); 13916 } 13917 13918 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 13919 int __b, unsigned char *__c) { 13920 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13921 __c); 13922 } 13923 13924 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 13925 int __b, 13926 vector unsigned char *__c) { 13927 return vec_stl( 13928 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13929 __b, __c); 13930 } 13931 13932 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 13933 vector bool char *__c) { 13934 return vec_stl( 13935 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13936 __b, __c); 13937 } 13938 13939 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 13940 short *__c) { 13941 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13942 __c); 13943 } 13944 13945 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 13946 vector short *__c) { 13947 return vec_stl( 13948 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13949 __b, __c); 13950 } 13951 13952 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 13953 int __b, unsigned short *__c) { 13954 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13955 __c); 13956 } 13957 13958 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 13959 int __b, 13960 vector unsigned short *__c) { 13961 return vec_stl( 13962 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13963 __b, __c); 13964 } 13965 13966 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 13967 vector bool short *__c) { 13968 return vec_stl( 13969 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13970 __b, __c); 13971 } 13972 13973 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 13974 vector pixel *__c) { 13975 return vec_stl( 13976 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13977 __b, __c); 13978 } 13979 13980 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 13981 int *__c) { 13982 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13983 __c); 13984 } 13985 13986 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 13987 vector int *__c) { 13988 return vec_stl( 13989 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 13990 __b, __c); 13991 } 13992 13993 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 13994 unsigned int *__c) { 13995 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 13996 __c); 13997 } 13998 13999 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14000 vector unsigned int *__c) { 14001 return vec_stl( 14002 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14003 __b, __c); 14004 } 14005 14006 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 14007 vector bool int *__c) { 14008 return vec_stl( 14009 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14010 __b, __c); 14011 } 14012 14013 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 14014 vector float *__c) { 14015 return vec_stl( 14016 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14017 __b, __c); 14018 } 14019 14020 /* vec_promote */ 14021 14022 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 14023 int __b) { 14024 vector signed char __res = (vector signed char)(0); 14025 __res[__b] = __a; 14026 return __res; 14027 } 14028 14029 static __inline__ vector unsigned char __ATTRS_o_ai 14030 vec_promote(unsigned char __a, int __b) { 14031 vector unsigned char __res = (vector unsigned char)(0); 14032 __res[__b] = __a; 14033 return __res; 14034 } 14035 14036 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 14037 vector short __res = (vector short)(0); 14038 __res[__b] = __a; 14039 return __res; 14040 } 14041 14042 static __inline__ vector unsigned short __ATTRS_o_ai 14043 vec_promote(unsigned short __a, int __b) { 14044 vector unsigned short __res = (vector unsigned short)(0); 14045 __res[__b] = __a; 14046 return __res; 14047 } 14048 14049 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 14050 vector int __res = (vector int)(0); 14051 __res[__b] = __a; 14052 return __res; 14053 } 14054 14055 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 14056 int __b) { 14057 vector unsigned int __res = (vector unsigned int)(0); 14058 __res[__b] = __a; 14059 return __res; 14060 } 14061 14062 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 14063 vector float __res = (vector float)(0); 14064 __res[__b] = __a; 14065 return __res; 14066 } 14067 14068 /* vec_splats */ 14069 14070 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 14071 return (vector signed char)(__a); 14072 } 14073 14074 static __inline__ vector unsigned char __ATTRS_o_ai 14075 vec_splats(unsigned char __a) { 14076 return (vector unsigned char)(__a); 14077 } 14078 14079 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 14080 return (vector short)(__a); 14081 } 14082 14083 static __inline__ vector unsigned short __ATTRS_o_ai 14084 vec_splats(unsigned short __a) { 14085 return (vector unsigned short)(__a); 14086 } 14087 14088 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 14089 return (vector int)(__a); 14090 } 14091 14092 static __inline__ vector unsigned int __ATTRS_o_ai 14093 vec_splats(unsigned int __a) { 14094 return (vector unsigned int)(__a); 14095 } 14096 14097 #ifdef __VSX__ 14098 static __inline__ vector signed long long __ATTRS_o_ai 14099 vec_splats(signed long long __a) { 14100 return (vector signed long long)(__a); 14101 } 14102 14103 static __inline__ vector unsigned long long __ATTRS_o_ai 14104 vec_splats(unsigned long long __a) { 14105 return (vector unsigned long long)(__a); 14106 } 14107 14108 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 14109 static __inline__ vector signed __int128 __ATTRS_o_ai 14110 vec_splats(signed __int128 __a) { 14111 return (vector signed __int128)(__a); 14112 } 14113 14114 static __inline__ vector unsigned __int128 __ATTRS_o_ai 14115 vec_splats(unsigned __int128 __a) { 14116 return (vector unsigned __int128)(__a); 14117 } 14118 14119 #endif 14120 14121 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 14122 return (vector double)(__a); 14123 } 14124 #endif 14125 14126 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 14127 return (vector float)(__a); 14128 } 14129 14130 /* ----------------------------- predicates --------------------------------- */ 14131 14132 /* vec_all_eq */ 14133 14134 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14135 vector signed char __b) { 14136 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14137 (vector char)__b); 14138 } 14139 14140 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14141 vector bool char __b) { 14142 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14143 (vector char)__b); 14144 } 14145 14146 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14147 vector unsigned char __b) { 14148 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14149 (vector char)__b); 14150 } 14151 14152 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14153 vector bool char __b) { 14154 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14155 (vector char)__b); 14156 } 14157 14158 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14159 vector signed char __b) { 14160 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14161 (vector char)__b); 14162 } 14163 14164 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14165 vector unsigned char __b) { 14166 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14167 (vector char)__b); 14168 } 14169 14170 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14171 vector bool char __b) { 14172 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14173 (vector char)__b); 14174 } 14175 14176 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14177 vector short __b) { 14178 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 14179 } 14180 14181 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14182 vector bool short __b) { 14183 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 14184 } 14185 14186 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14187 vector unsigned short __b) { 14188 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14189 (vector short)__b); 14190 } 14191 14192 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14193 vector bool short __b) { 14194 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14195 (vector short)__b); 14196 } 14197 14198 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14199 vector short __b) { 14200 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14201 (vector short)__b); 14202 } 14203 14204 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14205 vector unsigned short __b) { 14206 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14207 (vector short)__b); 14208 } 14209 14210 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14211 vector bool short __b) { 14212 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14213 (vector short)__b); 14214 } 14215 14216 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 14217 vector pixel __b) { 14218 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14219 (vector short)__b); 14220 } 14221 14222 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 14223 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 14224 } 14225 14226 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 14227 vector bool int __b) { 14228 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 14229 } 14230 14231 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14232 vector unsigned int __b) { 14233 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14234 (vector int)__b); 14235 } 14236 14237 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14238 vector bool int __b) { 14239 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14240 (vector int)__b); 14241 } 14242 14243 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14244 vector int __b) { 14245 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14246 (vector int)__b); 14247 } 14248 14249 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14250 vector unsigned int __b) { 14251 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14252 (vector int)__b); 14253 } 14254 14255 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14256 vector bool int __b) { 14257 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14258 (vector int)__b); 14259 } 14260 14261 #ifdef __POWER8_VECTOR__ 14262 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 14263 vector signed long long __b) { 14264 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 14265 } 14266 14267 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 14268 vector bool long long __b) { 14269 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b); 14270 } 14271 14272 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14273 vector unsigned long long __b) { 14274 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14275 (vector long long)__b); 14276 } 14277 14278 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14279 vector bool long long __b) { 14280 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14281 (vector long long)__b); 14282 } 14283 14284 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14285 vector long long __b) { 14286 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14287 (vector long long)__b); 14288 } 14289 14290 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14291 vector unsigned long long __b) { 14292 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14293 (vector long long)__b); 14294 } 14295 14296 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14297 vector bool long long __b) { 14298 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14299 (vector long long)__b); 14300 } 14301 #endif 14302 14303 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 14304 vector float __b) { 14305 #ifdef __VSX__ 14306 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 14307 #else 14308 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 14309 #endif 14310 } 14311 14312 #ifdef __VSX__ 14313 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 14314 vector double __b) { 14315 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 14316 } 14317 #endif 14318 14319 #ifdef __POWER10_VECTOR__ 14320 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, 14321 vector signed __int128 __b) { 14322 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14323 } 14324 14325 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, 14326 vector unsigned __int128 __b) { 14327 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14328 } 14329 #endif 14330 14331 /* vec_all_ge */ 14332 14333 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14334 vector signed char __b) { 14335 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 14336 } 14337 14338 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14339 vector bool char __b) { 14340 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 14341 } 14342 14343 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14344 vector unsigned char __b) { 14345 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 14346 } 14347 14348 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14349 vector bool char __b) { 14350 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 14351 } 14352 14353 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14354 vector signed char __b) { 14355 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14356 (vector unsigned char)__a); 14357 } 14358 14359 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14360 vector unsigned char __b) { 14361 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 14362 } 14363 14364 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14365 vector bool char __b) { 14366 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14367 (vector unsigned char)__a); 14368 } 14369 14370 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14371 vector short __b) { 14372 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 14373 } 14374 14375 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14376 vector bool short __b) { 14377 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 14378 } 14379 14380 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14381 vector unsigned short __b) { 14382 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 14383 } 14384 14385 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14386 vector bool short __b) { 14387 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14388 __a); 14389 } 14390 14391 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14392 vector short __b) { 14393 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14394 (vector unsigned short)__a); 14395 } 14396 14397 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14398 vector unsigned short __b) { 14399 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 14400 (vector unsigned short)__a); 14401 } 14402 14403 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14404 vector bool short __b) { 14405 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14406 (vector unsigned short)__a); 14407 } 14408 14409 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 14410 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 14411 } 14412 14413 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 14414 vector bool int __b) { 14415 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 14416 } 14417 14418 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14419 vector unsigned int __b) { 14420 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 14421 } 14422 14423 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14424 vector bool int __b) { 14425 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 14426 } 14427 14428 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14429 vector int __b) { 14430 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14431 (vector unsigned int)__a); 14432 } 14433 14434 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14435 vector unsigned int __b) { 14436 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 14437 } 14438 14439 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14440 vector bool int __b) { 14441 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14442 (vector unsigned int)__a); 14443 } 14444 14445 #ifdef __POWER8_VECTOR__ 14446 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14447 vector signed long long __b) { 14448 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 14449 } 14450 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14451 vector bool long long __b) { 14452 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 14453 __a); 14454 } 14455 14456 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 14457 vector unsigned long long __b) { 14458 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 14459 } 14460 14461 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 14462 vector bool long long __b) { 14463 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 14464 __a); 14465 } 14466 14467 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 14468 vector signed long long __b) { 14469 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 14470 (vector unsigned long long)__a); 14471 } 14472 14473 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 14474 vector unsigned long long __b) { 14475 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 14476 (vector unsigned long long)__a); 14477 } 14478 14479 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 14480 vector bool long long __b) { 14481 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 14482 (vector unsigned long long)__a); 14483 } 14484 #endif 14485 14486 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 14487 vector float __b) { 14488 #ifdef __VSX__ 14489 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 14490 #else 14491 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 14492 #endif 14493 } 14494 14495 #ifdef __VSX__ 14496 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 14497 vector double __b) { 14498 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 14499 } 14500 #endif 14501 14502 #ifdef __POWER10_VECTOR__ 14503 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, 14504 vector signed __int128 __b) { 14505 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); 14506 } 14507 14508 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, 14509 vector unsigned __int128 __b) { 14510 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); 14511 } 14512 #endif 14513 14514 /* vec_all_gt */ 14515 14516 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 14517 vector signed char __b) { 14518 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 14519 } 14520 14521 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 14522 vector bool char __b) { 14523 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 14524 } 14525 14526 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 14527 vector unsigned char __b) { 14528 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 14529 } 14530 14531 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 14532 vector bool char __b) { 14533 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 14534 } 14535 14536 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 14537 vector signed char __b) { 14538 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 14539 (vector unsigned char)__b); 14540 } 14541 14542 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 14543 vector unsigned char __b) { 14544 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 14545 } 14546 14547 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 14548 vector bool char __b) { 14549 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 14550 (vector unsigned char)__b); 14551 } 14552 14553 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 14554 vector short __b) { 14555 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 14556 } 14557 14558 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 14559 vector bool short __b) { 14560 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 14561 } 14562 14563 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 14564 vector unsigned short __b) { 14565 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 14566 } 14567 14568 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 14569 vector bool short __b) { 14570 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 14571 (vector unsigned short)__b); 14572 } 14573 14574 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 14575 vector short __b) { 14576 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 14577 (vector unsigned short)__b); 14578 } 14579 14580 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 14581 vector unsigned short __b) { 14582 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 14583 __b); 14584 } 14585 14586 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 14587 vector bool short __b) { 14588 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 14589 (vector unsigned short)__b); 14590 } 14591 14592 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 14593 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 14594 } 14595 14596 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 14597 vector bool int __b) { 14598 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 14599 } 14600 14601 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 14602 vector unsigned int __b) { 14603 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 14604 } 14605 14606 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 14607 vector bool int __b) { 14608 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 14609 } 14610 14611 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 14612 vector int __b) { 14613 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 14614 (vector unsigned int)__b); 14615 } 14616 14617 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 14618 vector unsigned int __b) { 14619 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 14620 } 14621 14622 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 14623 vector bool int __b) { 14624 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 14625 (vector unsigned int)__b); 14626 } 14627 14628 #ifdef __POWER8_VECTOR__ 14629 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 14630 vector signed long long __b) { 14631 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 14632 } 14633 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 14634 vector bool long long __b) { 14635 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 14636 (vector signed long long)__b); 14637 } 14638 14639 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 14640 vector unsigned long long __b) { 14641 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 14642 } 14643 14644 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 14645 vector bool long long __b) { 14646 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 14647 (vector unsigned long long)__b); 14648 } 14649 14650 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 14651 vector signed long long __b) { 14652 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 14653 (vector unsigned long long)__b); 14654 } 14655 14656 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 14657 vector unsigned long long __b) { 14658 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 14659 __b); 14660 } 14661 14662 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 14663 vector bool long long __b) { 14664 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 14665 (vector unsigned long long)__b); 14666 } 14667 #endif 14668 14669 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 14670 vector float __b) { 14671 #ifdef __VSX__ 14672 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 14673 #else 14674 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 14675 #endif 14676 } 14677 14678 #ifdef __VSX__ 14679 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 14680 vector double __b) { 14681 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 14682 } 14683 #endif 14684 14685 #ifdef __POWER10_VECTOR__ 14686 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, 14687 vector signed __int128 __b) { 14688 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); 14689 } 14690 14691 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, 14692 vector unsigned __int128 __b) { 14693 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); 14694 } 14695 #endif 14696 14697 /* vec_all_in */ 14698 14699 static __inline__ int __attribute__((__always_inline__)) 14700 vec_all_in(vector float __a, vector float __b) { 14701 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 14702 } 14703 14704 /* vec_all_le */ 14705 14706 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 14707 vector signed char __b) { 14708 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 14709 } 14710 14711 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 14712 vector bool char __b) { 14713 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 14714 } 14715 14716 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 14717 vector unsigned char __b) { 14718 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 14719 } 14720 14721 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 14722 vector bool char __b) { 14723 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 14724 } 14725 14726 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 14727 vector signed char __b) { 14728 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 14729 (vector unsigned char)__b); 14730 } 14731 14732 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 14733 vector unsigned char __b) { 14734 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 14735 } 14736 14737 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 14738 vector bool char __b) { 14739 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 14740 (vector unsigned char)__b); 14741 } 14742 14743 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 14744 vector short __b) { 14745 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 14746 } 14747 14748 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 14749 vector bool short __b) { 14750 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 14751 } 14752 14753 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 14754 vector unsigned short __b) { 14755 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 14756 } 14757 14758 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 14759 vector bool short __b) { 14760 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 14761 (vector unsigned short)__b); 14762 } 14763 14764 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 14765 vector short __b) { 14766 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 14767 (vector unsigned short)__b); 14768 } 14769 14770 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 14771 vector unsigned short __b) { 14772 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 14773 __b); 14774 } 14775 14776 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 14777 vector bool short __b) { 14778 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 14779 (vector unsigned short)__b); 14780 } 14781 14782 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 14783 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 14784 } 14785 14786 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 14787 vector bool int __b) { 14788 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 14789 } 14790 14791 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 14792 vector unsigned int __b) { 14793 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 14794 } 14795 14796 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 14797 vector bool int __b) { 14798 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 14799 } 14800 14801 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 14802 vector int __b) { 14803 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 14804 (vector unsigned int)__b); 14805 } 14806 14807 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 14808 vector unsigned int __b) { 14809 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 14810 } 14811 14812 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 14813 vector bool int __b) { 14814 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 14815 (vector unsigned int)__b); 14816 } 14817 14818 #ifdef __POWER8_VECTOR__ 14819 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 14820 vector signed long long __b) { 14821 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 14822 } 14823 14824 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 14825 vector unsigned long long __b) { 14826 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 14827 } 14828 14829 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 14830 vector bool long long __b) { 14831 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 14832 (vector signed long long)__b); 14833 } 14834 14835 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 14836 vector bool long long __b) { 14837 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 14838 (vector unsigned long long)__b); 14839 } 14840 14841 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 14842 vector signed long long __b) { 14843 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 14844 (vector unsigned long long)__b); 14845 } 14846 14847 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 14848 vector unsigned long long __b) { 14849 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 14850 __b); 14851 } 14852 14853 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 14854 vector bool long long __b) { 14855 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 14856 (vector unsigned long long)__b); 14857 } 14858 #endif 14859 14860 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 14861 vector float __b) { 14862 #ifdef __VSX__ 14863 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 14864 #else 14865 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 14866 #endif 14867 } 14868 14869 #ifdef __VSX__ 14870 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 14871 vector double __b) { 14872 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 14873 } 14874 #endif 14875 14876 #ifdef __POWER10_VECTOR__ 14877 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, 14878 vector signed __int128 __b) { 14879 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); 14880 } 14881 14882 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, 14883 vector unsigned __int128 __b) { 14884 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); 14885 } 14886 #endif 14887 14888 /* vec_all_lt */ 14889 14890 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 14891 vector signed char __b) { 14892 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 14893 } 14894 14895 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 14896 vector bool char __b) { 14897 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 14898 } 14899 14900 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 14901 vector unsigned char __b) { 14902 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 14903 } 14904 14905 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 14906 vector bool char __b) { 14907 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 14908 } 14909 14910 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 14911 vector signed char __b) { 14912 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 14913 (vector unsigned char)__a); 14914 } 14915 14916 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 14917 vector unsigned char __b) { 14918 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 14919 } 14920 14921 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 14922 vector bool char __b) { 14923 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 14924 (vector unsigned char)__a); 14925 } 14926 14927 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 14928 vector short __b) { 14929 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 14930 } 14931 14932 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 14933 vector bool short __b) { 14934 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 14935 } 14936 14937 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 14938 vector unsigned short __b) { 14939 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 14940 } 14941 14942 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 14943 vector bool short __b) { 14944 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 14945 __a); 14946 } 14947 14948 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 14949 vector short __b) { 14950 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 14951 (vector unsigned short)__a); 14952 } 14953 14954 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 14955 vector unsigned short __b) { 14956 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 14957 (vector unsigned short)__a); 14958 } 14959 14960 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 14961 vector bool short __b) { 14962 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 14963 (vector unsigned short)__a); 14964 } 14965 14966 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 14967 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 14968 } 14969 14970 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 14971 vector bool int __b) { 14972 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 14973 } 14974 14975 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 14976 vector unsigned int __b) { 14977 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 14978 } 14979 14980 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 14981 vector bool int __b) { 14982 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 14983 } 14984 14985 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 14986 vector int __b) { 14987 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 14988 (vector unsigned int)__a); 14989 } 14990 14991 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 14992 vector unsigned int __b) { 14993 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 14994 } 14995 14996 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 14997 vector bool int __b) { 14998 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 14999 (vector unsigned int)__a); 15000 } 15001 15002 #ifdef __POWER8_VECTOR__ 15003 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15004 vector signed long long __b) { 15005 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 15006 } 15007 15008 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15009 vector unsigned long long __b) { 15010 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 15011 } 15012 15013 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15014 vector bool long long __b) { 15015 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 15016 __a); 15017 } 15018 15019 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15020 vector bool long long __b) { 15021 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15022 __a); 15023 } 15024 15025 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15026 vector signed long long __b) { 15027 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15028 (vector unsigned long long)__a); 15029 } 15030 15031 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15032 vector unsigned long long __b) { 15033 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 15034 (vector unsigned long long)__a); 15035 } 15036 15037 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15038 vector bool long long __b) { 15039 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15040 (vector unsigned long long)__a); 15041 } 15042 #endif 15043 15044 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 15045 vector float __b) { 15046 #ifdef __VSX__ 15047 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 15048 #else 15049 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 15050 #endif 15051 } 15052 15053 #ifdef __VSX__ 15054 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 15055 vector double __b) { 15056 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 15057 } 15058 #endif 15059 15060 #ifdef __POWER10_VECTOR__ 15061 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a, 15062 vector signed __int128 __b) { 15063 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a); 15064 } 15065 15066 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a, 15067 vector unsigned __int128 __b) { 15068 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a); 15069 } 15070 #endif 15071 15072 /* vec_all_nan */ 15073 15074 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 15075 #ifdef __VSX__ 15076 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 15077 #else 15078 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 15079 #endif 15080 } 15081 15082 #ifdef __VSX__ 15083 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 15084 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 15085 } 15086 #endif 15087 15088 /* vec_all_ne */ 15089 15090 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15091 vector signed char __b) { 15092 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15093 (vector char)__b); 15094 } 15095 15096 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15097 vector bool char __b) { 15098 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15099 (vector char)__b); 15100 } 15101 15102 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15103 vector unsigned char __b) { 15104 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15105 (vector char)__b); 15106 } 15107 15108 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15109 vector bool char __b) { 15110 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15111 (vector char)__b); 15112 } 15113 15114 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15115 vector signed char __b) { 15116 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15117 (vector char)__b); 15118 } 15119 15120 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15121 vector unsigned char __b) { 15122 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15123 (vector char)__b); 15124 } 15125 15126 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15127 vector bool char __b) { 15128 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15129 (vector char)__b); 15130 } 15131 15132 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15133 vector short __b) { 15134 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 15135 } 15136 15137 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15138 vector bool short __b) { 15139 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 15140 } 15141 15142 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15143 vector unsigned short __b) { 15144 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15145 (vector short)__b); 15146 } 15147 15148 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15149 vector bool short __b) { 15150 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15151 (vector short)__b); 15152 } 15153 15154 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15155 vector short __b) { 15156 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15157 (vector short)__b); 15158 } 15159 15160 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15161 vector unsigned short __b) { 15162 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15163 (vector short)__b); 15164 } 15165 15166 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15167 vector bool short __b) { 15168 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15169 (vector short)__b); 15170 } 15171 15172 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 15173 vector pixel __b) { 15174 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15175 (vector short)__b); 15176 } 15177 15178 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 15179 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 15180 } 15181 15182 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 15183 vector bool int __b) { 15184 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 15185 } 15186 15187 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15188 vector unsigned int __b) { 15189 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15190 (vector int)__b); 15191 } 15192 15193 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15194 vector bool int __b) { 15195 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15196 (vector int)__b); 15197 } 15198 15199 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15200 vector int __b) { 15201 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15202 (vector int)__b); 15203 } 15204 15205 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15206 vector unsigned int __b) { 15207 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15208 (vector int)__b); 15209 } 15210 15211 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15212 vector bool int __b) { 15213 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15214 (vector int)__b); 15215 } 15216 15217 #ifdef __POWER8_VECTOR__ 15218 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15219 vector signed long long __b) { 15220 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 15221 } 15222 15223 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15224 vector unsigned long long __b) { 15225 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 15226 (vector long long)__b); 15227 } 15228 15229 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15230 vector bool long long __b) { 15231 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 15232 (vector signed long long)__b); 15233 } 15234 15235 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15236 vector bool long long __b) { 15237 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15238 (vector signed long long)__b); 15239 } 15240 15241 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15242 vector signed long long __b) { 15243 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15244 (vector signed long long)__b); 15245 } 15246 15247 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15248 vector unsigned long long __b) { 15249 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15250 (vector signed long long)__b); 15251 } 15252 15253 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15254 vector bool long long __b) { 15255 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15256 (vector signed long long)__b); 15257 } 15258 #endif 15259 15260 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 15261 vector float __b) { 15262 #ifdef __VSX__ 15263 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); 15264 #else 15265 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 15266 #endif 15267 } 15268 15269 #ifdef __VSX__ 15270 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 15271 vector double __b) { 15272 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 15273 } 15274 #endif 15275 15276 #ifdef __POWER10_VECTOR__ 15277 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a, 15278 vector signed __int128 __b) { 15279 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15280 } 15281 15282 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a, 15283 vector unsigned __int128 __b) { 15284 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15285 } 15286 #endif 15287 15288 /* vec_all_nge */ 15289 15290 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 15291 vector float __b) { 15292 #ifdef __VSX__ 15293 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 15294 #else 15295 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 15296 #endif 15297 } 15298 15299 #ifdef __VSX__ 15300 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 15301 vector double __b) { 15302 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 15303 } 15304 #endif 15305 15306 /* vec_all_ngt */ 15307 15308 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 15309 vector float __b) { 15310 #ifdef __VSX__ 15311 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 15312 #else 15313 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 15314 #endif 15315 } 15316 15317 #ifdef __VSX__ 15318 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 15319 vector double __b) { 15320 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 15321 } 15322 #endif 15323 15324 /* vec_all_nle */ 15325 15326 static __inline__ int __attribute__((__always_inline__)) 15327 vec_all_nle(vector float __a, vector float __b) { 15328 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 15329 } 15330 15331 /* vec_all_nlt */ 15332 15333 static __inline__ int __attribute__((__always_inline__)) 15334 vec_all_nlt(vector float __a, vector float __b) { 15335 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 15336 } 15337 15338 /* vec_all_numeric */ 15339 15340 static __inline__ int __attribute__((__always_inline__)) 15341 vec_all_numeric(vector float __a) { 15342 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 15343 } 15344 15345 /* vec_any_eq */ 15346 15347 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15348 vector signed char __b) { 15349 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15350 (vector char)__b); 15351 } 15352 15353 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15354 vector bool char __b) { 15355 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15356 (vector char)__b); 15357 } 15358 15359 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15360 vector unsigned char __b) { 15361 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15362 (vector char)__b); 15363 } 15364 15365 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15366 vector bool char __b) { 15367 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15368 (vector char)__b); 15369 } 15370 15371 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15372 vector signed char __b) { 15373 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15374 (vector char)__b); 15375 } 15376 15377 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15378 vector unsigned char __b) { 15379 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15380 (vector char)__b); 15381 } 15382 15383 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15384 vector bool char __b) { 15385 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15386 (vector char)__b); 15387 } 15388 15389 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 15390 vector short __b) { 15391 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 15392 } 15393 15394 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 15395 vector bool short __b) { 15396 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 15397 } 15398 15399 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 15400 vector unsigned short __b) { 15401 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15402 (vector short)__b); 15403 } 15404 15405 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 15406 vector bool short __b) { 15407 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15408 (vector short)__b); 15409 } 15410 15411 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 15412 vector short __b) { 15413 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15414 (vector short)__b); 15415 } 15416 15417 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 15418 vector unsigned short __b) { 15419 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15420 (vector short)__b); 15421 } 15422 15423 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 15424 vector bool short __b) { 15425 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15426 (vector short)__b); 15427 } 15428 15429 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 15430 vector pixel __b) { 15431 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15432 (vector short)__b); 15433 } 15434 15435 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 15436 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 15437 } 15438 15439 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 15440 vector bool int __b) { 15441 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 15442 } 15443 15444 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 15445 vector unsigned int __b) { 15446 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15447 (vector int)__b); 15448 } 15449 15450 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 15451 vector bool int __b) { 15452 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15453 (vector int)__b); 15454 } 15455 15456 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 15457 vector int __b) { 15458 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15459 (vector int)__b); 15460 } 15461 15462 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 15463 vector unsigned int __b) { 15464 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15465 (vector int)__b); 15466 } 15467 15468 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 15469 vector bool int __b) { 15470 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 15471 (vector int)__b); 15472 } 15473 15474 #ifdef __POWER8_VECTOR__ 15475 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 15476 vector signed long long __b) { 15477 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 15478 } 15479 15480 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 15481 vector unsigned long long __b) { 15482 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 15483 (vector long long)__b); 15484 } 15485 15486 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 15487 vector bool long long __b) { 15488 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 15489 (vector signed long long)__b); 15490 } 15491 15492 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 15493 vector bool long long __b) { 15494 return __builtin_altivec_vcmpequd_p( 15495 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15496 } 15497 15498 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 15499 vector signed long long __b) { 15500 return __builtin_altivec_vcmpequd_p( 15501 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15502 } 15503 15504 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 15505 vector unsigned long long __b) { 15506 return __builtin_altivec_vcmpequd_p( 15507 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15508 } 15509 15510 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 15511 vector bool long long __b) { 15512 return __builtin_altivec_vcmpequd_p( 15513 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 15514 } 15515 #endif 15516 15517 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 15518 vector float __b) { 15519 #ifdef __VSX__ 15520 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 15521 #else 15522 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 15523 #endif 15524 } 15525 15526 #ifdef __VSX__ 15527 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 15528 vector double __b) { 15529 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 15530 } 15531 #endif 15532 15533 #ifdef __POWER10_VECTOR__ 15534 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a, 15535 vector signed __int128 __b) { 15536 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 15537 } 15538 15539 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a, 15540 vector unsigned __int128 __b) { 15541 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 15542 } 15543 #endif 15544 15545 /* vec_any_ge */ 15546 15547 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 15548 vector signed char __b) { 15549 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 15550 } 15551 15552 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 15553 vector bool char __b) { 15554 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 15555 __a); 15556 } 15557 15558 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 15559 vector unsigned char __b) { 15560 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 15561 } 15562 15563 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 15564 vector bool char __b) { 15565 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 15566 __a); 15567 } 15568 15569 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 15570 vector signed char __b) { 15571 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 15572 (vector unsigned char)__a); 15573 } 15574 15575 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 15576 vector unsigned char __b) { 15577 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 15578 (vector unsigned char)__a); 15579 } 15580 15581 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 15582 vector bool char __b) { 15583 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 15584 (vector unsigned char)__a); 15585 } 15586 15587 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 15588 vector short __b) { 15589 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 15590 } 15591 15592 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 15593 vector bool short __b) { 15594 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 15595 } 15596 15597 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 15598 vector unsigned short __b) { 15599 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 15600 } 15601 15602 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 15603 vector bool short __b) { 15604 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 15605 __a); 15606 } 15607 15608 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 15609 vector short __b) { 15610 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 15611 (vector unsigned short)__a); 15612 } 15613 15614 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 15615 vector unsigned short __b) { 15616 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 15617 (vector unsigned short)__a); 15618 } 15619 15620 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 15621 vector bool short __b) { 15622 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 15623 (vector unsigned short)__a); 15624 } 15625 15626 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 15627 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 15628 } 15629 15630 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 15631 vector bool int __b) { 15632 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 15633 } 15634 15635 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 15636 vector unsigned int __b) { 15637 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 15638 } 15639 15640 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 15641 vector bool int __b) { 15642 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 15643 __a); 15644 } 15645 15646 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 15647 vector int __b) { 15648 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 15649 (vector unsigned int)__a); 15650 } 15651 15652 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 15653 vector unsigned int __b) { 15654 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 15655 (vector unsigned int)__a); 15656 } 15657 15658 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 15659 vector bool int __b) { 15660 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 15661 (vector unsigned int)__a); 15662 } 15663 15664 #ifdef __POWER8_VECTOR__ 15665 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 15666 vector signed long long __b) { 15667 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 15668 } 15669 15670 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 15671 vector unsigned long long __b) { 15672 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 15673 } 15674 15675 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 15676 vector bool long long __b) { 15677 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 15678 (vector signed long long)__b, __a); 15679 } 15680 15681 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 15682 vector bool long long __b) { 15683 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15684 (vector unsigned long long)__b, __a); 15685 } 15686 15687 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 15688 vector signed long long __b) { 15689 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15690 (vector unsigned long long)__b, 15691 (vector unsigned long long)__a); 15692 } 15693 15694 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 15695 vector unsigned long long __b) { 15696 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 15697 (vector unsigned long long)__a); 15698 } 15699 15700 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 15701 vector bool long long __b) { 15702 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 15703 (vector unsigned long long)__b, 15704 (vector unsigned long long)__a); 15705 } 15706 #endif 15707 15708 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 15709 vector float __b) { 15710 #ifdef __VSX__ 15711 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 15712 #else 15713 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 15714 #endif 15715 } 15716 15717 #ifdef __VSX__ 15718 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 15719 vector double __b) { 15720 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 15721 } 15722 #endif 15723 15724 #ifdef __POWER10_VECTOR__ 15725 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, 15726 vector signed __int128 __b) { 15727 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); 15728 } 15729 15730 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, 15731 vector unsigned __int128 __b) { 15732 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); 15733 } 15734 #endif 15735 15736 /* vec_any_gt */ 15737 15738 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 15739 vector signed char __b) { 15740 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 15741 } 15742 15743 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 15744 vector bool char __b) { 15745 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 15746 (vector signed char)__b); 15747 } 15748 15749 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 15750 vector unsigned char __b) { 15751 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 15752 } 15753 15754 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 15755 vector bool char __b) { 15756 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 15757 (vector unsigned char)__b); 15758 } 15759 15760 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 15761 vector signed char __b) { 15762 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 15763 (vector unsigned char)__b); 15764 } 15765 15766 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 15767 vector unsigned char __b) { 15768 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 15769 __b); 15770 } 15771 15772 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 15773 vector bool char __b) { 15774 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 15775 (vector unsigned char)__b); 15776 } 15777 15778 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 15779 vector short __b) { 15780 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 15781 } 15782 15783 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 15784 vector bool short __b) { 15785 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 15786 } 15787 15788 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 15789 vector unsigned short __b) { 15790 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 15791 } 15792 15793 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 15794 vector bool short __b) { 15795 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 15796 (vector unsigned short)__b); 15797 } 15798 15799 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 15800 vector short __b) { 15801 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 15802 (vector unsigned short)__b); 15803 } 15804 15805 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 15806 vector unsigned short __b) { 15807 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 15808 __b); 15809 } 15810 15811 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 15812 vector bool short __b) { 15813 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 15814 (vector unsigned short)__b); 15815 } 15816 15817 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 15818 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 15819 } 15820 15821 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 15822 vector bool int __b) { 15823 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 15824 } 15825 15826 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 15827 vector unsigned int __b) { 15828 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 15829 } 15830 15831 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 15832 vector bool int __b) { 15833 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 15834 (vector unsigned int)__b); 15835 } 15836 15837 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 15838 vector int __b) { 15839 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 15840 (vector unsigned int)__b); 15841 } 15842 15843 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 15844 vector unsigned int __b) { 15845 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 15846 __b); 15847 } 15848 15849 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 15850 vector bool int __b) { 15851 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 15852 (vector unsigned int)__b); 15853 } 15854 15855 #ifdef __POWER8_VECTOR__ 15856 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 15857 vector signed long long __b) { 15858 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 15859 } 15860 15861 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 15862 vector unsigned long long __b) { 15863 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 15864 } 15865 15866 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 15867 vector bool long long __b) { 15868 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 15869 (vector signed long long)__b); 15870 } 15871 15872 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 15873 vector bool long long __b) { 15874 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 15875 (vector unsigned long long)__b); 15876 } 15877 15878 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 15879 vector signed long long __b) { 15880 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15881 (vector unsigned long long)__a, 15882 (vector unsigned long long)__b); 15883 } 15884 15885 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 15886 vector unsigned long long __b) { 15887 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15888 (vector unsigned long long)__a, __b); 15889 } 15890 15891 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 15892 vector bool long long __b) { 15893 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 15894 (vector unsigned long long)__a, 15895 (vector unsigned long long)__b); 15896 } 15897 #endif 15898 15899 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 15900 vector float __b) { 15901 #ifdef __VSX__ 15902 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 15903 #else 15904 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 15905 #endif 15906 } 15907 15908 #ifdef __VSX__ 15909 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 15910 vector double __b) { 15911 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 15912 } 15913 #endif 15914 15915 #ifdef __POWER10_VECTOR__ 15916 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, 15917 vector signed __int128 __b) { 15918 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); 15919 } 15920 15921 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, 15922 vector unsigned __int128 __b) { 15923 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); 15924 } 15925 #endif 15926 15927 /* vec_any_le */ 15928 15929 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 15930 vector signed char __b) { 15931 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 15932 } 15933 15934 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 15935 vector bool char __b) { 15936 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 15937 (vector signed char)__b); 15938 } 15939 15940 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 15941 vector unsigned char __b) { 15942 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 15943 } 15944 15945 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 15946 vector bool char __b) { 15947 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 15948 (vector unsigned char)__b); 15949 } 15950 15951 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 15952 vector signed char __b) { 15953 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 15954 (vector unsigned char)__b); 15955 } 15956 15957 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 15958 vector unsigned char __b) { 15959 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 15960 __b); 15961 } 15962 15963 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 15964 vector bool char __b) { 15965 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 15966 (vector unsigned char)__b); 15967 } 15968 15969 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 15970 vector short __b) { 15971 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 15972 } 15973 15974 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 15975 vector bool short __b) { 15976 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 15977 } 15978 15979 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 15980 vector unsigned short __b) { 15981 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 15982 } 15983 15984 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 15985 vector bool short __b) { 15986 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 15987 (vector unsigned short)__b); 15988 } 15989 15990 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 15991 vector short __b) { 15992 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 15993 (vector unsigned short)__b); 15994 } 15995 15996 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 15997 vector unsigned short __b) { 15998 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 15999 __b); 16000 } 16001 16002 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16003 vector bool short __b) { 16004 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16005 (vector unsigned short)__b); 16006 } 16007 16008 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 16009 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 16010 } 16011 16012 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 16013 vector bool int __b) { 16014 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 16015 } 16016 16017 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16018 vector unsigned int __b) { 16019 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 16020 } 16021 16022 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16023 vector bool int __b) { 16024 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 16025 (vector unsigned int)__b); 16026 } 16027 16028 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16029 vector int __b) { 16030 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16031 (vector unsigned int)__b); 16032 } 16033 16034 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16035 vector unsigned int __b) { 16036 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16037 __b); 16038 } 16039 16040 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16041 vector bool int __b) { 16042 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16043 (vector unsigned int)__b); 16044 } 16045 16046 #ifdef __POWER8_VECTOR__ 16047 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16048 vector signed long long __b) { 16049 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 16050 } 16051 16052 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16053 vector unsigned long long __b) { 16054 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 16055 } 16056 16057 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16058 vector bool long long __b) { 16059 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 16060 (vector signed long long)__b); 16061 } 16062 16063 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16064 vector bool long long __b) { 16065 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 16066 (vector unsigned long long)__b); 16067 } 16068 16069 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16070 vector signed long long __b) { 16071 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16072 (vector unsigned long long)__a, 16073 (vector unsigned long long)__b); 16074 } 16075 16076 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16077 vector unsigned long long __b) { 16078 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16079 (vector unsigned long long)__a, __b); 16080 } 16081 16082 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16083 vector bool long long __b) { 16084 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16085 (vector unsigned long long)__a, 16086 (vector unsigned long long)__b); 16087 } 16088 #endif 16089 16090 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 16091 vector float __b) { 16092 #ifdef __VSX__ 16093 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 16094 #else 16095 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 16096 #endif 16097 } 16098 16099 #ifdef __VSX__ 16100 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 16101 vector double __b) { 16102 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 16103 } 16104 #endif 16105 16106 #ifdef __POWER10_VECTOR__ 16107 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, 16108 vector signed __int128 __b) { 16109 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); 16110 } 16111 16112 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, 16113 vector unsigned __int128 __b) { 16114 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); 16115 } 16116 #endif 16117 16118 /* vec_any_lt */ 16119 16120 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16121 vector signed char __b) { 16122 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 16123 } 16124 16125 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16126 vector bool char __b) { 16127 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 16128 __a); 16129 } 16130 16131 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16132 vector unsigned char __b) { 16133 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 16134 } 16135 16136 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16137 vector bool char __b) { 16138 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16139 __a); 16140 } 16141 16142 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16143 vector signed char __b) { 16144 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16145 (vector unsigned char)__a); 16146 } 16147 16148 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16149 vector unsigned char __b) { 16150 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 16151 (vector unsigned char)__a); 16152 } 16153 16154 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16155 vector bool char __b) { 16156 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16157 (vector unsigned char)__a); 16158 } 16159 16160 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16161 vector short __b) { 16162 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 16163 } 16164 16165 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16166 vector bool short __b) { 16167 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 16168 } 16169 16170 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16171 vector unsigned short __b) { 16172 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 16173 } 16174 16175 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16176 vector bool short __b) { 16177 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16178 __a); 16179 } 16180 16181 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16182 vector short __b) { 16183 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16184 (vector unsigned short)__a); 16185 } 16186 16187 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16188 vector unsigned short __b) { 16189 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 16190 (vector unsigned short)__a); 16191 } 16192 16193 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16194 vector bool short __b) { 16195 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16196 (vector unsigned short)__a); 16197 } 16198 16199 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 16200 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 16201 } 16202 16203 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 16204 vector bool int __b) { 16205 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 16206 } 16207 16208 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16209 vector unsigned int __b) { 16210 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 16211 } 16212 16213 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16214 vector bool int __b) { 16215 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16216 __a); 16217 } 16218 16219 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16220 vector int __b) { 16221 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16222 (vector unsigned int)__a); 16223 } 16224 16225 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16226 vector unsigned int __b) { 16227 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 16228 (vector unsigned int)__a); 16229 } 16230 16231 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16232 vector bool int __b) { 16233 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16234 (vector unsigned int)__a); 16235 } 16236 16237 #ifdef __POWER8_VECTOR__ 16238 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16239 vector signed long long __b) { 16240 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 16241 } 16242 16243 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16244 vector unsigned long long __b) { 16245 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 16246 } 16247 16248 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16249 vector bool long long __b) { 16250 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16251 (vector signed long long)__b, __a); 16252 } 16253 16254 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16255 vector bool long long __b) { 16256 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16257 (vector unsigned long long)__b, __a); 16258 } 16259 16260 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16261 vector signed long long __b) { 16262 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16263 (vector unsigned long long)__b, 16264 (vector unsigned long long)__a); 16265 } 16266 16267 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16268 vector unsigned long long __b) { 16269 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 16270 (vector unsigned long long)__a); 16271 } 16272 16273 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16274 vector bool long long __b) { 16275 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16276 (vector unsigned long long)__b, 16277 (vector unsigned long long)__a); 16278 } 16279 #endif 16280 16281 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 16282 vector float __b) { 16283 #ifdef __VSX__ 16284 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 16285 #else 16286 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 16287 #endif 16288 } 16289 16290 #ifdef __VSX__ 16291 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 16292 vector double __b) { 16293 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 16294 } 16295 #endif 16296 16297 #ifdef __POWER10_VECTOR__ 16298 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, 16299 vector signed __int128 __b) { 16300 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); 16301 } 16302 16303 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, 16304 vector unsigned __int128 __b) { 16305 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); 16306 } 16307 #endif 16308 16309 /* vec_any_nan */ 16310 16311 static __inline__ int __attribute__((__always_inline__)) 16312 vec_any_nan(vector float __a) { 16313 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 16314 } 16315 16316 /* vec_any_ne */ 16317 16318 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16319 vector signed char __b) { 16320 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16321 (vector char)__b); 16322 } 16323 16324 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16325 vector bool char __b) { 16326 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16327 (vector char)__b); 16328 } 16329 16330 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16331 vector unsigned char __b) { 16332 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16333 (vector char)__b); 16334 } 16335 16336 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16337 vector bool char __b) { 16338 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16339 (vector char)__b); 16340 } 16341 16342 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16343 vector signed char __b) { 16344 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16345 (vector char)__b); 16346 } 16347 16348 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16349 vector unsigned char __b) { 16350 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16351 (vector char)__b); 16352 } 16353 16354 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16355 vector bool char __b) { 16356 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16357 (vector char)__b); 16358 } 16359 16360 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16361 vector short __b) { 16362 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 16363 } 16364 16365 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16366 vector bool short __b) { 16367 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 16368 } 16369 16370 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16371 vector unsigned short __b) { 16372 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16373 (vector short)__b); 16374 } 16375 16376 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16377 vector bool short __b) { 16378 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16379 (vector short)__b); 16380 } 16381 16382 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16383 vector short __b) { 16384 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16385 (vector short)__b); 16386 } 16387 16388 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16389 vector unsigned short __b) { 16390 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16391 (vector short)__b); 16392 } 16393 16394 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16395 vector bool short __b) { 16396 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16397 (vector short)__b); 16398 } 16399 16400 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 16401 vector pixel __b) { 16402 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16403 (vector short)__b); 16404 } 16405 16406 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 16407 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 16408 } 16409 16410 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 16411 vector bool int __b) { 16412 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 16413 } 16414 16415 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 16416 vector unsigned int __b) { 16417 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16418 (vector int)__b); 16419 } 16420 16421 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 16422 vector bool int __b) { 16423 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16424 (vector int)__b); 16425 } 16426 16427 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 16428 vector int __b) { 16429 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16430 (vector int)__b); 16431 } 16432 16433 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 16434 vector unsigned int __b) { 16435 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16436 (vector int)__b); 16437 } 16438 16439 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 16440 vector bool int __b) { 16441 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16442 (vector int)__b); 16443 } 16444 16445 #ifdef __POWER8_VECTOR__ 16446 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 16447 vector signed long long __b) { 16448 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 16449 } 16450 16451 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 16452 vector unsigned long long __b) { 16453 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, 16454 (vector long long)__b); 16455 } 16456 16457 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 16458 vector bool long long __b) { 16459 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, 16460 (vector signed long long)__b); 16461 } 16462 16463 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 16464 vector bool long long __b) { 16465 return __builtin_altivec_vcmpequd_p( 16466 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 16467 } 16468 16469 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 16470 vector signed long long __b) { 16471 return __builtin_altivec_vcmpequd_p( 16472 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 16473 } 16474 16475 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 16476 vector unsigned long long __b) { 16477 return __builtin_altivec_vcmpequd_p( 16478 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 16479 } 16480 16481 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 16482 vector bool long long __b) { 16483 return __builtin_altivec_vcmpequd_p( 16484 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 16485 } 16486 #endif 16487 16488 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 16489 vector float __b) { 16490 #ifdef __VSX__ 16491 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 16492 #else 16493 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 16494 #endif 16495 } 16496 16497 #ifdef __VSX__ 16498 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 16499 vector double __b) { 16500 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 16501 } 16502 #endif 16503 16504 #ifdef __POWER10_VECTOR__ 16505 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, 16506 vector signed __int128 __b) { 16507 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 16508 } 16509 16510 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, 16511 vector unsigned __int128 __b) { 16512 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 16513 } 16514 #endif 16515 16516 /* vec_any_nge */ 16517 16518 static __inline__ int __attribute__((__always_inline__)) 16519 vec_any_nge(vector float __a, vector float __b) { 16520 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 16521 } 16522 16523 /* vec_any_ngt */ 16524 16525 static __inline__ int __attribute__((__always_inline__)) 16526 vec_any_ngt(vector float __a, vector float __b) { 16527 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 16528 } 16529 16530 /* vec_any_nle */ 16531 16532 static __inline__ int __attribute__((__always_inline__)) 16533 vec_any_nle(vector float __a, vector float __b) { 16534 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 16535 } 16536 16537 /* vec_any_nlt */ 16538 16539 static __inline__ int __attribute__((__always_inline__)) 16540 vec_any_nlt(vector float __a, vector float __b) { 16541 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 16542 } 16543 16544 /* vec_any_numeric */ 16545 16546 static __inline__ int __attribute__((__always_inline__)) 16547 vec_any_numeric(vector float __a) { 16548 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 16549 } 16550 16551 /* vec_any_out */ 16552 16553 static __inline__ int __attribute__((__always_inline__)) 16554 vec_any_out(vector float __a, vector float __b) { 16555 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 16556 } 16557 16558 /* Power 8 Crypto functions 16559 Note: We diverge from the current GCC implementation with regard 16560 to cryptography and related functions as follows: 16561 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 16562 - The remaining ones are only available on Power8 and up so 16563 require -mpower8-vector 16564 The justification for this is that export requirements require that 16565 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 16566 support). As a result, we need to be able to turn off support for those. 16567 The remaining ones (currently controlled by -mcrypto for GCC) still 16568 need to be provided on compliant hardware even if Vector.Crypto is not 16569 provided. 16570 */ 16571 #ifdef __CRYPTO__ 16572 #define vec_sbox_be __builtin_altivec_crypto_vsbox 16573 #define vec_cipher_be __builtin_altivec_crypto_vcipher 16574 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 16575 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 16576 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 16577 16578 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16579 __builtin_crypto_vsbox(vector unsigned long long __a) { 16580 return __builtin_altivec_crypto_vsbox(__a); 16581 } 16582 16583 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16584 __builtin_crypto_vcipher(vector unsigned long long __a, 16585 vector unsigned long long __b) { 16586 return __builtin_altivec_crypto_vcipher(__a, __b); 16587 } 16588 16589 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16590 __builtin_crypto_vcipherlast(vector unsigned long long __a, 16591 vector unsigned long long __b) { 16592 return __builtin_altivec_crypto_vcipherlast(__a, __b); 16593 } 16594 16595 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16596 __builtin_crypto_vncipher(vector unsigned long long __a, 16597 vector unsigned long long __b) { 16598 return __builtin_altivec_crypto_vncipher(__a, __b); 16599 } 16600 16601 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16602 __builtin_crypto_vncipherlast(vector unsigned long long __a, 16603 vector unsigned long long __b) { 16604 return __builtin_altivec_crypto_vncipherlast(__a, __b); 16605 } 16606 16607 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 16608 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 16609 16610 #define vec_shasigma_be(X, Y, Z) \ 16611 _Generic((X), vector unsigned int \ 16612 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 16613 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 16614 #endif 16615 16616 #ifdef __POWER8_VECTOR__ 16617 static __inline__ vector bool char __ATTRS_o_ai 16618 vec_permxor(vector bool char __a, vector bool char __b, 16619 vector bool char __c) { 16620 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16621 } 16622 16623 static __inline__ vector signed char __ATTRS_o_ai 16624 vec_permxor(vector signed char __a, vector signed char __b, 16625 vector signed char __c) { 16626 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16627 } 16628 16629 static __inline__ vector unsigned char __ATTRS_o_ai 16630 vec_permxor(vector unsigned char __a, vector unsigned char __b, 16631 vector unsigned char __c) { 16632 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16633 } 16634 16635 static __inline__ vector unsigned char __ATTRS_o_ai 16636 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 16637 vector unsigned char __c) { 16638 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 16639 } 16640 16641 static __inline__ vector unsigned short __ATTRS_o_ai 16642 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 16643 vector unsigned short __c) { 16644 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 16645 (vector unsigned char)__a, (vector unsigned char)__b, 16646 (vector unsigned char)__c); 16647 } 16648 16649 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 16650 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 16651 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 16652 (vector unsigned char)__a, (vector unsigned char)__b, 16653 (vector unsigned char)__c); 16654 } 16655 16656 static __inline__ vector unsigned long long __ATTRS_o_ai 16657 __builtin_crypto_vpermxor(vector unsigned long long __a, 16658 vector unsigned long long __b, 16659 vector unsigned long long __c) { 16660 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 16661 (vector unsigned char)__a, (vector unsigned char)__b, 16662 (vector unsigned char)__c); 16663 } 16664 16665 static __inline__ vector unsigned char __ATTRS_o_ai 16666 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 16667 return __builtin_altivec_crypto_vpmsumb(__a, __b); 16668 } 16669 16670 static __inline__ vector unsigned short __ATTRS_o_ai 16671 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 16672 return __builtin_altivec_crypto_vpmsumh(__a, __b); 16673 } 16674 16675 static __inline__ vector unsigned int __ATTRS_o_ai 16676 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 16677 return __builtin_altivec_crypto_vpmsumw(__a, __b); 16678 } 16679 16680 static __inline__ vector unsigned long long __ATTRS_o_ai 16681 __builtin_crypto_vpmsumb(vector unsigned long long __a, 16682 vector unsigned long long __b) { 16683 return __builtin_altivec_crypto_vpmsumd(__a, __b); 16684 } 16685 16686 static __inline__ vector signed char __ATTRS_o_ai 16687 vec_vgbbd(vector signed char __a) { 16688 return __builtin_altivec_vgbbd((vector unsigned char)__a); 16689 } 16690 16691 #define vec_pmsum_be __builtin_crypto_vpmsumb 16692 #define vec_gb __builtin_altivec_vgbbd 16693 16694 static __inline__ vector unsigned char __ATTRS_o_ai 16695 vec_vgbbd(vector unsigned char __a) { 16696 return __builtin_altivec_vgbbd(__a); 16697 } 16698 16699 static __inline__ vector long long __ATTRS_o_ai 16700 vec_vbpermq(vector signed char __a, vector signed char __b) { 16701 return __builtin_altivec_vbpermq((vector unsigned char)__a, 16702 (vector unsigned char)__b); 16703 } 16704 16705 static __inline__ vector long long __ATTRS_o_ai 16706 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 16707 return __builtin_altivec_vbpermq(__a, __b); 16708 } 16709 16710 #ifdef __powerpc64__ 16711 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 16712 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 16713 return __builtin_altivec_vbpermq((vector unsigned char)__a, 16714 (vector unsigned char)__b); 16715 } 16716 #endif 16717 #endif 16718 16719 16720 /* vec_reve */ 16721 16722 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 16723 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 16724 5, 4, 3, 2, 1, 0); 16725 } 16726 16727 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 16728 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 16729 5, 4, 3, 2, 1, 0); 16730 } 16731 16732 static inline __ATTRS_o_ai vector unsigned char 16733 vec_reve(vector unsigned char __a) { 16734 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 16735 5, 4, 3, 2, 1, 0); 16736 } 16737 16738 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 16739 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16740 } 16741 16742 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 16743 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16744 } 16745 16746 static inline __ATTRS_o_ai vector unsigned int 16747 vec_reve(vector unsigned int __a) { 16748 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16749 } 16750 16751 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 16752 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 16753 } 16754 16755 static inline __ATTRS_o_ai vector signed short 16756 vec_reve(vector signed short __a) { 16757 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 16758 } 16759 16760 static inline __ATTRS_o_ai vector unsigned short 16761 vec_reve(vector unsigned short __a) { 16762 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 16763 } 16764 16765 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 16766 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 16767 } 16768 16769 #ifdef __VSX__ 16770 static inline __ATTRS_o_ai vector bool long long 16771 vec_reve(vector bool long long __a) { 16772 return __builtin_shufflevector(__a, __a, 1, 0); 16773 } 16774 16775 static inline __ATTRS_o_ai vector signed long long 16776 vec_reve(vector signed long long __a) { 16777 return __builtin_shufflevector(__a, __a, 1, 0); 16778 } 16779 16780 static inline __ATTRS_o_ai vector unsigned long long 16781 vec_reve(vector unsigned long long __a) { 16782 return __builtin_shufflevector(__a, __a, 1, 0); 16783 } 16784 16785 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 16786 return __builtin_shufflevector(__a, __a, 1, 0); 16787 } 16788 #endif 16789 16790 /* vec_revb */ 16791 static __inline__ vector bool char __ATTRS_o_ai 16792 vec_revb(vector bool char __a) { 16793 return __a; 16794 } 16795 16796 static __inline__ vector signed char __ATTRS_o_ai 16797 vec_revb(vector signed char __a) { 16798 return __a; 16799 } 16800 16801 static __inline__ vector unsigned char __ATTRS_o_ai 16802 vec_revb(vector unsigned char __a) { 16803 return __a; 16804 } 16805 16806 static __inline__ vector bool short __ATTRS_o_ai 16807 vec_revb(vector bool short __a) { 16808 vector unsigned char __indices = 16809 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 16810 return vec_perm(__a, __a, __indices); 16811 } 16812 16813 static __inline__ vector signed short __ATTRS_o_ai 16814 vec_revb(vector signed short __a) { 16815 vector unsigned char __indices = 16816 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 16817 return vec_perm(__a, __a, __indices); 16818 } 16819 16820 static __inline__ vector unsigned short __ATTRS_o_ai 16821 vec_revb(vector unsigned short __a) { 16822 vector unsigned char __indices = 16823 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 16824 return vec_perm(__a, __a, __indices); 16825 } 16826 16827 static __inline__ vector bool int __ATTRS_o_ai 16828 vec_revb(vector bool int __a) { 16829 vector unsigned char __indices = 16830 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16831 return vec_perm(__a, __a, __indices); 16832 } 16833 16834 static __inline__ vector signed int __ATTRS_o_ai 16835 vec_revb(vector signed int __a) { 16836 vector unsigned char __indices = 16837 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16838 return vec_perm(__a, __a, __indices); 16839 } 16840 16841 static __inline__ vector unsigned int __ATTRS_o_ai 16842 vec_revb(vector unsigned int __a) { 16843 vector unsigned char __indices = 16844 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16845 return vec_perm(__a, __a, __indices); 16846 } 16847 16848 static __inline__ vector float __ATTRS_o_ai 16849 vec_revb(vector float __a) { 16850 vector unsigned char __indices = 16851 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 16852 return vec_perm(__a, __a, __indices); 16853 } 16854 16855 #ifdef __VSX__ 16856 static __inline__ vector bool long long __ATTRS_o_ai 16857 vec_revb(vector bool long long __a) { 16858 vector unsigned char __indices = 16859 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16860 return vec_perm(__a, __a, __indices); 16861 } 16862 16863 static __inline__ vector signed long long __ATTRS_o_ai 16864 vec_revb(vector signed long long __a) { 16865 vector unsigned char __indices = 16866 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16867 return vec_perm(__a, __a, __indices); 16868 } 16869 16870 static __inline__ vector unsigned long long __ATTRS_o_ai 16871 vec_revb(vector unsigned long long __a) { 16872 vector unsigned char __indices = 16873 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16874 return vec_perm(__a, __a, __indices); 16875 } 16876 16877 static __inline__ vector double __ATTRS_o_ai 16878 vec_revb(vector double __a) { 16879 vector unsigned char __indices = 16880 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 16881 return vec_perm(__a, __a, __indices); 16882 } 16883 #endif /* End __VSX__ */ 16884 16885 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16886 static __inline__ vector signed __int128 __ATTRS_o_ai 16887 vec_revb(vector signed __int128 __a) { 16888 vector unsigned char __indices = 16889 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 16890 return (vector signed __int128)vec_perm((vector signed int)__a, 16891 (vector signed int)__a, 16892 __indices); 16893 } 16894 16895 static __inline__ vector unsigned __int128 __ATTRS_o_ai 16896 vec_revb(vector unsigned __int128 __a) { 16897 vector unsigned char __indices = 16898 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 16899 return (vector unsigned __int128)vec_perm((vector signed int)__a, 16900 (vector signed int)__a, 16901 __indices); 16902 } 16903 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 16904 16905 /* vec_xl */ 16906 16907 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 16908 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 16909 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 16910 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 16911 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 16912 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 16913 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 16914 16915 static inline __ATTRS_o_ai vector signed char vec_xl(signed long long __offset, 16916 const signed char *__ptr) { 16917 return *(unaligned_vec_schar *)(__ptr + __offset); 16918 } 16919 16920 static inline __ATTRS_o_ai vector unsigned char 16921 vec_xl(signed long long __offset, const unsigned char *__ptr) { 16922 return *(unaligned_vec_uchar*)(__ptr + __offset); 16923 } 16924 16925 static inline __ATTRS_o_ai vector signed short vec_xl(signed long long __offset, 16926 const signed short *__ptr) { 16927 signed char *__addr = (signed char *)__ptr + __offset; 16928 return *(unaligned_vec_sshort *)__addr; 16929 } 16930 16931 static inline __ATTRS_o_ai vector unsigned short 16932 vec_xl(signed long long __offset, const unsigned short *__ptr) { 16933 signed char *__addr = (signed char *)__ptr + __offset; 16934 return *(unaligned_vec_ushort *)__addr; 16935 } 16936 16937 static inline __ATTRS_o_ai vector signed int vec_xl(signed long long __offset, 16938 const signed int *__ptr) { 16939 signed char *__addr = (signed char *)__ptr + __offset; 16940 return *(unaligned_vec_sint *)__addr; 16941 } 16942 16943 static inline __ATTRS_o_ai vector unsigned int vec_xl(signed long long __offset, 16944 const unsigned int *__ptr) { 16945 signed char *__addr = (signed char *)__ptr + __offset; 16946 return *(unaligned_vec_uint *)__addr; 16947 } 16948 16949 static inline __ATTRS_o_ai vector float vec_xl(signed long long __offset, 16950 const float *__ptr) { 16951 signed char *__addr = (signed char *)__ptr + __offset; 16952 return *(unaligned_vec_float *)__addr; 16953 } 16954 16955 #ifdef __VSX__ 16956 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 16957 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 16958 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 16959 16960 static inline __ATTRS_o_ai vector signed long long 16961 vec_xl(signed long long __offset, const signed long long *__ptr) { 16962 signed char *__addr = (signed char *)__ptr + __offset; 16963 return *(unaligned_vec_sll *)__addr; 16964 } 16965 16966 static inline __ATTRS_o_ai vector unsigned long long 16967 vec_xl(signed long long __offset, const unsigned long long *__ptr) { 16968 signed char *__addr = (signed char *)__ptr + __offset; 16969 return *(unaligned_vec_ull *)__addr; 16970 } 16971 16972 static inline __ATTRS_o_ai vector double vec_xl(signed long long __offset, 16973 const double *__ptr) { 16974 signed char *__addr = (signed char *)__ptr + __offset; 16975 return *(unaligned_vec_double *)__addr; 16976 } 16977 #endif 16978 16979 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 16980 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 16981 typedef vector unsigned __int128 unaligned_vec_ui128 16982 __attribute__((aligned(1))); 16983 static inline __ATTRS_o_ai vector signed __int128 16984 vec_xl(signed long long __offset, const signed __int128 *__ptr) { 16985 signed char *__addr = (signed char *)__ptr + __offset; 16986 return *(unaligned_vec_si128 *)__addr; 16987 } 16988 16989 static inline __ATTRS_o_ai vector unsigned __int128 16990 vec_xl(signed long long __offset, const unsigned __int128 *__ptr) { 16991 signed char *__addr = (signed char *)__ptr + __offset; 16992 return *(unaligned_vec_ui128 *)__addr; 16993 } 16994 #endif 16995 16996 /* vec_xl_be */ 16997 16998 #ifdef __LITTLE_ENDIAN__ 16999 static __inline__ vector signed char __ATTRS_o_ai 17000 vec_xl_be(signed long long __offset, const signed char *__ptr) { 17001 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17002 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17003 13, 12, 11, 10, 9, 8); 17004 } 17005 17006 static __inline__ vector unsigned char __ATTRS_o_ai 17007 vec_xl_be(signed long long __offset, const unsigned char *__ptr) { 17008 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17009 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17010 13, 12, 11, 10, 9, 8); 17011 } 17012 17013 static __inline__ vector signed short __ATTRS_o_ai 17014 vec_xl_be(signed long long __offset, const signed short *__ptr) { 17015 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17016 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17017 } 17018 17019 static __inline__ vector unsigned short __ATTRS_o_ai 17020 vec_xl_be(signed long long __offset, const unsigned short *__ptr) { 17021 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17022 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17023 } 17024 17025 static __inline__ vector signed int __ATTRS_o_ai 17026 vec_xl_be(signed long long __offset, const signed int *__ptr) { 17027 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17028 } 17029 17030 static __inline__ vector unsigned int __ATTRS_o_ai 17031 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 17032 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17033 } 17034 17035 static __inline__ vector float __ATTRS_o_ai 17036 vec_xl_be(signed long long __offset, const float *__ptr) { 17037 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17038 } 17039 17040 #ifdef __VSX__ 17041 static __inline__ vector signed long long __ATTRS_o_ai 17042 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 17043 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17044 } 17045 17046 static __inline__ vector unsigned long long __ATTRS_o_ai 17047 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 17048 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17049 } 17050 17051 static __inline__ vector double __ATTRS_o_ai 17052 vec_xl_be(signed long long __offset, const double *__ptr) { 17053 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17054 } 17055 #endif 17056 17057 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 17058 static __inline__ vector signed __int128 __ATTRS_o_ai 17059 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 17060 return vec_xl(__offset, __ptr); 17061 } 17062 17063 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17064 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 17065 return vec_xl(__offset, __ptr); 17066 } 17067 #endif 17068 #else 17069 #define vec_xl_be vec_xl 17070 #endif 17071 17072 #if defined(__POWER10_VECTOR__) && defined(__VSX__) 17073 17074 /* vect_xl_sext */ 17075 17076 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17077 vec_xl_sext(signed long long __offset, const signed char *__pointer) { 17078 return (vector unsigned __int128)*(__pointer + __offset); 17079 } 17080 17081 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17082 vec_xl_sext(signed long long __offset, const signed short *__pointer) { 17083 return (vector unsigned __int128)*(__pointer + __offset); 17084 } 17085 17086 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17087 vec_xl_sext(signed long long __offset, const signed int *__pointer) { 17088 return (vector unsigned __int128)*(__pointer + __offset); 17089 } 17090 17091 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17092 vec_xl_sext(signed long long __offset, const signed long long *__pointer) { 17093 return (vector unsigned __int128)*(__pointer + __offset); 17094 } 17095 17096 /* vec_xl_zext */ 17097 17098 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17099 vec_xl_zext(signed long long __offset, const unsigned char *__pointer) { 17100 return (vector unsigned __int128)*(__pointer + __offset); 17101 } 17102 17103 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17104 vec_xl_zext(signed long long __offset, const unsigned short *__pointer) { 17105 return (vector unsigned __int128)*(__pointer + __offset); 17106 } 17107 17108 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17109 vec_xl_zext(signed long long __offset, const unsigned int *__pointer) { 17110 return (vector unsigned __int128)*(__pointer + __offset); 17111 } 17112 17113 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17114 vec_xl_zext(signed long long __offset, const unsigned long long *__pointer) { 17115 return (vector unsigned __int128)*(__pointer + __offset); 17116 } 17117 17118 #endif 17119 17120 /* vec_xst */ 17121 17122 static inline __ATTRS_o_ai void vec_xst(vector signed char __vec, 17123 signed long long __offset, 17124 signed char *__ptr) { 17125 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 17126 } 17127 17128 static inline __ATTRS_o_ai void vec_xst(vector unsigned char __vec, 17129 signed long long __offset, 17130 unsigned char *__ptr) { 17131 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 17132 } 17133 17134 static inline __ATTRS_o_ai void vec_xst(vector signed short __vec, 17135 signed long long __offset, 17136 signed short *__ptr) { 17137 signed char *__addr = (signed char *)__ptr + __offset; 17138 *(unaligned_vec_sshort *)__addr = __vec; 17139 } 17140 17141 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 17142 signed long long __offset, 17143 unsigned short *__ptr) { 17144 signed char *__addr = (signed char *)__ptr + __offset; 17145 *(unaligned_vec_ushort *)__addr = __vec; 17146 } 17147 17148 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 17149 signed long long __offset, 17150 signed int *__ptr) { 17151 signed char *__addr = (signed char *)__ptr + __offset; 17152 *(unaligned_vec_sint *)__addr = __vec; 17153 } 17154 17155 static inline __ATTRS_o_ai void vec_xst(vector unsigned int __vec, 17156 signed long long __offset, 17157 unsigned int *__ptr) { 17158 signed char *__addr = (signed char *)__ptr + __offset; 17159 *(unaligned_vec_uint *)__addr = __vec; 17160 } 17161 17162 static inline __ATTRS_o_ai void vec_xst(vector float __vec, 17163 signed long long __offset, 17164 float *__ptr) { 17165 signed char *__addr = (signed char *)__ptr + __offset; 17166 *(unaligned_vec_float *)__addr = __vec; 17167 } 17168 17169 #ifdef __VSX__ 17170 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 17171 signed long long __offset, 17172 signed long long *__ptr) { 17173 signed char *__addr = (signed char *)__ptr + __offset; 17174 *(unaligned_vec_sll *)__addr = __vec; 17175 } 17176 17177 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 17178 signed long long __offset, 17179 unsigned long long *__ptr) { 17180 signed char *__addr = (signed char *)__ptr + __offset; 17181 *(unaligned_vec_ull *)__addr = __vec; 17182 } 17183 17184 static inline __ATTRS_o_ai void vec_xst(vector double __vec, 17185 signed long long __offset, 17186 double *__ptr) { 17187 signed char *__addr = (signed char *)__ptr + __offset; 17188 *(unaligned_vec_double *)__addr = __vec; 17189 } 17190 #endif 17191 17192 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 17193 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 17194 signed long long __offset, 17195 signed __int128 *__ptr) { 17196 signed char *__addr = (signed char *)__ptr + __offset; 17197 *(unaligned_vec_si128 *)__addr = __vec; 17198 } 17199 17200 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 17201 signed long long __offset, 17202 unsigned __int128 *__ptr) { 17203 signed char *__addr = (signed char *)__ptr + __offset; 17204 *(unaligned_vec_ui128 *)__addr = __vec; 17205 } 17206 #endif 17207 17208 /* vec_xst_trunc */ 17209 17210 #if defined(__POWER10_VECTOR__) && defined(__VSX__) 17211 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17212 signed long long __offset, 17213 signed char *__ptr) { 17214 *(__ptr + __offset) = (signed char)__vec[0]; 17215 } 17216 17217 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17218 signed long long __offset, 17219 unsigned char *__ptr) { 17220 *(__ptr + __offset) = (unsigned char)__vec[0]; 17221 } 17222 17223 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17224 signed long long __offset, 17225 signed short *__ptr) { 17226 *(__ptr + __offset) = (signed short)__vec[0]; 17227 } 17228 17229 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17230 signed long long __offset, 17231 unsigned short *__ptr) { 17232 *(__ptr + __offset) = (unsigned short)__vec[0]; 17233 } 17234 17235 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17236 signed long long __offset, 17237 signed int *__ptr) { 17238 *(__ptr + __offset) = (signed int)__vec[0]; 17239 } 17240 17241 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17242 signed long long __offset, 17243 unsigned int *__ptr) { 17244 *(__ptr + __offset) = (unsigned int)__vec[0]; 17245 } 17246 17247 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17248 signed long long __offset, 17249 signed long long *__ptr) { 17250 *(__ptr + __offset) = (signed long long)__vec[0]; 17251 } 17252 17253 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17254 signed long long __offset, 17255 unsigned long long *__ptr) { 17256 *(__ptr + __offset) = (unsigned long long)__vec[0]; 17257 } 17258 #endif 17259 17260 /* vec_xst_be */ 17261 17262 #ifdef __LITTLE_ENDIAN__ 17263 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 17264 signed long long __offset, 17265 signed char *__ptr) { 17266 vector signed char __tmp = 17267 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17268 13, 12, 11, 10, 9, 8); 17269 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17270 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17271 } 17272 17273 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 17274 signed long long __offset, 17275 unsigned char *__ptr) { 17276 vector unsigned char __tmp = 17277 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17278 13, 12, 11, 10, 9, 8); 17279 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17280 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17281 } 17282 17283 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 17284 signed long long __offset, 17285 signed short *__ptr) { 17286 vector signed short __tmp = 17287 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17288 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17289 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17290 } 17291 17292 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 17293 signed long long __offset, 17294 unsigned short *__ptr) { 17295 vector unsigned short __tmp = 17296 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17297 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17298 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17299 } 17300 17301 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 17302 signed long long __offset, 17303 signed int *__ptr) { 17304 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 17305 } 17306 17307 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 17308 signed long long __offset, 17309 unsigned int *__ptr) { 17310 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 17311 } 17312 17313 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 17314 signed long long __offset, 17315 float *__ptr) { 17316 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 17317 } 17318 17319 #ifdef __VSX__ 17320 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 17321 signed long long __offset, 17322 signed long long *__ptr) { 17323 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 17324 } 17325 17326 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 17327 signed long long __offset, 17328 unsigned long long *__ptr) { 17329 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 17330 } 17331 17332 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 17333 signed long long __offset, 17334 double *__ptr) { 17335 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 17336 } 17337 #endif 17338 17339 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 17340 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 17341 signed long long __offset, 17342 signed __int128 *__ptr) { 17343 vec_xst(__vec, __offset, __ptr); 17344 } 17345 17346 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 17347 signed long long __offset, 17348 unsigned __int128 *__ptr) { 17349 vec_xst(__vec, __offset, __ptr); 17350 } 17351 #endif 17352 #else 17353 #define vec_xst_be vec_xst 17354 #endif 17355 17356 #ifdef __POWER9_VECTOR__ 17357 #define vec_test_data_class(__a, __b) \ 17358 _Generic( \ 17359 (__a), vector float \ 17360 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 17361 vector double \ 17362 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 17363 (__b))) 17364 17365 #endif /* #ifdef __POWER9_VECTOR__ */ 17366 17367 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 17368 return -__a; 17369 } 17370 17371 #ifdef __VSX__ 17372 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 17373 return -__a; 17374 } 17375 17376 #endif 17377 17378 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 17379 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 17380 return -__a; 17381 } 17382 #endif 17383 17384 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 17385 return -__a; 17386 } 17387 17388 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 17389 return -__a; 17390 } 17391 17392 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 17393 return -__a; 17394 } 17395 17396 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 17397 return - vec_abs(__a); 17398 } 17399 17400 #ifdef __VSX__ 17401 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 17402 return - vec_abs(__a); 17403 } 17404 17405 #endif 17406 17407 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 17408 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 17409 return __builtin_altivec_vminsd(__a, -__a); 17410 } 17411 #endif 17412 17413 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 17414 return __builtin_altivec_vminsw(__a, -__a); 17415 } 17416 17417 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 17418 return __builtin_altivec_vminsh(__a, -__a); 17419 } 17420 17421 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 17422 return __builtin_altivec_vminsb(__a, -__a); 17423 } 17424 17425 #ifdef __POWER10_VECTOR__ 17426 17427 /* vec_extractm */ 17428 17429 static __inline__ unsigned int __ATTRS_o_ai 17430 vec_extractm(vector unsigned char __a) { 17431 return __builtin_altivec_vextractbm(__a); 17432 } 17433 17434 static __inline__ unsigned int __ATTRS_o_ai 17435 vec_extractm(vector unsigned short __a) { 17436 return __builtin_altivec_vextracthm(__a); 17437 } 17438 17439 static __inline__ unsigned int __ATTRS_o_ai 17440 vec_extractm(vector unsigned int __a) { 17441 return __builtin_altivec_vextractwm(__a); 17442 } 17443 17444 static __inline__ unsigned int __ATTRS_o_ai 17445 vec_extractm(vector unsigned long long __a) { 17446 return __builtin_altivec_vextractdm(__a); 17447 } 17448 17449 static __inline__ unsigned int __ATTRS_o_ai 17450 vec_extractm(vector unsigned __int128 __a) { 17451 return __builtin_altivec_vextractqm(__a); 17452 } 17453 17454 /* vec_expandm */ 17455 17456 static __inline__ vector unsigned char __ATTRS_o_ai 17457 vec_expandm(vector unsigned char __a) { 17458 return __builtin_altivec_vexpandbm(__a); 17459 } 17460 17461 static __inline__ vector unsigned short __ATTRS_o_ai 17462 vec_expandm(vector unsigned short __a) { 17463 return __builtin_altivec_vexpandhm(__a); 17464 } 17465 17466 static __inline__ vector unsigned int __ATTRS_o_ai 17467 vec_expandm(vector unsigned int __a) { 17468 return __builtin_altivec_vexpandwm(__a); 17469 } 17470 17471 static __inline__ vector unsigned long long __ATTRS_o_ai 17472 vec_expandm(vector unsigned long long __a) { 17473 return __builtin_altivec_vexpanddm(__a); 17474 } 17475 17476 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17477 vec_expandm(vector unsigned __int128 __a) { 17478 return __builtin_altivec_vexpandqm(__a); 17479 } 17480 17481 /* vec_cntm */ 17482 17483 #define vec_cntm(__a, __mp) \ 17484 _Generic((__a), vector unsigned char \ 17485 : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)), \ 17486 vector unsigned short \ 17487 : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)), \ 17488 vector unsigned int \ 17489 : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)), \ 17490 vector unsigned long long \ 17491 : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp))) 17492 17493 /* vec_gen[b|h|w|d|q]m */ 17494 17495 static __inline__ vector unsigned char __ATTRS_o_ai 17496 vec_genbm(unsigned long long __bm) { 17497 return __builtin_altivec_mtvsrbm(__bm); 17498 } 17499 17500 static __inline__ vector unsigned short __ATTRS_o_ai 17501 vec_genhm(unsigned long long __bm) { 17502 return __builtin_altivec_mtvsrhm(__bm); 17503 } 17504 17505 static __inline__ vector unsigned int __ATTRS_o_ai 17506 vec_genwm(unsigned long long __bm) { 17507 return __builtin_altivec_mtvsrwm(__bm); 17508 } 17509 17510 static __inline__ vector unsigned long long __ATTRS_o_ai 17511 vec_gendm(unsigned long long __bm) { 17512 return __builtin_altivec_mtvsrdm(__bm); 17513 } 17514 17515 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17516 vec_genqm(unsigned long long __bm) { 17517 return __builtin_altivec_mtvsrqm(__bm); 17518 } 17519 17520 /* vec_pdep */ 17521 17522 static __inline__ vector unsigned long long __ATTRS_o_ai 17523 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 17524 return __builtin_altivec_vpdepd(__a, __b); 17525 } 17526 17527 /* vec_pext */ 17528 17529 static __inline__ vector unsigned long long __ATTRS_o_ai 17530 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 17531 return __builtin_altivec_vpextd(__a, __b); 17532 } 17533 17534 /* vec_cfuge */ 17535 17536 static __inline__ vector unsigned long long __ATTRS_o_ai 17537 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 17538 return __builtin_altivec_vcfuged(__a, __b); 17539 } 17540 17541 /* vec_gnb */ 17542 17543 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 17544 17545 /* vec_ternarylogic */ 17546 #ifdef __VSX__ 17547 #define vec_ternarylogic(__a, __b, __c, __imm) \ 17548 _Generic((__a), vector unsigned char \ 17549 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 17550 (vector unsigned long long)(__b), \ 17551 (vector unsigned long long)(__c), (__imm)), \ 17552 vector unsigned short \ 17553 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 17554 (vector unsigned long long)(__b), \ 17555 (vector unsigned long long)(__c), (__imm)), \ 17556 vector unsigned int \ 17557 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 17558 (vector unsigned long long)(__b), \ 17559 (vector unsigned long long)(__c), (__imm)), \ 17560 vector unsigned long long \ 17561 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 17562 (vector unsigned long long)(__b), \ 17563 (vector unsigned long long)(__c), (__imm)), \ 17564 vector unsigned __int128 \ 17565 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 17566 (vector unsigned long long)(__b), \ 17567 (vector unsigned long long)(__c), (__imm))) 17568 #endif /* __VSX__ */ 17569 17570 /* vec_genpcvm */ 17571 17572 #ifdef __VSX__ 17573 #define vec_genpcvm(__a, __imm) \ 17574 _Generic((__a), vector unsigned char \ 17575 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ 17576 vector unsigned short \ 17577 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ 17578 vector unsigned int \ 17579 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ 17580 vector unsigned long long \ 17581 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) 17582 #endif /* __VSX__ */ 17583 17584 /* vec_clrl */ 17585 17586 static __inline__ vector signed char __ATTRS_o_ai 17587 vec_clrl(vector signed char __a, unsigned int __n) { 17588 #ifdef __LITTLE_ENDIAN__ 17589 return __builtin_altivec_vclrrb(__a, __n); 17590 #else 17591 return __builtin_altivec_vclrlb( __a, __n); 17592 #endif 17593 } 17594 17595 static __inline__ vector unsigned char __ATTRS_o_ai 17596 vec_clrl(vector unsigned char __a, unsigned int __n) { 17597 #ifdef __LITTLE_ENDIAN__ 17598 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 17599 #else 17600 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 17601 #endif 17602 } 17603 17604 /* vec_clrr */ 17605 17606 static __inline__ vector signed char __ATTRS_o_ai 17607 vec_clrr(vector signed char __a, unsigned int __n) { 17608 #ifdef __LITTLE_ENDIAN__ 17609 return __builtin_altivec_vclrlb(__a, __n); 17610 #else 17611 return __builtin_altivec_vclrrb( __a, __n); 17612 #endif 17613 } 17614 17615 static __inline__ vector unsigned char __ATTRS_o_ai 17616 vec_clrr(vector unsigned char __a, unsigned int __n) { 17617 #ifdef __LITTLE_ENDIAN__ 17618 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 17619 #else 17620 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 17621 #endif 17622 } 17623 17624 /* vec_cntlzm */ 17625 17626 static __inline__ vector unsigned long long __ATTRS_o_ai 17627 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 17628 return __builtin_altivec_vclzdm(__a, __b); 17629 } 17630 17631 /* vec_cnttzm */ 17632 17633 static __inline__ vector unsigned long long __ATTRS_o_ai 17634 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 17635 return __builtin_altivec_vctzdm(__a, __b); 17636 } 17637 17638 /* vec_mod */ 17639 17640 static __inline__ vector signed int __ATTRS_o_ai 17641 vec_mod(vector signed int __a, vector signed int __b) { 17642 return __a % __b; 17643 } 17644 17645 static __inline__ vector unsigned int __ATTRS_o_ai 17646 vec_mod(vector unsigned int __a, vector unsigned int __b) { 17647 return __a % __b; 17648 } 17649 17650 static __inline__ vector signed long long __ATTRS_o_ai 17651 vec_mod(vector signed long long __a, vector signed long long __b) { 17652 return __a % __b; 17653 } 17654 17655 static __inline__ vector unsigned long long __ATTRS_o_ai 17656 vec_mod(vector unsigned long long __a, vector unsigned long long __b) { 17657 return __a % __b; 17658 } 17659 17660 static __inline__ vector signed __int128 __ATTRS_o_ai 17661 vec_mod(vector signed __int128 __a, vector signed __int128 __b) { 17662 return __a % __b; 17663 } 17664 17665 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17666 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { 17667 return __a % __b; 17668 } 17669 17670 /* vec_sldbi */ 17671 17672 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) 17673 17674 /* vec_srdbi */ 17675 17676 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) 17677 17678 /* vec_insertl */ 17679 17680 static __inline__ vector unsigned char __ATTRS_o_ai 17681 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 17682 #ifdef __LITTLE_ENDIAN__ 17683 return __builtin_altivec_vinsbrx(__b, __c, __a); 17684 #else 17685 return __builtin_altivec_vinsblx(__b, __c, __a); 17686 #endif 17687 } 17688 17689 static __inline__ vector unsigned short __ATTRS_o_ai 17690 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 17691 #ifdef __LITTLE_ENDIAN__ 17692 return __builtin_altivec_vinshrx(__b, __c, __a); 17693 #else 17694 return __builtin_altivec_vinshlx(__b, __c, __a); 17695 #endif 17696 } 17697 17698 static __inline__ vector unsigned int __ATTRS_o_ai 17699 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 17700 #ifdef __LITTLE_ENDIAN__ 17701 return __builtin_altivec_vinswrx(__b, __c, __a); 17702 #else 17703 return __builtin_altivec_vinswlx(__b, __c, __a); 17704 #endif 17705 } 17706 17707 static __inline__ vector unsigned long long __ATTRS_o_ai 17708 vec_insertl(unsigned long long __a, vector unsigned long long __b, 17709 unsigned int __c) { 17710 #ifdef __LITTLE_ENDIAN__ 17711 return __builtin_altivec_vinsdrx(__b, __c, __a); 17712 #else 17713 return __builtin_altivec_vinsdlx(__b, __c, __a); 17714 #endif 17715 } 17716 17717 static __inline__ vector unsigned char __ATTRS_o_ai 17718 vec_insertl(vector unsigned char __a, vector unsigned char __b, 17719 unsigned int __c) { 17720 #ifdef __LITTLE_ENDIAN__ 17721 return __builtin_altivec_vinsbvrx(__b, __c, __a); 17722 #else 17723 return __builtin_altivec_vinsbvlx(__b, __c, __a); 17724 #endif 17725 } 17726 17727 static __inline__ vector unsigned short __ATTRS_o_ai 17728 vec_insertl(vector unsigned short __a, vector unsigned short __b, 17729 unsigned int __c) { 17730 #ifdef __LITTLE_ENDIAN__ 17731 return __builtin_altivec_vinshvrx(__b, __c, __a); 17732 #else 17733 return __builtin_altivec_vinshvlx(__b, __c, __a); 17734 #endif 17735 } 17736 17737 static __inline__ vector unsigned int __ATTRS_o_ai 17738 vec_insertl(vector unsigned int __a, vector unsigned int __b, 17739 unsigned int __c) { 17740 #ifdef __LITTLE_ENDIAN__ 17741 return __builtin_altivec_vinswvrx(__b, __c, __a); 17742 #else 17743 return __builtin_altivec_vinswvlx(__b, __c, __a); 17744 #endif 17745 } 17746 17747 /* vec_inserth */ 17748 17749 static __inline__ vector unsigned char __ATTRS_o_ai 17750 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 17751 #ifdef __LITTLE_ENDIAN__ 17752 return __builtin_altivec_vinsblx(__b, __c, __a); 17753 #else 17754 return __builtin_altivec_vinsbrx(__b, __c, __a); 17755 #endif 17756 } 17757 17758 static __inline__ vector unsigned short __ATTRS_o_ai 17759 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 17760 #ifdef __LITTLE_ENDIAN__ 17761 return __builtin_altivec_vinshlx(__b, __c, __a); 17762 #else 17763 return __builtin_altivec_vinshrx(__b, __c, __a); 17764 #endif 17765 } 17766 17767 static __inline__ vector unsigned int __ATTRS_o_ai 17768 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 17769 #ifdef __LITTLE_ENDIAN__ 17770 return __builtin_altivec_vinswlx(__b, __c, __a); 17771 #else 17772 return __builtin_altivec_vinswrx(__b, __c, __a); 17773 #endif 17774 } 17775 17776 static __inline__ vector unsigned long long __ATTRS_o_ai 17777 vec_inserth(unsigned long long __a, vector unsigned long long __b, 17778 unsigned int __c) { 17779 #ifdef __LITTLE_ENDIAN__ 17780 return __builtin_altivec_vinsdlx(__b, __c, __a); 17781 #else 17782 return __builtin_altivec_vinsdrx(__b, __c, __a); 17783 #endif 17784 } 17785 17786 static __inline__ vector unsigned char __ATTRS_o_ai 17787 vec_inserth(vector unsigned char __a, vector unsigned char __b, 17788 unsigned int __c) { 17789 #ifdef __LITTLE_ENDIAN__ 17790 return __builtin_altivec_vinsbvlx(__b, __c, __a); 17791 #else 17792 return __builtin_altivec_vinsbvrx(__b, __c, __a); 17793 #endif 17794 } 17795 17796 static __inline__ vector unsigned short __ATTRS_o_ai 17797 vec_inserth(vector unsigned short __a, vector unsigned short __b, 17798 unsigned int __c) { 17799 #ifdef __LITTLE_ENDIAN__ 17800 return __builtin_altivec_vinshvlx(__b, __c, __a); 17801 #else 17802 return __builtin_altivec_vinshvrx(__b, __c, __a); 17803 #endif 17804 } 17805 17806 static __inline__ vector unsigned int __ATTRS_o_ai 17807 vec_inserth(vector unsigned int __a, vector unsigned int __b, 17808 unsigned int __c) { 17809 #ifdef __LITTLE_ENDIAN__ 17810 return __builtin_altivec_vinswvlx(__b, __c, __a); 17811 #else 17812 return __builtin_altivec_vinswvrx(__b, __c, __a); 17813 #endif 17814 } 17815 17816 /* vec_extractl */ 17817 17818 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 17819 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 17820 #ifdef __LITTLE_ENDIAN__ 17821 return __builtin_altivec_vextdubvrx(__a, __b, __c); 17822 #else 17823 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); 17824 return vec_sld(__ret, __ret, 8); 17825 #endif 17826 } 17827 17828 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 17829 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 17830 #ifdef __LITTLE_ENDIAN__ 17831 return __builtin_altivec_vextduhvrx(__a, __b, __c); 17832 #else 17833 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); 17834 return vec_sld(__ret, __ret, 8); 17835 #endif 17836 } 17837 17838 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 17839 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 17840 #ifdef __LITTLE_ENDIAN__ 17841 return __builtin_altivec_vextduwvrx(__a, __b, __c); 17842 #else 17843 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); 17844 return vec_sld(__ret, __ret, 8); 17845 #endif 17846 } 17847 17848 static __inline__ vector unsigned long long __ATTRS_o_ai 17849 vec_extractl(vector unsigned long long __a, vector unsigned long long __b, 17850 unsigned int __c) { 17851 #ifdef __LITTLE_ENDIAN__ 17852 return __builtin_altivec_vextddvrx(__a, __b, __c); 17853 #else 17854 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); 17855 return vec_sld(__ret, __ret, 8); 17856 #endif 17857 } 17858 17859 /* vec_extracth */ 17860 17861 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 17862 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 17863 #ifdef __LITTLE_ENDIAN__ 17864 return __builtin_altivec_vextdubvlx(__a, __b, __c); 17865 #else 17866 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); 17867 return vec_sld(__ret, __ret, 8); 17868 #endif 17869 } 17870 17871 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 17872 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 17873 #ifdef __LITTLE_ENDIAN__ 17874 return __builtin_altivec_vextduhvlx(__a, __b, __c); 17875 #else 17876 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); 17877 return vec_sld(__ret, __ret, 8); 17878 #endif 17879 } 17880 17881 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 17882 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 17883 #ifdef __LITTLE_ENDIAN__ 17884 return __builtin_altivec_vextduwvlx(__a, __b, __c); 17885 #else 17886 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); 17887 return vec_sld(__ret, __ret, 8); 17888 #endif 17889 } 17890 17891 static __inline__ vector unsigned long long __ATTRS_o_ai 17892 vec_extracth(vector unsigned long long __a, vector unsigned long long __b, 17893 unsigned int __c) { 17894 #ifdef __LITTLE_ENDIAN__ 17895 return __builtin_altivec_vextddvlx(__a, __b, __c); 17896 #else 17897 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); 17898 return vec_sld(__ret, __ret, 8); 17899 #endif 17900 } 17901 17902 #ifdef __VSX__ 17903 17904 /* vec_permx */ 17905 17906 #define vec_permx(__a, __b, __c, __d) \ 17907 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) 17908 17909 /* vec_blendv */ 17910 17911 static __inline__ vector signed char __ATTRS_o_ai 17912 vec_blendv(vector signed char __a, vector signed char __b, 17913 vector unsigned char __c) { 17914 return __builtin_vsx_xxblendvb(__a, __b, __c); 17915 } 17916 17917 static __inline__ vector unsigned char __ATTRS_o_ai 17918 vec_blendv(vector unsigned char __a, vector unsigned char __b, 17919 vector unsigned char __c) { 17920 return __builtin_vsx_xxblendvb(__a, __b, __c); 17921 } 17922 17923 static __inline__ vector signed short __ATTRS_o_ai 17924 vec_blendv(vector signed short __a, vector signed short __b, 17925 vector unsigned short __c) { 17926 return __builtin_vsx_xxblendvh(__a, __b, __c); 17927 } 17928 17929 static __inline__ vector unsigned short __ATTRS_o_ai 17930 vec_blendv(vector unsigned short __a, vector unsigned short __b, 17931 vector unsigned short __c) { 17932 return __builtin_vsx_xxblendvh(__a, __b, __c); 17933 } 17934 17935 static __inline__ vector signed int __ATTRS_o_ai 17936 vec_blendv(vector signed int __a, vector signed int __b, 17937 vector unsigned int __c) { 17938 return __builtin_vsx_xxblendvw(__a, __b, __c); 17939 } 17940 17941 static __inline__ vector unsigned int __ATTRS_o_ai 17942 vec_blendv(vector unsigned int __a, vector unsigned int __b, 17943 vector unsigned int __c) { 17944 return __builtin_vsx_xxblendvw(__a, __b, __c); 17945 } 17946 17947 static __inline__ vector signed long long __ATTRS_o_ai 17948 vec_blendv(vector signed long long __a, vector signed long long __b, 17949 vector unsigned long long __c) { 17950 return __builtin_vsx_xxblendvd(__a, __b, __c); 17951 } 17952 17953 static __inline__ vector unsigned long long __ATTRS_o_ai 17954 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 17955 vector unsigned long long __c) { 17956 return __builtin_vsx_xxblendvd(__a, __b, __c); 17957 } 17958 17959 static __inline__ vector float __ATTRS_o_ai 17960 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 17961 return __builtin_vsx_xxblendvw(__a, __b, __c); 17962 } 17963 17964 static __inline__ vector double __ATTRS_o_ai 17965 vec_blendv(vector double __a, vector double __b, 17966 vector unsigned long long __c) { 17967 return __builtin_vsx_xxblendvd(__a, __b, __c); 17968 } 17969 17970 /* vec_replace_elt */ 17971 17972 #define vec_replace_elt __builtin_altivec_vec_replace_elt 17973 17974 /* vec_replace_unaligned */ 17975 17976 #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned 17977 17978 /* vec_splati */ 17979 17980 #define vec_splati(__a) \ 17981 _Generic((__a), signed int \ 17982 : ((vector signed int)__a), unsigned int \ 17983 : ((vector unsigned int)__a), float \ 17984 : ((vector float)__a)) 17985 17986 /* vec_spatid */ 17987 17988 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 17989 return ((vector double)((double)__a)); 17990 } 17991 17992 /* vec_splati_ins */ 17993 17994 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 17995 vector signed int __a, const unsigned int __b, const signed int __c) { 17996 #ifdef __LITTLE_ENDIAN__ 17997 __a[1 - __b] = __c; 17998 __a[3 - __b] = __c; 17999 #else 18000 __a[__b] = __c; 18001 __a[2 + __b] = __c; 18002 #endif 18003 return __a; 18004 } 18005 18006 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 18007 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 18008 #ifdef __LITTLE_ENDIAN__ 18009 __a[1 - __b] = __c; 18010 __a[3 - __b] = __c; 18011 #else 18012 __a[__b] = __c; 18013 __a[2 + __b] = __c; 18014 #endif 18015 return __a; 18016 } 18017 18018 static __inline__ vector float __ATTRS_o_ai 18019 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 18020 #ifdef __LITTLE_ENDIAN__ 18021 __a[1 - __b] = __c; 18022 __a[3 - __b] = __c; 18023 #else 18024 __a[__b] = __c; 18025 __a[2 + __b] = __c; 18026 #endif 18027 return __a; 18028 } 18029 18030 /* vec_test_lsbb_all_ones */ 18031 18032 static __inline__ int __ATTRS_o_ai 18033 vec_test_lsbb_all_ones(vector unsigned char __a) { 18034 return __builtin_vsx_xvtlsbb(__a, 1); 18035 } 18036 18037 /* vec_test_lsbb_all_zeros */ 18038 18039 static __inline__ int __ATTRS_o_ai 18040 vec_test_lsbb_all_zeros(vector unsigned char __a) { 18041 return __builtin_vsx_xvtlsbb(__a, 0); 18042 } 18043 #endif /* __VSX__ */ 18044 18045 /* vec_stril */ 18046 18047 static __inline__ vector unsigned char __ATTRS_o_ai 18048 vec_stril(vector unsigned char __a) { 18049 #ifdef __LITTLE_ENDIAN__ 18050 return __builtin_altivec_vstribr((vector signed char)__a); 18051 #else 18052 return __builtin_altivec_vstribl((vector signed char)__a); 18053 #endif 18054 } 18055 18056 static __inline__ vector signed char __ATTRS_o_ai 18057 vec_stril(vector signed char __a) { 18058 #ifdef __LITTLE_ENDIAN__ 18059 return __builtin_altivec_vstribr(__a); 18060 #else 18061 return __builtin_altivec_vstribl(__a); 18062 #endif 18063 } 18064 18065 static __inline__ vector unsigned short __ATTRS_o_ai 18066 vec_stril(vector unsigned short __a) { 18067 #ifdef __LITTLE_ENDIAN__ 18068 return __builtin_altivec_vstrihr((vector signed short)__a); 18069 #else 18070 return __builtin_altivec_vstrihl((vector signed short)__a); 18071 #endif 18072 } 18073 18074 static __inline__ vector signed short __ATTRS_o_ai 18075 vec_stril(vector signed short __a) { 18076 #ifdef __LITTLE_ENDIAN__ 18077 return __builtin_altivec_vstrihr(__a); 18078 #else 18079 return __builtin_altivec_vstrihl(__a); 18080 #endif 18081 } 18082 18083 /* vec_stril_p */ 18084 18085 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { 18086 #ifdef __LITTLE_ENDIAN__ 18087 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18088 #else 18089 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18090 #endif 18091 } 18092 18093 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { 18094 #ifdef __LITTLE_ENDIAN__ 18095 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18096 #else 18097 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18098 #endif 18099 } 18100 18101 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { 18102 #ifdef __LITTLE_ENDIAN__ 18103 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18104 #else 18105 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18106 #endif 18107 } 18108 18109 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { 18110 #ifdef __LITTLE_ENDIAN__ 18111 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18112 #else 18113 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18114 #endif 18115 } 18116 18117 /* vec_strir */ 18118 18119 static __inline__ vector unsigned char __ATTRS_o_ai 18120 vec_strir(vector unsigned char __a) { 18121 #ifdef __LITTLE_ENDIAN__ 18122 return __builtin_altivec_vstribl((vector signed char)__a); 18123 #else 18124 return __builtin_altivec_vstribr((vector signed char)__a); 18125 #endif 18126 } 18127 18128 static __inline__ vector signed char __ATTRS_o_ai 18129 vec_strir(vector signed char __a) { 18130 #ifdef __LITTLE_ENDIAN__ 18131 return __builtin_altivec_vstribl(__a); 18132 #else 18133 return __builtin_altivec_vstribr(__a); 18134 #endif 18135 } 18136 18137 static __inline__ vector unsigned short __ATTRS_o_ai 18138 vec_strir(vector unsigned short __a) { 18139 #ifdef __LITTLE_ENDIAN__ 18140 return __builtin_altivec_vstrihl((vector signed short)__a); 18141 #else 18142 return __builtin_altivec_vstrihr((vector signed short)__a); 18143 #endif 18144 } 18145 18146 static __inline__ vector signed short __ATTRS_o_ai 18147 vec_strir(vector signed short __a) { 18148 #ifdef __LITTLE_ENDIAN__ 18149 return __builtin_altivec_vstrihl(__a); 18150 #else 18151 return __builtin_altivec_vstrihr(__a); 18152 #endif 18153 } 18154 18155 /* vec_strir_p */ 18156 18157 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { 18158 #ifdef __LITTLE_ENDIAN__ 18159 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18160 #else 18161 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18162 #endif 18163 } 18164 18165 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { 18166 #ifdef __LITTLE_ENDIAN__ 18167 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18168 #else 18169 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18170 #endif 18171 } 18172 18173 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { 18174 #ifdef __LITTLE_ENDIAN__ 18175 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18176 #else 18177 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18178 #endif 18179 } 18180 18181 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { 18182 #ifdef __LITTLE_ENDIAN__ 18183 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18184 #else 18185 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18186 #endif 18187 } 18188 18189 /* vs[l | r | ra] */ 18190 18191 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18192 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18193 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18194 __CHAR_BIT__)); 18195 } 18196 18197 static __inline__ vector signed __int128 __ATTRS_o_ai 18198 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { 18199 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18200 __CHAR_BIT__)); 18201 } 18202 18203 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18204 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18205 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18206 __CHAR_BIT__)); 18207 } 18208 18209 static __inline__ vector signed __int128 __ATTRS_o_ai 18210 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { 18211 return ( 18212 vector signed __int128)(((vector unsigned __int128)__a) >> 18213 (__b % 18214 (vector unsigned __int128)(sizeof( 18215 unsigned __int128) * 18216 __CHAR_BIT__))); 18217 } 18218 18219 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18220 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18221 return ( 18222 vector unsigned __int128)(((vector signed __int128)__a) >> 18223 (__b % 18224 (vector unsigned __int128)(sizeof( 18225 unsigned __int128) * 18226 __CHAR_BIT__))); 18227 } 18228 18229 static __inline__ vector signed __int128 __ATTRS_o_ai 18230 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { 18231 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18232 __CHAR_BIT__)); 18233 } 18234 18235 #endif /* __POWER10_VECTOR__ */ 18236 18237 #undef __ATTRS_o_ai 18238 18239 #endif /* __ALTIVEC_H */ 18240