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 #include <stddef.h> 45 46 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 47 vector signed char __a, vector signed char __b, vector unsigned char __c); 48 49 static __inline__ vector unsigned char __ATTRS_o_ai 50 vec_perm(vector unsigned char __a, vector unsigned char __b, 51 vector unsigned char __c); 52 53 static __inline__ vector bool char __ATTRS_o_ai 54 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); 55 56 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 57 vector signed short __b, 58 vector unsigned char __c); 59 60 static __inline__ vector unsigned short __ATTRS_o_ai 61 vec_perm(vector unsigned short __a, vector unsigned short __b, 62 vector unsigned char __c); 63 64 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 65 vector bool short __a, vector bool short __b, vector unsigned char __c); 66 67 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 68 vector pixel __b, 69 vector unsigned char __c); 70 71 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 72 vector signed int __b, 73 vector unsigned char __c); 74 75 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( 76 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); 77 78 static __inline__ vector bool int __ATTRS_o_ai 79 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); 80 81 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 82 vector float __b, 83 vector unsigned char __c); 84 85 #ifdef __VSX__ 86 static __inline__ vector long long __ATTRS_o_ai 87 vec_perm(vector signed long long __a, vector signed long long __b, 88 vector unsigned char __c); 89 90 static __inline__ vector unsigned long long __ATTRS_o_ai 91 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 92 vector unsigned char __c); 93 94 static __inline__ vector bool long long __ATTRS_o_ai 95 vec_perm(vector bool long long __a, vector bool long long __b, 96 vector unsigned char __c); 97 98 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, 99 vector double __b, 100 vector unsigned char __c); 101 #endif 102 103 static __inline__ vector unsigned char __ATTRS_o_ai 104 vec_xor(vector unsigned char __a, vector unsigned char __b); 105 106 /* vec_abs */ 107 108 #define __builtin_altivec_abs_v16qi vec_abs 109 #define __builtin_altivec_abs_v8hi vec_abs 110 #define __builtin_altivec_abs_v4si vec_abs 111 112 static __inline__ vector signed char __ATTRS_o_ai 113 vec_abs(vector signed char __a) { 114 return __builtin_altivec_vmaxsb(__a, -__a); 115 } 116 117 static __inline__ vector signed short __ATTRS_o_ai 118 vec_abs(vector signed short __a) { 119 return __builtin_altivec_vmaxsh(__a, -__a); 120 } 121 122 static __inline__ vector signed int __ATTRS_o_ai 123 vec_abs(vector signed int __a) { 124 return __builtin_altivec_vmaxsw(__a, -__a); 125 } 126 127 #ifdef __POWER8_VECTOR__ 128 static __inline__ vector signed long long __ATTRS_o_ai 129 vec_abs(vector signed long long __a) { 130 return __builtin_altivec_vmaxsd(__a, -__a); 131 } 132 #endif 133 134 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { 135 #ifdef __VSX__ 136 return __builtin_vsx_xvabssp(__a); 137 #else 138 vector unsigned int __res = 139 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); 140 return (vector float)__res; 141 #endif 142 } 143 144 #ifdef __VSX__ 145 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { 146 return __builtin_vsx_xvabsdp(__a); 147 } 148 #endif 149 150 /* vec_abss */ 151 #define __builtin_altivec_abss_v16qi vec_abss 152 #define __builtin_altivec_abss_v8hi vec_abss 153 #define __builtin_altivec_abss_v4si vec_abss 154 155 static __inline__ vector signed char __ATTRS_o_ai 156 vec_abss(vector signed char __a) { 157 return __builtin_altivec_vmaxsb( 158 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); 159 } 160 161 static __inline__ vector signed short __ATTRS_o_ai 162 vec_abss(vector signed short __a) { 163 return __builtin_altivec_vmaxsh( 164 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); 165 } 166 167 static __inline__ vector signed int __ATTRS_o_ai 168 vec_abss(vector signed int __a) { 169 return __builtin_altivec_vmaxsw( 170 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); 171 } 172 173 /* vec_absd */ 174 #if defined(__POWER9_VECTOR__) 175 176 static __inline__ vector unsigned char __ATTRS_o_ai 177 vec_absd(vector unsigned char __a, vector unsigned char __b) { 178 return __builtin_altivec_vabsdub(__a, __b); 179 } 180 181 static __inline__ vector unsigned short __ATTRS_o_ai 182 vec_absd(vector unsigned short __a, vector unsigned short __b) { 183 return __builtin_altivec_vabsduh(__a, __b); 184 } 185 186 static __inline__ vector unsigned int __ATTRS_o_ai 187 vec_absd(vector unsigned int __a, vector unsigned int __b) { 188 return __builtin_altivec_vabsduw(__a, __b); 189 } 190 191 #endif /* End __POWER9_VECTOR__ */ 192 193 /* vec_add */ 194 195 static __inline__ vector signed char __ATTRS_o_ai 196 vec_add(vector signed char __a, vector signed char __b) { 197 return __a + __b; 198 } 199 200 static __inline__ vector signed char __ATTRS_o_ai 201 vec_add(vector bool char __a, vector signed char __b) { 202 return (vector signed char)__a + __b; 203 } 204 205 static __inline__ vector signed char __ATTRS_o_ai 206 vec_add(vector signed char __a, vector bool char __b) { 207 return __a + (vector signed char)__b; 208 } 209 210 static __inline__ vector unsigned char __ATTRS_o_ai 211 vec_add(vector unsigned char __a, vector unsigned char __b) { 212 return __a + __b; 213 } 214 215 static __inline__ vector unsigned char __ATTRS_o_ai 216 vec_add(vector bool char __a, vector unsigned char __b) { 217 return (vector unsigned char)__a + __b; 218 } 219 220 static __inline__ vector unsigned char __ATTRS_o_ai 221 vec_add(vector unsigned char __a, vector bool char __b) { 222 return __a + (vector unsigned char)__b; 223 } 224 225 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 226 vector short __b) { 227 return __a + __b; 228 } 229 230 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, 231 vector short __b) { 232 return (vector short)__a + __b; 233 } 234 235 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 236 vector bool short __b) { 237 return __a + (vector short)__b; 238 } 239 240 static __inline__ vector unsigned short __ATTRS_o_ai 241 vec_add(vector unsigned short __a, vector unsigned short __b) { 242 return __a + __b; 243 } 244 245 static __inline__ vector unsigned short __ATTRS_o_ai 246 vec_add(vector bool short __a, vector unsigned short __b) { 247 return (vector unsigned short)__a + __b; 248 } 249 250 static __inline__ vector unsigned short __ATTRS_o_ai 251 vec_add(vector unsigned short __a, vector bool short __b) { 252 return __a + (vector unsigned short)__b; 253 } 254 255 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 256 vector int __b) { 257 return __a + __b; 258 } 259 260 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, 261 vector int __b) { 262 return (vector int)__a + __b; 263 } 264 265 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 266 vector bool int __b) { 267 return __a + (vector int)__b; 268 } 269 270 static __inline__ vector unsigned int __ATTRS_o_ai 271 vec_add(vector unsigned int __a, vector unsigned int __b) { 272 return __a + __b; 273 } 274 275 static __inline__ vector unsigned int __ATTRS_o_ai 276 vec_add(vector bool int __a, vector unsigned int __b) { 277 return (vector unsigned int)__a + __b; 278 } 279 280 static __inline__ vector unsigned int __ATTRS_o_ai 281 vec_add(vector unsigned int __a, vector bool int __b) { 282 return __a + (vector unsigned int)__b; 283 } 284 285 #ifdef __POWER8_VECTOR__ 286 static __inline__ vector signed long long __ATTRS_o_ai 287 vec_add(vector signed long long __a, vector signed long long __b) { 288 return __a + __b; 289 } 290 291 static __inline__ vector unsigned long long __ATTRS_o_ai 292 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 293 return __a + __b; 294 } 295 296 #ifdef __SIZEOF_INT128__ 297 static __inline__ vector signed __int128 __ATTRS_o_ai 298 vec_add(vector signed __int128 __a, vector signed __int128 __b) { 299 return __a + __b; 300 } 301 302 static __inline__ vector unsigned __int128 __ATTRS_o_ai 303 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { 304 return __a + __b; 305 } 306 #endif 307 308 static __inline__ vector unsigned char __attribute__((__always_inline__)) 309 vec_add_u128(vector unsigned char __a, vector unsigned char __b) { 310 return __builtin_altivec_vadduqm(__a, __b); 311 } 312 #elif defined(__VSX__) 313 static __inline__ vector signed long long __ATTRS_o_ai 314 vec_add(vector signed long long __a, vector signed long long __b) { 315 #ifdef __LITTLE_ENDIAN__ 316 // Little endian systems on CPU's prior to Power8 don't really exist 317 // so scalarizing is fine. 318 return __a + __b; 319 #else 320 vector unsigned int __res = 321 (vector unsigned int)__a + (vector unsigned int)__b; 322 vector unsigned int __carry = __builtin_altivec_vaddcuw( 323 (vector unsigned int)__a, (vector unsigned int)__b); 324 __carry = __builtin_shufflevector((vector unsigned char)__carry, 325 (vector unsigned char)__carry, 0, 0, 0, 7, 326 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0); 327 return (vector signed long long)(__res + __carry); 328 #endif 329 } 330 331 static __inline__ vector unsigned long long __ATTRS_o_ai 332 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 333 return (vector unsigned long long)vec_add((vector signed long long)__a, 334 (vector signed long long)__b); 335 } 336 #endif // __POWER8_VECTOR__ 337 338 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 339 vector float __b) { 340 return __a + __b; 341 } 342 343 #ifdef __VSX__ 344 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 345 vector double __b) { 346 return __a + __b; 347 } 348 #endif // __VSX__ 349 350 /* vec_adde */ 351 352 #ifdef __POWER8_VECTOR__ 353 #ifdef __SIZEOF_INT128__ 354 static __inline__ vector signed __int128 __ATTRS_o_ai 355 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 356 vector signed __int128 __c) { 357 return __builtin_altivec_vaddeuqm(__a, __b, __c); 358 } 359 360 static __inline__ vector unsigned __int128 __ATTRS_o_ai 361 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 362 vector unsigned __int128 __c) { 363 return __builtin_altivec_vaddeuqm(__a, __b, __c); 364 } 365 #endif 366 367 static __inline__ vector unsigned char __attribute__((__always_inline__)) 368 vec_adde_u128(vector unsigned char __a, vector unsigned char __b, 369 vector unsigned char __c) { 370 return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c); 371 } 372 #endif 373 374 static __inline__ vector signed int __ATTRS_o_ai 375 vec_adde(vector signed int __a, vector signed int __b, 376 vector signed int __c) { 377 vector signed int __mask = {1, 1, 1, 1}; 378 vector signed int __carry = __c & __mask; 379 return vec_add(vec_add(__a, __b), __carry); 380 } 381 382 static __inline__ vector unsigned int __ATTRS_o_ai 383 vec_adde(vector unsigned int __a, vector unsigned int __b, 384 vector unsigned int __c) { 385 vector unsigned int __mask = {1, 1, 1, 1}; 386 vector unsigned int __carry = __c & __mask; 387 return vec_add(vec_add(__a, __b), __carry); 388 } 389 390 /* vec_addec */ 391 392 #ifdef __POWER8_VECTOR__ 393 #ifdef __SIZEOF_INT128__ 394 static __inline__ vector signed __int128 __ATTRS_o_ai 395 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 396 vector signed __int128 __c) { 397 return __builtin_altivec_vaddecuq(__a, __b, __c); 398 } 399 400 static __inline__ vector unsigned __int128 __ATTRS_o_ai 401 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 402 vector unsigned __int128 __c) { 403 return __builtin_altivec_vaddecuq(__a, __b, __c); 404 } 405 #endif 406 407 static __inline__ vector unsigned char __attribute__((__always_inline__)) 408 vec_addec_u128(vector unsigned char __a, vector unsigned char __b, 409 vector unsigned char __c) { 410 return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c); 411 } 412 413 #ifdef __powerpc64__ 414 static __inline__ vector signed int __ATTRS_o_ai 415 vec_addec(vector signed int __a, vector signed int __b, 416 vector signed int __c) { 417 418 signed int __result[4]; 419 for (int i = 0; i < 4; i++) { 420 unsigned int __tempa = (unsigned int) __a[i]; 421 unsigned int __tempb = (unsigned int) __b[i]; 422 unsigned int __tempc = (unsigned int) __c[i]; 423 __tempc = __tempc & 0x00000001; 424 unsigned long long __longa = (unsigned long long) __tempa; 425 unsigned long long __longb = (unsigned long long) __tempb; 426 unsigned long long __longc = (unsigned long long) __tempc; 427 unsigned long long __sum = __longa + __longb + __longc; 428 unsigned long long __res = (__sum >> 32) & 0x01; 429 unsigned long long __tempres = (unsigned int) __res; 430 __result[i] = (signed int) __tempres; 431 } 432 433 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; 434 return ret; 435 } 436 437 static __inline__ vector unsigned int __ATTRS_o_ai 438 vec_addec(vector unsigned int __a, vector unsigned int __b, 439 vector unsigned int __c) { 440 441 unsigned int __result[4]; 442 for (int i = 0; i < 4; i++) { 443 unsigned int __tempc = __c[i] & 1; 444 unsigned long long __longa = (unsigned long long) __a[i]; 445 unsigned long long __longb = (unsigned long long) __b[i]; 446 unsigned long long __longc = (unsigned long long) __tempc; 447 unsigned long long __sum = __longa + __longb + __longc; 448 unsigned long long __res = (__sum >> 32) & 0x01; 449 unsigned long long __tempres = (unsigned int) __res; 450 __result[i] = (signed int) __tempres; 451 } 452 453 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; 454 return ret; 455 } 456 #endif // __powerpc64__ 457 #endif // __POWER8_VECTOR__ 458 459 /* vec_vaddubm */ 460 461 #define __builtin_altivec_vaddubm vec_vaddubm 462 463 static __inline__ vector signed char __ATTRS_o_ai 464 vec_vaddubm(vector signed char __a, vector signed char __b) { 465 return __a + __b; 466 } 467 468 static __inline__ vector signed char __ATTRS_o_ai 469 vec_vaddubm(vector bool char __a, vector signed char __b) { 470 return (vector signed char)__a + __b; 471 } 472 473 static __inline__ vector signed char __ATTRS_o_ai 474 vec_vaddubm(vector signed char __a, vector bool char __b) { 475 return __a + (vector signed char)__b; 476 } 477 478 static __inline__ vector unsigned char __ATTRS_o_ai 479 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 480 return __a + __b; 481 } 482 483 static __inline__ vector unsigned char __ATTRS_o_ai 484 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 485 return (vector unsigned char)__a + __b; 486 } 487 488 static __inline__ vector unsigned char __ATTRS_o_ai 489 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 490 return __a + (vector unsigned char)__b; 491 } 492 493 /* vec_vadduhm */ 494 495 #define __builtin_altivec_vadduhm vec_vadduhm 496 497 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 498 vector short __b) { 499 return __a + __b; 500 } 501 502 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 503 vector short __b) { 504 return (vector short)__a + __b; 505 } 506 507 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 508 vector bool short __b) { 509 return __a + (vector short)__b; 510 } 511 512 static __inline__ vector unsigned short __ATTRS_o_ai 513 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 514 return __a + __b; 515 } 516 517 static __inline__ vector unsigned short __ATTRS_o_ai 518 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 519 return (vector unsigned short)__a + __b; 520 } 521 522 static __inline__ vector unsigned short __ATTRS_o_ai 523 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 524 return __a + (vector unsigned short)__b; 525 } 526 527 /* vec_vadduwm */ 528 529 #define __builtin_altivec_vadduwm vec_vadduwm 530 531 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 532 vector int __b) { 533 return __a + __b; 534 } 535 536 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 537 vector int __b) { 538 return (vector int)__a + __b; 539 } 540 541 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 542 vector bool int __b) { 543 return __a + (vector int)__b; 544 } 545 546 static __inline__ vector unsigned int __ATTRS_o_ai 547 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 548 return __a + __b; 549 } 550 551 static __inline__ vector unsigned int __ATTRS_o_ai 552 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 553 return (vector unsigned int)__a + __b; 554 } 555 556 static __inline__ vector unsigned int __ATTRS_o_ai 557 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 558 return __a + (vector unsigned int)__b; 559 } 560 561 /* vec_vaddfp */ 562 563 #define __builtin_altivec_vaddfp vec_vaddfp 564 565 static __inline__ vector float __attribute__((__always_inline__)) 566 vec_vaddfp(vector float __a, vector float __b) { 567 return __a + __b; 568 } 569 570 /* vec_addc */ 571 572 static __inline__ vector signed int __ATTRS_o_ai 573 vec_addc(vector signed int __a, vector signed int __b) { 574 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 575 (vector unsigned int)__b); 576 } 577 578 static __inline__ vector unsigned int __ATTRS_o_ai 579 vec_addc(vector unsigned int __a, vector unsigned int __b) { 580 return __builtin_altivec_vaddcuw(__a, __b); 581 } 582 583 #ifdef __POWER8_VECTOR__ 584 #ifdef __SIZEOF_INT128__ 585 static __inline__ vector signed __int128 __ATTRS_o_ai 586 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 587 return (vector signed __int128)__builtin_altivec_vaddcuq( 588 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 589 } 590 591 static __inline__ vector unsigned __int128 __ATTRS_o_ai 592 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 593 return __builtin_altivec_vaddcuq(__a, __b); 594 } 595 #endif 596 597 static __inline__ vector unsigned char __attribute__((__always_inline__)) 598 vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { 599 return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b); 600 } 601 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 602 603 /* vec_vaddcuw */ 604 605 static __inline__ vector unsigned int __attribute__((__always_inline__)) 606 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 607 return __builtin_altivec_vaddcuw(__a, __b); 608 } 609 610 /* vec_adds */ 611 612 static __inline__ vector signed char __ATTRS_o_ai 613 vec_adds(vector signed char __a, vector signed char __b) { 614 return __builtin_altivec_vaddsbs(__a, __b); 615 } 616 617 static __inline__ vector signed char __ATTRS_o_ai 618 vec_adds(vector bool char __a, vector signed char __b) { 619 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 620 } 621 622 static __inline__ vector signed char __ATTRS_o_ai 623 vec_adds(vector signed char __a, vector bool char __b) { 624 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 625 } 626 627 static __inline__ vector unsigned char __ATTRS_o_ai 628 vec_adds(vector unsigned char __a, vector unsigned char __b) { 629 return __builtin_altivec_vaddubs(__a, __b); 630 } 631 632 static __inline__ vector unsigned char __ATTRS_o_ai 633 vec_adds(vector bool char __a, vector unsigned char __b) { 634 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 635 } 636 637 static __inline__ vector unsigned char __ATTRS_o_ai 638 vec_adds(vector unsigned char __a, vector bool char __b) { 639 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 640 } 641 642 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 643 vector short __b) { 644 return __builtin_altivec_vaddshs(__a, __b); 645 } 646 647 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 648 vector short __b) { 649 return __builtin_altivec_vaddshs((vector short)__a, __b); 650 } 651 652 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 653 vector bool short __b) { 654 return __builtin_altivec_vaddshs(__a, (vector short)__b); 655 } 656 657 static __inline__ vector unsigned short __ATTRS_o_ai 658 vec_adds(vector unsigned short __a, vector unsigned short __b) { 659 return __builtin_altivec_vadduhs(__a, __b); 660 } 661 662 static __inline__ vector unsigned short __ATTRS_o_ai 663 vec_adds(vector bool short __a, vector unsigned short __b) { 664 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 665 } 666 667 static __inline__ vector unsigned short __ATTRS_o_ai 668 vec_adds(vector unsigned short __a, vector bool short __b) { 669 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 670 } 671 672 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 673 vector int __b) { 674 return __builtin_altivec_vaddsws(__a, __b); 675 } 676 677 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 678 vector int __b) { 679 return __builtin_altivec_vaddsws((vector int)__a, __b); 680 } 681 682 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 683 vector bool int __b) { 684 return __builtin_altivec_vaddsws(__a, (vector int)__b); 685 } 686 687 static __inline__ vector unsigned int __ATTRS_o_ai 688 vec_adds(vector unsigned int __a, vector unsigned int __b) { 689 return __builtin_altivec_vadduws(__a, __b); 690 } 691 692 static __inline__ vector unsigned int __ATTRS_o_ai 693 vec_adds(vector bool int __a, vector unsigned int __b) { 694 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 695 } 696 697 static __inline__ vector unsigned int __ATTRS_o_ai 698 vec_adds(vector unsigned int __a, vector bool int __b) { 699 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 700 } 701 702 /* vec_vaddsbs */ 703 704 static __inline__ vector signed char __ATTRS_o_ai 705 vec_vaddsbs(vector signed char __a, vector signed char __b) { 706 return __builtin_altivec_vaddsbs(__a, __b); 707 } 708 709 static __inline__ vector signed char __ATTRS_o_ai 710 vec_vaddsbs(vector bool char __a, vector signed char __b) { 711 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 712 } 713 714 static __inline__ vector signed char __ATTRS_o_ai 715 vec_vaddsbs(vector signed char __a, vector bool char __b) { 716 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 717 } 718 719 /* vec_vaddubs */ 720 721 static __inline__ vector unsigned char __ATTRS_o_ai 722 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 723 return __builtin_altivec_vaddubs(__a, __b); 724 } 725 726 static __inline__ vector unsigned char __ATTRS_o_ai 727 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 728 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 729 } 730 731 static __inline__ vector unsigned char __ATTRS_o_ai 732 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 733 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 734 } 735 736 /* vec_vaddshs */ 737 738 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 739 vector short __b) { 740 return __builtin_altivec_vaddshs(__a, __b); 741 } 742 743 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 744 vector short __b) { 745 return __builtin_altivec_vaddshs((vector short)__a, __b); 746 } 747 748 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 749 vector bool short __b) { 750 return __builtin_altivec_vaddshs(__a, (vector short)__b); 751 } 752 753 /* vec_vadduhs */ 754 755 static __inline__ vector unsigned short __ATTRS_o_ai 756 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 757 return __builtin_altivec_vadduhs(__a, __b); 758 } 759 760 static __inline__ vector unsigned short __ATTRS_o_ai 761 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 762 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 763 } 764 765 static __inline__ vector unsigned short __ATTRS_o_ai 766 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 767 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 768 } 769 770 /* vec_vaddsws */ 771 772 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 773 vector int __b) { 774 return __builtin_altivec_vaddsws(__a, __b); 775 } 776 777 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 778 vector int __b) { 779 return __builtin_altivec_vaddsws((vector int)__a, __b); 780 } 781 782 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 783 vector bool int __b) { 784 return __builtin_altivec_vaddsws(__a, (vector int)__b); 785 } 786 787 /* vec_vadduws */ 788 789 static __inline__ vector unsigned int __ATTRS_o_ai 790 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 791 return __builtin_altivec_vadduws(__a, __b); 792 } 793 794 static __inline__ vector unsigned int __ATTRS_o_ai 795 vec_vadduws(vector bool int __a, vector unsigned int __b) { 796 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 797 } 798 799 static __inline__ vector unsigned int __ATTRS_o_ai 800 vec_vadduws(vector unsigned int __a, vector bool int __b) { 801 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 802 } 803 804 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 805 defined(__SIZEOF_INT128__) 806 /* vec_vadduqm */ 807 808 static __inline__ vector signed __int128 __ATTRS_o_ai 809 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 810 return __a + __b; 811 } 812 813 static __inline__ vector unsigned __int128 __ATTRS_o_ai 814 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 815 return __a + __b; 816 } 817 818 /* vec_vaddeuqm */ 819 820 static __inline__ vector signed __int128 __ATTRS_o_ai 821 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 822 vector signed __int128 __c) { 823 return __builtin_altivec_vaddeuqm(__a, __b, __c); 824 } 825 826 static __inline__ vector unsigned __int128 __ATTRS_o_ai 827 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 828 vector unsigned __int128 __c) { 829 return __builtin_altivec_vaddeuqm(__a, __b, __c); 830 } 831 832 /* vec_vaddcuq */ 833 834 static __inline__ vector signed __int128 __ATTRS_o_ai 835 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 836 return __builtin_altivec_vaddcuq(__a, __b); 837 } 838 839 static __inline__ vector unsigned __int128 __ATTRS_o_ai 840 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 841 return __builtin_altivec_vaddcuq(__a, __b); 842 } 843 844 /* vec_vaddecuq */ 845 846 static __inline__ vector signed __int128 __ATTRS_o_ai 847 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 848 vector signed __int128 __c) { 849 return __builtin_altivec_vaddecuq(__a, __b, __c); 850 } 851 852 static __inline__ vector unsigned __int128 __ATTRS_o_ai 853 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 854 vector unsigned __int128 __c) { 855 return __builtin_altivec_vaddecuq(__a, __b, __c); 856 } 857 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 858 859 /* vec_and */ 860 861 #define __builtin_altivec_vand vec_and 862 863 static __inline__ vector signed char __ATTRS_o_ai 864 vec_and(vector signed char __a, vector signed char __b) { 865 return __a & __b; 866 } 867 868 static __inline__ vector signed char __ATTRS_o_ai 869 vec_and(vector bool char __a, vector signed char __b) { 870 return (vector signed char)__a & __b; 871 } 872 873 static __inline__ vector signed char __ATTRS_o_ai 874 vec_and(vector signed char __a, vector bool char __b) { 875 return __a & (vector signed char)__b; 876 } 877 878 static __inline__ vector unsigned char __ATTRS_o_ai 879 vec_and(vector unsigned char __a, vector unsigned char __b) { 880 return __a & __b; 881 } 882 883 static __inline__ vector unsigned char __ATTRS_o_ai 884 vec_and(vector bool char __a, vector unsigned char __b) { 885 return (vector unsigned char)__a & __b; 886 } 887 888 static __inline__ vector unsigned char __ATTRS_o_ai 889 vec_and(vector unsigned char __a, vector bool char __b) { 890 return __a & (vector unsigned char)__b; 891 } 892 893 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 894 vector bool char __b) { 895 return __a & __b; 896 } 897 898 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 899 vector short __b) { 900 return __a & __b; 901 } 902 903 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 904 vector short __b) { 905 return (vector short)__a & __b; 906 } 907 908 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 909 vector bool short __b) { 910 return __a & (vector short)__b; 911 } 912 913 static __inline__ vector unsigned short __ATTRS_o_ai 914 vec_and(vector unsigned short __a, vector unsigned short __b) { 915 return __a & __b; 916 } 917 918 static __inline__ vector unsigned short __ATTRS_o_ai 919 vec_and(vector bool short __a, vector unsigned short __b) { 920 return (vector unsigned short)__a & __b; 921 } 922 923 static __inline__ vector unsigned short __ATTRS_o_ai 924 vec_and(vector unsigned short __a, vector bool short __b) { 925 return __a & (vector unsigned short)__b; 926 } 927 928 static __inline__ vector bool short __ATTRS_o_ai 929 vec_and(vector bool short __a, vector bool short __b) { 930 return __a & __b; 931 } 932 933 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 934 vector int __b) { 935 return __a & __b; 936 } 937 938 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 939 vector int __b) { 940 return (vector int)__a & __b; 941 } 942 943 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 944 vector bool int __b) { 945 return __a & (vector int)__b; 946 } 947 948 static __inline__ vector unsigned int __ATTRS_o_ai 949 vec_and(vector unsigned int __a, vector unsigned int __b) { 950 return __a & __b; 951 } 952 953 static __inline__ vector unsigned int __ATTRS_o_ai 954 vec_and(vector bool int __a, vector unsigned int __b) { 955 return (vector unsigned int)__a & __b; 956 } 957 958 static __inline__ vector unsigned int __ATTRS_o_ai 959 vec_and(vector unsigned int __a, vector bool int __b) { 960 return __a & (vector unsigned int)__b; 961 } 962 963 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 964 vector bool int __b) { 965 return __a & __b; 966 } 967 968 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 969 vector float __b) { 970 vector unsigned int __res = 971 (vector unsigned int)__a & (vector unsigned int)__b; 972 return (vector float)__res; 973 } 974 975 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 976 vector float __b) { 977 vector unsigned int __res = 978 (vector unsigned int)__a & (vector unsigned int)__b; 979 return (vector float)__res; 980 } 981 982 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 983 vector bool int __b) { 984 vector unsigned int __res = 985 (vector unsigned int)__a & (vector unsigned int)__b; 986 return (vector float)__res; 987 } 988 989 #ifdef __VSX__ 990 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 991 vector double __b) { 992 vector unsigned long long __res = 993 (vector unsigned long long)__a & (vector unsigned long long)__b; 994 return (vector double)__res; 995 } 996 997 static __inline__ vector double __ATTRS_o_ai 998 vec_and(vector double __a, vector bool long long __b) { 999 vector unsigned long long __res = 1000 (vector unsigned long long)__a & (vector unsigned long long)__b; 1001 return (vector double)__res; 1002 } 1003 1004 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 1005 vector double __b) { 1006 vector unsigned long long __res = 1007 (vector unsigned long long)__a & (vector unsigned long long)__b; 1008 return (vector double)__res; 1009 } 1010 1011 static __inline__ vector signed long long __ATTRS_o_ai 1012 vec_and(vector signed long long __a, vector signed long long __b) { 1013 return __a & __b; 1014 } 1015 1016 static __inline__ vector signed long long __ATTRS_o_ai 1017 vec_and(vector bool long long __a, vector signed long long __b) { 1018 return (vector signed long long)__a & __b; 1019 } 1020 1021 static __inline__ vector signed long long __ATTRS_o_ai 1022 vec_and(vector signed long long __a, vector bool long long __b) { 1023 return __a & (vector signed long long)__b; 1024 } 1025 1026 static __inline__ vector unsigned long long __ATTRS_o_ai 1027 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 1028 return __a & __b; 1029 } 1030 1031 static __inline__ vector unsigned long long __ATTRS_o_ai 1032 vec_and(vector bool long long __a, vector unsigned long long __b) { 1033 return (vector unsigned long long)__a & __b; 1034 } 1035 1036 static __inline__ vector unsigned long long __ATTRS_o_ai 1037 vec_and(vector unsigned long long __a, vector bool long long __b) { 1038 return __a & (vector unsigned long long)__b; 1039 } 1040 1041 static __inline__ vector bool long long __ATTRS_o_ai 1042 vec_and(vector bool long long __a, vector bool long long __b) { 1043 return __a & __b; 1044 } 1045 #endif 1046 1047 /* vec_vand */ 1048 1049 static __inline__ vector signed char __ATTRS_o_ai 1050 vec_vand(vector signed char __a, vector signed char __b) { 1051 return __a & __b; 1052 } 1053 1054 static __inline__ vector signed char __ATTRS_o_ai 1055 vec_vand(vector bool char __a, vector signed char __b) { 1056 return (vector signed char)__a & __b; 1057 } 1058 1059 static __inline__ vector signed char __ATTRS_o_ai 1060 vec_vand(vector signed char __a, vector bool char __b) { 1061 return __a & (vector signed char)__b; 1062 } 1063 1064 static __inline__ vector unsigned char __ATTRS_o_ai 1065 vec_vand(vector unsigned char __a, vector unsigned char __b) { 1066 return __a & __b; 1067 } 1068 1069 static __inline__ vector unsigned char __ATTRS_o_ai 1070 vec_vand(vector bool char __a, vector unsigned char __b) { 1071 return (vector unsigned char)__a & __b; 1072 } 1073 1074 static __inline__ vector unsigned char __ATTRS_o_ai 1075 vec_vand(vector unsigned char __a, vector bool char __b) { 1076 return __a & (vector unsigned char)__b; 1077 } 1078 1079 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 1080 vector bool char __b) { 1081 return __a & __b; 1082 } 1083 1084 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1085 vector short __b) { 1086 return __a & __b; 1087 } 1088 1089 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 1090 vector short __b) { 1091 return (vector short)__a & __b; 1092 } 1093 1094 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1095 vector bool short __b) { 1096 return __a & (vector short)__b; 1097 } 1098 1099 static __inline__ vector unsigned short __ATTRS_o_ai 1100 vec_vand(vector unsigned short __a, vector unsigned short __b) { 1101 return __a & __b; 1102 } 1103 1104 static __inline__ vector unsigned short __ATTRS_o_ai 1105 vec_vand(vector bool short __a, vector unsigned short __b) { 1106 return (vector unsigned short)__a & __b; 1107 } 1108 1109 static __inline__ vector unsigned short __ATTRS_o_ai 1110 vec_vand(vector unsigned short __a, vector bool short __b) { 1111 return __a & (vector unsigned short)__b; 1112 } 1113 1114 static __inline__ vector bool short __ATTRS_o_ai 1115 vec_vand(vector bool short __a, vector bool short __b) { 1116 return __a & __b; 1117 } 1118 1119 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1120 vector int __b) { 1121 return __a & __b; 1122 } 1123 1124 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 1125 vector int __b) { 1126 return (vector int)__a & __b; 1127 } 1128 1129 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1130 vector bool int __b) { 1131 return __a & (vector int)__b; 1132 } 1133 1134 static __inline__ vector unsigned int __ATTRS_o_ai 1135 vec_vand(vector unsigned int __a, vector unsigned int __b) { 1136 return __a & __b; 1137 } 1138 1139 static __inline__ vector unsigned int __ATTRS_o_ai 1140 vec_vand(vector bool int __a, vector unsigned int __b) { 1141 return (vector unsigned int)__a & __b; 1142 } 1143 1144 static __inline__ vector unsigned int __ATTRS_o_ai 1145 vec_vand(vector unsigned int __a, vector bool int __b) { 1146 return __a & (vector unsigned int)__b; 1147 } 1148 1149 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1150 vector bool int __b) { 1151 return __a & __b; 1152 } 1153 1154 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1155 vector float __b) { 1156 vector unsigned int __res = 1157 (vector unsigned int)__a & (vector unsigned int)__b; 1158 return (vector float)__res; 1159 } 1160 1161 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1162 vector float __b) { 1163 vector unsigned int __res = 1164 (vector unsigned int)__a & (vector unsigned int)__b; 1165 return (vector float)__res; 1166 } 1167 1168 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1169 vector bool int __b) { 1170 vector unsigned int __res = 1171 (vector unsigned int)__a & (vector unsigned int)__b; 1172 return (vector float)__res; 1173 } 1174 1175 #ifdef __VSX__ 1176 static __inline__ vector signed long long __ATTRS_o_ai 1177 vec_vand(vector signed long long __a, vector signed long long __b) { 1178 return __a & __b; 1179 } 1180 1181 static __inline__ vector signed long long __ATTRS_o_ai 1182 vec_vand(vector bool long long __a, vector signed long long __b) { 1183 return (vector signed long long)__a & __b; 1184 } 1185 1186 static __inline__ vector signed long long __ATTRS_o_ai 1187 vec_vand(vector signed long long __a, vector bool long long __b) { 1188 return __a & (vector signed long long)__b; 1189 } 1190 1191 static __inline__ vector unsigned long long __ATTRS_o_ai 1192 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1193 return __a & __b; 1194 } 1195 1196 static __inline__ vector unsigned long long __ATTRS_o_ai 1197 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1198 return (vector unsigned long long)__a & __b; 1199 } 1200 1201 static __inline__ vector unsigned long long __ATTRS_o_ai 1202 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1203 return __a & (vector unsigned long long)__b; 1204 } 1205 1206 static __inline__ vector bool long long __ATTRS_o_ai 1207 vec_vand(vector bool long long __a, vector bool long long __b) { 1208 return __a & __b; 1209 } 1210 #endif 1211 1212 /* vec_andc */ 1213 1214 #define __builtin_altivec_vandc vec_andc 1215 1216 static __inline__ vector signed char __ATTRS_o_ai 1217 vec_andc(vector signed char __a, vector signed char __b) { 1218 return __a & ~__b; 1219 } 1220 1221 static __inline__ vector signed char __ATTRS_o_ai 1222 vec_andc(vector bool char __a, vector signed char __b) { 1223 return (vector signed char)__a & ~__b; 1224 } 1225 1226 static __inline__ vector signed char __ATTRS_o_ai 1227 vec_andc(vector signed char __a, vector bool char __b) { 1228 return __a & ~(vector signed char)__b; 1229 } 1230 1231 static __inline__ vector unsigned char __ATTRS_o_ai 1232 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1233 return __a & ~__b; 1234 } 1235 1236 static __inline__ vector unsigned char __ATTRS_o_ai 1237 vec_andc(vector bool char __a, vector unsigned char __b) { 1238 return (vector unsigned char)__a & ~__b; 1239 } 1240 1241 static __inline__ vector unsigned char __ATTRS_o_ai 1242 vec_andc(vector unsigned char __a, vector bool char __b) { 1243 return __a & ~(vector unsigned char)__b; 1244 } 1245 1246 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1247 vector bool char __b) { 1248 return __a & ~__b; 1249 } 1250 1251 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1252 vector short __b) { 1253 return __a & ~__b; 1254 } 1255 1256 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1257 vector short __b) { 1258 return (vector short)__a & ~__b; 1259 } 1260 1261 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1262 vector bool short __b) { 1263 return __a & ~(vector short)__b; 1264 } 1265 1266 static __inline__ vector unsigned short __ATTRS_o_ai 1267 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1268 return __a & ~__b; 1269 } 1270 1271 static __inline__ vector unsigned short __ATTRS_o_ai 1272 vec_andc(vector bool short __a, vector unsigned short __b) { 1273 return (vector unsigned short)__a & ~__b; 1274 } 1275 1276 static __inline__ vector unsigned short __ATTRS_o_ai 1277 vec_andc(vector unsigned short __a, vector bool short __b) { 1278 return __a & ~(vector unsigned short)__b; 1279 } 1280 1281 static __inline__ vector bool short __ATTRS_o_ai 1282 vec_andc(vector bool short __a, vector bool short __b) { 1283 return __a & ~__b; 1284 } 1285 1286 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1287 vector int __b) { 1288 return __a & ~__b; 1289 } 1290 1291 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1292 vector int __b) { 1293 return (vector int)__a & ~__b; 1294 } 1295 1296 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1297 vector bool int __b) { 1298 return __a & ~(vector int)__b; 1299 } 1300 1301 static __inline__ vector unsigned int __ATTRS_o_ai 1302 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1303 return __a & ~__b; 1304 } 1305 1306 static __inline__ vector unsigned int __ATTRS_o_ai 1307 vec_andc(vector bool int __a, vector unsigned int __b) { 1308 return (vector unsigned int)__a & ~__b; 1309 } 1310 1311 static __inline__ vector unsigned int __ATTRS_o_ai 1312 vec_andc(vector unsigned int __a, vector bool int __b) { 1313 return __a & ~(vector unsigned int)__b; 1314 } 1315 1316 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1317 vector bool int __b) { 1318 return __a & ~__b; 1319 } 1320 1321 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1322 vector float __b) { 1323 vector unsigned int __res = 1324 (vector unsigned int)__a & ~(vector unsigned int)__b; 1325 return (vector float)__res; 1326 } 1327 1328 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1329 vector float __b) { 1330 vector unsigned int __res = 1331 (vector unsigned int)__a & ~(vector unsigned int)__b; 1332 return (vector float)__res; 1333 } 1334 1335 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1336 vector bool int __b) { 1337 vector unsigned int __res = 1338 (vector unsigned int)__a & ~(vector unsigned int)__b; 1339 return (vector float)__res; 1340 } 1341 1342 #ifdef __VSX__ 1343 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1344 vector double __b) { 1345 vector unsigned long long __res = 1346 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1347 return (vector double)__res; 1348 } 1349 1350 static __inline__ vector double __ATTRS_o_ai 1351 vec_andc(vector double __a, vector bool long long __b) { 1352 vector unsigned long long __res = 1353 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1354 return (vector double)__res; 1355 } 1356 1357 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1358 vector double __b) { 1359 vector unsigned long long __res = 1360 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1361 return (vector double)__res; 1362 } 1363 1364 static __inline__ vector signed long long __ATTRS_o_ai 1365 vec_andc(vector signed long long __a, vector signed long long __b) { 1366 return __a & ~__b; 1367 } 1368 1369 static __inline__ vector signed long long __ATTRS_o_ai 1370 vec_andc(vector bool long long __a, vector signed long long __b) { 1371 return (vector signed long long)__a & ~__b; 1372 } 1373 1374 static __inline__ vector signed long long __ATTRS_o_ai 1375 vec_andc(vector signed long long __a, vector bool long long __b) { 1376 return __a & ~(vector signed long long)__b; 1377 } 1378 1379 static __inline__ vector unsigned long long __ATTRS_o_ai 1380 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1381 return __a & ~__b; 1382 } 1383 1384 static __inline__ vector unsigned long long __ATTRS_o_ai 1385 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1386 return (vector unsigned long long)__a & ~__b; 1387 } 1388 1389 static __inline__ vector unsigned long long __ATTRS_o_ai 1390 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1391 return __a & ~(vector unsigned long long)__b; 1392 } 1393 1394 static __inline__ vector bool long long __ATTRS_o_ai 1395 vec_andc(vector bool long long __a, vector bool long long __b) { 1396 return __a & ~__b; 1397 } 1398 #endif 1399 1400 /* vec_vandc */ 1401 1402 static __inline__ vector signed char __ATTRS_o_ai 1403 vec_vandc(vector signed char __a, vector signed char __b) { 1404 return __a & ~__b; 1405 } 1406 1407 static __inline__ vector signed char __ATTRS_o_ai 1408 vec_vandc(vector bool char __a, vector signed char __b) { 1409 return (vector signed char)__a & ~__b; 1410 } 1411 1412 static __inline__ vector signed char __ATTRS_o_ai 1413 vec_vandc(vector signed char __a, vector bool char __b) { 1414 return __a & ~(vector signed char)__b; 1415 } 1416 1417 static __inline__ vector unsigned char __ATTRS_o_ai 1418 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1419 return __a & ~__b; 1420 } 1421 1422 static __inline__ vector unsigned char __ATTRS_o_ai 1423 vec_vandc(vector bool char __a, vector unsigned char __b) { 1424 return (vector unsigned char)__a & ~__b; 1425 } 1426 1427 static __inline__ vector unsigned char __ATTRS_o_ai 1428 vec_vandc(vector unsigned char __a, vector bool char __b) { 1429 return __a & ~(vector unsigned char)__b; 1430 } 1431 1432 static __inline__ vector bool char __ATTRS_o_ai 1433 vec_vandc(vector bool char __a, vector bool char __b) { 1434 return __a & ~__b; 1435 } 1436 1437 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1438 vector short __b) { 1439 return __a & ~__b; 1440 } 1441 1442 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1443 vector short __b) { 1444 return (vector short)__a & ~__b; 1445 } 1446 1447 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1448 vector bool short __b) { 1449 return __a & ~(vector short)__b; 1450 } 1451 1452 static __inline__ vector unsigned short __ATTRS_o_ai 1453 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1454 return __a & ~__b; 1455 } 1456 1457 static __inline__ vector unsigned short __ATTRS_o_ai 1458 vec_vandc(vector bool short __a, vector unsigned short __b) { 1459 return (vector unsigned short)__a & ~__b; 1460 } 1461 1462 static __inline__ vector unsigned short __ATTRS_o_ai 1463 vec_vandc(vector unsigned short __a, vector bool short __b) { 1464 return __a & ~(vector unsigned short)__b; 1465 } 1466 1467 static __inline__ vector bool short __ATTRS_o_ai 1468 vec_vandc(vector bool short __a, vector bool short __b) { 1469 return __a & ~__b; 1470 } 1471 1472 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1473 vector int __b) { 1474 return __a & ~__b; 1475 } 1476 1477 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1478 vector int __b) { 1479 return (vector int)__a & ~__b; 1480 } 1481 1482 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1483 vector bool int __b) { 1484 return __a & ~(vector int)__b; 1485 } 1486 1487 static __inline__ vector unsigned int __ATTRS_o_ai 1488 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1489 return __a & ~__b; 1490 } 1491 1492 static __inline__ vector unsigned int __ATTRS_o_ai 1493 vec_vandc(vector bool int __a, vector unsigned int __b) { 1494 return (vector unsigned int)__a & ~__b; 1495 } 1496 1497 static __inline__ vector unsigned int __ATTRS_o_ai 1498 vec_vandc(vector unsigned int __a, vector bool int __b) { 1499 return __a & ~(vector unsigned int)__b; 1500 } 1501 1502 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1503 vector bool int __b) { 1504 return __a & ~__b; 1505 } 1506 1507 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1508 vector float __b) { 1509 vector unsigned int __res = 1510 (vector unsigned int)__a & ~(vector unsigned int)__b; 1511 return (vector float)__res; 1512 } 1513 1514 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1515 vector float __b) { 1516 vector unsigned int __res = 1517 (vector unsigned int)__a & ~(vector unsigned int)__b; 1518 return (vector float)__res; 1519 } 1520 1521 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1522 vector bool int __b) { 1523 vector unsigned int __res = 1524 (vector unsigned int)__a & ~(vector unsigned int)__b; 1525 return (vector float)__res; 1526 } 1527 1528 #ifdef __VSX__ 1529 static __inline__ vector signed long long __ATTRS_o_ai 1530 vec_vandc(vector signed long long __a, vector signed long long __b) { 1531 return __a & ~__b; 1532 } 1533 1534 static __inline__ vector signed long long __ATTRS_o_ai 1535 vec_vandc(vector bool long long __a, vector signed long long __b) { 1536 return (vector signed long long)__a & ~__b; 1537 } 1538 1539 static __inline__ vector signed long long __ATTRS_o_ai 1540 vec_vandc(vector signed long long __a, vector bool long long __b) { 1541 return __a & ~(vector signed long long)__b; 1542 } 1543 1544 static __inline__ vector unsigned long long __ATTRS_o_ai 1545 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1546 return __a & ~__b; 1547 } 1548 1549 static __inline__ vector unsigned long long __ATTRS_o_ai 1550 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1551 return (vector unsigned long long)__a & ~__b; 1552 } 1553 1554 static __inline__ vector unsigned long long __ATTRS_o_ai 1555 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1556 return __a & ~(vector unsigned long long)__b; 1557 } 1558 1559 static __inline__ vector bool long long __ATTRS_o_ai 1560 vec_vandc(vector bool long long __a, vector bool long long __b) { 1561 return __a & ~__b; 1562 } 1563 #endif 1564 1565 /* vec_avg */ 1566 1567 static __inline__ vector signed char __ATTRS_o_ai 1568 vec_avg(vector signed char __a, vector signed char __b) { 1569 return __builtin_altivec_vavgsb(__a, __b); 1570 } 1571 1572 static __inline__ vector unsigned char __ATTRS_o_ai 1573 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1574 return __builtin_altivec_vavgub(__a, __b); 1575 } 1576 1577 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1578 vector short __b) { 1579 return __builtin_altivec_vavgsh(__a, __b); 1580 } 1581 1582 static __inline__ vector unsigned short __ATTRS_o_ai 1583 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1584 return __builtin_altivec_vavguh(__a, __b); 1585 } 1586 1587 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1588 vector int __b) { 1589 return __builtin_altivec_vavgsw(__a, __b); 1590 } 1591 1592 static __inline__ vector unsigned int __ATTRS_o_ai 1593 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1594 return __builtin_altivec_vavguw(__a, __b); 1595 } 1596 1597 /* vec_vavgsb */ 1598 1599 static __inline__ vector signed char __attribute__((__always_inline__)) 1600 vec_vavgsb(vector signed char __a, vector signed char __b) { 1601 return __builtin_altivec_vavgsb(__a, __b); 1602 } 1603 1604 /* vec_vavgub */ 1605 1606 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1607 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1608 return __builtin_altivec_vavgub(__a, __b); 1609 } 1610 1611 /* vec_vavgsh */ 1612 1613 static __inline__ vector short __attribute__((__always_inline__)) 1614 vec_vavgsh(vector short __a, vector short __b) { 1615 return __builtin_altivec_vavgsh(__a, __b); 1616 } 1617 1618 /* vec_vavguh */ 1619 1620 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1621 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1622 return __builtin_altivec_vavguh(__a, __b); 1623 } 1624 1625 /* vec_vavgsw */ 1626 1627 static __inline__ vector int __attribute__((__always_inline__)) 1628 vec_vavgsw(vector int __a, vector int __b) { 1629 return __builtin_altivec_vavgsw(__a, __b); 1630 } 1631 1632 /* vec_vavguw */ 1633 1634 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1635 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1636 return __builtin_altivec_vavguw(__a, __b); 1637 } 1638 1639 /* vec_ceil */ 1640 1641 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1642 #ifdef __VSX__ 1643 return __builtin_vsx_xvrspip(__a); 1644 #else 1645 return __builtin_altivec_vrfip(__a); 1646 #endif 1647 } 1648 1649 #ifdef __VSX__ 1650 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1651 return __builtin_vsx_xvrdpip(__a); 1652 } 1653 #endif 1654 1655 /* vec_roundp */ 1656 static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { 1657 return vec_ceil(__a); 1658 } 1659 1660 #ifdef __VSX__ 1661 static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { 1662 return vec_ceil(__a); 1663 } 1664 #endif 1665 1666 /* vec_vrfip */ 1667 1668 static __inline__ vector float __attribute__((__always_inline__)) 1669 vec_vrfip(vector float __a) { 1670 return __builtin_altivec_vrfip(__a); 1671 } 1672 1673 /* vec_cmpb */ 1674 1675 static __inline__ vector int __attribute__((__always_inline__)) 1676 vec_cmpb(vector float __a, vector float __b) { 1677 return __builtin_altivec_vcmpbfp(__a, __b); 1678 } 1679 1680 /* vec_vcmpbfp */ 1681 1682 static __inline__ vector int __attribute__((__always_inline__)) 1683 vec_vcmpbfp(vector float __a, vector float __b) { 1684 return __builtin_altivec_vcmpbfp(__a, __b); 1685 } 1686 1687 /* vec_cmpeq */ 1688 1689 static __inline__ vector bool char __ATTRS_o_ai 1690 vec_cmpeq(vector signed char __a, vector signed char __b) { 1691 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1692 (vector char)__b); 1693 } 1694 1695 static __inline__ vector bool char __ATTRS_o_ai 1696 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1697 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1698 (vector char)__b); 1699 } 1700 1701 static __inline__ vector bool char __ATTRS_o_ai 1702 vec_cmpeq(vector bool char __a, vector bool char __b) { 1703 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1704 (vector char)__b); 1705 } 1706 1707 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1708 vector short __b) { 1709 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1710 } 1711 1712 static __inline__ vector bool short __ATTRS_o_ai 1713 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1714 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1715 (vector short)__b); 1716 } 1717 1718 static __inline__ vector bool short __ATTRS_o_ai 1719 vec_cmpeq(vector bool short __a, vector bool short __b) { 1720 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1721 (vector short)__b); 1722 } 1723 1724 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1725 vector int __b) { 1726 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1727 } 1728 1729 static __inline__ vector bool int __ATTRS_o_ai 1730 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1731 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1732 (vector int)__b); 1733 } 1734 1735 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, 1736 vector bool int __b) { 1737 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1738 (vector int)__b); 1739 } 1740 1741 #ifdef __POWER8_VECTOR__ 1742 static __inline__ vector bool long long __ATTRS_o_ai 1743 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1744 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1745 } 1746 1747 static __inline__ vector bool long long __ATTRS_o_ai 1748 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1749 return (vector bool long long)__builtin_altivec_vcmpequd( 1750 (vector long long)__a, (vector long long)__b); 1751 } 1752 1753 static __inline__ vector bool long long __ATTRS_o_ai 1754 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1755 return (vector bool long long)__builtin_altivec_vcmpequd( 1756 (vector long long)__a, (vector long long)__b); 1757 } 1758 #elif defined(__VSX__) 1759 static __inline__ vector bool long long __ATTRS_o_ai 1760 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1761 vector bool int __wordcmp = 1762 vec_cmpeq((vector signed int)__a, (vector signed int)__b); 1763 #ifdef __LITTLE_ENDIAN__ 1764 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); 1765 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, 1766 1, 3, 3); 1767 #else 1768 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); 1769 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, 1770 0, 2, 2); 1771 #endif 1772 } 1773 1774 static __inline__ vector bool long long __ATTRS_o_ai 1775 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1776 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1777 } 1778 1779 static __inline__ vector bool long long __ATTRS_o_ai 1780 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1781 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1782 } 1783 #endif 1784 1785 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1786 vector float __b) { 1787 #ifdef __VSX__ 1788 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1789 #else 1790 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1791 #endif 1792 } 1793 1794 #ifdef __VSX__ 1795 static __inline__ vector bool long long __ATTRS_o_ai 1796 vec_cmpeq(vector double __a, vector double __b) { 1797 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1798 } 1799 #endif 1800 1801 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1802 static __inline__ vector bool __int128 __ATTRS_o_ai 1803 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { 1804 return (vector bool __int128)__builtin_altivec_vcmpequq( 1805 (vector bool __int128)__a, (vector bool __int128)__b); 1806 } 1807 1808 static __inline__ vector bool __int128 __ATTRS_o_ai 1809 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1810 return (vector bool __int128)__builtin_altivec_vcmpequq( 1811 (vector bool __int128)__a, (vector bool __int128)__b); 1812 } 1813 #endif 1814 1815 #ifdef __POWER9_VECTOR__ 1816 /* vec_cmpne */ 1817 1818 static __inline__ vector bool char __ATTRS_o_ai 1819 vec_cmpne(vector bool char __a, vector bool char __b) { 1820 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1821 (vector char)__b); 1822 } 1823 1824 static __inline__ vector bool char __ATTRS_o_ai 1825 vec_cmpne(vector signed char __a, vector signed char __b) { 1826 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1827 (vector char)__b); 1828 } 1829 1830 static __inline__ vector bool char __ATTRS_o_ai 1831 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1832 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1833 (vector char)__b); 1834 } 1835 1836 static __inline__ vector bool short __ATTRS_o_ai 1837 vec_cmpne(vector bool short __a, vector bool short __b) { 1838 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1839 (vector short)__b); 1840 } 1841 1842 static __inline__ vector bool short __ATTRS_o_ai 1843 vec_cmpne(vector signed short __a, vector signed short __b) { 1844 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1845 (vector short)__b); 1846 } 1847 1848 static __inline__ vector bool short __ATTRS_o_ai 1849 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1850 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1851 (vector short)__b); 1852 } 1853 1854 static __inline__ vector bool int __ATTRS_o_ai 1855 vec_cmpne(vector bool int __a, vector bool int __b) { 1856 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1857 (vector int)__b); 1858 } 1859 1860 static __inline__ vector bool int __ATTRS_o_ai 1861 vec_cmpne(vector signed int __a, vector signed int __b) { 1862 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1863 (vector int)__b); 1864 } 1865 1866 static __inline__ vector bool int __ATTRS_o_ai 1867 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1868 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1869 (vector int)__b); 1870 } 1871 1872 static __inline__ vector bool int __ATTRS_o_ai 1873 vec_cmpne(vector float __a, vector float __b) { 1874 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1875 (vector int)__b); 1876 } 1877 1878 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1879 static __inline__ vector bool __int128 __ATTRS_o_ai 1880 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1881 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1882 (vector bool __int128)__a, (vector bool __int128)__b)); 1883 } 1884 1885 static __inline__ vector bool __int128 __ATTRS_o_ai 1886 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { 1887 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1888 (vector bool __int128)__a, (vector bool __int128)__b)); 1889 } 1890 #endif 1891 1892 /* vec_cmpnez */ 1893 1894 static __inline__ vector bool char __ATTRS_o_ai 1895 vec_cmpnez(vector signed char __a, vector signed char __b) { 1896 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1897 (vector char)__b); 1898 } 1899 1900 static __inline__ vector bool char __ATTRS_o_ai 1901 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1902 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1903 (vector char)__b); 1904 } 1905 1906 static __inline__ vector bool short __ATTRS_o_ai 1907 vec_cmpnez(vector signed short __a, vector signed short __b) { 1908 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1909 (vector short)__b); 1910 } 1911 1912 static __inline__ vector bool short __ATTRS_o_ai 1913 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1914 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1915 (vector short)__b); 1916 } 1917 1918 static __inline__ vector bool int __ATTRS_o_ai 1919 vec_cmpnez(vector signed int __a, vector signed int __b) { 1920 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1921 (vector int)__b); 1922 } 1923 1924 static __inline__ vector bool int __ATTRS_o_ai 1925 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1926 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1927 (vector int)__b); 1928 } 1929 1930 static __inline__ signed int __ATTRS_o_ai 1931 vec_cntlz_lsbb(vector signed char __a) { 1932 #ifdef __LITTLE_ENDIAN__ 1933 return __builtin_altivec_vctzlsbb(__a); 1934 #else 1935 return __builtin_altivec_vclzlsbb(__a); 1936 #endif 1937 } 1938 1939 static __inline__ signed int __ATTRS_o_ai 1940 vec_cntlz_lsbb(vector unsigned char __a) { 1941 #ifdef __LITTLE_ENDIAN__ 1942 return __builtin_altivec_vctzlsbb(__a); 1943 #else 1944 return __builtin_altivec_vclzlsbb(__a); 1945 #endif 1946 } 1947 1948 static __inline__ signed int __ATTRS_o_ai 1949 vec_cnttz_lsbb(vector signed char __a) { 1950 #ifdef __LITTLE_ENDIAN__ 1951 return __builtin_altivec_vclzlsbb(__a); 1952 #else 1953 return __builtin_altivec_vctzlsbb(__a); 1954 #endif 1955 } 1956 1957 static __inline__ signed int __ATTRS_o_ai 1958 vec_cnttz_lsbb(vector unsigned char __a) { 1959 #ifdef __LITTLE_ENDIAN__ 1960 return __builtin_altivec_vclzlsbb(__a); 1961 #else 1962 return __builtin_altivec_vctzlsbb(__a); 1963 #endif 1964 } 1965 1966 static __inline__ vector unsigned int __ATTRS_o_ai 1967 vec_parity_lsbb(vector unsigned int __a) { 1968 return __builtin_altivec_vprtybw(__a); 1969 } 1970 1971 static __inline__ vector unsigned int __ATTRS_o_ai 1972 vec_parity_lsbb(vector signed int __a) { 1973 return __builtin_altivec_vprtybw(__a); 1974 } 1975 1976 #ifdef __SIZEOF_INT128__ 1977 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1978 vec_parity_lsbb(vector unsigned __int128 __a) { 1979 return __builtin_altivec_vprtybq(__a); 1980 } 1981 1982 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1983 vec_parity_lsbb(vector signed __int128 __a) { 1984 return __builtin_altivec_vprtybq(__a); 1985 } 1986 #endif 1987 1988 static __inline__ vector unsigned long long __ATTRS_o_ai 1989 vec_parity_lsbb(vector unsigned long long __a) { 1990 return __builtin_altivec_vprtybd(__a); 1991 } 1992 1993 static __inline__ vector unsigned long long __ATTRS_o_ai 1994 vec_parity_lsbb(vector signed long long __a) { 1995 return __builtin_altivec_vprtybd(__a); 1996 } 1997 1998 #else 1999 /* vec_cmpne */ 2000 2001 static __inline__ vector bool char __ATTRS_o_ai 2002 vec_cmpne(vector bool char __a, vector bool char __b) { 2003 return ~(vec_cmpeq(__a, __b)); 2004 } 2005 2006 static __inline__ vector bool char __ATTRS_o_ai 2007 vec_cmpne(vector signed char __a, vector signed char __b) { 2008 return ~(vec_cmpeq(__a, __b)); 2009 } 2010 2011 static __inline__ vector bool char __ATTRS_o_ai 2012 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 2013 return ~(vec_cmpeq(__a, __b)); 2014 } 2015 2016 static __inline__ vector bool short __ATTRS_o_ai 2017 vec_cmpne(vector bool short __a, vector bool short __b) { 2018 return ~(vec_cmpeq(__a, __b)); 2019 } 2020 2021 static __inline__ vector bool short __ATTRS_o_ai 2022 vec_cmpne(vector signed short __a, vector signed short __b) { 2023 return ~(vec_cmpeq(__a, __b)); 2024 } 2025 2026 static __inline__ vector bool short __ATTRS_o_ai 2027 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 2028 return ~(vec_cmpeq(__a, __b)); 2029 } 2030 2031 static __inline__ vector bool int __ATTRS_o_ai 2032 vec_cmpne(vector bool int __a, vector bool int __b) { 2033 return ~(vec_cmpeq(__a, __b)); 2034 } 2035 2036 static __inline__ vector bool int __ATTRS_o_ai 2037 vec_cmpne(vector signed int __a, vector signed int __b) { 2038 return ~(vec_cmpeq(__a, __b)); 2039 } 2040 2041 static __inline__ vector bool int __ATTRS_o_ai 2042 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 2043 return ~(vec_cmpeq(__a, __b)); 2044 } 2045 2046 static __inline__ vector bool int __ATTRS_o_ai 2047 vec_cmpne(vector float __a, vector float __b) { 2048 return ~(vec_cmpeq(__a, __b)); 2049 } 2050 #endif 2051 2052 #ifdef __POWER8_VECTOR__ 2053 static __inline__ vector bool long long __ATTRS_o_ai 2054 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2055 return (vector bool long long) 2056 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2057 } 2058 2059 static __inline__ vector bool long long __ATTRS_o_ai 2060 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2061 return (vector bool long long) 2062 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2063 } 2064 2065 static __inline__ vector bool long long __ATTRS_o_ai 2066 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2067 return (vector bool long long) 2068 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2069 } 2070 #elif defined(__VSX__) 2071 static __inline__ vector bool long long __ATTRS_o_ai 2072 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2073 return (vector bool long long)~( 2074 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2075 } 2076 2077 static __inline__ vector bool long long __ATTRS_o_ai 2078 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2079 return (vector bool long long)~( 2080 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2081 } 2082 2083 static __inline__ vector bool long long __ATTRS_o_ai 2084 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2085 return (vector bool long long)~( 2086 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2087 } 2088 #endif 2089 2090 #ifdef __VSX__ 2091 static __inline__ vector bool long long __ATTRS_o_ai 2092 vec_cmpne(vector double __a, vector double __b) { 2093 return (vector bool long long) 2094 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2095 } 2096 #endif 2097 2098 /* vec_cmpgt */ 2099 2100 static __inline__ vector bool char __ATTRS_o_ai 2101 vec_cmpgt(vector signed char __a, vector signed char __b) { 2102 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2103 } 2104 2105 static __inline__ vector bool char __ATTRS_o_ai 2106 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 2107 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2108 } 2109 2110 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 2111 vector short __b) { 2112 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2113 } 2114 2115 static __inline__ vector bool short __ATTRS_o_ai 2116 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 2117 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2118 } 2119 2120 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 2121 vector int __b) { 2122 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2123 } 2124 2125 static __inline__ vector bool int __ATTRS_o_ai 2126 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 2127 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2128 } 2129 2130 #ifdef __POWER8_VECTOR__ 2131 static __inline__ vector bool long long __ATTRS_o_ai 2132 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2133 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 2134 } 2135 2136 static __inline__ vector bool long long __ATTRS_o_ai 2137 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2138 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2139 } 2140 #elif defined(__VSX__) 2141 static __inline__ vector bool long long __ATTRS_o_ai 2142 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2143 vector signed int __sgtw = (vector signed int)vec_cmpgt( 2144 (vector signed int)__a, (vector signed int)__b); 2145 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2146 (vector unsigned int)__a, (vector unsigned int)__b); 2147 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2148 (vector signed int)__a, (vector signed int)__b); 2149 #ifdef __LITTLE_ENDIAN__ 2150 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2151 __sgtw |= (vector signed int)__ugtw; 2152 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, 2153 3); 2154 #else 2155 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2156 __sgtw |= (vector signed int)__ugtw; 2157 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, 2158 2); 2159 #endif 2160 } 2161 2162 static __inline__ vector bool long long __ATTRS_o_ai 2163 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2164 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2165 (vector unsigned int)__a, (vector unsigned int)__b); 2166 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2167 (vector signed int)__a, (vector signed int)__b); 2168 #ifdef __LITTLE_ENDIAN__ 2169 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2170 __ugtw |= __eqw; 2171 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, 2172 3); 2173 #else 2174 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2175 __ugtw |= __eqw; 2176 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, 2177 2); 2178 #endif 2179 } 2180 #endif 2181 2182 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2183 vector float __b) { 2184 #ifdef __VSX__ 2185 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2186 #else 2187 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2188 #endif 2189 } 2190 2191 #ifdef __VSX__ 2192 static __inline__ vector bool long long __ATTRS_o_ai 2193 vec_cmpgt(vector double __a, vector double __b) { 2194 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2195 } 2196 #endif 2197 2198 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2199 static __inline__ vector bool __int128 __ATTRS_o_ai 2200 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { 2201 return (vector bool __int128)__builtin_altivec_vcmpgtsq( 2202 (vector bool __int128)__a, (vector bool __int128)__b); 2203 } 2204 2205 static __inline__ vector bool __int128 __ATTRS_o_ai 2206 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2207 return (vector bool __int128)__builtin_altivec_vcmpgtuq( 2208 (vector bool __int128)__a, (vector bool __int128)__b); 2209 } 2210 #endif 2211 2212 /* vec_cmpge */ 2213 2214 static __inline__ vector bool char __ATTRS_o_ai 2215 vec_cmpge(vector signed char __a, vector signed char __b) { 2216 return ~(vec_cmpgt(__b, __a)); 2217 } 2218 2219 static __inline__ vector bool char __ATTRS_o_ai 2220 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2221 return ~(vec_cmpgt(__b, __a)); 2222 } 2223 2224 static __inline__ vector bool short __ATTRS_o_ai 2225 vec_cmpge(vector signed short __a, vector signed short __b) { 2226 return ~(vec_cmpgt(__b, __a)); 2227 } 2228 2229 static __inline__ vector bool short __ATTRS_o_ai 2230 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2231 return ~(vec_cmpgt(__b, __a)); 2232 } 2233 2234 static __inline__ vector bool int __ATTRS_o_ai 2235 vec_cmpge(vector signed int __a, vector signed int __b) { 2236 return ~(vec_cmpgt(__b, __a)); 2237 } 2238 2239 static __inline__ vector bool int __ATTRS_o_ai 2240 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2241 return ~(vec_cmpgt(__b, __a)); 2242 } 2243 2244 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2245 vector float __b) { 2246 #ifdef __VSX__ 2247 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2248 #else 2249 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2250 #endif 2251 } 2252 2253 #ifdef __VSX__ 2254 static __inline__ vector bool long long __ATTRS_o_ai 2255 vec_cmpge(vector double __a, vector double __b) { 2256 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2257 } 2258 2259 static __inline__ vector bool long long __ATTRS_o_ai 2260 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2261 return ~(vec_cmpgt(__b, __a)); 2262 } 2263 2264 static __inline__ vector bool long long __ATTRS_o_ai 2265 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2266 return ~(vec_cmpgt(__b, __a)); 2267 } 2268 #endif 2269 2270 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2271 static __inline__ vector bool __int128 __ATTRS_o_ai 2272 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { 2273 return ~(vec_cmpgt(__b, __a)); 2274 } 2275 2276 static __inline__ vector bool __int128 __ATTRS_o_ai 2277 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2278 return ~(vec_cmpgt(__b, __a)); 2279 } 2280 #endif 2281 2282 /* vec_vcmpgefp */ 2283 2284 static __inline__ vector bool int __attribute__((__always_inline__)) 2285 vec_vcmpgefp(vector float __a, vector float __b) { 2286 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2287 } 2288 2289 /* vec_vcmpgtsb */ 2290 2291 static __inline__ vector bool char __attribute__((__always_inline__)) 2292 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2293 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2294 } 2295 2296 /* vec_vcmpgtub */ 2297 2298 static __inline__ vector bool char __attribute__((__always_inline__)) 2299 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2300 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2301 } 2302 2303 /* vec_vcmpgtsh */ 2304 2305 static __inline__ vector bool short __attribute__((__always_inline__)) 2306 vec_vcmpgtsh(vector short __a, vector short __b) { 2307 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2308 } 2309 2310 /* vec_vcmpgtuh */ 2311 2312 static __inline__ vector bool short __attribute__((__always_inline__)) 2313 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2314 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2315 } 2316 2317 /* vec_vcmpgtsw */ 2318 2319 static __inline__ vector bool int __attribute__((__always_inline__)) 2320 vec_vcmpgtsw(vector int __a, vector int __b) { 2321 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2322 } 2323 2324 /* vec_vcmpgtuw */ 2325 2326 static __inline__ vector bool int __attribute__((__always_inline__)) 2327 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2328 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2329 } 2330 2331 /* vec_vcmpgtfp */ 2332 2333 static __inline__ vector bool int __attribute__((__always_inline__)) 2334 vec_vcmpgtfp(vector float __a, vector float __b) { 2335 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2336 } 2337 2338 /* vec_cmple */ 2339 2340 static __inline__ vector bool char __ATTRS_o_ai 2341 vec_cmple(vector signed char __a, vector signed char __b) { 2342 return vec_cmpge(__b, __a); 2343 } 2344 2345 static __inline__ vector bool char __ATTRS_o_ai 2346 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2347 return vec_cmpge(__b, __a); 2348 } 2349 2350 static __inline__ vector bool short __ATTRS_o_ai 2351 vec_cmple(vector signed short __a, vector signed short __b) { 2352 return vec_cmpge(__b, __a); 2353 } 2354 2355 static __inline__ vector bool short __ATTRS_o_ai 2356 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2357 return vec_cmpge(__b, __a); 2358 } 2359 2360 static __inline__ vector bool int __ATTRS_o_ai 2361 vec_cmple(vector signed int __a, vector signed int __b) { 2362 return vec_cmpge(__b, __a); 2363 } 2364 2365 static __inline__ vector bool int __ATTRS_o_ai 2366 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2367 return vec_cmpge(__b, __a); 2368 } 2369 2370 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2371 vector float __b) { 2372 return vec_cmpge(__b, __a); 2373 } 2374 2375 #ifdef __VSX__ 2376 static __inline__ vector bool long long __ATTRS_o_ai 2377 vec_cmple(vector double __a, vector double __b) { 2378 return vec_cmpge(__b, __a); 2379 } 2380 2381 static __inline__ vector bool long long __ATTRS_o_ai 2382 vec_cmple(vector signed long long __a, vector signed long long __b) { 2383 return vec_cmpge(__b, __a); 2384 } 2385 2386 static __inline__ vector bool long long __ATTRS_o_ai 2387 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2388 return vec_cmpge(__b, __a); 2389 } 2390 #endif 2391 2392 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2393 static __inline__ vector bool __int128 __ATTRS_o_ai 2394 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { 2395 return vec_cmpge(__b, __a); 2396 } 2397 2398 static __inline__ vector bool __int128 __ATTRS_o_ai 2399 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2400 return vec_cmpge(__b, __a); 2401 } 2402 #endif 2403 2404 /* vec_cmplt */ 2405 2406 static __inline__ vector bool char __ATTRS_o_ai 2407 vec_cmplt(vector signed char __a, vector signed char __b) { 2408 return vec_cmpgt(__b, __a); 2409 } 2410 2411 static __inline__ vector bool char __ATTRS_o_ai 2412 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2413 return vec_cmpgt(__b, __a); 2414 } 2415 2416 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2417 vector short __b) { 2418 return vec_cmpgt(__b, __a); 2419 } 2420 2421 static __inline__ vector bool short __ATTRS_o_ai 2422 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2423 return vec_cmpgt(__b, __a); 2424 } 2425 2426 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2427 vector int __b) { 2428 return vec_cmpgt(__b, __a); 2429 } 2430 2431 static __inline__ vector bool int __ATTRS_o_ai 2432 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2433 return vec_cmpgt(__b, __a); 2434 } 2435 2436 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2437 vector float __b) { 2438 return vec_cmpgt(__b, __a); 2439 } 2440 2441 #ifdef __VSX__ 2442 static __inline__ vector bool long long __ATTRS_o_ai 2443 vec_cmplt(vector double __a, vector double __b) { 2444 return vec_cmpgt(__b, __a); 2445 } 2446 #endif 2447 2448 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2449 static __inline__ vector bool __int128 __ATTRS_o_ai 2450 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { 2451 return vec_cmpgt(__b, __a); 2452 } 2453 2454 static __inline__ vector bool __int128 __ATTRS_o_ai 2455 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2456 return vec_cmpgt(__b, __a); 2457 } 2458 #endif 2459 2460 #ifdef __VSX__ 2461 static __inline__ vector bool long long __ATTRS_o_ai 2462 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2463 return vec_cmpgt(__b, __a); 2464 } 2465 2466 static __inline__ vector bool long long __ATTRS_o_ai 2467 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2468 return vec_cmpgt(__b, __a); 2469 } 2470 #endif 2471 2472 #ifdef __POWER8_VECTOR__ 2473 /* vec_popcnt */ 2474 2475 static __inline__ vector signed char __ATTRS_o_ai 2476 vec_popcnt(vector signed char __a) { 2477 return __builtin_altivec_vpopcntb(__a); 2478 } 2479 static __inline__ vector unsigned char __ATTRS_o_ai 2480 vec_popcnt(vector unsigned char __a) { 2481 return __builtin_altivec_vpopcntb(__a); 2482 } 2483 static __inline__ vector signed short __ATTRS_o_ai 2484 vec_popcnt(vector signed short __a) { 2485 return __builtin_altivec_vpopcnth(__a); 2486 } 2487 static __inline__ vector unsigned short __ATTRS_o_ai 2488 vec_popcnt(vector unsigned short __a) { 2489 return __builtin_altivec_vpopcnth(__a); 2490 } 2491 static __inline__ vector signed int __ATTRS_o_ai 2492 vec_popcnt(vector signed int __a) { 2493 return __builtin_altivec_vpopcntw(__a); 2494 } 2495 static __inline__ vector unsigned int __ATTRS_o_ai 2496 vec_popcnt(vector unsigned int __a) { 2497 return __builtin_altivec_vpopcntw(__a); 2498 } 2499 static __inline__ vector signed long long __ATTRS_o_ai 2500 vec_popcnt(vector signed long long __a) { 2501 return __builtin_altivec_vpopcntd(__a); 2502 } 2503 static __inline__ vector unsigned long long __ATTRS_o_ai 2504 vec_popcnt(vector unsigned long long __a) { 2505 return __builtin_altivec_vpopcntd(__a); 2506 } 2507 2508 #define vec_vclz vec_cntlz 2509 /* vec_cntlz */ 2510 2511 static __inline__ vector signed char __ATTRS_o_ai 2512 vec_cntlz(vector signed char __a) { 2513 return __builtin_altivec_vclzb(__a); 2514 } 2515 static __inline__ vector unsigned char __ATTRS_o_ai 2516 vec_cntlz(vector unsigned char __a) { 2517 return __builtin_altivec_vclzb(__a); 2518 } 2519 static __inline__ vector signed short __ATTRS_o_ai 2520 vec_cntlz(vector signed short __a) { 2521 return __builtin_altivec_vclzh(__a); 2522 } 2523 static __inline__ vector unsigned short __ATTRS_o_ai 2524 vec_cntlz(vector unsigned short __a) { 2525 return __builtin_altivec_vclzh(__a); 2526 } 2527 static __inline__ vector signed int __ATTRS_o_ai 2528 vec_cntlz(vector signed int __a) { 2529 return __builtin_altivec_vclzw(__a); 2530 } 2531 static __inline__ vector unsigned int __ATTRS_o_ai 2532 vec_cntlz(vector unsigned int __a) { 2533 return __builtin_altivec_vclzw(__a); 2534 } 2535 static __inline__ vector signed long long __ATTRS_o_ai 2536 vec_cntlz(vector signed long long __a) { 2537 return __builtin_altivec_vclzd(__a); 2538 } 2539 static __inline__ vector unsigned long long __ATTRS_o_ai 2540 vec_cntlz(vector unsigned long long __a) { 2541 return __builtin_altivec_vclzd(__a); 2542 } 2543 #endif 2544 2545 #ifdef __POWER9_VECTOR__ 2546 2547 /* vec_cnttz */ 2548 2549 static __inline__ vector signed char __ATTRS_o_ai 2550 vec_cnttz(vector signed char __a) { 2551 return __builtin_altivec_vctzb(__a); 2552 } 2553 static __inline__ vector unsigned char __ATTRS_o_ai 2554 vec_cnttz(vector unsigned char __a) { 2555 return __builtin_altivec_vctzb(__a); 2556 } 2557 static __inline__ vector signed short __ATTRS_o_ai 2558 vec_cnttz(vector signed short __a) { 2559 return __builtin_altivec_vctzh(__a); 2560 } 2561 static __inline__ vector unsigned short __ATTRS_o_ai 2562 vec_cnttz(vector unsigned short __a) { 2563 return __builtin_altivec_vctzh(__a); 2564 } 2565 static __inline__ vector signed int __ATTRS_o_ai 2566 vec_cnttz(vector signed int __a) { 2567 return __builtin_altivec_vctzw(__a); 2568 } 2569 static __inline__ vector unsigned int __ATTRS_o_ai 2570 vec_cnttz(vector unsigned int __a) { 2571 return __builtin_altivec_vctzw(__a); 2572 } 2573 static __inline__ vector signed long long __ATTRS_o_ai 2574 vec_cnttz(vector signed long long __a) { 2575 return __builtin_altivec_vctzd(__a); 2576 } 2577 static __inline__ vector unsigned long long __ATTRS_o_ai 2578 vec_cnttz(vector unsigned long long __a) { 2579 return __builtin_altivec_vctzd(__a); 2580 } 2581 2582 /* vec_first_match_index */ 2583 2584 static __inline__ unsigned __ATTRS_o_ai 2585 vec_first_match_index(vector signed char __a, vector signed char __b) { 2586 vector unsigned long long __res = 2587 #ifdef __LITTLE_ENDIAN__ 2588 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2589 #else 2590 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2591 #endif 2592 if (__res[0] == 64) { 2593 return (__res[1] + 64) >> 3; 2594 } 2595 return __res[0] >> 3; 2596 } 2597 2598 static __inline__ unsigned __ATTRS_o_ai 2599 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2600 vector unsigned long long __res = 2601 #ifdef __LITTLE_ENDIAN__ 2602 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2603 #else 2604 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2605 #endif 2606 if (__res[0] == 64) { 2607 return (__res[1] + 64) >> 3; 2608 } 2609 return __res[0] >> 3; 2610 } 2611 2612 static __inline__ unsigned __ATTRS_o_ai 2613 vec_first_match_index(vector signed short __a, vector signed short __b) { 2614 vector unsigned long long __res = 2615 #ifdef __LITTLE_ENDIAN__ 2616 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2617 #else 2618 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2619 #endif 2620 if (__res[0] == 64) { 2621 return (__res[1] + 64) >> 4; 2622 } 2623 return __res[0] >> 4; 2624 } 2625 2626 static __inline__ unsigned __ATTRS_o_ai 2627 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2628 vector unsigned long long __res = 2629 #ifdef __LITTLE_ENDIAN__ 2630 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2631 #else 2632 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2633 #endif 2634 if (__res[0] == 64) { 2635 return (__res[1] + 64) >> 4; 2636 } 2637 return __res[0] >> 4; 2638 } 2639 2640 static __inline__ unsigned __ATTRS_o_ai 2641 vec_first_match_index(vector signed int __a, vector signed int __b) { 2642 vector unsigned long long __res = 2643 #ifdef __LITTLE_ENDIAN__ 2644 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2645 #else 2646 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2647 #endif 2648 if (__res[0] == 64) { 2649 return (__res[1] + 64) >> 5; 2650 } 2651 return __res[0] >> 5; 2652 } 2653 2654 static __inline__ unsigned __ATTRS_o_ai 2655 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2656 vector unsigned long long __res = 2657 #ifdef __LITTLE_ENDIAN__ 2658 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2659 #else 2660 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2661 #endif 2662 if (__res[0] == 64) { 2663 return (__res[1] + 64) >> 5; 2664 } 2665 return __res[0] >> 5; 2666 } 2667 2668 /* vec_first_match_or_eos_index */ 2669 2670 static __inline__ unsigned __ATTRS_o_ai 2671 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2672 /* Compare the result of the comparison of two vectors with either and OR the 2673 result. Either the elements are equal or one will equal the comparison 2674 result if either is zero. 2675 */ 2676 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2677 vector bool char __tmp2 = __tmp1 | 2678 vec_cmpeq((vector signed char)__tmp1, __a) | 2679 vec_cmpeq((vector signed char)__tmp1, __b); 2680 2681 vector unsigned long long __res = 2682 #ifdef __LITTLE_ENDIAN__ 2683 vec_cnttz((vector unsigned long long)__tmp2); 2684 #else 2685 vec_cntlz((vector unsigned long long)__tmp2); 2686 #endif 2687 if (__res[0] == 64) { 2688 return (__res[1] + 64) >> 3; 2689 } 2690 return __res[0] >> 3; 2691 } 2692 2693 static __inline__ unsigned __ATTRS_o_ai 2694 vec_first_match_or_eos_index(vector unsigned char __a, 2695 vector unsigned char __b) { 2696 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2697 vector bool char __tmp2 = __tmp1 | 2698 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2699 vec_cmpeq((vector unsigned char)__tmp1, __b); 2700 2701 vector unsigned long long __res = 2702 #ifdef __LITTLE_ENDIAN__ 2703 vec_cnttz((vector unsigned long long)__tmp2); 2704 #else 2705 vec_cntlz((vector unsigned long long)__tmp2); 2706 #endif 2707 if (__res[0] == 64) { 2708 return (__res[1] + 64) >> 3; 2709 } 2710 return __res[0] >> 3; 2711 } 2712 2713 static __inline__ unsigned __ATTRS_o_ai 2714 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2715 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2716 vector bool short __tmp2 = __tmp1 | 2717 vec_cmpeq((vector signed short)__tmp1, __a) | 2718 vec_cmpeq((vector signed short)__tmp1, __b); 2719 2720 vector unsigned long long __res = 2721 #ifdef __LITTLE_ENDIAN__ 2722 vec_cnttz((vector unsigned long long)__tmp2); 2723 #else 2724 vec_cntlz((vector unsigned long long)__tmp2); 2725 #endif 2726 if (__res[0] == 64) { 2727 return (__res[1] + 64) >> 4; 2728 } 2729 return __res[0] >> 4; 2730 } 2731 2732 static __inline__ unsigned __ATTRS_o_ai 2733 vec_first_match_or_eos_index(vector unsigned short __a, 2734 vector unsigned short __b) { 2735 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2736 vector bool short __tmp2 = __tmp1 | 2737 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2738 vec_cmpeq((vector unsigned short)__tmp1, __b); 2739 2740 vector unsigned long long __res = 2741 #ifdef __LITTLE_ENDIAN__ 2742 vec_cnttz((vector unsigned long long)__tmp2); 2743 #else 2744 vec_cntlz((vector unsigned long long)__tmp2); 2745 #endif 2746 if (__res[0] == 64) { 2747 return (__res[1] + 64) >> 4; 2748 } 2749 return __res[0] >> 4; 2750 } 2751 2752 static __inline__ unsigned __ATTRS_o_ai 2753 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2754 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2755 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2756 vec_cmpeq((vector signed int)__tmp1, __b); 2757 2758 vector unsigned long long __res = 2759 #ifdef __LITTLE_ENDIAN__ 2760 vec_cnttz((vector unsigned long long)__tmp2); 2761 #else 2762 vec_cntlz((vector unsigned long long)__tmp2); 2763 #endif 2764 if (__res[0] == 64) { 2765 return (__res[1] + 64) >> 5; 2766 } 2767 return __res[0] >> 5; 2768 } 2769 2770 static __inline__ unsigned __ATTRS_o_ai 2771 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2772 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2773 vector bool int __tmp2 = __tmp1 | 2774 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2775 vec_cmpeq((vector unsigned int)__tmp1, __b); 2776 2777 vector unsigned long long __res = 2778 #ifdef __LITTLE_ENDIAN__ 2779 vec_cnttz((vector unsigned long long)__tmp2); 2780 #else 2781 vec_cntlz((vector unsigned long long)__tmp2); 2782 #endif 2783 if (__res[0] == 64) { 2784 return (__res[1] + 64) >> 5; 2785 } 2786 return __res[0] >> 5; 2787 } 2788 2789 /* vec_first_mismatch_index */ 2790 2791 static __inline__ unsigned __ATTRS_o_ai 2792 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2793 vector unsigned long long __res = 2794 #ifdef __LITTLE_ENDIAN__ 2795 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2796 #else 2797 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2798 #endif 2799 if (__res[0] == 64) { 2800 return (__res[1] + 64) >> 3; 2801 } 2802 return __res[0] >> 3; 2803 } 2804 2805 static __inline__ unsigned __ATTRS_o_ai 2806 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2807 vector unsigned long long __res = 2808 #ifdef __LITTLE_ENDIAN__ 2809 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2810 #else 2811 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2812 #endif 2813 if (__res[0] == 64) { 2814 return (__res[1] + 64) >> 3; 2815 } 2816 return __res[0] >> 3; 2817 } 2818 2819 static __inline__ unsigned __ATTRS_o_ai 2820 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2821 vector unsigned long long __res = 2822 #ifdef __LITTLE_ENDIAN__ 2823 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2824 #else 2825 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2826 #endif 2827 if (__res[0] == 64) { 2828 return (__res[1] + 64) >> 4; 2829 } 2830 return __res[0] >> 4; 2831 } 2832 2833 static __inline__ unsigned __ATTRS_o_ai 2834 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2835 vector unsigned long long __res = 2836 #ifdef __LITTLE_ENDIAN__ 2837 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2838 #else 2839 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2840 #endif 2841 if (__res[0] == 64) { 2842 return (__res[1] + 64) >> 4; 2843 } 2844 return __res[0] >> 4; 2845 } 2846 2847 static __inline__ unsigned __ATTRS_o_ai 2848 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2849 vector unsigned long long __res = 2850 #ifdef __LITTLE_ENDIAN__ 2851 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2852 #else 2853 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2854 #endif 2855 if (__res[0] == 64) { 2856 return (__res[1] + 64) >> 5; 2857 } 2858 return __res[0] >> 5; 2859 } 2860 2861 static __inline__ unsigned __ATTRS_o_ai 2862 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2863 vector unsigned long long __res = 2864 #ifdef __LITTLE_ENDIAN__ 2865 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2866 #else 2867 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2868 #endif 2869 if (__res[0] == 64) { 2870 return (__res[1] + 64) >> 5; 2871 } 2872 return __res[0] >> 5; 2873 } 2874 2875 /* vec_first_mismatch_or_eos_index */ 2876 2877 static __inline__ unsigned __ATTRS_o_ai 2878 vec_first_mismatch_or_eos_index(vector signed char __a, 2879 vector signed char __b) { 2880 vector unsigned long long __res = 2881 #ifdef __LITTLE_ENDIAN__ 2882 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2883 #else 2884 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2885 #endif 2886 if (__res[0] == 64) { 2887 return (__res[1] + 64) >> 3; 2888 } 2889 return __res[0] >> 3; 2890 } 2891 2892 static __inline__ unsigned __ATTRS_o_ai 2893 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2894 vector unsigned char __b) { 2895 vector unsigned long long __res = 2896 #ifdef __LITTLE_ENDIAN__ 2897 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2898 #else 2899 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2900 #endif 2901 if (__res[0] == 64) { 2902 return (__res[1] + 64) >> 3; 2903 } 2904 return __res[0] >> 3; 2905 } 2906 2907 static __inline__ unsigned __ATTRS_o_ai 2908 vec_first_mismatch_or_eos_index(vector signed short __a, 2909 vector signed short __b) { 2910 vector unsigned long long __res = 2911 #ifdef __LITTLE_ENDIAN__ 2912 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2913 #else 2914 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2915 #endif 2916 if (__res[0] == 64) { 2917 return (__res[1] + 64) >> 4; 2918 } 2919 return __res[0] >> 4; 2920 } 2921 2922 static __inline__ unsigned __ATTRS_o_ai 2923 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2924 vector unsigned short __b) { 2925 vector unsigned long long __res = 2926 #ifdef __LITTLE_ENDIAN__ 2927 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2928 #else 2929 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2930 #endif 2931 if (__res[0] == 64) { 2932 return (__res[1] + 64) >> 4; 2933 } 2934 return __res[0] >> 4; 2935 } 2936 2937 static __inline__ unsigned __ATTRS_o_ai 2938 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2939 vector unsigned long long __res = 2940 #ifdef __LITTLE_ENDIAN__ 2941 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2942 #else 2943 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2944 #endif 2945 if (__res[0] == 64) { 2946 return (__res[1] + 64) >> 5; 2947 } 2948 return __res[0] >> 5; 2949 } 2950 2951 static __inline__ unsigned __ATTRS_o_ai 2952 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2953 vector unsigned int __b) { 2954 vector unsigned long long __res = 2955 #ifdef __LITTLE_ENDIAN__ 2956 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2957 #else 2958 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2959 #endif 2960 if (__res[0] == 64) { 2961 return (__res[1] + 64) >> 5; 2962 } 2963 return __res[0] >> 5; 2964 } 2965 2966 static __inline__ vector double __ATTRS_o_ai 2967 vec_insert_exp(vector double __a, vector unsigned long long __b) { 2968 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 2969 } 2970 2971 static __inline__ vector double __ATTRS_o_ai 2972 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 2973 return __builtin_vsx_xviexpdp(__a,__b); 2974 } 2975 2976 static __inline__ vector float __ATTRS_o_ai 2977 vec_insert_exp(vector float __a, vector unsigned int __b) { 2978 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 2979 } 2980 2981 static __inline__ vector float __ATTRS_o_ai 2982 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 2983 return __builtin_vsx_xviexpsp(__a,__b); 2984 } 2985 2986 #if defined(__powerpc64__) 2987 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 2988 size_t __b) { 2989 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 2990 } 2991 2992 static __inline__ vector unsigned char __ATTRS_o_ai 2993 vec_xl_len(const unsigned char *__a, size_t __b) { 2994 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 2995 } 2996 2997 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 2998 size_t __b) { 2999 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 3000 } 3001 3002 static __inline__ vector unsigned short __ATTRS_o_ai 3003 vec_xl_len(const unsigned short *__a, size_t __b) { 3004 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 3005 } 3006 3007 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 3008 size_t __b) { 3009 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 3010 } 3011 3012 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 3013 size_t __b) { 3014 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 3015 } 3016 3017 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 3018 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 3019 } 3020 3021 #ifdef __SIZEOF_INT128__ 3022 static __inline__ vector signed __int128 __ATTRS_o_ai 3023 vec_xl_len(const signed __int128 *__a, size_t __b) { 3024 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3025 } 3026 3027 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3028 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 3029 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3030 } 3031 #endif 3032 3033 static __inline__ vector signed long long __ATTRS_o_ai 3034 vec_xl_len(const signed long long *__a, size_t __b) { 3035 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3036 } 3037 3038 static __inline__ vector unsigned long long __ATTRS_o_ai 3039 vec_xl_len(const unsigned long long *__a, size_t __b) { 3040 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3041 } 3042 3043 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 3044 size_t __b) { 3045 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 3046 } 3047 3048 static __inline__ vector unsigned char __ATTRS_o_ai 3049 vec_xl_len_r(const unsigned char *__a, size_t __b) { 3050 vector unsigned char __res = 3051 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 3052 #ifdef __LITTLE_ENDIAN__ 3053 vector unsigned char __mask = 3054 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 3055 __res = (vector unsigned char)__builtin_altivec_vperm_4si( 3056 (vector int)__res, (vector int)__res, __mask); 3057 #endif 3058 return __res; 3059 } 3060 3061 // vec_xst_len 3062 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 3063 unsigned char *__b, 3064 size_t __c) { 3065 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3066 } 3067 3068 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, 3069 signed char *__b, size_t __c) { 3070 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3071 } 3072 3073 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed short __a, 3074 signed short *__b, size_t __c) { 3075 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3076 } 3077 3078 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, 3079 unsigned short *__b, 3080 size_t __c) { 3081 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3082 } 3083 3084 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 3085 signed int *__b, size_t __c) { 3086 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3087 } 3088 3089 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, 3090 unsigned int *__b, size_t __c) { 3091 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3092 } 3093 3094 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, 3095 size_t __c) { 3096 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3097 } 3098 3099 #ifdef __SIZEOF_INT128__ 3100 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 3101 signed __int128 *__b, 3102 size_t __c) { 3103 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3104 } 3105 3106 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, 3107 unsigned __int128 *__b, 3108 size_t __c) { 3109 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3110 } 3111 #endif 3112 3113 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 3114 signed long long *__b, 3115 size_t __c) { 3116 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3117 } 3118 3119 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 3120 unsigned long long *__b, 3121 size_t __c) { 3122 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3123 } 3124 3125 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, 3126 size_t __c) { 3127 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3128 } 3129 3130 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, 3131 unsigned char *__b, 3132 size_t __c) { 3133 #ifdef __LITTLE_ENDIAN__ 3134 vector unsigned char __mask = 3135 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 3136 vector unsigned char __res = 3137 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); 3138 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 3139 #else 3140 return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56)); 3141 #endif 3142 } 3143 #endif 3144 #endif 3145 3146 #if defined(__POWER9_VECTOR__) && defined(__powerpc64__) 3147 #define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT)) 3148 #define __vec_strmb(PTR, CNT, VAL) \ 3149 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT)) 3150 #else 3151 #define __vec_ldrmb __builtin_vsx_ldrmb 3152 #define __vec_strmb __builtin_vsx_strmb 3153 #endif 3154 3155 /* vec_cpsgn */ 3156 3157 #ifdef __VSX__ 3158 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 3159 vector float __b) { 3160 return __builtin_vsx_xvcpsgnsp(__b, __a); 3161 } 3162 3163 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 3164 vector double __b) { 3165 return __builtin_vsx_xvcpsgndp(__b, __a); 3166 } 3167 #endif 3168 3169 /* vec_ctf */ 3170 3171 #ifdef __VSX__ 3172 // There are some functions that have different signatures with the XL compiler 3173 // from those in Clang/GCC and documented in the PVIPR. This macro ensures that 3174 // the XL-compatible signatures are used for those functions. 3175 #ifdef __XL_COMPAT_ALTIVEC__ 3176 #define vec_ctf(__a, __b) \ 3177 _Generic((__a), vector int \ 3178 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3179 vector unsigned int \ 3180 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3181 (__b)), \ 3182 vector unsigned long long \ 3183 : (__builtin_vsx_xvcvuxdsp((vector unsigned long long)(__a)) * \ 3184 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \ 3185 vector signed long long \ 3186 : (__builtin_vsx_xvcvsxdsp((vector signed long long)(__a)) * \ 3187 (vector float)(vector unsigned)((0x7f - (__b)) << 23))) 3188 #else // __XL_COMPAT_ALTIVEC__ 3189 #define vec_ctf(__a, __b) \ 3190 _Generic((__a), vector int \ 3191 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3192 vector unsigned int \ 3193 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3194 (__b)), \ 3195 vector unsigned long long \ 3196 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3197 vector double) * \ 3198 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3199 << 52)), \ 3200 vector signed long long \ 3201 : (__builtin_convertvector((vector signed long long)(__a), \ 3202 vector double) * \ 3203 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3204 << 52))) 3205 #endif // __XL_COMPAT_ALTIVEC__ 3206 #else 3207 #define vec_ctf(__a, __b) \ 3208 _Generic((__a), vector int \ 3209 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3210 vector unsigned int \ 3211 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3212 (__b))) 3213 #endif 3214 3215 /* vec_ctd */ 3216 #ifdef __VSX__ 3217 #define vec_ctd(__a, __b) \ 3218 _Generic((__a), vector signed int \ 3219 : (vec_doublee((vector signed int)(__a)) * \ 3220 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3221 << 52)), \ 3222 vector unsigned int \ 3223 : (vec_doublee((vector unsigned int)(__a)) * \ 3224 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3225 << 52)), \ 3226 vector unsigned long long \ 3227 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3228 vector double) * \ 3229 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3230 << 52)), \ 3231 vector signed long long \ 3232 : (__builtin_convertvector((vector signed long long)(__a), \ 3233 vector double) * \ 3234 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3235 << 52))) 3236 #endif // __VSX__ 3237 3238 /* vec_vcfsx */ 3239 3240 #define vec_vcfux __builtin_altivec_vcfux 3241 /* vec_vcfux */ 3242 3243 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 3244 3245 /* vec_cts */ 3246 3247 #ifdef __VSX__ 3248 #ifdef __XL_COMPAT_ALTIVEC__ 3249 #define vec_cts(__a, __b) \ 3250 _Generic((__a), vector float \ 3251 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3252 vector double \ 3253 : __extension__({ \ 3254 vector double __ret = \ 3255 (vector double)(__a) * \ 3256 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3257 << 52); \ 3258 __builtin_vsx_xvcvdpsxws(__ret); \ 3259 })) 3260 #else // __XL_COMPAT_ALTIVEC__ 3261 #define vec_cts(__a, __b) \ 3262 _Generic((__a), vector float \ 3263 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3264 vector double \ 3265 : __extension__({ \ 3266 vector double __ret = \ 3267 (vector double)(__a) * \ 3268 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3269 << 52); \ 3270 __builtin_convertvector(__ret, vector signed long long); \ 3271 })) 3272 #endif // __XL_COMPAT_ALTIVEC__ 3273 #else 3274 #define vec_cts __builtin_altivec_vctsxs 3275 #endif 3276 3277 /* vec_vctsxs */ 3278 3279 #define vec_vctsxs __builtin_altivec_vctsxs 3280 3281 /* vec_ctu */ 3282 3283 #ifdef __VSX__ 3284 #ifdef __XL_COMPAT_ALTIVEC__ 3285 #define vec_ctu(__a, __b) \ 3286 _Generic((__a), vector float \ 3287 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3288 vector double \ 3289 : __extension__({ \ 3290 vector double __ret = \ 3291 (vector double)(__a) * \ 3292 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3293 << 52); \ 3294 __builtin_vsx_xvcvdpuxws(__ret); \ 3295 })) 3296 #else // __XL_COMPAT_ALTIVEC__ 3297 #define vec_ctu(__a, __b) \ 3298 _Generic((__a), vector float \ 3299 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3300 vector double \ 3301 : __extension__({ \ 3302 vector double __ret = \ 3303 (vector double)(__a) * \ 3304 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3305 << 52); \ 3306 __builtin_convertvector(__ret, vector unsigned long long); \ 3307 })) 3308 #endif // __XL_COMPAT_ALTIVEC__ 3309 #else 3310 #define vec_ctu __builtin_altivec_vctuxs 3311 #endif 3312 3313 #ifdef __LITTLE_ENDIAN__ 3314 /* vec_ctsl */ 3315 3316 #ifdef __VSX__ 3317 #define vec_ctsl(__a, __b) \ 3318 _Generic((__a), vector float \ 3319 : __extension__({ \ 3320 vector float __ret = \ 3321 (vector float)(__a) * \ 3322 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3323 __builtin_vsx_xvcvspsxds( \ 3324 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3325 }), \ 3326 vector double \ 3327 : __extension__({ \ 3328 vector double __ret = \ 3329 (vector double)(__a) * \ 3330 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3331 << 52); \ 3332 __builtin_convertvector(__ret, vector signed long long); \ 3333 })) 3334 3335 /* vec_ctul */ 3336 3337 #define vec_ctul(__a, __b) \ 3338 _Generic((__a), vector float \ 3339 : __extension__({ \ 3340 vector float __ret = \ 3341 (vector float)(__a) * \ 3342 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3343 __builtin_vsx_xvcvspuxds( \ 3344 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3345 }), \ 3346 vector double \ 3347 : __extension__({ \ 3348 vector double __ret = \ 3349 (vector double)(__a) * \ 3350 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3351 << 52); \ 3352 __builtin_convertvector(__ret, vector unsigned long long); \ 3353 })) 3354 #endif 3355 #else // __LITTLE_ENDIAN__ 3356 /* vec_ctsl */ 3357 3358 #ifdef __VSX__ 3359 #define vec_ctsl(__a, __b) \ 3360 _Generic((__a), vector float \ 3361 : __extension__({ \ 3362 vector float __ret = \ 3363 (vector float)(__a) * \ 3364 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3365 __builtin_vsx_xvcvspsxds(__ret); \ 3366 }), \ 3367 vector double \ 3368 : __extension__({ \ 3369 vector double __ret = \ 3370 (vector double)(__a) * \ 3371 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3372 << 52); \ 3373 __builtin_convertvector(__ret, vector signed long long); \ 3374 })) 3375 3376 /* vec_ctul */ 3377 3378 #define vec_ctul(__a, __b) \ 3379 _Generic((__a), vector float \ 3380 : __extension__({ \ 3381 vector float __ret = \ 3382 (vector float)(__a) * \ 3383 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3384 __builtin_vsx_xvcvspuxds(__ret); \ 3385 }), \ 3386 vector double \ 3387 : __extension__({ \ 3388 vector double __ret = \ 3389 (vector double)(__a) * \ 3390 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3391 << 52); \ 3392 __builtin_convertvector(__ret, vector unsigned long long); \ 3393 })) 3394 #endif 3395 #endif // __LITTLE_ENDIAN__ 3396 3397 /* vec_vctuxs */ 3398 3399 #define vec_vctuxs __builtin_altivec_vctuxs 3400 3401 /* vec_signext */ 3402 3403 #ifdef __POWER9_VECTOR__ 3404 static __inline__ vector signed int __ATTRS_o_ai 3405 vec_signexti(vector signed char __a) { 3406 return __builtin_altivec_vextsb2w(__a); 3407 } 3408 3409 static __inline__ vector signed int __ATTRS_o_ai 3410 vec_signexti(vector signed short __a) { 3411 return __builtin_altivec_vextsh2w(__a); 3412 } 3413 3414 static __inline__ vector signed long long __ATTRS_o_ai 3415 vec_signextll(vector signed char __a) { 3416 return __builtin_altivec_vextsb2d(__a); 3417 } 3418 3419 static __inline__ vector signed long long __ATTRS_o_ai 3420 vec_signextll(vector signed short __a) { 3421 return __builtin_altivec_vextsh2d(__a); 3422 } 3423 3424 static __inline__ vector signed long long __ATTRS_o_ai 3425 vec_signextll(vector signed int __a) { 3426 return __builtin_altivec_vextsw2d(__a); 3427 } 3428 #endif 3429 3430 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3431 static __inline__ vector signed __int128 __ATTRS_o_ai 3432 vec_signextq(vector signed long long __a) { 3433 return __builtin_altivec_vextsd2q(__a); 3434 } 3435 #endif 3436 3437 /* vec_signed */ 3438 3439 static __inline__ vector signed int __ATTRS_o_ai 3440 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3441 3442 static __inline__ vector signed int __ATTRS_o_ai 3443 vec_signed(vector float __a) { 3444 return __builtin_convertvector(__a, vector signed int); 3445 } 3446 3447 #ifdef __VSX__ 3448 static __inline__ vector signed long long __ATTRS_o_ai 3449 vec_signed(vector double __a) { 3450 return __builtin_convertvector(__a, vector signed long long); 3451 } 3452 3453 static __inline__ vector signed int __attribute__((__always_inline__)) 3454 vec_signed2(vector double __a, vector double __b) { 3455 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3456 } 3457 3458 static __inline__ vector signed int __ATTRS_o_ai 3459 vec_signede(vector double __a) { 3460 #ifdef __LITTLE_ENDIAN__ 3461 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3462 return vec_sld(__ret, __ret, 12); 3463 #else 3464 return __builtin_vsx_xvcvdpsxws(__a); 3465 #endif 3466 } 3467 3468 static __inline__ vector signed int __ATTRS_o_ai 3469 vec_signedo(vector double __a) { 3470 #ifdef __LITTLE_ENDIAN__ 3471 return __builtin_vsx_xvcvdpsxws(__a); 3472 #else 3473 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3474 return vec_sld(__ret, __ret, 12); 3475 #endif 3476 } 3477 #endif 3478 3479 /* vec_unsigned */ 3480 3481 static __inline__ vector unsigned int __ATTRS_o_ai 3482 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3483 3484 static __inline__ vector unsigned int __ATTRS_o_ai 3485 vec_unsigned(vector float __a) { 3486 return __builtin_convertvector(__a, vector unsigned int); 3487 } 3488 3489 #ifdef __VSX__ 3490 static __inline__ vector unsigned long long __ATTRS_o_ai 3491 vec_unsigned(vector double __a) { 3492 return __builtin_convertvector(__a, vector unsigned long long); 3493 } 3494 3495 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3496 vec_unsigned2(vector double __a, vector double __b) { 3497 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3498 } 3499 3500 static __inline__ vector unsigned int __ATTRS_o_ai 3501 vec_unsignede(vector double __a) { 3502 #ifdef __LITTLE_ENDIAN__ 3503 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3504 return vec_sld(__ret, __ret, 12); 3505 #else 3506 return __builtin_vsx_xvcvdpuxws(__a); 3507 #endif 3508 } 3509 3510 static __inline__ vector unsigned int __ATTRS_o_ai 3511 vec_unsignedo(vector double __a) { 3512 #ifdef __LITTLE_ENDIAN__ 3513 return __builtin_vsx_xvcvdpuxws(__a); 3514 #else 3515 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3516 return vec_sld(__ret, __ret, 12); 3517 #endif 3518 } 3519 #endif 3520 3521 /* vec_float */ 3522 3523 static __inline__ vector float __ATTRS_o_ai 3524 vec_sld(vector float, vector float, unsigned const int __c); 3525 3526 static __inline__ vector float __ATTRS_o_ai 3527 vec_float(vector signed int __a) { 3528 return __builtin_convertvector(__a, vector float); 3529 } 3530 3531 static __inline__ vector float __ATTRS_o_ai 3532 vec_float(vector unsigned int __a) { 3533 return __builtin_convertvector(__a, vector float); 3534 } 3535 3536 #ifdef __VSX__ 3537 static __inline__ vector float __ATTRS_o_ai 3538 vec_float2(vector signed long long __a, vector signed long long __b) { 3539 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3540 } 3541 3542 static __inline__ vector float __ATTRS_o_ai 3543 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3544 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3545 } 3546 3547 static __inline__ vector float __ATTRS_o_ai 3548 vec_float2(vector double __a, vector double __b) { 3549 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3550 } 3551 3552 static __inline__ vector float __ATTRS_o_ai 3553 vec_floate(vector signed long long __a) { 3554 #ifdef __LITTLE_ENDIAN__ 3555 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3556 return vec_sld(__ret, __ret, 12); 3557 #else 3558 return __builtin_vsx_xvcvsxdsp(__a); 3559 #endif 3560 } 3561 3562 static __inline__ vector float __ATTRS_o_ai 3563 vec_floate(vector unsigned long long __a) { 3564 #ifdef __LITTLE_ENDIAN__ 3565 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3566 return vec_sld(__ret, __ret, 12); 3567 #else 3568 return __builtin_vsx_xvcvuxdsp(__a); 3569 #endif 3570 } 3571 3572 static __inline__ vector float __ATTRS_o_ai 3573 vec_floate(vector double __a) { 3574 #ifdef __LITTLE_ENDIAN__ 3575 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3576 return vec_sld(__ret, __ret, 12); 3577 #else 3578 return __builtin_vsx_xvcvdpsp(__a); 3579 #endif 3580 } 3581 3582 static __inline__ vector float __ATTRS_o_ai 3583 vec_floato(vector signed long long __a) { 3584 #ifdef __LITTLE_ENDIAN__ 3585 return __builtin_vsx_xvcvsxdsp(__a); 3586 #else 3587 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3588 return vec_sld(__ret, __ret, 12); 3589 #endif 3590 } 3591 3592 static __inline__ vector float __ATTRS_o_ai 3593 vec_floato(vector unsigned long long __a) { 3594 #ifdef __LITTLE_ENDIAN__ 3595 return __builtin_vsx_xvcvuxdsp(__a); 3596 #else 3597 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3598 return vec_sld(__ret, __ret, 12); 3599 #endif 3600 } 3601 3602 static __inline__ vector float __ATTRS_o_ai 3603 vec_floato(vector double __a) { 3604 #ifdef __LITTLE_ENDIAN__ 3605 return __builtin_vsx_xvcvdpsp(__a); 3606 #else 3607 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3608 return vec_sld(__ret, __ret, 12); 3609 #endif 3610 } 3611 #endif 3612 3613 /* vec_double */ 3614 3615 #ifdef __VSX__ 3616 static __inline__ vector double __ATTRS_o_ai 3617 vec_double(vector signed long long __a) { 3618 return __builtin_convertvector(__a, vector double); 3619 } 3620 3621 static __inline__ vector double __ATTRS_o_ai 3622 vec_double(vector unsigned long long __a) { 3623 return __builtin_convertvector(__a, vector double); 3624 } 3625 3626 static __inline__ vector double __ATTRS_o_ai 3627 vec_doublee(vector signed int __a) { 3628 #ifdef __LITTLE_ENDIAN__ 3629 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3630 #else 3631 return __builtin_vsx_xvcvsxwdp(__a); 3632 #endif 3633 } 3634 3635 static __inline__ vector double __ATTRS_o_ai 3636 vec_doublee(vector unsigned int __a) { 3637 #ifdef __LITTLE_ENDIAN__ 3638 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3639 #else 3640 return __builtin_vsx_xvcvuxwdp(__a); 3641 #endif 3642 } 3643 3644 static __inline__ vector double __ATTRS_o_ai 3645 vec_doublee(vector float __a) { 3646 #ifdef __LITTLE_ENDIAN__ 3647 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3648 #else 3649 return __builtin_vsx_xvcvspdp(__a); 3650 #endif 3651 } 3652 3653 static __inline__ vector double __ATTRS_o_ai 3654 vec_doubleh(vector signed int __a) { 3655 vector double __ret = {__a[0], __a[1]}; 3656 return __ret; 3657 } 3658 3659 static __inline__ vector double __ATTRS_o_ai 3660 vec_doubleh(vector unsigned int __a) { 3661 vector double __ret = {__a[0], __a[1]}; 3662 return __ret; 3663 } 3664 3665 static __inline__ vector double __ATTRS_o_ai 3666 vec_doubleh(vector float __a) { 3667 vector double __ret = {__a[0], __a[1]}; 3668 return __ret; 3669 } 3670 3671 static __inline__ vector double __ATTRS_o_ai 3672 vec_doublel(vector signed int __a) { 3673 vector double __ret = {__a[2], __a[3]}; 3674 return __ret; 3675 } 3676 3677 static __inline__ vector double __ATTRS_o_ai 3678 vec_doublel(vector unsigned int __a) { 3679 vector double __ret = {__a[2], __a[3]}; 3680 return __ret; 3681 } 3682 3683 static __inline__ vector double __ATTRS_o_ai 3684 vec_doublel(vector float __a) { 3685 vector double __ret = {__a[2], __a[3]}; 3686 return __ret; 3687 } 3688 3689 static __inline__ vector double __ATTRS_o_ai 3690 vec_doubleo(vector signed int __a) { 3691 #ifdef __LITTLE_ENDIAN__ 3692 return __builtin_vsx_xvcvsxwdp(__a); 3693 #else 3694 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3695 #endif 3696 } 3697 3698 static __inline__ vector double __ATTRS_o_ai 3699 vec_doubleo(vector unsigned int __a) { 3700 #ifdef __LITTLE_ENDIAN__ 3701 return __builtin_vsx_xvcvuxwdp(__a); 3702 #else 3703 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3704 #endif 3705 } 3706 3707 static __inline__ vector double __ATTRS_o_ai 3708 vec_doubleo(vector float __a) { 3709 #ifdef __LITTLE_ENDIAN__ 3710 return __builtin_vsx_xvcvspdp(__a); 3711 #else 3712 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3713 #endif 3714 } 3715 3716 /* vec_cvf */ 3717 static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) { 3718 return vec_doublee(__a); 3719 } 3720 3721 static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) { 3722 return vec_floate(__a); 3723 } 3724 #endif 3725 3726 /* vec_div */ 3727 3728 /* Integer vector divides (vectors are scalarized, elements divided 3729 and the vectors reassembled). 3730 */ 3731 static __inline__ vector signed char __ATTRS_o_ai 3732 vec_div(vector signed char __a, vector signed char __b) { 3733 return __a / __b; 3734 } 3735 3736 static __inline__ vector unsigned char __ATTRS_o_ai 3737 vec_div(vector unsigned char __a, vector unsigned char __b) { 3738 return __a / __b; 3739 } 3740 3741 static __inline__ vector signed short __ATTRS_o_ai 3742 vec_div(vector signed short __a, vector signed short __b) { 3743 return __a / __b; 3744 } 3745 3746 static __inline__ vector unsigned short __ATTRS_o_ai 3747 vec_div(vector unsigned short __a, vector unsigned short __b) { 3748 return __a / __b; 3749 } 3750 3751 static __inline__ vector signed int __ATTRS_o_ai 3752 vec_div(vector signed int __a, vector signed int __b) { 3753 return __a / __b; 3754 } 3755 3756 static __inline__ vector unsigned int __ATTRS_o_ai 3757 vec_div(vector unsigned int __a, vector unsigned int __b) { 3758 return __a / __b; 3759 } 3760 3761 #ifdef __VSX__ 3762 static __inline__ vector signed long long __ATTRS_o_ai 3763 vec_div(vector signed long long __a, vector signed long long __b) { 3764 return __a / __b; 3765 } 3766 3767 static __inline__ vector unsigned long long __ATTRS_o_ai 3768 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3769 return __a / __b; 3770 } 3771 3772 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3773 vector float __b) { 3774 return __a / __b; 3775 } 3776 3777 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3778 vector double __b) { 3779 return __a / __b; 3780 } 3781 #endif 3782 3783 /* vec_dive */ 3784 3785 #ifdef __POWER10_VECTOR__ 3786 static __inline__ vector signed int __ATTRS_o_ai 3787 vec_dive(vector signed int __a, vector signed int __b) { 3788 return __builtin_altivec_vdivesw(__a, __b); 3789 } 3790 3791 static __inline__ vector unsigned int __ATTRS_o_ai 3792 vec_dive(vector unsigned int __a, vector unsigned int __b) { 3793 return __builtin_altivec_vdiveuw(__a, __b); 3794 } 3795 3796 static __inline__ vector signed long long __ATTRS_o_ai 3797 vec_dive(vector signed long long __a, vector signed long long __b) { 3798 return __builtin_altivec_vdivesd(__a, __b); 3799 } 3800 3801 static __inline__ vector unsigned long long __ATTRS_o_ai 3802 vec_dive(vector unsigned long long __a, vector unsigned long long __b) { 3803 return __builtin_altivec_vdiveud(__a, __b); 3804 } 3805 3806 #ifdef __SIZEOF_INT128__ 3807 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3808 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3809 return __builtin_altivec_vdiveuq(__a, __b); 3810 } 3811 3812 static __inline__ vector signed __int128 __ATTRS_o_ai 3813 vec_dive(vector signed __int128 __a, vector signed __int128 __b) { 3814 return __builtin_altivec_vdivesq(__a, __b); 3815 } 3816 #endif 3817 #endif 3818 3819 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3820 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3821 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3822 return __a / __b; 3823 } 3824 3825 static __inline__ vector signed __int128 __ATTRS_o_ai 3826 vec_div(vector signed __int128 __a, vector signed __int128 __b) { 3827 return __a / __b; 3828 } 3829 #endif /* __POWER10_VECTOR__ */ 3830 3831 /* vec_xvtdiv */ 3832 3833 #ifdef __VSX__ 3834 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, 3835 vector double __b) { 3836 return __builtin_vsx_xvtdivdp(__a, __b); 3837 } 3838 3839 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, 3840 vector float __b) { 3841 return __builtin_vsx_xvtdivsp(__a, __b); 3842 } 3843 #endif 3844 3845 /* vec_dss */ 3846 3847 #define vec_dss __builtin_altivec_dss 3848 3849 /* vec_dssall */ 3850 3851 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3852 __builtin_altivec_dssall(); 3853 } 3854 3855 /* vec_dst */ 3856 #define vec_dst(__PTR, __CW, __STR) \ 3857 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) 3858 3859 /* vec_dstst */ 3860 #define vec_dstst(__PTR, __CW, __STR) \ 3861 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) 3862 3863 /* vec_dststt */ 3864 #define vec_dststt(__PTR, __CW, __STR) \ 3865 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) 3866 3867 /* vec_dstt */ 3868 #define vec_dstt(__PTR, __CW, __STR) \ 3869 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) 3870 3871 /* vec_eqv */ 3872 3873 #ifdef __POWER8_VECTOR__ 3874 static __inline__ vector signed char __ATTRS_o_ai 3875 vec_eqv(vector signed char __a, vector signed char __b) { 3876 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3877 (vector unsigned int)__b); 3878 } 3879 3880 static __inline__ vector unsigned char __ATTRS_o_ai 3881 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3882 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3883 (vector unsigned int)__b); 3884 } 3885 3886 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3887 vector bool char __b) { 3888 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3889 (vector unsigned int)__b); 3890 } 3891 3892 static __inline__ vector signed short __ATTRS_o_ai 3893 vec_eqv(vector signed short __a, vector signed short __b) { 3894 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3895 (vector unsigned int)__b); 3896 } 3897 3898 static __inline__ vector unsigned short __ATTRS_o_ai 3899 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3900 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3901 (vector unsigned int)__b); 3902 } 3903 3904 static __inline__ vector bool short __ATTRS_o_ai 3905 vec_eqv(vector bool short __a, vector bool short __b) { 3906 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3907 (vector unsigned int)__b); 3908 } 3909 3910 static __inline__ vector signed int __ATTRS_o_ai 3911 vec_eqv(vector signed int __a, vector signed int __b) { 3912 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3913 (vector unsigned int)__b); 3914 } 3915 3916 static __inline__ vector unsigned int __ATTRS_o_ai 3917 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3918 return __builtin_vsx_xxleqv(__a, __b); 3919 } 3920 3921 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3922 vector bool int __b) { 3923 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3924 (vector unsigned int)__b); 3925 } 3926 3927 static __inline__ vector signed long long __ATTRS_o_ai 3928 vec_eqv(vector signed long long __a, vector signed long long __b) { 3929 return (vector signed long long)__builtin_vsx_xxleqv( 3930 (vector unsigned int)__a, (vector unsigned int)__b); 3931 } 3932 3933 static __inline__ vector unsigned long long __ATTRS_o_ai 3934 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3935 return (vector unsigned long long)__builtin_vsx_xxleqv( 3936 (vector unsigned int)__a, (vector unsigned int)__b); 3937 } 3938 3939 static __inline__ vector bool long long __ATTRS_o_ai 3940 vec_eqv(vector bool long long __a, vector bool long long __b) { 3941 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3942 (vector unsigned int)__b); 3943 } 3944 3945 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3946 vector float __b) { 3947 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3948 (vector unsigned int)__b); 3949 } 3950 3951 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3952 vector double __b) { 3953 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3954 (vector unsigned int)__b); 3955 } 3956 #endif 3957 3958 /* vec_expte */ 3959 3960 static __inline__ vector float __attribute__((__always_inline__)) 3961 vec_expte(vector float __a) { 3962 return __builtin_altivec_vexptefp(__a); 3963 } 3964 3965 /* vec_vexptefp */ 3966 3967 static __inline__ vector float __attribute__((__always_inline__)) 3968 vec_vexptefp(vector float __a) { 3969 return __builtin_altivec_vexptefp(__a); 3970 } 3971 3972 /* vec_floor */ 3973 3974 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 3975 #ifdef __VSX__ 3976 return __builtin_vsx_xvrspim(__a); 3977 #else 3978 return __builtin_altivec_vrfim(__a); 3979 #endif 3980 } 3981 3982 #ifdef __VSX__ 3983 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 3984 return __builtin_vsx_xvrdpim(__a); 3985 } 3986 #endif 3987 3988 /* vec_roundm */ 3989 static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { 3990 return vec_floor(__a); 3991 } 3992 3993 #ifdef __VSX__ 3994 static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { 3995 return vec_floor(__a); 3996 } 3997 #endif 3998 3999 /* vec_vrfim */ 4000 4001 static __inline__ vector float __attribute__((__always_inline__)) 4002 vec_vrfim(vector float __a) { 4003 return __builtin_altivec_vrfim(__a); 4004 } 4005 4006 /* vec_ld */ 4007 4008 static __inline__ vector signed char __ATTRS_o_ai 4009 vec_ld(long __a, const vector signed char *__b) { 4010 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4011 } 4012 4013 static __inline__ vector signed char __ATTRS_o_ai 4014 vec_ld(long __a, const signed char *__b) { 4015 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4016 } 4017 4018 static __inline__ vector unsigned char __ATTRS_o_ai 4019 vec_ld(long __a, const vector unsigned char *__b) { 4020 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4021 } 4022 4023 static __inline__ vector unsigned char __ATTRS_o_ai 4024 vec_ld(long __a, const unsigned char *__b) { 4025 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4026 } 4027 4028 static __inline__ vector bool char __ATTRS_o_ai 4029 vec_ld(long __a, const vector bool char *__b) { 4030 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4031 } 4032 4033 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, 4034 const vector short *__b) { 4035 return (vector short)__builtin_altivec_lvx(__a, __b); 4036 } 4037 4038 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) { 4039 return (vector short)__builtin_altivec_lvx(__a, __b); 4040 } 4041 4042 static __inline__ vector unsigned short __ATTRS_o_ai 4043 vec_ld(long __a, const vector unsigned short *__b) { 4044 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4045 } 4046 4047 static __inline__ vector unsigned short __ATTRS_o_ai 4048 vec_ld(long __a, const unsigned short *__b) { 4049 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4050 } 4051 4052 static __inline__ vector bool short __ATTRS_o_ai 4053 vec_ld(long __a, const vector bool short *__b) { 4054 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4055 } 4056 4057 static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a, 4058 const vector pixel *__b) { 4059 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4060 } 4061 4062 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, 4063 const vector int *__b) { 4064 return (vector int)__builtin_altivec_lvx(__a, __b); 4065 } 4066 4067 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) { 4068 return (vector int)__builtin_altivec_lvx(__a, __b); 4069 } 4070 4071 static __inline__ vector unsigned int __ATTRS_o_ai 4072 vec_ld(long __a, const vector unsigned int *__b) { 4073 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4074 } 4075 4076 static __inline__ vector unsigned int __ATTRS_o_ai 4077 vec_ld(long __a, const unsigned int *__b) { 4078 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4079 } 4080 4081 static __inline__ vector bool int __ATTRS_o_ai 4082 vec_ld(long __a, const vector bool int *__b) { 4083 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4084 } 4085 4086 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, 4087 const vector float *__b) { 4088 return (vector float)__builtin_altivec_lvx(__a, __b); 4089 } 4090 4091 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) { 4092 return (vector float)__builtin_altivec_lvx(__a, __b); 4093 } 4094 4095 /* vec_lvx */ 4096 4097 static __inline__ vector signed char __ATTRS_o_ai 4098 vec_lvx(long __a, const vector signed char *__b) { 4099 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4100 } 4101 4102 static __inline__ vector signed char __ATTRS_o_ai 4103 vec_lvx(long __a, const signed char *__b) { 4104 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4105 } 4106 4107 static __inline__ vector unsigned char __ATTRS_o_ai 4108 vec_lvx(long __a, const vector unsigned char *__b) { 4109 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4110 } 4111 4112 static __inline__ vector unsigned char __ATTRS_o_ai 4113 vec_lvx(long __a, const unsigned char *__b) { 4114 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4115 } 4116 4117 static __inline__ vector bool char __ATTRS_o_ai 4118 vec_lvx(long __a, const vector bool char *__b) { 4119 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4120 } 4121 4122 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, 4123 const vector short *__b) { 4124 return (vector short)__builtin_altivec_lvx(__a, __b); 4125 } 4126 4127 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) { 4128 return (vector short)__builtin_altivec_lvx(__a, __b); 4129 } 4130 4131 static __inline__ vector unsigned short __ATTRS_o_ai 4132 vec_lvx(long __a, const vector unsigned short *__b) { 4133 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4134 } 4135 4136 static __inline__ vector unsigned short __ATTRS_o_ai 4137 vec_lvx(long __a, const unsigned short *__b) { 4138 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4139 } 4140 4141 static __inline__ vector bool short __ATTRS_o_ai 4142 vec_lvx(long __a, const vector bool short *__b) { 4143 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4144 } 4145 4146 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a, 4147 const vector pixel *__b) { 4148 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4149 } 4150 4151 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, 4152 const vector int *__b) { 4153 return (vector int)__builtin_altivec_lvx(__a, __b); 4154 } 4155 4156 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) { 4157 return (vector int)__builtin_altivec_lvx(__a, __b); 4158 } 4159 4160 static __inline__ vector unsigned int __ATTRS_o_ai 4161 vec_lvx(long __a, const vector unsigned int *__b) { 4162 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4163 } 4164 4165 static __inline__ vector unsigned int __ATTRS_o_ai 4166 vec_lvx(long __a, const unsigned int *__b) { 4167 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4168 } 4169 4170 static __inline__ vector bool int __ATTRS_o_ai 4171 vec_lvx(long __a, const vector bool int *__b) { 4172 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4173 } 4174 4175 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, 4176 const vector float *__b) { 4177 return (vector float)__builtin_altivec_lvx(__a, __b); 4178 } 4179 4180 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) { 4181 return (vector float)__builtin_altivec_lvx(__a, __b); 4182 } 4183 4184 /* vec_lde */ 4185 4186 static __inline__ vector signed char __ATTRS_o_ai 4187 vec_lde(long __a, const signed char *__b) { 4188 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4189 } 4190 4191 static __inline__ vector unsigned char __ATTRS_o_ai 4192 vec_lde(long __a, const unsigned char *__b) { 4193 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4194 } 4195 4196 static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) { 4197 return (vector short)__builtin_altivec_lvehx(__a, __b); 4198 } 4199 4200 static __inline__ vector unsigned short __ATTRS_o_ai 4201 vec_lde(long __a, const unsigned short *__b) { 4202 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4203 } 4204 4205 static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) { 4206 return (vector int)__builtin_altivec_lvewx(__a, __b); 4207 } 4208 4209 static __inline__ vector unsigned int __ATTRS_o_ai 4210 vec_lde(long __a, const unsigned int *__b) { 4211 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4212 } 4213 4214 static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) { 4215 return (vector float)__builtin_altivec_lvewx(__a, __b); 4216 } 4217 4218 /* vec_lvebx */ 4219 4220 static __inline__ vector signed char __ATTRS_o_ai 4221 vec_lvebx(long __a, const signed char *__b) { 4222 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4223 } 4224 4225 static __inline__ vector unsigned char __ATTRS_o_ai 4226 vec_lvebx(long __a, const unsigned char *__b) { 4227 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4228 } 4229 4230 /* vec_lvehx */ 4231 4232 static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, 4233 const short *__b) { 4234 return (vector short)__builtin_altivec_lvehx(__a, __b); 4235 } 4236 4237 static __inline__ vector unsigned short __ATTRS_o_ai 4238 vec_lvehx(long __a, const unsigned short *__b) { 4239 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4240 } 4241 4242 /* vec_lvewx */ 4243 4244 static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) { 4245 return (vector int)__builtin_altivec_lvewx(__a, __b); 4246 } 4247 4248 static __inline__ vector unsigned int __ATTRS_o_ai 4249 vec_lvewx(long __a, const unsigned int *__b) { 4250 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4251 } 4252 4253 static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a, 4254 const float *__b) { 4255 return (vector float)__builtin_altivec_lvewx(__a, __b); 4256 } 4257 4258 /* vec_ldl */ 4259 4260 static __inline__ vector signed char __ATTRS_o_ai 4261 vec_ldl(long __a, const vector signed char *__b) { 4262 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4263 } 4264 4265 static __inline__ vector signed char __ATTRS_o_ai 4266 vec_ldl(long __a, const signed char *__b) { 4267 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4268 } 4269 4270 static __inline__ vector unsigned char __ATTRS_o_ai 4271 vec_ldl(long __a, const vector unsigned char *__b) { 4272 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4273 } 4274 4275 static __inline__ vector unsigned char __ATTRS_o_ai 4276 vec_ldl(long __a, const unsigned char *__b) { 4277 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4278 } 4279 4280 static __inline__ vector bool char __ATTRS_o_ai 4281 vec_ldl(long __a, const vector bool char *__b) { 4282 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4283 } 4284 4285 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, 4286 const vector short *__b) { 4287 return (vector short)__builtin_altivec_lvxl(__a, __b); 4288 } 4289 4290 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) { 4291 return (vector short)__builtin_altivec_lvxl(__a, __b); 4292 } 4293 4294 static __inline__ vector unsigned short __ATTRS_o_ai 4295 vec_ldl(long __a, const vector unsigned short *__b) { 4296 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4297 } 4298 4299 static __inline__ vector unsigned short __ATTRS_o_ai 4300 vec_ldl(long __a, const unsigned short *__b) { 4301 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4302 } 4303 4304 static __inline__ vector bool short __ATTRS_o_ai 4305 vec_ldl(long __a, const vector bool short *__b) { 4306 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4307 } 4308 4309 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a, 4310 const vector pixel *__b) { 4311 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 4312 } 4313 4314 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, 4315 const vector int *__b) { 4316 return (vector int)__builtin_altivec_lvxl(__a, __b); 4317 } 4318 4319 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) { 4320 return (vector int)__builtin_altivec_lvxl(__a, __b); 4321 } 4322 4323 static __inline__ vector unsigned int __ATTRS_o_ai 4324 vec_ldl(long __a, const vector unsigned int *__b) { 4325 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4326 } 4327 4328 static __inline__ vector unsigned int __ATTRS_o_ai 4329 vec_ldl(long __a, const unsigned int *__b) { 4330 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4331 } 4332 4333 static __inline__ vector bool int __ATTRS_o_ai 4334 vec_ldl(long __a, const vector bool int *__b) { 4335 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4336 } 4337 4338 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, 4339 const vector float *__b) { 4340 return (vector float)__builtin_altivec_lvxl(__a, __b); 4341 } 4342 4343 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) { 4344 return (vector float)__builtin_altivec_lvxl(__a, __b); 4345 } 4346 4347 /* vec_lvxl */ 4348 4349 static __inline__ vector signed char __ATTRS_o_ai 4350 vec_lvxl(long __a, const vector signed char *__b) { 4351 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4352 } 4353 4354 static __inline__ vector signed char __ATTRS_o_ai 4355 vec_lvxl(long __a, const signed char *__b) { 4356 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4357 } 4358 4359 static __inline__ vector unsigned char __ATTRS_o_ai 4360 vec_lvxl(long __a, const vector unsigned char *__b) { 4361 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4362 } 4363 4364 static __inline__ vector unsigned char __ATTRS_o_ai 4365 vec_lvxl(long __a, const unsigned char *__b) { 4366 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4367 } 4368 4369 static __inline__ vector bool char __ATTRS_o_ai 4370 vec_lvxl(long __a, const vector bool char *__b) { 4371 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4372 } 4373 4374 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4375 const vector short *__b) { 4376 return (vector short)__builtin_altivec_lvxl(__a, __b); 4377 } 4378 4379 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4380 const short *__b) { 4381 return (vector short)__builtin_altivec_lvxl(__a, __b); 4382 } 4383 4384 static __inline__ vector unsigned short __ATTRS_o_ai 4385 vec_lvxl(long __a, const vector unsigned short *__b) { 4386 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4387 } 4388 4389 static __inline__ vector unsigned short __ATTRS_o_ai 4390 vec_lvxl(long __a, const unsigned short *__b) { 4391 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4392 } 4393 4394 static __inline__ vector bool short __ATTRS_o_ai 4395 vec_lvxl(long __a, const vector bool short *__b) { 4396 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4397 } 4398 4399 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a, 4400 const vector pixel *__b) { 4401 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 4402 } 4403 4404 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, 4405 const vector int *__b) { 4406 return (vector int)__builtin_altivec_lvxl(__a, __b); 4407 } 4408 4409 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) { 4410 return (vector int)__builtin_altivec_lvxl(__a, __b); 4411 } 4412 4413 static __inline__ vector unsigned int __ATTRS_o_ai 4414 vec_lvxl(long __a, const vector unsigned int *__b) { 4415 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4416 } 4417 4418 static __inline__ vector unsigned int __ATTRS_o_ai 4419 vec_lvxl(long __a, const unsigned int *__b) { 4420 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4421 } 4422 4423 static __inline__ vector bool int __ATTRS_o_ai 4424 vec_lvxl(long __a, const vector bool int *__b) { 4425 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4426 } 4427 4428 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4429 const vector float *__b) { 4430 return (vector float)__builtin_altivec_lvxl(__a, __b); 4431 } 4432 4433 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4434 const float *__b) { 4435 return (vector float)__builtin_altivec_lvxl(__a, __b); 4436 } 4437 4438 /* vec_loge */ 4439 4440 static __inline__ vector float __attribute__((__always_inline__)) 4441 vec_loge(vector float __a) { 4442 return __builtin_altivec_vlogefp(__a); 4443 } 4444 4445 /* vec_vlogefp */ 4446 4447 static __inline__ vector float __attribute__((__always_inline__)) 4448 vec_vlogefp(vector float __a) { 4449 return __builtin_altivec_vlogefp(__a); 4450 } 4451 4452 /* vec_lvsl */ 4453 4454 #ifdef __LITTLE_ENDIAN__ 4455 static __inline__ vector unsigned char __ATTRS_o_ai 4456 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4457 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 4458 vector unsigned char mask = 4459 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4460 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4461 7, 6, 5, 4, 3, 2, 1, 0}; 4462 return vec_perm(mask, mask, reverse); 4463 } 4464 #else 4465 static __inline__ vector unsigned char __ATTRS_o_ai 4466 vec_lvsl(int __a, const signed char *__b) { 4467 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4468 } 4469 #endif 4470 4471 #ifdef __LITTLE_ENDIAN__ 4472 static __inline__ vector unsigned char __ATTRS_o_ai 4473 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4474 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 4475 vector unsigned char mask = 4476 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4477 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4478 7, 6, 5, 4, 3, 2, 1, 0}; 4479 return vec_perm(mask, mask, reverse); 4480 } 4481 #else 4482 static __inline__ vector unsigned char __ATTRS_o_ai 4483 vec_lvsl(int __a, const unsigned char *__b) { 4484 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4485 } 4486 #endif 4487 4488 #ifdef __LITTLE_ENDIAN__ 4489 static __inline__ vector unsigned char __ATTRS_o_ai 4490 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4491 loads/stores"))) vec_lvsl(int __a, const short *__b) { 4492 vector unsigned char mask = 4493 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4494 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4495 7, 6, 5, 4, 3, 2, 1, 0}; 4496 return vec_perm(mask, mask, reverse); 4497 } 4498 #else 4499 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4500 const short *__b) { 4501 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4502 } 4503 #endif 4504 4505 #ifdef __LITTLE_ENDIAN__ 4506 static __inline__ vector unsigned char __ATTRS_o_ai 4507 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4508 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4509 vector unsigned char mask = 4510 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4511 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4512 7, 6, 5, 4, 3, 2, 1, 0}; 4513 return vec_perm(mask, mask, reverse); 4514 } 4515 #else 4516 static __inline__ vector unsigned char __ATTRS_o_ai 4517 vec_lvsl(int __a, const unsigned short *__b) { 4518 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4519 } 4520 #endif 4521 4522 #ifdef __LITTLE_ENDIAN__ 4523 static __inline__ vector unsigned char __ATTRS_o_ai 4524 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4525 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4526 vector unsigned char mask = 4527 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4528 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4529 7, 6, 5, 4, 3, 2, 1, 0}; 4530 return vec_perm(mask, mask, reverse); 4531 } 4532 #else 4533 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4534 const int *__b) { 4535 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4536 } 4537 #endif 4538 4539 #ifdef __LITTLE_ENDIAN__ 4540 static __inline__ vector unsigned char __ATTRS_o_ai 4541 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4542 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4543 vector unsigned char mask = 4544 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4545 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4546 7, 6, 5, 4, 3, 2, 1, 0}; 4547 return vec_perm(mask, mask, reverse); 4548 } 4549 #else 4550 static __inline__ vector unsigned char __ATTRS_o_ai 4551 vec_lvsl(int __a, const unsigned int *__b) { 4552 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4553 } 4554 #endif 4555 4556 #ifdef __LITTLE_ENDIAN__ 4557 static __inline__ vector unsigned char __ATTRS_o_ai 4558 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4559 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4560 vector unsigned char mask = 4561 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4562 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4563 7, 6, 5, 4, 3, 2, 1, 0}; 4564 return vec_perm(mask, mask, reverse); 4565 } 4566 #else 4567 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4568 const float *__b) { 4569 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4570 } 4571 #endif 4572 4573 /* vec_lvsr */ 4574 4575 #ifdef __LITTLE_ENDIAN__ 4576 static __inline__ vector unsigned char __ATTRS_o_ai 4577 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4578 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4579 vector unsigned char mask = 4580 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4581 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4582 7, 6, 5, 4, 3, 2, 1, 0}; 4583 return vec_perm(mask, mask, reverse); 4584 } 4585 #else 4586 static __inline__ vector unsigned char __ATTRS_o_ai 4587 vec_lvsr(int __a, const signed char *__b) { 4588 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4589 } 4590 #endif 4591 4592 #ifdef __LITTLE_ENDIAN__ 4593 static __inline__ vector unsigned char __ATTRS_o_ai 4594 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4595 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4596 vector unsigned char mask = 4597 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4598 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4599 7, 6, 5, 4, 3, 2, 1, 0}; 4600 return vec_perm(mask, mask, reverse); 4601 } 4602 #else 4603 static __inline__ vector unsigned char __ATTRS_o_ai 4604 vec_lvsr(int __a, const unsigned char *__b) { 4605 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4606 } 4607 #endif 4608 4609 #ifdef __LITTLE_ENDIAN__ 4610 static __inline__ vector unsigned char __ATTRS_o_ai 4611 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4612 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4613 vector unsigned char mask = 4614 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4615 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4616 7, 6, 5, 4, 3, 2, 1, 0}; 4617 return vec_perm(mask, mask, reverse); 4618 } 4619 #else 4620 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4621 const short *__b) { 4622 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4623 } 4624 #endif 4625 4626 #ifdef __LITTLE_ENDIAN__ 4627 static __inline__ vector unsigned char __ATTRS_o_ai 4628 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4629 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4630 vector unsigned char mask = 4631 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4632 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4633 7, 6, 5, 4, 3, 2, 1, 0}; 4634 return vec_perm(mask, mask, reverse); 4635 } 4636 #else 4637 static __inline__ vector unsigned char __ATTRS_o_ai 4638 vec_lvsr(int __a, const unsigned short *__b) { 4639 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4640 } 4641 #endif 4642 4643 #ifdef __LITTLE_ENDIAN__ 4644 static __inline__ vector unsigned char __ATTRS_o_ai 4645 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4646 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4647 vector unsigned char mask = 4648 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4649 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4650 7, 6, 5, 4, 3, 2, 1, 0}; 4651 return vec_perm(mask, mask, reverse); 4652 } 4653 #else 4654 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4655 const int *__b) { 4656 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4657 } 4658 #endif 4659 4660 #ifdef __LITTLE_ENDIAN__ 4661 static __inline__ vector unsigned char __ATTRS_o_ai 4662 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4663 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4664 vector unsigned char mask = 4665 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4666 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4667 7, 6, 5, 4, 3, 2, 1, 0}; 4668 return vec_perm(mask, mask, reverse); 4669 } 4670 #else 4671 static __inline__ vector unsigned char __ATTRS_o_ai 4672 vec_lvsr(int __a, const unsigned int *__b) { 4673 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4674 } 4675 #endif 4676 4677 #ifdef __LITTLE_ENDIAN__ 4678 static __inline__ vector unsigned char __ATTRS_o_ai 4679 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4680 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4681 vector unsigned char mask = 4682 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4683 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4684 7, 6, 5, 4, 3, 2, 1, 0}; 4685 return vec_perm(mask, mask, reverse); 4686 } 4687 #else 4688 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4689 const float *__b) { 4690 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4691 } 4692 #endif 4693 4694 /* vec_madd */ 4695 static __inline__ vector signed short __ATTRS_o_ai 4696 vec_mladd(vector signed short, vector signed short, vector signed short); 4697 static __inline__ vector signed short __ATTRS_o_ai 4698 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4699 static __inline__ vector signed short __ATTRS_o_ai 4700 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4701 static __inline__ vector unsigned short __ATTRS_o_ai 4702 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4703 4704 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4705 vector signed short __a, vector signed short __b, vector signed short __c) { 4706 return vec_mladd(__a, __b, __c); 4707 } 4708 4709 static __inline__ vector signed short __ATTRS_o_ai 4710 vec_madd(vector signed short __a, vector unsigned short __b, 4711 vector unsigned short __c) { 4712 return vec_mladd(__a, __b, __c); 4713 } 4714 4715 static __inline__ vector signed short __ATTRS_o_ai 4716 vec_madd(vector unsigned short __a, vector signed short __b, 4717 vector signed short __c) { 4718 return vec_mladd(__a, __b, __c); 4719 } 4720 4721 static __inline__ vector unsigned short __ATTRS_o_ai 4722 vec_madd(vector unsigned short __a, vector unsigned short __b, 4723 vector unsigned short __c) { 4724 return vec_mladd(__a, __b, __c); 4725 } 4726 4727 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4728 vector float __b, 4729 vector float __c) { 4730 #ifdef __VSX__ 4731 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4732 #else 4733 return __builtin_altivec_vmaddfp(__a, __b, __c); 4734 #endif 4735 } 4736 4737 #ifdef __VSX__ 4738 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4739 vector double __b, 4740 vector double __c) { 4741 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4742 } 4743 #endif 4744 4745 /* vec_vmaddfp */ 4746 4747 static __inline__ vector float __attribute__((__always_inline__)) 4748 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4749 return __builtin_altivec_vmaddfp(__a, __b, __c); 4750 } 4751 4752 /* vec_madds */ 4753 4754 static __inline__ vector signed short __attribute__((__always_inline__)) 4755 vec_madds(vector signed short __a, vector signed short __b, 4756 vector signed short __c) { 4757 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4758 } 4759 4760 /* vec_vmhaddshs */ 4761 static __inline__ vector signed short __attribute__((__always_inline__)) 4762 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4763 vector signed short __c) { 4764 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4765 } 4766 4767 /* vec_msub */ 4768 4769 #ifdef __VSX__ 4770 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4771 vector float __b, 4772 vector float __c) { 4773 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4774 } 4775 4776 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4777 vector double __b, 4778 vector double __c) { 4779 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4780 } 4781 #endif 4782 4783 /* vec_max */ 4784 4785 static __inline__ vector signed char __ATTRS_o_ai 4786 vec_max(vector signed char __a, vector signed char __b) { 4787 return __builtin_altivec_vmaxsb(__a, __b); 4788 } 4789 4790 static __inline__ vector signed char __ATTRS_o_ai 4791 vec_max(vector bool char __a, vector signed char __b) { 4792 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4793 } 4794 4795 static __inline__ vector signed char __ATTRS_o_ai 4796 vec_max(vector signed char __a, vector bool char __b) { 4797 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4798 } 4799 4800 static __inline__ vector unsigned char __ATTRS_o_ai 4801 vec_max(vector unsigned char __a, vector unsigned char __b) { 4802 return __builtin_altivec_vmaxub(__a, __b); 4803 } 4804 4805 static __inline__ vector unsigned char __ATTRS_o_ai 4806 vec_max(vector bool char __a, vector unsigned char __b) { 4807 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4808 } 4809 4810 static __inline__ vector unsigned char __ATTRS_o_ai 4811 vec_max(vector unsigned char __a, vector bool char __b) { 4812 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4813 } 4814 4815 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4816 vector short __b) { 4817 return __builtin_altivec_vmaxsh(__a, __b); 4818 } 4819 4820 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4821 vector short __b) { 4822 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4823 } 4824 4825 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4826 vector bool short __b) { 4827 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4828 } 4829 4830 static __inline__ vector unsigned short __ATTRS_o_ai 4831 vec_max(vector unsigned short __a, vector unsigned short __b) { 4832 return __builtin_altivec_vmaxuh(__a, __b); 4833 } 4834 4835 static __inline__ vector unsigned short __ATTRS_o_ai 4836 vec_max(vector bool short __a, vector unsigned short __b) { 4837 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4838 } 4839 4840 static __inline__ vector unsigned short __ATTRS_o_ai 4841 vec_max(vector unsigned short __a, vector bool short __b) { 4842 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4843 } 4844 4845 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4846 vector int __b) { 4847 return __builtin_altivec_vmaxsw(__a, __b); 4848 } 4849 4850 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4851 vector int __b) { 4852 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4853 } 4854 4855 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4856 vector bool int __b) { 4857 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4858 } 4859 4860 static __inline__ vector unsigned int __ATTRS_o_ai 4861 vec_max(vector unsigned int __a, vector unsigned int __b) { 4862 return __builtin_altivec_vmaxuw(__a, __b); 4863 } 4864 4865 static __inline__ vector unsigned int __ATTRS_o_ai 4866 vec_max(vector bool int __a, vector unsigned int __b) { 4867 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4868 } 4869 4870 static __inline__ vector unsigned int __ATTRS_o_ai 4871 vec_max(vector unsigned int __a, vector bool int __b) { 4872 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4873 } 4874 4875 #ifdef __POWER8_VECTOR__ 4876 static __inline__ vector signed long long __ATTRS_o_ai 4877 vec_max(vector signed long long __a, vector signed long long __b) { 4878 return __builtin_altivec_vmaxsd(__a, __b); 4879 } 4880 4881 static __inline__ vector signed long long __ATTRS_o_ai 4882 vec_max(vector bool long long __a, vector signed long long __b) { 4883 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4884 } 4885 4886 static __inline__ vector signed long long __ATTRS_o_ai 4887 vec_max(vector signed long long __a, vector bool long long __b) { 4888 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4889 } 4890 4891 static __inline__ vector unsigned long long __ATTRS_o_ai 4892 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4893 return __builtin_altivec_vmaxud(__a, __b); 4894 } 4895 4896 static __inline__ vector unsigned long long __ATTRS_o_ai 4897 vec_max(vector bool long long __a, vector unsigned long long __b) { 4898 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4899 } 4900 4901 static __inline__ vector unsigned long long __ATTRS_o_ai 4902 vec_max(vector unsigned long long __a, vector bool long long __b) { 4903 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4904 } 4905 #endif 4906 4907 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4908 vector float __b) { 4909 #ifdef __VSX__ 4910 return __builtin_vsx_xvmaxsp(__a, __b); 4911 #else 4912 return __builtin_altivec_vmaxfp(__a, __b); 4913 #endif 4914 } 4915 4916 #ifdef __VSX__ 4917 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4918 vector double __b) { 4919 return __builtin_vsx_xvmaxdp(__a, __b); 4920 } 4921 #endif 4922 4923 /* vec_vmaxsb */ 4924 4925 static __inline__ vector signed char __ATTRS_o_ai 4926 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4927 return __builtin_altivec_vmaxsb(__a, __b); 4928 } 4929 4930 static __inline__ vector signed char __ATTRS_o_ai 4931 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4932 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4933 } 4934 4935 static __inline__ vector signed char __ATTRS_o_ai 4936 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4937 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4938 } 4939 4940 /* vec_vmaxub */ 4941 4942 static __inline__ vector unsigned char __ATTRS_o_ai 4943 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4944 return __builtin_altivec_vmaxub(__a, __b); 4945 } 4946 4947 static __inline__ vector unsigned char __ATTRS_o_ai 4948 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4949 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4950 } 4951 4952 static __inline__ vector unsigned char __ATTRS_o_ai 4953 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4954 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4955 } 4956 4957 /* vec_vmaxsh */ 4958 4959 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4960 vector short __b) { 4961 return __builtin_altivec_vmaxsh(__a, __b); 4962 } 4963 4964 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 4965 vector short __b) { 4966 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4967 } 4968 4969 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4970 vector bool short __b) { 4971 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4972 } 4973 4974 /* vec_vmaxuh */ 4975 4976 static __inline__ vector unsigned short __ATTRS_o_ai 4977 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 4978 return __builtin_altivec_vmaxuh(__a, __b); 4979 } 4980 4981 static __inline__ vector unsigned short __ATTRS_o_ai 4982 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 4983 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4984 } 4985 4986 static __inline__ vector unsigned short __ATTRS_o_ai 4987 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 4988 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4989 } 4990 4991 /* vec_vmaxsw */ 4992 4993 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4994 vector int __b) { 4995 return __builtin_altivec_vmaxsw(__a, __b); 4996 } 4997 4998 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 4999 vector int __b) { 5000 return __builtin_altivec_vmaxsw((vector int)__a, __b); 5001 } 5002 5003 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 5004 vector bool int __b) { 5005 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 5006 } 5007 5008 /* vec_vmaxuw */ 5009 5010 static __inline__ vector unsigned int __ATTRS_o_ai 5011 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 5012 return __builtin_altivec_vmaxuw(__a, __b); 5013 } 5014 5015 static __inline__ vector unsigned int __ATTRS_o_ai 5016 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 5017 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 5018 } 5019 5020 static __inline__ vector unsigned int __ATTRS_o_ai 5021 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 5022 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 5023 } 5024 5025 /* vec_vmaxfp */ 5026 5027 static __inline__ vector float __attribute__((__always_inline__)) 5028 vec_vmaxfp(vector float __a, vector float __b) { 5029 #ifdef __VSX__ 5030 return __builtin_vsx_xvmaxsp(__a, __b); 5031 #else 5032 return __builtin_altivec_vmaxfp(__a, __b); 5033 #endif 5034 } 5035 5036 /* vec_mergeh */ 5037 5038 static __inline__ vector signed char __ATTRS_o_ai 5039 vec_mergeh(vector signed char __a, vector signed char __b) { 5040 return vec_perm(__a, __b, 5041 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5042 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5043 0x06, 0x16, 0x07, 0x17)); 5044 } 5045 5046 static __inline__ vector unsigned char __ATTRS_o_ai 5047 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 5048 return vec_perm(__a, __b, 5049 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5050 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5051 0x06, 0x16, 0x07, 0x17)); 5052 } 5053 5054 static __inline__ vector bool char __ATTRS_o_ai 5055 vec_mergeh(vector bool char __a, vector bool char __b) { 5056 return vec_perm(__a, __b, 5057 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5058 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5059 0x06, 0x16, 0x07, 0x17)); 5060 } 5061 5062 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 5063 vector short __b) { 5064 return vec_perm(__a, __b, 5065 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5066 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5067 0x06, 0x07, 0x16, 0x17)); 5068 } 5069 5070 static __inline__ vector unsigned short __ATTRS_o_ai 5071 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 5072 return vec_perm(__a, __b, 5073 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5074 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5075 0x06, 0x07, 0x16, 0x17)); 5076 } 5077 5078 static __inline__ vector bool short __ATTRS_o_ai 5079 vec_mergeh(vector bool short __a, vector bool short __b) { 5080 return vec_perm(__a, __b, 5081 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5082 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5083 0x06, 0x07, 0x16, 0x17)); 5084 } 5085 5086 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 5087 vector pixel __b) { 5088 return vec_perm(__a, __b, 5089 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5090 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5091 0x06, 0x07, 0x16, 0x17)); 5092 } 5093 5094 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 5095 vector int __b) { 5096 return vec_perm(__a, __b, 5097 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5098 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5099 0x14, 0x15, 0x16, 0x17)); 5100 } 5101 5102 static __inline__ vector unsigned int __ATTRS_o_ai 5103 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 5104 return vec_perm(__a, __b, 5105 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5106 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5107 0x14, 0x15, 0x16, 0x17)); 5108 } 5109 5110 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 5111 vector bool int __b) { 5112 return vec_perm(__a, __b, 5113 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5114 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5115 0x14, 0x15, 0x16, 0x17)); 5116 } 5117 5118 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 5119 vector float __b) { 5120 return vec_perm(__a, __b, 5121 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5122 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5123 0x14, 0x15, 0x16, 0x17)); 5124 } 5125 5126 #ifdef __VSX__ 5127 static __inline__ vector signed long long __ATTRS_o_ai 5128 vec_mergeh(vector signed long long __a, vector signed long long __b) { 5129 return vec_perm(__a, __b, 5130 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5131 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5132 0x14, 0x15, 0x16, 0x17)); 5133 } 5134 5135 static __inline__ vector signed long long __ATTRS_o_ai 5136 vec_mergeh(vector signed long long __a, vector bool long long __b) { 5137 return vec_perm(__a, (vector signed long long)__b, 5138 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5139 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5140 0x14, 0x15, 0x16, 0x17)); 5141 } 5142 5143 static __inline__ vector signed long long __ATTRS_o_ai 5144 vec_mergeh(vector bool long long __a, vector signed long long __b) { 5145 return vec_perm((vector signed long long)__a, __b, 5146 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5147 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5148 0x14, 0x15, 0x16, 0x17)); 5149 } 5150 5151 static __inline__ vector unsigned long long __ATTRS_o_ai 5152 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 5153 return vec_perm(__a, __b, 5154 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5155 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5156 0x14, 0x15, 0x16, 0x17)); 5157 } 5158 5159 static __inline__ vector unsigned long long __ATTRS_o_ai 5160 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 5161 return vec_perm(__a, (vector unsigned long long)__b, 5162 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5163 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5164 0x14, 0x15, 0x16, 0x17)); 5165 } 5166 5167 static __inline__ vector unsigned long long __ATTRS_o_ai 5168 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 5169 return vec_perm((vector unsigned long long)__a, __b, 5170 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5171 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5172 0x14, 0x15, 0x16, 0x17)); 5173 } 5174 5175 static __inline__ vector bool long long __ATTRS_o_ai 5176 vec_mergeh(vector bool long long __a, vector bool long long __b) { 5177 return vec_perm(__a, __b, 5178 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5179 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5180 0x14, 0x15, 0x16, 0x17)); 5181 } 5182 5183 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 5184 vector double __b) { 5185 return vec_perm(__a, __b, 5186 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5187 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5188 0x14, 0x15, 0x16, 0x17)); 5189 } 5190 static __inline__ vector double __ATTRS_o_ai 5191 vec_mergeh(vector double __a, vector bool long long __b) { 5192 return vec_perm(__a, (vector double)__b, 5193 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5194 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5195 0x14, 0x15, 0x16, 0x17)); 5196 } 5197 static __inline__ vector double __ATTRS_o_ai 5198 vec_mergeh(vector bool long long __a, vector double __b) { 5199 return vec_perm((vector double)__a, __b, 5200 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5201 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5202 0x14, 0x15, 0x16, 0x17)); 5203 } 5204 #endif 5205 5206 /* vec_vmrghb */ 5207 5208 #define __builtin_altivec_vmrghb vec_vmrghb 5209 5210 static __inline__ vector signed char __ATTRS_o_ai 5211 vec_vmrghb(vector signed char __a, vector signed char __b) { 5212 return vec_perm(__a, __b, 5213 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5214 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5215 0x06, 0x16, 0x07, 0x17)); 5216 } 5217 5218 static __inline__ vector unsigned char __ATTRS_o_ai 5219 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 5220 return vec_perm(__a, __b, 5221 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5222 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5223 0x06, 0x16, 0x07, 0x17)); 5224 } 5225 5226 static __inline__ vector bool char __ATTRS_o_ai 5227 vec_vmrghb(vector bool char __a, vector bool char __b) { 5228 return vec_perm(__a, __b, 5229 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5230 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5231 0x06, 0x16, 0x07, 0x17)); 5232 } 5233 5234 /* vec_vmrghh */ 5235 5236 #define __builtin_altivec_vmrghh vec_vmrghh 5237 5238 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 5239 vector short __b) { 5240 return vec_perm(__a, __b, 5241 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5242 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5243 0x06, 0x07, 0x16, 0x17)); 5244 } 5245 5246 static __inline__ vector unsigned short __ATTRS_o_ai 5247 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 5248 return vec_perm(__a, __b, 5249 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5250 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5251 0x06, 0x07, 0x16, 0x17)); 5252 } 5253 5254 static __inline__ vector bool short __ATTRS_o_ai 5255 vec_vmrghh(vector bool short __a, vector bool short __b) { 5256 return vec_perm(__a, __b, 5257 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5258 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5259 0x06, 0x07, 0x16, 0x17)); 5260 } 5261 5262 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 5263 vector pixel __b) { 5264 return vec_perm(__a, __b, 5265 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5266 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5267 0x06, 0x07, 0x16, 0x17)); 5268 } 5269 5270 /* vec_vmrghw */ 5271 5272 #define __builtin_altivec_vmrghw vec_vmrghw 5273 5274 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 5275 vector int __b) { 5276 return vec_perm(__a, __b, 5277 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5278 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5279 0x14, 0x15, 0x16, 0x17)); 5280 } 5281 5282 static __inline__ vector unsigned int __ATTRS_o_ai 5283 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 5284 return vec_perm(__a, __b, 5285 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5286 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5287 0x14, 0x15, 0x16, 0x17)); 5288 } 5289 5290 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 5291 vector bool int __b) { 5292 return vec_perm(__a, __b, 5293 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5294 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5295 0x14, 0x15, 0x16, 0x17)); 5296 } 5297 5298 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 5299 vector float __b) { 5300 return vec_perm(__a, __b, 5301 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5302 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5303 0x14, 0x15, 0x16, 0x17)); 5304 } 5305 5306 /* vec_mergel */ 5307 5308 static __inline__ vector signed char __ATTRS_o_ai 5309 vec_mergel(vector signed char __a, vector signed char __b) { 5310 return vec_perm(__a, __b, 5311 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5312 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5313 0x0E, 0x1E, 0x0F, 0x1F)); 5314 } 5315 5316 static __inline__ vector unsigned char __ATTRS_o_ai 5317 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 5318 return vec_perm(__a, __b, 5319 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5320 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5321 0x0E, 0x1E, 0x0F, 0x1F)); 5322 } 5323 5324 static __inline__ vector bool char __ATTRS_o_ai 5325 vec_mergel(vector bool char __a, vector bool char __b) { 5326 return vec_perm(__a, __b, 5327 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5328 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5329 0x0E, 0x1E, 0x0F, 0x1F)); 5330 } 5331 5332 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 5333 vector short __b) { 5334 return vec_perm(__a, __b, 5335 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5336 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5337 0x0E, 0x0F, 0x1E, 0x1F)); 5338 } 5339 5340 static __inline__ vector unsigned short __ATTRS_o_ai 5341 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 5342 return vec_perm(__a, __b, 5343 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5344 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5345 0x0E, 0x0F, 0x1E, 0x1F)); 5346 } 5347 5348 static __inline__ vector bool short __ATTRS_o_ai 5349 vec_mergel(vector bool short __a, vector bool short __b) { 5350 return vec_perm(__a, __b, 5351 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5352 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5353 0x0E, 0x0F, 0x1E, 0x1F)); 5354 } 5355 5356 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 5357 vector pixel __b) { 5358 return vec_perm(__a, __b, 5359 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5360 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5361 0x0E, 0x0F, 0x1E, 0x1F)); 5362 } 5363 5364 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 5365 vector int __b) { 5366 return vec_perm(__a, __b, 5367 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5368 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5369 0x1C, 0x1D, 0x1E, 0x1F)); 5370 } 5371 5372 static __inline__ vector unsigned int __ATTRS_o_ai 5373 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 5374 return vec_perm(__a, __b, 5375 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5376 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5377 0x1C, 0x1D, 0x1E, 0x1F)); 5378 } 5379 5380 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 5381 vector bool int __b) { 5382 return vec_perm(__a, __b, 5383 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5384 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5385 0x1C, 0x1D, 0x1E, 0x1F)); 5386 } 5387 5388 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 5389 vector float __b) { 5390 return vec_perm(__a, __b, 5391 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5392 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5393 0x1C, 0x1D, 0x1E, 0x1F)); 5394 } 5395 5396 #ifdef __VSX__ 5397 static __inline__ vector signed long long __ATTRS_o_ai 5398 vec_mergel(vector signed long long __a, vector signed long long __b) { 5399 return vec_perm(__a, __b, 5400 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5401 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5402 0x1C, 0x1D, 0x1E, 0x1F)); 5403 } 5404 static __inline__ vector signed long long __ATTRS_o_ai 5405 vec_mergel(vector signed long long __a, vector bool long long __b) { 5406 return vec_perm(__a, (vector signed long long)__b, 5407 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5408 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5409 0x1C, 0x1D, 0x1E, 0x1F)); 5410 } 5411 static __inline__ vector signed long long __ATTRS_o_ai 5412 vec_mergel(vector bool long long __a, vector signed long long __b) { 5413 return vec_perm((vector signed long long)__a, __b, 5414 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5415 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5416 0x1C, 0x1D, 0x1E, 0x1F)); 5417 } 5418 static __inline__ vector unsigned long long __ATTRS_o_ai 5419 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 5420 return vec_perm(__a, __b, 5421 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5422 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5423 0x1C, 0x1D, 0x1E, 0x1F)); 5424 } 5425 static __inline__ vector unsigned long long __ATTRS_o_ai 5426 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 5427 return vec_perm(__a, (vector unsigned long long)__b, 5428 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5429 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5430 0x1C, 0x1D, 0x1E, 0x1F)); 5431 } 5432 static __inline__ vector unsigned long long __ATTRS_o_ai 5433 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 5434 return vec_perm((vector unsigned long long)__a, __b, 5435 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5436 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5437 0x1C, 0x1D, 0x1E, 0x1F)); 5438 } 5439 static __inline__ vector bool long long __ATTRS_o_ai 5440 vec_mergel(vector bool long long __a, vector bool long long __b) { 5441 return vec_perm(__a, __b, 5442 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5443 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5444 0x1C, 0x1D, 0x1E, 0x1F)); 5445 } 5446 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 5447 vector double __b) { 5448 return vec_perm(__a, __b, 5449 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5450 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5451 0x1C, 0x1D, 0x1E, 0x1F)); 5452 } 5453 static __inline__ vector double __ATTRS_o_ai 5454 vec_mergel(vector double __a, vector bool long long __b) { 5455 return vec_perm(__a, (vector double)__b, 5456 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5457 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5458 0x1C, 0x1D, 0x1E, 0x1F)); 5459 } 5460 static __inline__ vector double __ATTRS_o_ai 5461 vec_mergel(vector bool long long __a, vector double __b) { 5462 return vec_perm((vector double)__a, __b, 5463 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5464 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5465 0x1C, 0x1D, 0x1E, 0x1F)); 5466 } 5467 #endif 5468 5469 /* vec_vmrglb */ 5470 5471 #define __builtin_altivec_vmrglb vec_vmrglb 5472 5473 static __inline__ vector signed char __ATTRS_o_ai 5474 vec_vmrglb(vector signed char __a, vector signed char __b) { 5475 return vec_perm(__a, __b, 5476 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5477 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5478 0x0E, 0x1E, 0x0F, 0x1F)); 5479 } 5480 5481 static __inline__ vector unsigned char __ATTRS_o_ai 5482 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 5483 return vec_perm(__a, __b, 5484 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5485 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5486 0x0E, 0x1E, 0x0F, 0x1F)); 5487 } 5488 5489 static __inline__ vector bool char __ATTRS_o_ai 5490 vec_vmrglb(vector bool char __a, vector bool char __b) { 5491 return vec_perm(__a, __b, 5492 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5493 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5494 0x0E, 0x1E, 0x0F, 0x1F)); 5495 } 5496 5497 /* vec_vmrglh */ 5498 5499 #define __builtin_altivec_vmrglh vec_vmrglh 5500 5501 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 5502 vector short __b) { 5503 return vec_perm(__a, __b, 5504 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5505 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5506 0x0E, 0x0F, 0x1E, 0x1F)); 5507 } 5508 5509 static __inline__ vector unsigned short __ATTRS_o_ai 5510 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5511 return vec_perm(__a, __b, 5512 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5513 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5514 0x0E, 0x0F, 0x1E, 0x1F)); 5515 } 5516 5517 static __inline__ vector bool short __ATTRS_o_ai 5518 vec_vmrglh(vector bool short __a, vector bool short __b) { 5519 return vec_perm(__a, __b, 5520 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5521 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5522 0x0E, 0x0F, 0x1E, 0x1F)); 5523 } 5524 5525 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5526 vector pixel __b) { 5527 return vec_perm(__a, __b, 5528 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5529 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5530 0x0E, 0x0F, 0x1E, 0x1F)); 5531 } 5532 5533 /* vec_vmrglw */ 5534 5535 #define __builtin_altivec_vmrglw vec_vmrglw 5536 5537 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5538 vector int __b) { 5539 return vec_perm(__a, __b, 5540 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5541 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5542 0x1C, 0x1D, 0x1E, 0x1F)); 5543 } 5544 5545 static __inline__ vector unsigned int __ATTRS_o_ai 5546 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5547 return vec_perm(__a, __b, 5548 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5549 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5550 0x1C, 0x1D, 0x1E, 0x1F)); 5551 } 5552 5553 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5554 vector bool int __b) { 5555 return vec_perm(__a, __b, 5556 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5557 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5558 0x1C, 0x1D, 0x1E, 0x1F)); 5559 } 5560 5561 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5562 vector float __b) { 5563 return vec_perm(__a, __b, 5564 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5565 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5566 0x1C, 0x1D, 0x1E, 0x1F)); 5567 } 5568 5569 #ifdef __POWER8_VECTOR__ 5570 /* vec_mergee */ 5571 5572 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5573 vector bool int __b) { 5574 return vec_perm(__a, __b, 5575 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5576 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5577 0x18, 0x19, 0x1A, 0x1B)); 5578 } 5579 5580 static __inline__ vector signed int __ATTRS_o_ai 5581 vec_mergee(vector signed int __a, vector signed int __b) { 5582 return vec_perm(__a, __b, 5583 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5584 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5585 0x18, 0x19, 0x1A, 0x1B)); 5586 } 5587 5588 static __inline__ vector unsigned int __ATTRS_o_ai 5589 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5590 return vec_perm(__a, __b, 5591 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5592 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5593 0x18, 0x19, 0x1A, 0x1B)); 5594 } 5595 5596 static __inline__ vector bool long long __ATTRS_o_ai 5597 vec_mergee(vector bool long long __a, vector bool long long __b) { 5598 return vec_mergeh(__a, __b); 5599 } 5600 5601 static __inline__ vector signed long long __ATTRS_o_ai 5602 vec_mergee(vector signed long long __a, vector signed long long __b) { 5603 return vec_mergeh(__a, __b); 5604 } 5605 5606 static __inline__ vector unsigned long long __ATTRS_o_ai 5607 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5608 return vec_mergeh(__a, __b); 5609 } 5610 5611 static __inline__ vector float __ATTRS_o_ai 5612 vec_mergee(vector float __a, vector float __b) { 5613 return vec_perm(__a, __b, 5614 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5615 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5616 0x18, 0x19, 0x1A, 0x1B)); 5617 } 5618 5619 static __inline__ vector double __ATTRS_o_ai 5620 vec_mergee(vector double __a, vector double __b) { 5621 return vec_mergeh(__a, __b); 5622 } 5623 5624 /* vec_mergeo */ 5625 5626 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5627 vector bool int __b) { 5628 return vec_perm(__a, __b, 5629 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5630 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5631 0x1C, 0x1D, 0x1E, 0x1F)); 5632 } 5633 5634 static __inline__ vector signed int __ATTRS_o_ai 5635 vec_mergeo(vector signed int __a, vector signed int __b) { 5636 return vec_perm(__a, __b, 5637 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5638 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5639 0x1C, 0x1D, 0x1E, 0x1F)); 5640 } 5641 5642 static __inline__ vector unsigned int __ATTRS_o_ai 5643 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5644 return vec_perm(__a, __b, 5645 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5646 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5647 0x1C, 0x1D, 0x1E, 0x1F)); 5648 } 5649 5650 static __inline__ vector bool long long __ATTRS_o_ai 5651 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5652 return vec_mergel(__a, __b); 5653 } 5654 5655 static __inline__ vector signed long long __ATTRS_o_ai 5656 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5657 return vec_mergel(__a, __b); 5658 } 5659 5660 static __inline__ vector unsigned long long __ATTRS_o_ai 5661 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5662 return vec_mergel(__a, __b); 5663 } 5664 5665 static __inline__ vector float __ATTRS_o_ai 5666 vec_mergeo(vector float __a, vector float __b) { 5667 return vec_perm(__a, __b, 5668 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5669 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5670 0x1C, 0x1D, 0x1E, 0x1F)); 5671 } 5672 5673 static __inline__ vector double __ATTRS_o_ai 5674 vec_mergeo(vector double __a, vector double __b) { 5675 return vec_mergel(__a, __b); 5676 } 5677 5678 #endif 5679 5680 /* vec_mfvscr */ 5681 5682 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5683 vec_mfvscr(void) { 5684 return __builtin_altivec_mfvscr(); 5685 } 5686 5687 /* vec_min */ 5688 5689 static __inline__ vector signed char __ATTRS_o_ai 5690 vec_min(vector signed char __a, vector signed char __b) { 5691 return __builtin_altivec_vminsb(__a, __b); 5692 } 5693 5694 static __inline__ vector signed char __ATTRS_o_ai 5695 vec_min(vector bool char __a, vector signed char __b) { 5696 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5697 } 5698 5699 static __inline__ vector signed char __ATTRS_o_ai 5700 vec_min(vector signed char __a, vector bool char __b) { 5701 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5702 } 5703 5704 static __inline__ vector unsigned char __ATTRS_o_ai 5705 vec_min(vector unsigned char __a, vector unsigned char __b) { 5706 return __builtin_altivec_vminub(__a, __b); 5707 } 5708 5709 static __inline__ vector unsigned char __ATTRS_o_ai 5710 vec_min(vector bool char __a, vector unsigned char __b) { 5711 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5712 } 5713 5714 static __inline__ vector unsigned char __ATTRS_o_ai 5715 vec_min(vector unsigned char __a, vector bool char __b) { 5716 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5717 } 5718 5719 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5720 vector short __b) { 5721 return __builtin_altivec_vminsh(__a, __b); 5722 } 5723 5724 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5725 vector short __b) { 5726 return __builtin_altivec_vminsh((vector short)__a, __b); 5727 } 5728 5729 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5730 vector bool short __b) { 5731 return __builtin_altivec_vminsh(__a, (vector short)__b); 5732 } 5733 5734 static __inline__ vector unsigned short __ATTRS_o_ai 5735 vec_min(vector unsigned short __a, vector unsigned short __b) { 5736 return __builtin_altivec_vminuh(__a, __b); 5737 } 5738 5739 static __inline__ vector unsigned short __ATTRS_o_ai 5740 vec_min(vector bool short __a, vector unsigned short __b) { 5741 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5742 } 5743 5744 static __inline__ vector unsigned short __ATTRS_o_ai 5745 vec_min(vector unsigned short __a, vector bool short __b) { 5746 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5747 } 5748 5749 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5750 vector int __b) { 5751 return __builtin_altivec_vminsw(__a, __b); 5752 } 5753 5754 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5755 vector int __b) { 5756 return __builtin_altivec_vminsw((vector int)__a, __b); 5757 } 5758 5759 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5760 vector bool int __b) { 5761 return __builtin_altivec_vminsw(__a, (vector int)__b); 5762 } 5763 5764 static __inline__ vector unsigned int __ATTRS_o_ai 5765 vec_min(vector unsigned int __a, vector unsigned int __b) { 5766 return __builtin_altivec_vminuw(__a, __b); 5767 } 5768 5769 static __inline__ vector unsigned int __ATTRS_o_ai 5770 vec_min(vector bool int __a, vector unsigned int __b) { 5771 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5772 } 5773 5774 static __inline__ vector unsigned int __ATTRS_o_ai 5775 vec_min(vector unsigned int __a, vector bool int __b) { 5776 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5777 } 5778 5779 #ifdef __POWER8_VECTOR__ 5780 static __inline__ vector signed long long __ATTRS_o_ai 5781 vec_min(vector signed long long __a, vector signed long long __b) { 5782 return __builtin_altivec_vminsd(__a, __b); 5783 } 5784 5785 static __inline__ vector signed long long __ATTRS_o_ai 5786 vec_min(vector bool long long __a, vector signed long long __b) { 5787 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5788 } 5789 5790 static __inline__ vector signed long long __ATTRS_o_ai 5791 vec_min(vector signed long long __a, vector bool long long __b) { 5792 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5793 } 5794 5795 static __inline__ vector unsigned long long __ATTRS_o_ai 5796 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5797 return __builtin_altivec_vminud(__a, __b); 5798 } 5799 5800 static __inline__ vector unsigned long long __ATTRS_o_ai 5801 vec_min(vector bool long long __a, vector unsigned long long __b) { 5802 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5803 } 5804 5805 static __inline__ vector unsigned long long __ATTRS_o_ai 5806 vec_min(vector unsigned long long __a, vector bool long long __b) { 5807 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5808 } 5809 #endif 5810 5811 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5812 vector float __b) { 5813 #ifdef __VSX__ 5814 return __builtin_vsx_xvminsp(__a, __b); 5815 #else 5816 return __builtin_altivec_vminfp(__a, __b); 5817 #endif 5818 } 5819 5820 #ifdef __VSX__ 5821 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5822 vector double __b) { 5823 return __builtin_vsx_xvmindp(__a, __b); 5824 } 5825 #endif 5826 5827 /* vec_vminsb */ 5828 5829 static __inline__ vector signed char __ATTRS_o_ai 5830 vec_vminsb(vector signed char __a, vector signed char __b) { 5831 return __builtin_altivec_vminsb(__a, __b); 5832 } 5833 5834 static __inline__ vector signed char __ATTRS_o_ai 5835 vec_vminsb(vector bool char __a, vector signed char __b) { 5836 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5837 } 5838 5839 static __inline__ vector signed char __ATTRS_o_ai 5840 vec_vminsb(vector signed char __a, vector bool char __b) { 5841 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5842 } 5843 5844 /* vec_vminub */ 5845 5846 static __inline__ vector unsigned char __ATTRS_o_ai 5847 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5848 return __builtin_altivec_vminub(__a, __b); 5849 } 5850 5851 static __inline__ vector unsigned char __ATTRS_o_ai 5852 vec_vminub(vector bool char __a, vector unsigned char __b) { 5853 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5854 } 5855 5856 static __inline__ vector unsigned char __ATTRS_o_ai 5857 vec_vminub(vector unsigned char __a, vector bool char __b) { 5858 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5859 } 5860 5861 /* vec_vminsh */ 5862 5863 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5864 vector short __b) { 5865 return __builtin_altivec_vminsh(__a, __b); 5866 } 5867 5868 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5869 vector short __b) { 5870 return __builtin_altivec_vminsh((vector short)__a, __b); 5871 } 5872 5873 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5874 vector bool short __b) { 5875 return __builtin_altivec_vminsh(__a, (vector short)__b); 5876 } 5877 5878 /* vec_vminuh */ 5879 5880 static __inline__ vector unsigned short __ATTRS_o_ai 5881 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5882 return __builtin_altivec_vminuh(__a, __b); 5883 } 5884 5885 static __inline__ vector unsigned short __ATTRS_o_ai 5886 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5887 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5888 } 5889 5890 static __inline__ vector unsigned short __ATTRS_o_ai 5891 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5892 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5893 } 5894 5895 /* vec_vminsw */ 5896 5897 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5898 vector int __b) { 5899 return __builtin_altivec_vminsw(__a, __b); 5900 } 5901 5902 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5903 vector int __b) { 5904 return __builtin_altivec_vminsw((vector int)__a, __b); 5905 } 5906 5907 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5908 vector bool int __b) { 5909 return __builtin_altivec_vminsw(__a, (vector int)__b); 5910 } 5911 5912 /* vec_vminuw */ 5913 5914 static __inline__ vector unsigned int __ATTRS_o_ai 5915 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5916 return __builtin_altivec_vminuw(__a, __b); 5917 } 5918 5919 static __inline__ vector unsigned int __ATTRS_o_ai 5920 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5921 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5922 } 5923 5924 static __inline__ vector unsigned int __ATTRS_o_ai 5925 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5926 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5927 } 5928 5929 /* vec_vminfp */ 5930 5931 static __inline__ vector float __attribute__((__always_inline__)) 5932 vec_vminfp(vector float __a, vector float __b) { 5933 #ifdef __VSX__ 5934 return __builtin_vsx_xvminsp(__a, __b); 5935 #else 5936 return __builtin_altivec_vminfp(__a, __b); 5937 #endif 5938 } 5939 5940 /* vec_mladd */ 5941 5942 #define __builtin_altivec_vmladduhm vec_mladd 5943 5944 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5945 vector short __b, 5946 vector short __c) { 5947 return __a * __b + __c; 5948 } 5949 5950 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5951 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5952 return __a * (vector short)__b + (vector short)__c; 5953 } 5954 5955 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5956 vector short __b, 5957 vector short __c) { 5958 return (vector short)__a * __b + __c; 5959 } 5960 5961 static __inline__ vector unsigned short __ATTRS_o_ai 5962 vec_mladd(vector unsigned short __a, vector unsigned short __b, 5963 vector unsigned short __c) { 5964 return __a * __b + __c; 5965 } 5966 5967 /* vec_vmladduhm */ 5968 5969 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 5970 vector short __b, 5971 vector short __c) { 5972 return __a * __b + __c; 5973 } 5974 5975 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 5976 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5977 return __a * (vector short)__b + (vector short)__c; 5978 } 5979 5980 static __inline__ vector short __ATTRS_o_ai 5981 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 5982 return (vector short)__a * __b + __c; 5983 } 5984 5985 static __inline__ vector unsigned short __ATTRS_o_ai 5986 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 5987 vector unsigned short __c) { 5988 return __a * __b + __c; 5989 } 5990 5991 /* vec_mradds */ 5992 5993 static __inline__ vector short __attribute__((__always_inline__)) 5994 vec_mradds(vector short __a, vector short __b, vector short __c) { 5995 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5996 } 5997 5998 /* vec_vmhraddshs */ 5999 6000 static __inline__ vector short __attribute__((__always_inline__)) 6001 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 6002 return __builtin_altivec_vmhraddshs(__a, __b, __c); 6003 } 6004 6005 /* vec_msum */ 6006 6007 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 6008 vector unsigned char __b, 6009 vector int __c) { 6010 return __builtin_altivec_vmsummbm(__a, __b, __c); 6011 } 6012 6013 static __inline__ vector unsigned int __ATTRS_o_ai 6014 vec_msum(vector unsigned char __a, vector unsigned char __b, 6015 vector unsigned int __c) { 6016 return __builtin_altivec_vmsumubm(__a, __b, __c); 6017 } 6018 6019 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 6020 vector short __b, 6021 vector int __c) { 6022 return __builtin_altivec_vmsumshm(__a, __b, __c); 6023 } 6024 6025 static __inline__ vector unsigned int __ATTRS_o_ai 6026 vec_msum(vector unsigned short __a, vector unsigned short __b, 6027 vector unsigned int __c) { 6028 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6029 } 6030 6031 /* vec_msumc */ 6032 6033 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6034 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6035 vec_msumc(vector unsigned long long __a, vector unsigned long long __b, 6036 vector unsigned __int128 __c) { 6037 return __builtin_altivec_vmsumcud(__a, __b, __c); 6038 } 6039 #endif 6040 6041 /* vec_vmsummbm */ 6042 6043 static __inline__ vector int __attribute__((__always_inline__)) 6044 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 6045 return __builtin_altivec_vmsummbm(__a, __b, __c); 6046 } 6047 6048 /* vec_vmsumubm */ 6049 6050 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6051 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 6052 vector unsigned int __c) { 6053 return __builtin_altivec_vmsumubm(__a, __b, __c); 6054 } 6055 6056 /* vec_vmsumshm */ 6057 6058 static __inline__ vector int __attribute__((__always_inline__)) 6059 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 6060 return __builtin_altivec_vmsumshm(__a, __b, __c); 6061 } 6062 6063 /* vec_vmsumuhm */ 6064 6065 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6066 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 6067 vector unsigned int __c) { 6068 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6069 } 6070 6071 /* vec_msums */ 6072 6073 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 6074 vector short __b, 6075 vector int __c) { 6076 return __builtin_altivec_vmsumshs(__a, __b, __c); 6077 } 6078 6079 static __inline__ vector unsigned int __ATTRS_o_ai 6080 vec_msums(vector unsigned short __a, vector unsigned short __b, 6081 vector unsigned int __c) { 6082 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6083 } 6084 6085 /* vec_vmsumshs */ 6086 6087 static __inline__ vector int __attribute__((__always_inline__)) 6088 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 6089 return __builtin_altivec_vmsumshs(__a, __b, __c); 6090 } 6091 6092 /* vec_vmsumuhs */ 6093 6094 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6095 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 6096 vector unsigned int __c) { 6097 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6098 } 6099 6100 /* vec_mtvscr */ 6101 6102 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 6103 __builtin_altivec_mtvscr((vector int)__a); 6104 } 6105 6106 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 6107 __builtin_altivec_mtvscr((vector int)__a); 6108 } 6109 6110 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 6111 __builtin_altivec_mtvscr((vector int)__a); 6112 } 6113 6114 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 6115 __builtin_altivec_mtvscr((vector int)__a); 6116 } 6117 6118 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 6119 __builtin_altivec_mtvscr((vector int)__a); 6120 } 6121 6122 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 6123 __builtin_altivec_mtvscr((vector int)__a); 6124 } 6125 6126 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 6127 __builtin_altivec_mtvscr((vector int)__a); 6128 } 6129 6130 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 6131 __builtin_altivec_mtvscr((vector int)__a); 6132 } 6133 6134 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 6135 __builtin_altivec_mtvscr((vector int)__a); 6136 } 6137 6138 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 6139 __builtin_altivec_mtvscr((vector int)__a); 6140 } 6141 6142 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 6143 __builtin_altivec_mtvscr((vector int)__a); 6144 } 6145 6146 /* vec_mul */ 6147 6148 /* Integer vector multiplication will involve multiplication of the odd/even 6149 elements separately, then truncating the results and moving to the 6150 result vector. 6151 */ 6152 static __inline__ vector signed char __ATTRS_o_ai 6153 vec_mul(vector signed char __a, vector signed char __b) { 6154 return __a * __b; 6155 } 6156 6157 static __inline__ vector unsigned char __ATTRS_o_ai 6158 vec_mul(vector unsigned char __a, vector unsigned char __b) { 6159 return __a * __b; 6160 } 6161 6162 static __inline__ vector signed short __ATTRS_o_ai 6163 vec_mul(vector signed short __a, vector signed short __b) { 6164 return __a * __b; 6165 } 6166 6167 static __inline__ vector unsigned short __ATTRS_o_ai 6168 vec_mul(vector unsigned short __a, vector unsigned short __b) { 6169 return __a * __b; 6170 } 6171 6172 static __inline__ vector signed int __ATTRS_o_ai 6173 vec_mul(vector signed int __a, vector signed int __b) { 6174 return __a * __b; 6175 } 6176 6177 static __inline__ vector unsigned int __ATTRS_o_ai 6178 vec_mul(vector unsigned int __a, vector unsigned int __b) { 6179 return __a * __b; 6180 } 6181 6182 #ifdef __VSX__ 6183 static __inline__ vector signed long long __ATTRS_o_ai 6184 vec_mul(vector signed long long __a, vector signed long long __b) { 6185 return __a * __b; 6186 } 6187 6188 static __inline__ vector unsigned long long __ATTRS_o_ai 6189 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 6190 return __a * __b; 6191 } 6192 #endif 6193 6194 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 6195 vector float __b) { 6196 return __a * __b; 6197 } 6198 6199 #ifdef __VSX__ 6200 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 6201 vector double __b) { 6202 return __a * __b; 6203 } 6204 #endif 6205 6206 /* The vmulos* and vmules* instructions have a big endian bias, so 6207 we must reverse the meaning of "even" and "odd" for little endian. */ 6208 6209 /* vec_mule */ 6210 6211 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 6212 vector signed char __b) { 6213 #ifdef __LITTLE_ENDIAN__ 6214 return __builtin_altivec_vmulosb(__a, __b); 6215 #else 6216 return __builtin_altivec_vmulesb(__a, __b); 6217 #endif 6218 } 6219 6220 static __inline__ vector unsigned short __ATTRS_o_ai 6221 vec_mule(vector unsigned char __a, vector unsigned char __b) { 6222 #ifdef __LITTLE_ENDIAN__ 6223 return __builtin_altivec_vmuloub(__a, __b); 6224 #else 6225 return __builtin_altivec_vmuleub(__a, __b); 6226 #endif 6227 } 6228 6229 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 6230 vector short __b) { 6231 #ifdef __LITTLE_ENDIAN__ 6232 return __builtin_altivec_vmulosh(__a, __b); 6233 #else 6234 return __builtin_altivec_vmulesh(__a, __b); 6235 #endif 6236 } 6237 6238 static __inline__ vector unsigned int __ATTRS_o_ai 6239 vec_mule(vector unsigned short __a, vector unsigned short __b) { 6240 #ifdef __LITTLE_ENDIAN__ 6241 return __builtin_altivec_vmulouh(__a, __b); 6242 #else 6243 return __builtin_altivec_vmuleuh(__a, __b); 6244 #endif 6245 } 6246 6247 #ifdef __POWER8_VECTOR__ 6248 static __inline__ vector signed long long __ATTRS_o_ai 6249 vec_mule(vector signed int __a, vector signed int __b) { 6250 #ifdef __LITTLE_ENDIAN__ 6251 return __builtin_altivec_vmulosw(__a, __b); 6252 #else 6253 return __builtin_altivec_vmulesw(__a, __b); 6254 #endif 6255 } 6256 6257 static __inline__ vector unsigned long long __ATTRS_o_ai 6258 vec_mule(vector unsigned int __a, vector unsigned int __b) { 6259 #ifdef __LITTLE_ENDIAN__ 6260 return __builtin_altivec_vmulouw(__a, __b); 6261 #else 6262 return __builtin_altivec_vmuleuw(__a, __b); 6263 #endif 6264 } 6265 #endif 6266 6267 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6268 static __inline__ vector signed __int128 __ATTRS_o_ai 6269 vec_mule(vector signed long long __a, vector signed long long __b) { 6270 #ifdef __LITTLE_ENDIAN__ 6271 return __builtin_altivec_vmulosd(__a, __b); 6272 #else 6273 return __builtin_altivec_vmulesd(__a, __b); 6274 #endif 6275 } 6276 6277 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6278 vec_mule(vector unsigned long long __a, vector unsigned long long __b) { 6279 #ifdef __LITTLE_ENDIAN__ 6280 return __builtin_altivec_vmuloud(__a, __b); 6281 #else 6282 return __builtin_altivec_vmuleud(__a, __b); 6283 #endif 6284 } 6285 #endif 6286 6287 /* vec_vmulesb */ 6288 6289 static __inline__ vector short __attribute__((__always_inline__)) 6290 vec_vmulesb(vector signed char __a, vector signed char __b) { 6291 #ifdef __LITTLE_ENDIAN__ 6292 return __builtin_altivec_vmulosb(__a, __b); 6293 #else 6294 return __builtin_altivec_vmulesb(__a, __b); 6295 #endif 6296 } 6297 6298 /* vec_vmuleub */ 6299 6300 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6301 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 6302 #ifdef __LITTLE_ENDIAN__ 6303 return __builtin_altivec_vmuloub(__a, __b); 6304 #else 6305 return __builtin_altivec_vmuleub(__a, __b); 6306 #endif 6307 } 6308 6309 /* vec_vmulesh */ 6310 6311 static __inline__ vector int __attribute__((__always_inline__)) 6312 vec_vmulesh(vector short __a, vector short __b) { 6313 #ifdef __LITTLE_ENDIAN__ 6314 return __builtin_altivec_vmulosh(__a, __b); 6315 #else 6316 return __builtin_altivec_vmulesh(__a, __b); 6317 #endif 6318 } 6319 6320 /* vec_vmuleuh */ 6321 6322 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6323 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 6324 #ifdef __LITTLE_ENDIAN__ 6325 return __builtin_altivec_vmulouh(__a, __b); 6326 #else 6327 return __builtin_altivec_vmuleuh(__a, __b); 6328 #endif 6329 } 6330 6331 /* vec_mulh */ 6332 6333 #ifdef __POWER10_VECTOR__ 6334 static __inline__ vector signed int __ATTRS_o_ai 6335 vec_mulh(vector signed int __a, vector signed int __b) { 6336 return __builtin_altivec_vmulhsw(__a, __b); 6337 } 6338 6339 static __inline__ vector unsigned int __ATTRS_o_ai 6340 vec_mulh(vector unsigned int __a, vector unsigned int __b) { 6341 return __builtin_altivec_vmulhuw(__a, __b); 6342 } 6343 6344 static __inline__ vector signed long long __ATTRS_o_ai 6345 vec_mulh(vector signed long long __a, vector signed long long __b) { 6346 return __builtin_altivec_vmulhsd(__a, __b); 6347 } 6348 6349 static __inline__ vector unsigned long long __ATTRS_o_ai 6350 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { 6351 return __builtin_altivec_vmulhud(__a, __b); 6352 } 6353 #endif 6354 6355 /* vec_mulo */ 6356 6357 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 6358 vector signed char __b) { 6359 #ifdef __LITTLE_ENDIAN__ 6360 return __builtin_altivec_vmulesb(__a, __b); 6361 #else 6362 return __builtin_altivec_vmulosb(__a, __b); 6363 #endif 6364 } 6365 6366 static __inline__ vector unsigned short __ATTRS_o_ai 6367 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 6368 #ifdef __LITTLE_ENDIAN__ 6369 return __builtin_altivec_vmuleub(__a, __b); 6370 #else 6371 return __builtin_altivec_vmuloub(__a, __b); 6372 #endif 6373 } 6374 6375 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 6376 vector short __b) { 6377 #ifdef __LITTLE_ENDIAN__ 6378 return __builtin_altivec_vmulesh(__a, __b); 6379 #else 6380 return __builtin_altivec_vmulosh(__a, __b); 6381 #endif 6382 } 6383 6384 static __inline__ vector unsigned int __ATTRS_o_ai 6385 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 6386 #ifdef __LITTLE_ENDIAN__ 6387 return __builtin_altivec_vmuleuh(__a, __b); 6388 #else 6389 return __builtin_altivec_vmulouh(__a, __b); 6390 #endif 6391 } 6392 6393 #ifdef __POWER8_VECTOR__ 6394 static __inline__ vector signed long long __ATTRS_o_ai 6395 vec_mulo(vector signed int __a, vector signed int __b) { 6396 #ifdef __LITTLE_ENDIAN__ 6397 return __builtin_altivec_vmulesw(__a, __b); 6398 #else 6399 return __builtin_altivec_vmulosw(__a, __b); 6400 #endif 6401 } 6402 6403 static __inline__ vector unsigned long long __ATTRS_o_ai 6404 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 6405 #ifdef __LITTLE_ENDIAN__ 6406 return __builtin_altivec_vmuleuw(__a, __b); 6407 #else 6408 return __builtin_altivec_vmulouw(__a, __b); 6409 #endif 6410 } 6411 #endif 6412 6413 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6414 static __inline__ vector signed __int128 __ATTRS_o_ai 6415 vec_mulo(vector signed long long __a, vector signed long long __b) { 6416 #ifdef __LITTLE_ENDIAN__ 6417 return __builtin_altivec_vmulesd(__a, __b); 6418 #else 6419 return __builtin_altivec_vmulosd(__a, __b); 6420 #endif 6421 } 6422 6423 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6424 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { 6425 #ifdef __LITTLE_ENDIAN__ 6426 return __builtin_altivec_vmuleud(__a, __b); 6427 #else 6428 return __builtin_altivec_vmuloud(__a, __b); 6429 #endif 6430 } 6431 #endif 6432 6433 /* vec_vmulosb */ 6434 6435 static __inline__ vector short __attribute__((__always_inline__)) 6436 vec_vmulosb(vector signed char __a, vector signed char __b) { 6437 #ifdef __LITTLE_ENDIAN__ 6438 return __builtin_altivec_vmulesb(__a, __b); 6439 #else 6440 return __builtin_altivec_vmulosb(__a, __b); 6441 #endif 6442 } 6443 6444 /* vec_vmuloub */ 6445 6446 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6447 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 6448 #ifdef __LITTLE_ENDIAN__ 6449 return __builtin_altivec_vmuleub(__a, __b); 6450 #else 6451 return __builtin_altivec_vmuloub(__a, __b); 6452 #endif 6453 } 6454 6455 /* vec_vmulosh */ 6456 6457 static __inline__ vector int __attribute__((__always_inline__)) 6458 vec_vmulosh(vector short __a, vector short __b) { 6459 #ifdef __LITTLE_ENDIAN__ 6460 return __builtin_altivec_vmulesh(__a, __b); 6461 #else 6462 return __builtin_altivec_vmulosh(__a, __b); 6463 #endif 6464 } 6465 6466 /* vec_vmulouh */ 6467 6468 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6469 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 6470 #ifdef __LITTLE_ENDIAN__ 6471 return __builtin_altivec_vmuleuh(__a, __b); 6472 #else 6473 return __builtin_altivec_vmulouh(__a, __b); 6474 #endif 6475 } 6476 6477 /* vec_nand */ 6478 6479 #ifdef __POWER8_VECTOR__ 6480 static __inline__ vector signed char __ATTRS_o_ai 6481 vec_nand(vector signed char __a, vector signed char __b) { 6482 return ~(__a & __b); 6483 } 6484 6485 static __inline__ vector signed char __ATTRS_o_ai 6486 vec_nand(vector signed char __a, vector bool char __b) { 6487 return ~(__a & __b); 6488 } 6489 6490 static __inline__ vector signed char __ATTRS_o_ai 6491 vec_nand(vector bool char __a, vector signed char __b) { 6492 return ~(__a & __b); 6493 } 6494 6495 static __inline__ vector unsigned char __ATTRS_o_ai 6496 vec_nand(vector unsigned char __a, vector unsigned char __b) { 6497 return ~(__a & __b); 6498 } 6499 6500 static __inline__ vector unsigned char __ATTRS_o_ai 6501 vec_nand(vector unsigned char __a, vector bool char __b) { 6502 return ~(__a & __b); 6503 } 6504 6505 static __inline__ vector unsigned char __ATTRS_o_ai 6506 vec_nand(vector bool char __a, vector unsigned char __b) { 6507 return ~(__a & __b); 6508 } 6509 6510 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 6511 vector bool char __b) { 6512 return ~(__a & __b); 6513 } 6514 6515 static __inline__ vector signed short __ATTRS_o_ai 6516 vec_nand(vector signed short __a, vector signed short __b) { 6517 return ~(__a & __b); 6518 } 6519 6520 static __inline__ vector signed short __ATTRS_o_ai 6521 vec_nand(vector signed short __a, vector bool short __b) { 6522 return ~(__a & __b); 6523 } 6524 6525 static __inline__ vector signed short __ATTRS_o_ai 6526 vec_nand(vector bool short __a, vector signed short __b) { 6527 return ~(__a & __b); 6528 } 6529 6530 static __inline__ vector unsigned short __ATTRS_o_ai 6531 vec_nand(vector unsigned short __a, vector unsigned short __b) { 6532 return ~(__a & __b); 6533 } 6534 6535 static __inline__ vector unsigned short __ATTRS_o_ai 6536 vec_nand(vector unsigned short __a, vector bool short __b) { 6537 return ~(__a & __b); 6538 } 6539 6540 static __inline__ vector bool short __ATTRS_o_ai 6541 vec_nand(vector bool short __a, vector bool short __b) { 6542 return ~(__a & __b); 6543 } 6544 6545 static __inline__ vector signed int __ATTRS_o_ai 6546 vec_nand(vector signed int __a, vector signed int __b) { 6547 return ~(__a & __b); 6548 } 6549 6550 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 6551 vector bool int __b) { 6552 return ~(__a & __b); 6553 } 6554 6555 static __inline__ vector signed int __ATTRS_o_ai 6556 vec_nand(vector bool int __a, vector signed int __b) { 6557 return ~(__a & __b); 6558 } 6559 6560 static __inline__ vector unsigned int __ATTRS_o_ai 6561 vec_nand(vector unsigned int __a, vector unsigned int __b) { 6562 return ~(__a & __b); 6563 } 6564 6565 static __inline__ vector unsigned int __ATTRS_o_ai 6566 vec_nand(vector unsigned int __a, vector bool int __b) { 6567 return ~(__a & __b); 6568 } 6569 6570 static __inline__ vector unsigned int __ATTRS_o_ai 6571 vec_nand(vector bool int __a, vector unsigned int __b) { 6572 return ~(__a & __b); 6573 } 6574 6575 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 6576 vector bool int __b) { 6577 return ~(__a & __b); 6578 } 6579 6580 static __inline__ vector float __ATTRS_o_ai 6581 vec_nand(vector float __a, vector float __b) { 6582 return (vector float)(~((vector unsigned int)__a & 6583 (vector unsigned int)__b)); 6584 } 6585 6586 static __inline__ vector signed long long __ATTRS_o_ai 6587 vec_nand(vector signed long long __a, vector signed long long __b) { 6588 return ~(__a & __b); 6589 } 6590 6591 static __inline__ vector signed long long __ATTRS_o_ai 6592 vec_nand(vector signed long long __a, vector bool long long __b) { 6593 return ~(__a & __b); 6594 } 6595 6596 static __inline__ vector signed long long __ATTRS_o_ai 6597 vec_nand(vector bool long long __a, vector signed long long __b) { 6598 return ~(__a & __b); 6599 } 6600 6601 static __inline__ vector unsigned long long __ATTRS_o_ai 6602 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6603 return ~(__a & __b); 6604 } 6605 6606 static __inline__ vector unsigned long long __ATTRS_o_ai 6607 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6608 return ~(__a & __b); 6609 } 6610 6611 static __inline__ vector unsigned long long __ATTRS_o_ai 6612 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6613 return ~(__a & __b); 6614 } 6615 6616 static __inline__ vector bool long long __ATTRS_o_ai 6617 vec_nand(vector bool long long __a, vector bool long long __b) { 6618 return ~(__a & __b); 6619 } 6620 6621 static __inline__ vector double __ATTRS_o_ai 6622 vec_nand(vector double __a, vector double __b) { 6623 return (vector double)(~((vector unsigned long long)__a & 6624 (vector unsigned long long)__b)); 6625 } 6626 6627 #endif 6628 6629 /* vec_nmadd */ 6630 6631 #ifdef __VSX__ 6632 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6633 vector float __b, 6634 vector float __c) { 6635 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6636 } 6637 6638 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6639 vector double __b, 6640 vector double __c) { 6641 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6642 } 6643 #endif 6644 6645 /* vec_nmsub */ 6646 6647 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6648 vector float __b, 6649 vector float __c) { 6650 #ifdef __VSX__ 6651 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6652 #else 6653 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6654 #endif 6655 } 6656 6657 #ifdef __VSX__ 6658 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6659 vector double __b, 6660 vector double __c) { 6661 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6662 } 6663 #endif 6664 6665 /* vec_vnmsubfp */ 6666 6667 static __inline__ vector float __attribute__((__always_inline__)) 6668 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6669 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6670 } 6671 6672 /* vec_nor */ 6673 6674 #define __builtin_altivec_vnor vec_nor 6675 6676 static __inline__ vector signed char __ATTRS_o_ai 6677 vec_nor(vector signed char __a, vector signed char __b) { 6678 return ~(__a | __b); 6679 } 6680 6681 static __inline__ vector unsigned char __ATTRS_o_ai 6682 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6683 return ~(__a | __b); 6684 } 6685 6686 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6687 vector bool char __b) { 6688 return ~(__a | __b); 6689 } 6690 6691 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6692 vector short __b) { 6693 return ~(__a | __b); 6694 } 6695 6696 static __inline__ vector unsigned short __ATTRS_o_ai 6697 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6698 return ~(__a | __b); 6699 } 6700 6701 static __inline__ vector bool short __ATTRS_o_ai 6702 vec_nor(vector bool short __a, vector bool short __b) { 6703 return ~(__a | __b); 6704 } 6705 6706 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6707 vector int __b) { 6708 return ~(__a | __b); 6709 } 6710 6711 static __inline__ vector unsigned int __ATTRS_o_ai 6712 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6713 return ~(__a | __b); 6714 } 6715 6716 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6717 vector bool int __b) { 6718 return ~(__a | __b); 6719 } 6720 6721 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6722 vector float __b) { 6723 vector unsigned int __res = 6724 ~((vector unsigned int)__a | (vector unsigned int)__b); 6725 return (vector float)__res; 6726 } 6727 6728 #ifdef __VSX__ 6729 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6730 vector double __b) { 6731 vector unsigned long long __res = 6732 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6733 return (vector double)__res; 6734 } 6735 #endif 6736 6737 /* vec_vnor */ 6738 6739 static __inline__ vector signed char __ATTRS_o_ai 6740 vec_vnor(vector signed char __a, vector signed char __b) { 6741 return ~(__a | __b); 6742 } 6743 6744 static __inline__ vector unsigned char __ATTRS_o_ai 6745 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6746 return ~(__a | __b); 6747 } 6748 6749 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6750 vector bool char __b) { 6751 return ~(__a | __b); 6752 } 6753 6754 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6755 vector short __b) { 6756 return ~(__a | __b); 6757 } 6758 6759 static __inline__ vector unsigned short __ATTRS_o_ai 6760 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6761 return ~(__a | __b); 6762 } 6763 6764 static __inline__ vector bool short __ATTRS_o_ai 6765 vec_vnor(vector bool short __a, vector bool short __b) { 6766 return ~(__a | __b); 6767 } 6768 6769 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6770 vector int __b) { 6771 return ~(__a | __b); 6772 } 6773 6774 static __inline__ vector unsigned int __ATTRS_o_ai 6775 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6776 return ~(__a | __b); 6777 } 6778 6779 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6780 vector bool int __b) { 6781 return ~(__a | __b); 6782 } 6783 6784 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6785 vector float __b) { 6786 vector unsigned int __res = 6787 ~((vector unsigned int)__a | (vector unsigned int)__b); 6788 return (vector float)__res; 6789 } 6790 6791 #ifdef __VSX__ 6792 static __inline__ vector signed long long __ATTRS_o_ai 6793 vec_nor(vector signed long long __a, vector signed long long __b) { 6794 return ~(__a | __b); 6795 } 6796 6797 static __inline__ vector unsigned long long __ATTRS_o_ai 6798 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6799 return ~(__a | __b); 6800 } 6801 6802 static __inline__ vector bool long long __ATTRS_o_ai 6803 vec_nor(vector bool long long __a, vector bool long long __b) { 6804 return ~(__a | __b); 6805 } 6806 #endif 6807 6808 /* vec_or */ 6809 6810 #define __builtin_altivec_vor vec_or 6811 6812 static __inline__ vector signed char __ATTRS_o_ai 6813 vec_or(vector signed char __a, vector signed char __b) { 6814 return __a | __b; 6815 } 6816 6817 static __inline__ vector signed char __ATTRS_o_ai 6818 vec_or(vector bool char __a, vector signed char __b) { 6819 return (vector signed char)__a | __b; 6820 } 6821 6822 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6823 vector bool char __b) { 6824 return __a | (vector signed char)__b; 6825 } 6826 6827 static __inline__ vector unsigned char __ATTRS_o_ai 6828 vec_or(vector unsigned char __a, vector unsigned char __b) { 6829 return __a | __b; 6830 } 6831 6832 static __inline__ vector unsigned char __ATTRS_o_ai 6833 vec_or(vector bool char __a, vector unsigned char __b) { 6834 return (vector unsigned char)__a | __b; 6835 } 6836 6837 static __inline__ vector unsigned char __ATTRS_o_ai 6838 vec_or(vector unsigned char __a, vector bool char __b) { 6839 return __a | (vector unsigned char)__b; 6840 } 6841 6842 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6843 vector bool char __b) { 6844 return __a | __b; 6845 } 6846 6847 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6848 vector short __b) { 6849 return __a | __b; 6850 } 6851 6852 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6853 vector short __b) { 6854 return (vector short)__a | __b; 6855 } 6856 6857 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6858 vector bool short __b) { 6859 return __a | (vector short)__b; 6860 } 6861 6862 static __inline__ vector unsigned short __ATTRS_o_ai 6863 vec_or(vector unsigned short __a, vector unsigned short __b) { 6864 return __a | __b; 6865 } 6866 6867 static __inline__ vector unsigned short __ATTRS_o_ai 6868 vec_or(vector bool short __a, vector unsigned short __b) { 6869 return (vector unsigned short)__a | __b; 6870 } 6871 6872 static __inline__ vector unsigned short __ATTRS_o_ai 6873 vec_or(vector unsigned short __a, vector bool short __b) { 6874 return __a | (vector unsigned short)__b; 6875 } 6876 6877 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6878 vector bool short __b) { 6879 return __a | __b; 6880 } 6881 6882 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6883 vector int __b) { 6884 return __a | __b; 6885 } 6886 6887 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6888 vector int __b) { 6889 return (vector int)__a | __b; 6890 } 6891 6892 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6893 vector bool int __b) { 6894 return __a | (vector int)__b; 6895 } 6896 6897 static __inline__ vector unsigned int __ATTRS_o_ai 6898 vec_or(vector unsigned int __a, vector unsigned int __b) { 6899 return __a | __b; 6900 } 6901 6902 static __inline__ vector unsigned int __ATTRS_o_ai 6903 vec_or(vector bool int __a, vector unsigned int __b) { 6904 return (vector unsigned int)__a | __b; 6905 } 6906 6907 static __inline__ vector unsigned int __ATTRS_o_ai 6908 vec_or(vector unsigned int __a, vector bool int __b) { 6909 return __a | (vector unsigned int)__b; 6910 } 6911 6912 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6913 vector bool int __b) { 6914 return __a | __b; 6915 } 6916 6917 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6918 vector float __b) { 6919 vector unsigned int __res = 6920 (vector unsigned int)__a | (vector unsigned int)__b; 6921 return (vector float)__res; 6922 } 6923 6924 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6925 vector float __b) { 6926 vector unsigned int __res = 6927 (vector unsigned int)__a | (vector unsigned int)__b; 6928 return (vector float)__res; 6929 } 6930 6931 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6932 vector bool int __b) { 6933 vector unsigned int __res = 6934 (vector unsigned int)__a | (vector unsigned int)__b; 6935 return (vector float)__res; 6936 } 6937 6938 #ifdef __VSX__ 6939 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6940 vector double __b) { 6941 return (vector double)((vector unsigned long long)__a | 6942 (vector unsigned long long)__b); 6943 } 6944 6945 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6946 vector bool long long __b) { 6947 return (vector double)((vector unsigned long long)__a | 6948 (vector unsigned long long)__b); 6949 } 6950 6951 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6952 vector double __b) { 6953 return (vector double)((vector unsigned long long)__a | 6954 (vector unsigned long long)__b); 6955 } 6956 6957 static __inline__ vector signed long long __ATTRS_o_ai 6958 vec_or(vector signed long long __a, vector signed long long __b) { 6959 return __a | __b; 6960 } 6961 6962 static __inline__ vector signed long long __ATTRS_o_ai 6963 vec_or(vector bool long long __a, vector signed long long __b) { 6964 return (vector signed long long)__a | __b; 6965 } 6966 6967 static __inline__ vector signed long long __ATTRS_o_ai 6968 vec_or(vector signed long long __a, vector bool long long __b) { 6969 return __a | (vector signed long long)__b; 6970 } 6971 6972 static __inline__ vector unsigned long long __ATTRS_o_ai 6973 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 6974 return __a | __b; 6975 } 6976 6977 static __inline__ vector unsigned long long __ATTRS_o_ai 6978 vec_or(vector bool long long __a, vector unsigned long long __b) { 6979 return (vector unsigned long long)__a | __b; 6980 } 6981 6982 static __inline__ vector unsigned long long __ATTRS_o_ai 6983 vec_or(vector unsigned long long __a, vector bool long long __b) { 6984 return __a | (vector unsigned long long)__b; 6985 } 6986 6987 static __inline__ vector bool long long __ATTRS_o_ai 6988 vec_or(vector bool long long __a, vector bool long long __b) { 6989 return __a | __b; 6990 } 6991 #endif 6992 6993 #ifdef __POWER8_VECTOR__ 6994 static __inline__ vector signed char __ATTRS_o_ai 6995 vec_orc(vector signed char __a, vector signed char __b) { 6996 return __a | ~__b; 6997 } 6998 6999 static __inline__ vector signed char __ATTRS_o_ai 7000 vec_orc(vector signed char __a, vector bool char __b) { 7001 return __a | ~__b; 7002 } 7003 7004 static __inline__ vector signed char __ATTRS_o_ai 7005 vec_orc(vector bool char __a, vector signed char __b) { 7006 return __a | ~__b; 7007 } 7008 7009 static __inline__ vector unsigned char __ATTRS_o_ai 7010 vec_orc(vector unsigned char __a, vector unsigned char __b) { 7011 return __a | ~__b; 7012 } 7013 7014 static __inline__ vector unsigned char __ATTRS_o_ai 7015 vec_orc(vector unsigned char __a, vector bool char __b) { 7016 return __a | ~__b; 7017 } 7018 7019 static __inline__ vector unsigned char __ATTRS_o_ai 7020 vec_orc(vector bool char __a, vector unsigned char __b) { 7021 return __a | ~__b; 7022 } 7023 7024 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 7025 vector bool char __b) { 7026 return __a | ~__b; 7027 } 7028 7029 static __inline__ vector signed short __ATTRS_o_ai 7030 vec_orc(vector signed short __a, vector signed short __b) { 7031 return __a | ~__b; 7032 } 7033 7034 static __inline__ vector signed short __ATTRS_o_ai 7035 vec_orc(vector signed short __a, vector bool short __b) { 7036 return __a | ~__b; 7037 } 7038 7039 static __inline__ vector signed short __ATTRS_o_ai 7040 vec_orc(vector bool short __a, vector signed short __b) { 7041 return __a | ~__b; 7042 } 7043 7044 static __inline__ vector unsigned short __ATTRS_o_ai 7045 vec_orc(vector unsigned short __a, vector unsigned short __b) { 7046 return __a | ~__b; 7047 } 7048 7049 static __inline__ vector unsigned short __ATTRS_o_ai 7050 vec_orc(vector unsigned short __a, vector bool short __b) { 7051 return __a | ~__b; 7052 } 7053 7054 static __inline__ vector unsigned short __ATTRS_o_ai 7055 vec_orc(vector bool short __a, vector unsigned short __b) { 7056 return __a | ~__b; 7057 } 7058 7059 static __inline__ vector bool short __ATTRS_o_ai 7060 vec_orc(vector bool short __a, vector bool short __b) { 7061 return __a | ~__b; 7062 } 7063 7064 static __inline__ vector signed int __ATTRS_o_ai 7065 vec_orc(vector signed int __a, vector signed int __b) { 7066 return __a | ~__b; 7067 } 7068 7069 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 7070 vector bool int __b) { 7071 return __a | ~__b; 7072 } 7073 7074 static __inline__ vector signed int __ATTRS_o_ai 7075 vec_orc(vector bool int __a, vector signed int __b) { 7076 return __a | ~__b; 7077 } 7078 7079 static __inline__ vector unsigned int __ATTRS_o_ai 7080 vec_orc(vector unsigned int __a, vector unsigned int __b) { 7081 return __a | ~__b; 7082 } 7083 7084 static __inline__ vector unsigned int __ATTRS_o_ai 7085 vec_orc(vector unsigned int __a, vector bool int __b) { 7086 return __a | ~__b; 7087 } 7088 7089 static __inline__ vector unsigned int __ATTRS_o_ai 7090 vec_orc(vector bool int __a, vector unsigned int __b) { 7091 return __a | ~__b; 7092 } 7093 7094 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 7095 vector bool int __b) { 7096 return __a | ~__b; 7097 } 7098 7099 static __inline__ vector float __ATTRS_o_ai 7100 vec_orc(vector bool int __a, vector float __b) { 7101 return (vector float)(__a | ~(vector unsigned int)__b); 7102 } 7103 7104 static __inline__ vector float __ATTRS_o_ai 7105 vec_orc(vector float __a, vector bool int __b) { 7106 return (vector float)((vector unsigned int)__a | ~__b); 7107 } 7108 7109 static __inline__ vector signed long long __ATTRS_o_ai 7110 vec_orc(vector signed long long __a, vector signed long long __b) { 7111 return __a | ~__b; 7112 } 7113 7114 static __inline__ vector signed long long __ATTRS_o_ai 7115 vec_orc(vector signed long long __a, vector bool long long __b) { 7116 return __a | ~__b; 7117 } 7118 7119 static __inline__ vector signed long long __ATTRS_o_ai 7120 vec_orc(vector bool long long __a, vector signed long long __b) { 7121 return __a | ~__b; 7122 } 7123 7124 static __inline__ vector unsigned long long __ATTRS_o_ai 7125 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 7126 return __a | ~__b; 7127 } 7128 7129 static __inline__ vector unsigned long long __ATTRS_o_ai 7130 vec_orc(vector unsigned long long __a, vector bool long long __b) { 7131 return __a | ~__b; 7132 } 7133 7134 static __inline__ vector unsigned long long __ATTRS_o_ai 7135 vec_orc(vector bool long long __a, vector unsigned long long __b) { 7136 return __a | ~__b; 7137 } 7138 7139 static __inline__ vector bool long long __ATTRS_o_ai 7140 vec_orc(vector bool long long __a, vector bool long long __b) { 7141 return __a | ~__b; 7142 } 7143 7144 static __inline__ vector double __ATTRS_o_ai 7145 vec_orc(vector double __a, vector bool long long __b) { 7146 return (vector double)((vector unsigned long long)__a | ~__b); 7147 } 7148 7149 static __inline__ vector double __ATTRS_o_ai 7150 vec_orc(vector bool long long __a, vector double __b) { 7151 return (vector double)(__a | ~(vector unsigned long long)__b); 7152 } 7153 #endif 7154 7155 /* vec_vor */ 7156 7157 static __inline__ vector signed char __ATTRS_o_ai 7158 vec_vor(vector signed char __a, vector signed char __b) { 7159 return __a | __b; 7160 } 7161 7162 static __inline__ vector signed char __ATTRS_o_ai 7163 vec_vor(vector bool char __a, vector signed char __b) { 7164 return (vector signed char)__a | __b; 7165 } 7166 7167 static __inline__ vector signed char __ATTRS_o_ai 7168 vec_vor(vector signed char __a, vector bool char __b) { 7169 return __a | (vector signed char)__b; 7170 } 7171 7172 static __inline__ vector unsigned char __ATTRS_o_ai 7173 vec_vor(vector unsigned char __a, vector unsigned char __b) { 7174 return __a | __b; 7175 } 7176 7177 static __inline__ vector unsigned char __ATTRS_o_ai 7178 vec_vor(vector bool char __a, vector unsigned char __b) { 7179 return (vector unsigned char)__a | __b; 7180 } 7181 7182 static __inline__ vector unsigned char __ATTRS_o_ai 7183 vec_vor(vector unsigned char __a, vector bool char __b) { 7184 return __a | (vector unsigned char)__b; 7185 } 7186 7187 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 7188 vector bool char __b) { 7189 return __a | __b; 7190 } 7191 7192 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7193 vector short __b) { 7194 return __a | __b; 7195 } 7196 7197 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 7198 vector short __b) { 7199 return (vector short)__a | __b; 7200 } 7201 7202 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7203 vector bool short __b) { 7204 return __a | (vector short)__b; 7205 } 7206 7207 static __inline__ vector unsigned short __ATTRS_o_ai 7208 vec_vor(vector unsigned short __a, vector unsigned short __b) { 7209 return __a | __b; 7210 } 7211 7212 static __inline__ vector unsigned short __ATTRS_o_ai 7213 vec_vor(vector bool short __a, vector unsigned short __b) { 7214 return (vector unsigned short)__a | __b; 7215 } 7216 7217 static __inline__ vector unsigned short __ATTRS_o_ai 7218 vec_vor(vector unsigned short __a, vector bool short __b) { 7219 return __a | (vector unsigned short)__b; 7220 } 7221 7222 static __inline__ vector bool short __ATTRS_o_ai 7223 vec_vor(vector bool short __a, vector bool short __b) { 7224 return __a | __b; 7225 } 7226 7227 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7228 vector int __b) { 7229 return __a | __b; 7230 } 7231 7232 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 7233 vector int __b) { 7234 return (vector int)__a | __b; 7235 } 7236 7237 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7238 vector bool int __b) { 7239 return __a | (vector int)__b; 7240 } 7241 7242 static __inline__ vector unsigned int __ATTRS_o_ai 7243 vec_vor(vector unsigned int __a, vector unsigned int __b) { 7244 return __a | __b; 7245 } 7246 7247 static __inline__ vector unsigned int __ATTRS_o_ai 7248 vec_vor(vector bool int __a, vector unsigned int __b) { 7249 return (vector unsigned int)__a | __b; 7250 } 7251 7252 static __inline__ vector unsigned int __ATTRS_o_ai 7253 vec_vor(vector unsigned int __a, vector bool int __b) { 7254 return __a | (vector unsigned int)__b; 7255 } 7256 7257 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 7258 vector bool int __b) { 7259 return __a | __b; 7260 } 7261 7262 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7263 vector float __b) { 7264 vector unsigned int __res = 7265 (vector unsigned int)__a | (vector unsigned int)__b; 7266 return (vector float)__res; 7267 } 7268 7269 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 7270 vector float __b) { 7271 vector unsigned int __res = 7272 (vector unsigned int)__a | (vector unsigned int)__b; 7273 return (vector float)__res; 7274 } 7275 7276 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7277 vector bool int __b) { 7278 vector unsigned int __res = 7279 (vector unsigned int)__a | (vector unsigned int)__b; 7280 return (vector float)__res; 7281 } 7282 7283 #ifdef __VSX__ 7284 static __inline__ vector signed long long __ATTRS_o_ai 7285 vec_vor(vector signed long long __a, vector signed long long __b) { 7286 return __a | __b; 7287 } 7288 7289 static __inline__ vector signed long long __ATTRS_o_ai 7290 vec_vor(vector bool long long __a, vector signed long long __b) { 7291 return (vector signed long long)__a | __b; 7292 } 7293 7294 static __inline__ vector signed long long __ATTRS_o_ai 7295 vec_vor(vector signed long long __a, vector bool long long __b) { 7296 return __a | (vector signed long long)__b; 7297 } 7298 7299 static __inline__ vector unsigned long long __ATTRS_o_ai 7300 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 7301 return __a | __b; 7302 } 7303 7304 static __inline__ vector unsigned long long __ATTRS_o_ai 7305 vec_vor(vector bool long long __a, vector unsigned long long __b) { 7306 return (vector unsigned long long)__a | __b; 7307 } 7308 7309 static __inline__ vector unsigned long long __ATTRS_o_ai 7310 vec_vor(vector unsigned long long __a, vector bool long long __b) { 7311 return __a | (vector unsigned long long)__b; 7312 } 7313 7314 static __inline__ vector bool long long __ATTRS_o_ai 7315 vec_vor(vector bool long long __a, vector bool long long __b) { 7316 return __a | __b; 7317 } 7318 #endif 7319 7320 /* vec_pack */ 7321 7322 /* The various vector pack instructions have a big-endian bias, so for 7323 little endian we must handle reversed element numbering. */ 7324 7325 static __inline__ vector signed char __ATTRS_o_ai 7326 vec_pack(vector signed short __a, vector signed short __b) { 7327 #ifdef __LITTLE_ENDIAN__ 7328 return (vector signed char)vec_perm( 7329 __a, __b, 7330 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7331 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7332 #else 7333 return (vector signed char)vec_perm( 7334 __a, __b, 7335 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7336 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7337 #endif 7338 } 7339 7340 static __inline__ vector unsigned char __ATTRS_o_ai 7341 vec_pack(vector unsigned short __a, vector unsigned short __b) { 7342 #ifdef __LITTLE_ENDIAN__ 7343 return (vector unsigned char)vec_perm( 7344 __a, __b, 7345 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7346 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7347 #else 7348 return (vector unsigned char)vec_perm( 7349 __a, __b, 7350 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7351 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7352 #endif 7353 } 7354 7355 static __inline__ vector bool char __ATTRS_o_ai 7356 vec_pack(vector bool short __a, vector bool short __b) { 7357 #ifdef __LITTLE_ENDIAN__ 7358 return (vector bool char)vec_perm( 7359 __a, __b, 7360 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7361 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7362 #else 7363 return (vector bool char)vec_perm( 7364 __a, __b, 7365 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7366 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7367 #endif 7368 } 7369 7370 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 7371 vector int __b) { 7372 #ifdef __LITTLE_ENDIAN__ 7373 return (vector short)vec_perm( 7374 __a, __b, 7375 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7376 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7377 #else 7378 return (vector short)vec_perm( 7379 __a, __b, 7380 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7381 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7382 #endif 7383 } 7384 7385 static __inline__ vector unsigned short __ATTRS_o_ai 7386 vec_pack(vector unsigned int __a, vector unsigned int __b) { 7387 #ifdef __LITTLE_ENDIAN__ 7388 return (vector unsigned short)vec_perm( 7389 __a, __b, 7390 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7391 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7392 #else 7393 return (vector unsigned short)vec_perm( 7394 __a, __b, 7395 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7396 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7397 #endif 7398 } 7399 7400 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 7401 vector bool int __b) { 7402 #ifdef __LITTLE_ENDIAN__ 7403 return (vector bool short)vec_perm( 7404 __a, __b, 7405 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7406 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7407 #else 7408 return (vector bool short)vec_perm( 7409 __a, __b, 7410 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7411 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7412 #endif 7413 } 7414 7415 #ifdef __VSX__ 7416 static __inline__ vector signed int __ATTRS_o_ai 7417 vec_pack(vector signed long long __a, vector signed long long __b) { 7418 #ifdef __LITTLE_ENDIAN__ 7419 return (vector signed int)vec_perm( 7420 __a, __b, 7421 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7422 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7423 #else 7424 return (vector signed int)vec_perm( 7425 __a, __b, 7426 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7427 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7428 #endif 7429 } 7430 static __inline__ vector unsigned int __ATTRS_o_ai 7431 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 7432 #ifdef __LITTLE_ENDIAN__ 7433 return (vector unsigned int)vec_perm( 7434 __a, __b, 7435 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7436 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7437 #else 7438 return (vector unsigned int)vec_perm( 7439 __a, __b, 7440 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7441 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7442 #endif 7443 } 7444 7445 static __inline__ vector bool int __ATTRS_o_ai 7446 vec_pack(vector bool long long __a, vector bool long long __b) { 7447 #ifdef __LITTLE_ENDIAN__ 7448 return (vector bool int)vec_perm( 7449 __a, __b, 7450 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7451 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7452 #else 7453 return (vector bool int)vec_perm( 7454 __a, __b, 7455 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7456 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7457 #endif 7458 } 7459 7460 static __inline__ vector float __ATTRS_o_ai 7461 vec_pack(vector double __a, vector double __b) { 7462 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 7463 } 7464 #endif 7465 7466 #ifdef __POWER9_VECTOR__ 7467 static __inline__ vector unsigned short __ATTRS_o_ai 7468 vec_pack_to_short_fp32(vector float __a, vector float __b) { 7469 vector float __resa = __builtin_vsx_xvcvsphp(__a); 7470 vector float __resb = __builtin_vsx_xvcvsphp(__b); 7471 #ifdef __LITTLE_ENDIAN__ 7472 return (vector unsigned short)vec_mergee(__resa, __resb); 7473 #else 7474 return (vector unsigned short)vec_mergeo(__resa, __resb); 7475 #endif 7476 } 7477 7478 #endif 7479 /* vec_vpkuhum */ 7480 7481 #define __builtin_altivec_vpkuhum vec_vpkuhum 7482 7483 static __inline__ vector signed char __ATTRS_o_ai 7484 vec_vpkuhum(vector signed short __a, vector signed short __b) { 7485 #ifdef __LITTLE_ENDIAN__ 7486 return (vector signed char)vec_perm( 7487 __a, __b, 7488 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7489 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7490 #else 7491 return (vector signed char)vec_perm( 7492 __a, __b, 7493 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7494 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7495 #endif 7496 } 7497 7498 static __inline__ vector unsigned char __ATTRS_o_ai 7499 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 7500 #ifdef __LITTLE_ENDIAN__ 7501 return (vector unsigned char)vec_perm( 7502 __a, __b, 7503 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7504 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7505 #else 7506 return (vector unsigned char)vec_perm( 7507 __a, __b, 7508 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7509 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7510 #endif 7511 } 7512 7513 static __inline__ vector bool char __ATTRS_o_ai 7514 vec_vpkuhum(vector bool short __a, vector bool short __b) { 7515 #ifdef __LITTLE_ENDIAN__ 7516 return (vector bool char)vec_perm( 7517 __a, __b, 7518 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7519 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7520 #else 7521 return (vector bool char)vec_perm( 7522 __a, __b, 7523 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7524 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7525 #endif 7526 } 7527 7528 /* vec_vpkuwum */ 7529 7530 #define __builtin_altivec_vpkuwum vec_vpkuwum 7531 7532 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 7533 vector int __b) { 7534 #ifdef __LITTLE_ENDIAN__ 7535 return (vector short)vec_perm( 7536 __a, __b, 7537 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7538 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7539 #else 7540 return (vector short)vec_perm( 7541 __a, __b, 7542 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7543 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7544 #endif 7545 } 7546 7547 static __inline__ vector unsigned short __ATTRS_o_ai 7548 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 7549 #ifdef __LITTLE_ENDIAN__ 7550 return (vector unsigned short)vec_perm( 7551 __a, __b, 7552 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7553 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7554 #else 7555 return (vector unsigned short)vec_perm( 7556 __a, __b, 7557 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7558 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7559 #endif 7560 } 7561 7562 static __inline__ vector bool short __ATTRS_o_ai 7563 vec_vpkuwum(vector bool int __a, vector bool int __b) { 7564 #ifdef __LITTLE_ENDIAN__ 7565 return (vector bool short)vec_perm( 7566 __a, __b, 7567 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7568 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7569 #else 7570 return (vector bool short)vec_perm( 7571 __a, __b, 7572 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7573 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7574 #endif 7575 } 7576 7577 /* vec_vpkudum */ 7578 7579 #ifdef __POWER8_VECTOR__ 7580 #define __builtin_altivec_vpkudum vec_vpkudum 7581 7582 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7583 vector long long __b) { 7584 #ifdef __LITTLE_ENDIAN__ 7585 return (vector int)vec_perm( 7586 __a, __b, 7587 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7588 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7589 #else 7590 return (vector int)vec_perm( 7591 __a, __b, 7592 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7593 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7594 #endif 7595 } 7596 7597 static __inline__ vector unsigned int __ATTRS_o_ai 7598 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7599 #ifdef __LITTLE_ENDIAN__ 7600 return (vector unsigned int)vec_perm( 7601 __a, __b, 7602 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7603 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7604 #else 7605 return (vector unsigned int)vec_perm( 7606 __a, __b, 7607 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7608 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7609 #endif 7610 } 7611 7612 static __inline__ vector bool int __ATTRS_o_ai 7613 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7614 #ifdef __LITTLE_ENDIAN__ 7615 return (vector bool int)vec_perm( 7616 (vector long long)__a, (vector long long)__b, 7617 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7618 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7619 #else 7620 return (vector bool int)vec_perm( 7621 (vector long long)__a, (vector long long)__b, 7622 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7623 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7624 #endif 7625 } 7626 #endif 7627 7628 /* vec_packpx */ 7629 7630 static __inline__ vector pixel __attribute__((__always_inline__)) 7631 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7632 #ifdef __LITTLE_ENDIAN__ 7633 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7634 #else 7635 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7636 #endif 7637 } 7638 7639 /* vec_vpkpx */ 7640 7641 static __inline__ vector pixel __attribute__((__always_inline__)) 7642 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7643 #ifdef __LITTLE_ENDIAN__ 7644 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7645 #else 7646 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7647 #endif 7648 } 7649 7650 /* vec_packs */ 7651 7652 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7653 vector short __b) { 7654 #ifdef __LITTLE_ENDIAN__ 7655 return __builtin_altivec_vpkshss(__b, __a); 7656 #else 7657 return __builtin_altivec_vpkshss(__a, __b); 7658 #endif 7659 } 7660 7661 static __inline__ vector unsigned char __ATTRS_o_ai 7662 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7663 #ifdef __LITTLE_ENDIAN__ 7664 return __builtin_altivec_vpkuhus(__b, __a); 7665 #else 7666 return __builtin_altivec_vpkuhus(__a, __b); 7667 #endif 7668 } 7669 7670 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7671 vector int __b) { 7672 #ifdef __LITTLE_ENDIAN__ 7673 return __builtin_altivec_vpkswss(__b, __a); 7674 #else 7675 return __builtin_altivec_vpkswss(__a, __b); 7676 #endif 7677 } 7678 7679 static __inline__ vector unsigned short __ATTRS_o_ai 7680 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7681 #ifdef __LITTLE_ENDIAN__ 7682 return __builtin_altivec_vpkuwus(__b, __a); 7683 #else 7684 return __builtin_altivec_vpkuwus(__a, __b); 7685 #endif 7686 } 7687 7688 #ifdef __POWER8_VECTOR__ 7689 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7690 vector long long __b) { 7691 #ifdef __LITTLE_ENDIAN__ 7692 return __builtin_altivec_vpksdss(__b, __a); 7693 #else 7694 return __builtin_altivec_vpksdss(__a, __b); 7695 #endif 7696 } 7697 7698 static __inline__ vector unsigned int __ATTRS_o_ai 7699 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7700 #ifdef __LITTLE_ENDIAN__ 7701 return __builtin_altivec_vpkudus(__b, __a); 7702 #else 7703 return __builtin_altivec_vpkudus(__a, __b); 7704 #endif 7705 } 7706 #endif 7707 7708 /* vec_vpkshss */ 7709 7710 static __inline__ vector signed char __attribute__((__always_inline__)) 7711 vec_vpkshss(vector short __a, vector short __b) { 7712 #ifdef __LITTLE_ENDIAN__ 7713 return __builtin_altivec_vpkshss(__b, __a); 7714 #else 7715 return __builtin_altivec_vpkshss(__a, __b); 7716 #endif 7717 } 7718 7719 /* vec_vpksdss */ 7720 7721 #ifdef __POWER8_VECTOR__ 7722 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7723 vector long long __b) { 7724 #ifdef __LITTLE_ENDIAN__ 7725 return __builtin_altivec_vpksdss(__b, __a); 7726 #else 7727 return __builtin_altivec_vpksdss(__a, __b); 7728 #endif 7729 } 7730 #endif 7731 7732 /* vec_vpkuhus */ 7733 7734 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7735 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7736 #ifdef __LITTLE_ENDIAN__ 7737 return __builtin_altivec_vpkuhus(__b, __a); 7738 #else 7739 return __builtin_altivec_vpkuhus(__a, __b); 7740 #endif 7741 } 7742 7743 /* vec_vpkudus */ 7744 7745 #ifdef __POWER8_VECTOR__ 7746 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7747 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7748 #ifdef __LITTLE_ENDIAN__ 7749 return __builtin_altivec_vpkudus(__b, __a); 7750 #else 7751 return __builtin_altivec_vpkudus(__a, __b); 7752 #endif 7753 } 7754 #endif 7755 7756 /* vec_vpkswss */ 7757 7758 static __inline__ vector signed short __attribute__((__always_inline__)) 7759 vec_vpkswss(vector int __a, vector int __b) { 7760 #ifdef __LITTLE_ENDIAN__ 7761 return __builtin_altivec_vpkswss(__b, __a); 7762 #else 7763 return __builtin_altivec_vpkswss(__a, __b); 7764 #endif 7765 } 7766 7767 /* vec_vpkuwus */ 7768 7769 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7770 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7771 #ifdef __LITTLE_ENDIAN__ 7772 return __builtin_altivec_vpkuwus(__b, __a); 7773 #else 7774 return __builtin_altivec_vpkuwus(__a, __b); 7775 #endif 7776 } 7777 7778 /* vec_packsu */ 7779 7780 static __inline__ vector unsigned char __ATTRS_o_ai 7781 vec_packsu(vector short __a, vector short __b) { 7782 #ifdef __LITTLE_ENDIAN__ 7783 return __builtin_altivec_vpkshus(__b, __a); 7784 #else 7785 return __builtin_altivec_vpkshus(__a, __b); 7786 #endif 7787 } 7788 7789 static __inline__ vector unsigned char __ATTRS_o_ai 7790 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7791 #ifdef __LITTLE_ENDIAN__ 7792 return __builtin_altivec_vpkuhus(__b, __a); 7793 #else 7794 return __builtin_altivec_vpkuhus(__a, __b); 7795 #endif 7796 } 7797 7798 static __inline__ vector unsigned short __ATTRS_o_ai 7799 vec_packsu(vector int __a, vector int __b) { 7800 #ifdef __LITTLE_ENDIAN__ 7801 return __builtin_altivec_vpkswus(__b, __a); 7802 #else 7803 return __builtin_altivec_vpkswus(__a, __b); 7804 #endif 7805 } 7806 7807 static __inline__ vector unsigned short __ATTRS_o_ai 7808 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7809 #ifdef __LITTLE_ENDIAN__ 7810 return __builtin_altivec_vpkuwus(__b, __a); 7811 #else 7812 return __builtin_altivec_vpkuwus(__a, __b); 7813 #endif 7814 } 7815 7816 #ifdef __POWER8_VECTOR__ 7817 static __inline__ vector unsigned int __ATTRS_o_ai 7818 vec_packsu(vector long long __a, vector long long __b) { 7819 #ifdef __LITTLE_ENDIAN__ 7820 return __builtin_altivec_vpksdus(__b, __a); 7821 #else 7822 return __builtin_altivec_vpksdus(__a, __b); 7823 #endif 7824 } 7825 7826 static __inline__ vector unsigned int __ATTRS_o_ai 7827 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7828 #ifdef __LITTLE_ENDIAN__ 7829 return __builtin_altivec_vpkudus(__b, __a); 7830 #else 7831 return __builtin_altivec_vpkudus(__a, __b); 7832 #endif 7833 } 7834 #endif 7835 7836 /* vec_vpkshus */ 7837 7838 static __inline__ vector unsigned char __ATTRS_o_ai 7839 vec_vpkshus(vector short __a, vector short __b) { 7840 #ifdef __LITTLE_ENDIAN__ 7841 return __builtin_altivec_vpkshus(__b, __a); 7842 #else 7843 return __builtin_altivec_vpkshus(__a, __b); 7844 #endif 7845 } 7846 7847 static __inline__ vector unsigned char __ATTRS_o_ai 7848 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7849 #ifdef __LITTLE_ENDIAN__ 7850 return __builtin_altivec_vpkuhus(__b, __a); 7851 #else 7852 return __builtin_altivec_vpkuhus(__a, __b); 7853 #endif 7854 } 7855 7856 /* vec_vpkswus */ 7857 7858 static __inline__ vector unsigned short __ATTRS_o_ai 7859 vec_vpkswus(vector int __a, vector int __b) { 7860 #ifdef __LITTLE_ENDIAN__ 7861 return __builtin_altivec_vpkswus(__b, __a); 7862 #else 7863 return __builtin_altivec_vpkswus(__a, __b); 7864 #endif 7865 } 7866 7867 static __inline__ vector unsigned short __ATTRS_o_ai 7868 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7869 #ifdef __LITTLE_ENDIAN__ 7870 return __builtin_altivec_vpkuwus(__b, __a); 7871 #else 7872 return __builtin_altivec_vpkuwus(__a, __b); 7873 #endif 7874 } 7875 7876 /* vec_vpksdus */ 7877 7878 #ifdef __POWER8_VECTOR__ 7879 static __inline__ vector unsigned int __ATTRS_o_ai 7880 vec_vpksdus(vector long long __a, vector long long __b) { 7881 #ifdef __LITTLE_ENDIAN__ 7882 return __builtin_altivec_vpksdus(__b, __a); 7883 #else 7884 return __builtin_altivec_vpksdus(__a, __b); 7885 #endif 7886 } 7887 #endif 7888 7889 /* vec_perm */ 7890 7891 // The vperm instruction is defined architecturally with a big-endian bias. 7892 // For little endian, we swap the input operands and invert the permute 7893 // control vector. Only the rightmost 5 bits matter, so we could use 7894 // a vector of all 31s instead of all 255s to perform the inversion. 7895 // However, when the PCV is not a constant, using 255 has an advantage 7896 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7897 // later, possibly a vec_nand). 7898 7899 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7900 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7901 #ifdef __LITTLE_ENDIAN__ 7902 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7903 255, 255, 255, 255, 255, 255, 255, 255}; 7904 __d = vec_xor(__c, __d); 7905 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7906 (vector int)__a, __d); 7907 #else 7908 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7909 (vector int)__b, __c); 7910 #endif 7911 } 7912 7913 static __inline__ vector unsigned char __ATTRS_o_ai 7914 vec_perm(vector unsigned char __a, vector unsigned char __b, 7915 vector unsigned char __c) { 7916 #ifdef __LITTLE_ENDIAN__ 7917 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7918 255, 255, 255, 255, 255, 255, 255, 255}; 7919 __d = vec_xor(__c, __d); 7920 return (vector unsigned char)__builtin_altivec_vperm_4si( 7921 (vector int)__b, (vector int)__a, __d); 7922 #else 7923 return (vector unsigned char)__builtin_altivec_vperm_4si( 7924 (vector int)__a, (vector int)__b, __c); 7925 #endif 7926 } 7927 7928 static __inline__ vector bool char __ATTRS_o_ai 7929 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7930 #ifdef __LITTLE_ENDIAN__ 7931 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7932 255, 255, 255, 255, 255, 255, 255, 255}; 7933 __d = vec_xor(__c, __d); 7934 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 7935 (vector int)__a, __d); 7936 #else 7937 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7938 (vector int)__b, __c); 7939 #endif 7940 } 7941 7942 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7943 vector signed short __b, 7944 vector unsigned char __c) { 7945 #ifdef __LITTLE_ENDIAN__ 7946 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7947 255, 255, 255, 255, 255, 255, 255, 255}; 7948 __d = vec_xor(__c, __d); 7949 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 7950 (vector int)__a, __d); 7951 #else 7952 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 7953 (vector int)__b, __c); 7954 #endif 7955 } 7956 7957 static __inline__ vector unsigned short __ATTRS_o_ai 7958 vec_perm(vector unsigned short __a, vector unsigned short __b, 7959 vector unsigned char __c) { 7960 #ifdef __LITTLE_ENDIAN__ 7961 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7962 255, 255, 255, 255, 255, 255, 255, 255}; 7963 __d = vec_xor(__c, __d); 7964 return (vector unsigned short)__builtin_altivec_vperm_4si( 7965 (vector int)__b, (vector int)__a, __d); 7966 #else 7967 return (vector unsigned short)__builtin_altivec_vperm_4si( 7968 (vector int)__a, (vector int)__b, __c); 7969 #endif 7970 } 7971 7972 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 7973 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7974 #ifdef __LITTLE_ENDIAN__ 7975 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7976 255, 255, 255, 255, 255, 255, 255, 255}; 7977 __d = vec_xor(__c, __d); 7978 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 7979 (vector int)__a, __d); 7980 #else 7981 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 7982 (vector int)__b, __c); 7983 #endif 7984 } 7985 7986 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 7987 vector pixel __b, 7988 vector unsigned char __c) { 7989 #ifdef __LITTLE_ENDIAN__ 7990 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7991 255, 255, 255, 255, 255, 255, 255, 255}; 7992 __d = vec_xor(__c, __d); 7993 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 7994 (vector int)__a, __d); 7995 #else 7996 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 7997 (vector int)__b, __c); 7998 #endif 7999 } 8000 8001 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 8002 vector signed int __b, 8003 vector unsigned char __c) { 8004 #ifdef __LITTLE_ENDIAN__ 8005 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8006 255, 255, 255, 255, 255, 255, 255, 255}; 8007 __d = vec_xor(__c, __d); 8008 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 8009 #else 8010 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 8011 #endif 8012 } 8013 8014 static __inline__ vector unsigned int __ATTRS_o_ai 8015 vec_perm(vector unsigned int __a, vector unsigned int __b, 8016 vector unsigned char __c) { 8017 #ifdef __LITTLE_ENDIAN__ 8018 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8019 255, 255, 255, 255, 255, 255, 255, 255}; 8020 __d = vec_xor(__c, __d); 8021 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 8022 (vector int)__a, __d); 8023 #else 8024 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 8025 (vector int)__b, __c); 8026 #endif 8027 } 8028 8029 static __inline__ vector bool int __ATTRS_o_ai 8030 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8031 #ifdef __LITTLE_ENDIAN__ 8032 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8033 255, 255, 255, 255, 255, 255, 255, 255}; 8034 __d = vec_xor(__c, __d); 8035 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 8036 (vector int)__a, __d); 8037 #else 8038 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 8039 (vector int)__b, __c); 8040 #endif 8041 } 8042 8043 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 8044 vector float __b, 8045 vector unsigned char __c) { 8046 #ifdef __LITTLE_ENDIAN__ 8047 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8048 255, 255, 255, 255, 255, 255, 255, 255}; 8049 __d = vec_xor(__c, __d); 8050 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 8051 (vector int)__a, __d); 8052 #else 8053 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 8054 (vector int)__b, __c); 8055 #endif 8056 } 8057 8058 #ifdef __VSX__ 8059 static __inline__ vector long long __ATTRS_o_ai 8060 vec_perm(vector signed long long __a, vector signed long long __b, 8061 vector unsigned char __c) { 8062 #ifdef __LITTLE_ENDIAN__ 8063 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8064 255, 255, 255, 255, 255, 255, 255, 255}; 8065 __d = vec_xor(__c, __d); 8066 return (vector signed long long)__builtin_altivec_vperm_4si( 8067 (vector int)__b, (vector int)__a, __d); 8068 #else 8069 return (vector signed long long)__builtin_altivec_vperm_4si( 8070 (vector int)__a, (vector int)__b, __c); 8071 #endif 8072 } 8073 8074 static __inline__ vector unsigned long long __ATTRS_o_ai 8075 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 8076 vector unsigned char __c) { 8077 #ifdef __LITTLE_ENDIAN__ 8078 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8079 255, 255, 255, 255, 255, 255, 255, 255}; 8080 __d = vec_xor(__c, __d); 8081 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8082 (vector int)__b, (vector int)__a, __d); 8083 #else 8084 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8085 (vector int)__a, (vector int)__b, __c); 8086 #endif 8087 } 8088 8089 static __inline__ vector bool long long __ATTRS_o_ai 8090 vec_perm(vector bool long long __a, vector bool long long __b, 8091 vector unsigned char __c) { 8092 #ifdef __LITTLE_ENDIAN__ 8093 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8094 255, 255, 255, 255, 255, 255, 255, 255}; 8095 __d = vec_xor(__c, __d); 8096 return (vector bool long long)__builtin_altivec_vperm_4si( 8097 (vector int)__b, (vector int)__a, __d); 8098 #else 8099 return (vector bool long long)__builtin_altivec_vperm_4si( 8100 (vector int)__a, (vector int)__b, __c); 8101 #endif 8102 } 8103 8104 static __inline__ vector double __ATTRS_o_ai 8105 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 8106 #ifdef __LITTLE_ENDIAN__ 8107 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8108 255, 255, 255, 255, 255, 255, 255, 255}; 8109 __d = vec_xor(__c, __d); 8110 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 8111 (vector int)__a, __d); 8112 #else 8113 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 8114 (vector int)__b, __c); 8115 #endif 8116 } 8117 #endif 8118 8119 /* vec_vperm */ 8120 8121 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 8122 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8123 return vec_perm(__a, __b, __c); 8124 } 8125 8126 static __inline__ vector unsigned char __ATTRS_o_ai 8127 vec_vperm(vector unsigned char __a, vector unsigned char __b, 8128 vector unsigned char __c) { 8129 return vec_perm(__a, __b, __c); 8130 } 8131 8132 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 8133 vector bool char __a, vector bool char __b, vector unsigned char __c) { 8134 return vec_perm(__a, __b, __c); 8135 } 8136 8137 static __inline__ vector short __ATTRS_o_ai 8138 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 8139 return vec_perm(__a, __b, __c); 8140 } 8141 8142 static __inline__ vector unsigned short __ATTRS_o_ai 8143 vec_vperm(vector unsigned short __a, vector unsigned short __b, 8144 vector unsigned char __c) { 8145 return vec_perm(__a, __b, __c); 8146 } 8147 8148 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 8149 vector bool short __a, vector bool short __b, vector unsigned char __c) { 8150 return vec_perm(__a, __b, __c); 8151 } 8152 8153 static __inline__ vector pixel __ATTRS_o_ai 8154 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 8155 return vec_perm(__a, __b, __c); 8156 } 8157 8158 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 8159 vector int __b, 8160 vector unsigned char __c) { 8161 return vec_perm(__a, __b, __c); 8162 } 8163 8164 static __inline__ vector unsigned int __ATTRS_o_ai 8165 vec_vperm(vector unsigned int __a, vector unsigned int __b, 8166 vector unsigned char __c) { 8167 return vec_perm(__a, __b, __c); 8168 } 8169 8170 static __inline__ vector bool int __ATTRS_o_ai 8171 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8172 return vec_perm(__a, __b, __c); 8173 } 8174 8175 static __inline__ vector float __ATTRS_o_ai 8176 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 8177 return vec_perm(__a, __b, __c); 8178 } 8179 8180 #ifdef __VSX__ 8181 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 8182 vector long long __a, vector long long __b, vector unsigned char __c) { 8183 return vec_perm(__a, __b, __c); 8184 } 8185 8186 static __inline__ vector unsigned long long __ATTRS_o_ai 8187 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 8188 vector unsigned char __c) { 8189 return vec_perm(__a, __b, __c); 8190 } 8191 8192 static __inline__ vector double __ATTRS_o_ai 8193 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 8194 return vec_perm(__a, __b, __c); 8195 } 8196 #endif 8197 8198 /* vec_re */ 8199 8200 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 8201 #ifdef __VSX__ 8202 return __builtin_vsx_xvresp(__a); 8203 #else 8204 return __builtin_altivec_vrefp(__a); 8205 #endif 8206 } 8207 8208 #ifdef __VSX__ 8209 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 8210 return __builtin_vsx_xvredp(__a); 8211 } 8212 #endif 8213 8214 /* vec_vrefp */ 8215 8216 static __inline__ vector float __attribute__((__always_inline__)) 8217 vec_vrefp(vector float __a) { 8218 return __builtin_altivec_vrefp(__a); 8219 } 8220 8221 /* vec_rl */ 8222 8223 static __inline__ vector signed char __ATTRS_o_ai 8224 vec_rl(vector signed char __a, vector unsigned char __b) { 8225 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8226 } 8227 8228 static __inline__ vector unsigned char __ATTRS_o_ai 8229 vec_rl(vector unsigned char __a, vector unsigned char __b) { 8230 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8231 } 8232 8233 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 8234 vector unsigned short __b) { 8235 return __builtin_altivec_vrlh(__a, __b); 8236 } 8237 8238 static __inline__ vector unsigned short __ATTRS_o_ai 8239 vec_rl(vector unsigned short __a, vector unsigned short __b) { 8240 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8241 } 8242 8243 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 8244 vector unsigned int __b) { 8245 return __builtin_altivec_vrlw(__a, __b); 8246 } 8247 8248 static __inline__ vector unsigned int __ATTRS_o_ai 8249 vec_rl(vector unsigned int __a, vector unsigned int __b) { 8250 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8251 } 8252 8253 #ifdef __POWER8_VECTOR__ 8254 static __inline__ vector signed long long __ATTRS_o_ai 8255 vec_rl(vector signed long long __a, vector unsigned long long __b) { 8256 return __builtin_altivec_vrld(__a, __b); 8257 } 8258 8259 static __inline__ vector unsigned long long __ATTRS_o_ai 8260 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 8261 return __builtin_altivec_vrld(__a, __b); 8262 } 8263 #endif 8264 8265 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8266 static __inline__ vector signed __int128 __ATTRS_o_ai 8267 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { 8268 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a)); 8269 } 8270 8271 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8272 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 8273 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); 8274 } 8275 #endif 8276 8277 /* vec_rlmi */ 8278 #ifdef __POWER9_VECTOR__ 8279 static __inline__ vector unsigned int __ATTRS_o_ai 8280 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 8281 vector unsigned int __c) { 8282 return __builtin_altivec_vrlwmi(__a, __c, __b); 8283 } 8284 8285 static __inline__ vector unsigned long long __ATTRS_o_ai 8286 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 8287 vector unsigned long long __c) { 8288 return __builtin_altivec_vrldmi(__a, __c, __b); 8289 } 8290 #endif 8291 8292 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8293 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8294 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, 8295 vector unsigned __int128 __c) { 8296 return __builtin_altivec_vrlqmi(__a, __c, __b); 8297 } 8298 8299 static __inline__ vector signed __int128 __ATTRS_o_ai 8300 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, 8301 vector signed __int128 __c) { 8302 return __builtin_altivec_vrlqmi(__a, __c, __b); 8303 } 8304 #endif 8305 8306 /* vec_rlnm */ 8307 #ifdef __POWER9_VECTOR__ 8308 static __inline__ vector unsigned int __ATTRS_o_ai 8309 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 8310 vector unsigned int __c) { 8311 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 8312 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 8313 } 8314 8315 static __inline__ vector unsigned long long __ATTRS_o_ai 8316 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 8317 vector unsigned long long __c) { 8318 vector unsigned long long OneByte = { 0x8, 0x8 }; 8319 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 8320 } 8321 #endif 8322 8323 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8324 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8325 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, 8326 vector unsigned __int128 __c) { 8327 // Merge __b and __c using an appropriate shuffle. 8328 vector unsigned char TmpB = (vector unsigned char)__b; 8329 vector unsigned char TmpC = (vector unsigned char)__c; 8330 vector unsigned char MaskAndShift = 8331 #ifdef __LITTLE_ENDIAN__ 8332 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8333 1, -1, -1, -1, -1, -1); 8334 #else 8335 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8336 -1, -1, -1, -1, -1, -1, -1); 8337 #endif 8338 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8339 } 8340 8341 static __inline__ vector signed __int128 __ATTRS_o_ai 8342 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, 8343 vector signed __int128 __c) { 8344 // Merge __b and __c using an appropriate shuffle. 8345 vector unsigned char TmpB = (vector unsigned char)__b; 8346 vector unsigned char TmpC = (vector unsigned char)__c; 8347 vector unsigned char MaskAndShift = 8348 #ifdef __LITTLE_ENDIAN__ 8349 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8350 1, -1, -1, -1, -1, -1); 8351 #else 8352 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8353 -1, -1, -1, -1, -1, -1, -1); 8354 #endif 8355 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8356 } 8357 #endif 8358 8359 /* vec_vrlb */ 8360 8361 static __inline__ vector signed char __ATTRS_o_ai 8362 vec_vrlb(vector signed char __a, vector unsigned char __b) { 8363 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8364 } 8365 8366 static __inline__ vector unsigned char __ATTRS_o_ai 8367 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 8368 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8369 } 8370 8371 /* vec_vrlh */ 8372 8373 static __inline__ vector short __ATTRS_o_ai 8374 vec_vrlh(vector short __a, vector unsigned short __b) { 8375 return __builtin_altivec_vrlh(__a, __b); 8376 } 8377 8378 static __inline__ vector unsigned short __ATTRS_o_ai 8379 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 8380 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8381 } 8382 8383 /* vec_vrlw */ 8384 8385 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 8386 vector unsigned int __b) { 8387 return __builtin_altivec_vrlw(__a, __b); 8388 } 8389 8390 static __inline__ vector unsigned int __ATTRS_o_ai 8391 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 8392 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8393 } 8394 8395 /* vec_round */ 8396 8397 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 8398 return __builtin_altivec_vrfin(__a); 8399 } 8400 8401 #ifdef __VSX__ 8402 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8403 return __builtin_vsx_xvrdpi(__a); 8404 } 8405 8406 /* vec_rint */ 8407 8408 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 8409 return __builtin_vsx_xvrspic(__a); 8410 } 8411 8412 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 8413 return __builtin_vsx_xvrdpic(__a); 8414 } 8415 8416 /* vec_roundc */ 8417 8418 static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { 8419 return __builtin_vsx_xvrspic(__a); 8420 } 8421 8422 static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { 8423 return __builtin_vsx_xvrdpic(__a); 8424 } 8425 8426 /* vec_nearbyint */ 8427 8428 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 8429 return __builtin_vsx_xvrspi(__a); 8430 } 8431 8432 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 8433 return __builtin_vsx_xvrdpi(__a); 8434 } 8435 #endif 8436 8437 /* vec_vrfin */ 8438 8439 static __inline__ vector float __attribute__((__always_inline__)) 8440 vec_vrfin(vector float __a) { 8441 return __builtin_altivec_vrfin(__a); 8442 } 8443 8444 /* vec_sqrt */ 8445 8446 #ifdef __VSX__ 8447 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 8448 return __builtin_vsx_xvsqrtsp(__a); 8449 } 8450 8451 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 8452 return __builtin_vsx_xvsqrtdp(__a); 8453 } 8454 #endif 8455 8456 /* vec_rsqrte */ 8457 8458 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 8459 #ifdef __VSX__ 8460 return __builtin_vsx_xvrsqrtesp(__a); 8461 #else 8462 return __builtin_altivec_vrsqrtefp(__a); 8463 #endif 8464 } 8465 8466 #ifdef __VSX__ 8467 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 8468 return __builtin_vsx_xvrsqrtedp(__a); 8469 } 8470 #endif 8471 8472 static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { 8473 return __builtin_ppc_rsqrtf(__a); 8474 } 8475 8476 #ifdef __VSX__ 8477 static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { 8478 return __builtin_ppc_rsqrtd(__a); 8479 } 8480 #endif 8481 8482 /* vec_vrsqrtefp */ 8483 8484 static __inline__ __vector float __attribute__((__always_inline__)) 8485 vec_vrsqrtefp(vector float __a) { 8486 return __builtin_altivec_vrsqrtefp(__a); 8487 } 8488 8489 /* vec_xvtsqrt */ 8490 8491 #ifdef __VSX__ 8492 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { 8493 return __builtin_vsx_xvtsqrtdp(__a); 8494 } 8495 8496 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { 8497 return __builtin_vsx_xvtsqrtsp(__a); 8498 } 8499 #endif 8500 8501 /* vec_sel */ 8502 8503 #define __builtin_altivec_vsel_4si vec_sel 8504 8505 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 8506 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8507 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8508 } 8509 8510 static __inline__ vector signed char __ATTRS_o_ai 8511 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 8512 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8513 } 8514 8515 static __inline__ vector unsigned char __ATTRS_o_ai 8516 vec_sel(vector unsigned char __a, vector unsigned char __b, 8517 vector unsigned char __c) { 8518 return (__a & ~__c) | (__b & __c); 8519 } 8520 8521 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 8522 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8523 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8524 } 8525 8526 static __inline__ vector bool char __ATTRS_o_ai 8527 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8528 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8529 } 8530 8531 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 8532 vector bool char __b, 8533 vector bool char __c) { 8534 return (__a & ~__c) | (__b & __c); 8535 } 8536 8537 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8538 vector short __b, 8539 vector unsigned short __c) { 8540 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8541 } 8542 8543 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8544 vector short __b, 8545 vector bool short __c) { 8546 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8547 } 8548 8549 static __inline__ vector unsigned short __ATTRS_o_ai 8550 vec_sel(vector unsigned short __a, vector unsigned short __b, 8551 vector unsigned short __c) { 8552 return (__a & ~__c) | (__b & __c); 8553 } 8554 8555 static __inline__ vector unsigned short __ATTRS_o_ai 8556 vec_sel(vector unsigned short __a, vector unsigned short __b, 8557 vector bool short __c) { 8558 return (__a & ~(vector unsigned short)__c) | 8559 (__b & (vector unsigned short)__c); 8560 } 8561 8562 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 8563 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8564 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8565 } 8566 8567 static __inline__ vector bool short __ATTRS_o_ai 8568 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 8569 return (__a & ~__c) | (__b & __c); 8570 } 8571 8572 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8573 vector int __b, 8574 vector unsigned int __c) { 8575 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8576 } 8577 8578 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8579 vector int __b, 8580 vector bool int __c) { 8581 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8582 } 8583 8584 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 8585 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8586 return (__a & ~__c) | (__b & __c); 8587 } 8588 8589 static __inline__ vector unsigned int __ATTRS_o_ai 8590 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8591 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8592 } 8593 8594 static __inline__ vector bool int __ATTRS_o_ai 8595 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8596 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8597 } 8598 8599 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 8600 vector bool int __b, 8601 vector bool int __c) { 8602 return (__a & ~__c) | (__b & __c); 8603 } 8604 8605 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8606 vector float __b, 8607 vector unsigned int __c) { 8608 vector int __res = ((vector int)__a & ~(vector int)__c) | 8609 ((vector int)__b & (vector int)__c); 8610 return (vector float)__res; 8611 } 8612 8613 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8614 vector float __b, 8615 vector bool int __c) { 8616 vector int __res = ((vector int)__a & ~(vector int)__c) | 8617 ((vector int)__b & (vector int)__c); 8618 return (vector float)__res; 8619 } 8620 8621 #ifdef __VSX__ 8622 static __inline__ vector double __ATTRS_o_ai 8623 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 8624 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8625 ((vector long long)__b & (vector long long)__c); 8626 return (vector double)__res; 8627 } 8628 8629 static __inline__ vector double __ATTRS_o_ai 8630 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 8631 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8632 ((vector long long)__b & (vector long long)__c); 8633 return (vector double)__res; 8634 } 8635 8636 static __inline__ vector bool long long __ATTRS_o_ai 8637 vec_sel(vector bool long long __a, vector bool long long __b, 8638 vector bool long long __c) { 8639 return (__a & ~__c) | (__b & __c); 8640 } 8641 8642 static __inline__ vector bool long long __ATTRS_o_ai 8643 vec_sel(vector bool long long __a, vector bool long long __b, 8644 vector unsigned long long __c) { 8645 return (__a & ~(vector bool long long)__c) | 8646 (__b & (vector bool long long)__c); 8647 } 8648 8649 static __inline__ vector signed long long __ATTRS_o_ai 8650 vec_sel(vector signed long long __a, vector signed long long __b, 8651 vector bool long long __c) { 8652 return (__a & ~(vector signed long long)__c) | 8653 (__b & (vector signed long long)__c); 8654 } 8655 8656 static __inline__ vector signed long long __ATTRS_o_ai 8657 vec_sel(vector signed long long __a, vector signed long long __b, 8658 vector unsigned long long __c) { 8659 return (__a & ~(vector signed long long)__c) | 8660 (__b & (vector signed long long)__c); 8661 } 8662 8663 static __inline__ vector unsigned long long __ATTRS_o_ai 8664 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8665 vector bool long long __c) { 8666 return (__a & ~(vector unsigned long long)__c) | 8667 (__b & (vector unsigned long long)__c); 8668 } 8669 8670 static __inline__ vector unsigned long long __ATTRS_o_ai 8671 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8672 vector unsigned long long __c) { 8673 return (__a & ~__c) | (__b & __c); 8674 } 8675 #endif 8676 8677 /* vec_vsel */ 8678 8679 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 8680 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8681 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8682 } 8683 8684 static __inline__ vector signed char __ATTRS_o_ai 8685 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 8686 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8687 } 8688 8689 static __inline__ vector unsigned char __ATTRS_o_ai 8690 vec_vsel(vector unsigned char __a, vector unsigned char __b, 8691 vector unsigned char __c) { 8692 return (__a & ~__c) | (__b & __c); 8693 } 8694 8695 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 8696 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8697 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8698 } 8699 8700 static __inline__ vector bool char __ATTRS_o_ai 8701 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8702 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8703 } 8704 8705 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 8706 vector bool char __b, 8707 vector bool char __c) { 8708 return (__a & ~__c) | (__b & __c); 8709 } 8710 8711 static __inline__ vector short __ATTRS_o_ai 8712 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8713 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8714 } 8715 8716 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8717 vector short __b, 8718 vector bool short __c) { 8719 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8720 } 8721 8722 static __inline__ vector unsigned short __ATTRS_o_ai 8723 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8724 vector unsigned short __c) { 8725 return (__a & ~__c) | (__b & __c); 8726 } 8727 8728 static __inline__ vector unsigned short __ATTRS_o_ai 8729 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8730 vector bool short __c) { 8731 return (__a & ~(vector unsigned short)__c) | 8732 (__b & (vector unsigned short)__c); 8733 } 8734 8735 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8736 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8737 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8738 } 8739 8740 static __inline__ vector bool short __ATTRS_o_ai 8741 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8742 return (__a & ~__c) | (__b & __c); 8743 } 8744 8745 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8746 vector int __b, 8747 vector unsigned int __c) { 8748 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8749 } 8750 8751 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8752 vector int __b, 8753 vector bool int __c) { 8754 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8755 } 8756 8757 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8758 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8759 return (__a & ~__c) | (__b & __c); 8760 } 8761 8762 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8763 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8764 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8765 } 8766 8767 static __inline__ vector bool int __ATTRS_o_ai 8768 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8769 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8770 } 8771 8772 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8773 vector bool int __b, 8774 vector bool int __c) { 8775 return (__a & ~__c) | (__b & __c); 8776 } 8777 8778 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8779 vector float __b, 8780 vector unsigned int __c) { 8781 vector int __res = ((vector int)__a & ~(vector int)__c) | 8782 ((vector int)__b & (vector int)__c); 8783 return (vector float)__res; 8784 } 8785 8786 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8787 vector float __b, 8788 vector bool int __c) { 8789 vector int __res = ((vector int)__a & ~(vector int)__c) | 8790 ((vector int)__b & (vector int)__c); 8791 return (vector float)__res; 8792 } 8793 8794 /* vec_sl */ 8795 8796 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8797 // than the length of __a. 8798 static __inline__ vector unsigned char __ATTRS_o_ai 8799 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8800 return __a << (__b % 8801 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8802 } 8803 8804 static __inline__ vector signed char __ATTRS_o_ai 8805 vec_sl(vector signed char __a, vector unsigned char __b) { 8806 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8807 } 8808 8809 static __inline__ vector unsigned short __ATTRS_o_ai 8810 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8811 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8812 __CHAR_BIT__)); 8813 } 8814 8815 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8816 vector unsigned short __b) { 8817 return (vector short)vec_sl((vector unsigned short)__a, __b); 8818 } 8819 8820 static __inline__ vector unsigned int __ATTRS_o_ai 8821 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8822 return __a << (__b % 8823 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8824 } 8825 8826 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8827 vector unsigned int __b) { 8828 return (vector int)vec_sl((vector unsigned int)__a, __b); 8829 } 8830 8831 #ifdef __POWER8_VECTOR__ 8832 static __inline__ vector unsigned long long __ATTRS_o_ai 8833 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8834 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8835 __CHAR_BIT__)); 8836 } 8837 8838 static __inline__ vector long long __ATTRS_o_ai 8839 vec_sl(vector long long __a, vector unsigned long long __b) { 8840 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8841 } 8842 #else 8843 static __inline__ vector unsigned char __ATTRS_o_ai 8844 vec_vspltb(vector unsigned char __a, unsigned char __b); 8845 static __inline__ vector unsigned long long __ATTRS_o_ai 8846 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8847 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 8848 8849 // Big endian element one (the right doubleword) can be left shifted as-is. 8850 // The other element needs to be swapped into the right doubleword and 8851 // shifted. Then the right doublewords of the two result vectors are merged. 8852 vector signed long long __rightelt = 8853 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8854 (vector signed int)__b); 8855 #ifdef __LITTLE_ENDIAN__ 8856 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8857 (vector signed int)__rightelt, 8858 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8859 #else 8860 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8861 (vector signed int)__rightelt, 8862 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8863 #endif 8864 __a = __builtin_shufflevector(__a, __a, 1, 0); 8865 __b = __builtin_shufflevector(__b, __b, 1, 0); 8866 vector signed long long __leftelt = 8867 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8868 (vector signed int)__b); 8869 #ifdef __LITTLE_ENDIAN__ 8870 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8871 (vector signed int)__leftelt, 8872 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8873 return (vector unsigned long long)__builtin_shufflevector(__rightelt, 8874 __leftelt, 0, 2); 8875 #else 8876 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8877 (vector signed int)__leftelt, 8878 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8879 return (vector unsigned long long)__builtin_shufflevector(__leftelt, 8880 __rightelt, 1, 3); 8881 #endif 8882 } 8883 8884 static __inline__ vector long long __ATTRS_o_ai 8885 vec_sl(vector long long __a, vector unsigned long long __b) { 8886 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8887 } 8888 #endif 8889 8890 /* vec_vslb */ 8891 8892 #define __builtin_altivec_vslb vec_vslb 8893 8894 static __inline__ vector signed char __ATTRS_o_ai 8895 vec_vslb(vector signed char __a, vector unsigned char __b) { 8896 return vec_sl(__a, __b); 8897 } 8898 8899 static __inline__ vector unsigned char __ATTRS_o_ai 8900 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8901 return vec_sl(__a, __b); 8902 } 8903 8904 /* vec_vslh */ 8905 8906 #define __builtin_altivec_vslh vec_vslh 8907 8908 static __inline__ vector short __ATTRS_o_ai 8909 vec_vslh(vector short __a, vector unsigned short __b) { 8910 return vec_sl(__a, __b); 8911 } 8912 8913 static __inline__ vector unsigned short __ATTRS_o_ai 8914 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8915 return vec_sl(__a, __b); 8916 } 8917 8918 /* vec_vslw */ 8919 8920 #define __builtin_altivec_vslw vec_vslw 8921 8922 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8923 vector unsigned int __b) { 8924 return vec_sl(__a, __b); 8925 } 8926 8927 static __inline__ vector unsigned int __ATTRS_o_ai 8928 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 8929 return vec_sl(__a, __b); 8930 } 8931 8932 /* vec_sld */ 8933 8934 #define __builtin_altivec_vsldoi_4si vec_sld 8935 8936 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 8937 vector signed char __a, vector signed char __b, unsigned const int __c) { 8938 unsigned char __d = __c & 0x0F; 8939 #ifdef __LITTLE_ENDIAN__ 8940 return vec_perm( 8941 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8942 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8943 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8944 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8945 #else 8946 return vec_perm( 8947 __a, __b, 8948 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8949 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8950 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8951 #endif 8952 } 8953 8954 static __inline__ vector unsigned char __ATTRS_o_ai 8955 vec_sld(vector unsigned char __a, vector unsigned char __b, 8956 unsigned const int __c) { 8957 unsigned char __d = __c & 0x0F; 8958 #ifdef __LITTLE_ENDIAN__ 8959 return vec_perm( 8960 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8961 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8962 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8963 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8964 #else 8965 return vec_perm( 8966 __a, __b, 8967 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8968 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8969 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8970 #endif 8971 } 8972 8973 static __inline__ vector bool char __ATTRS_o_ai 8974 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 8975 unsigned char __d = __c & 0x0F; 8976 #ifdef __LITTLE_ENDIAN__ 8977 return vec_perm( 8978 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8979 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8980 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8981 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8982 #else 8983 return vec_perm( 8984 __a, __b, 8985 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8986 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8987 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8988 #endif 8989 } 8990 8991 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 8992 vector signed short __a, vector signed short __b, unsigned const int __c) { 8993 unsigned char __d = __c & 0x0F; 8994 #ifdef __LITTLE_ENDIAN__ 8995 return vec_perm( 8996 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8997 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8998 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8999 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9000 #else 9001 return vec_perm( 9002 __a, __b, 9003 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9004 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9005 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9006 #endif 9007 } 9008 9009 static __inline__ vector unsigned short __ATTRS_o_ai 9010 vec_sld(vector unsigned short __a, vector unsigned short __b, 9011 unsigned const int __c) { 9012 unsigned char __d = __c & 0x0F; 9013 #ifdef __LITTLE_ENDIAN__ 9014 return vec_perm( 9015 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9016 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9017 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9018 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9019 #else 9020 return vec_perm( 9021 __a, __b, 9022 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9023 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9024 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9025 #endif 9026 } 9027 9028 static __inline__ vector bool short __ATTRS_o_ai 9029 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 9030 unsigned char __d = __c & 0x0F; 9031 #ifdef __LITTLE_ENDIAN__ 9032 return vec_perm( 9033 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9034 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9035 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9036 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9037 #else 9038 return vec_perm( 9039 __a, __b, 9040 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9041 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9042 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9043 #endif 9044 } 9045 9046 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 9047 vector pixel __b, 9048 unsigned const int __c) { 9049 unsigned char __d = __c & 0x0F; 9050 #ifdef __LITTLE_ENDIAN__ 9051 return vec_perm( 9052 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9053 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9054 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9055 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9056 #else 9057 return vec_perm( 9058 __a, __b, 9059 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9060 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9061 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9062 #endif 9063 } 9064 9065 static __inline__ vector signed int __ATTRS_o_ai 9066 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 9067 unsigned char __d = __c & 0x0F; 9068 #ifdef __LITTLE_ENDIAN__ 9069 return vec_perm( 9070 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9071 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9072 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9073 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9074 #else 9075 return vec_perm( 9076 __a, __b, 9077 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9078 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9079 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9080 #endif 9081 } 9082 9083 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 9084 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9085 unsigned char __d = __c & 0x0F; 9086 #ifdef __LITTLE_ENDIAN__ 9087 return vec_perm( 9088 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9089 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9090 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9091 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9092 #else 9093 return vec_perm( 9094 __a, __b, 9095 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9096 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9097 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9098 #endif 9099 } 9100 9101 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 9102 vector bool int __b, 9103 unsigned const int __c) { 9104 unsigned char __d = __c & 0x0F; 9105 #ifdef __LITTLE_ENDIAN__ 9106 return vec_perm( 9107 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9108 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9109 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9110 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9111 #else 9112 return vec_perm( 9113 __a, __b, 9114 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9115 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9116 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9117 #endif 9118 } 9119 9120 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 9121 vector float __b, 9122 unsigned const int __c) { 9123 unsigned char __d = __c & 0x0F; 9124 #ifdef __LITTLE_ENDIAN__ 9125 return vec_perm( 9126 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9127 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9128 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9129 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9130 #else 9131 return vec_perm( 9132 __a, __b, 9133 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9134 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9135 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9136 #endif 9137 } 9138 9139 #ifdef __VSX__ 9140 static __inline__ vector bool long long __ATTRS_o_ai 9141 vec_sld(vector bool long long __a, vector bool long long __b, 9142 unsigned const int __c) { 9143 unsigned char __d = __c & 0x0F; 9144 #ifdef __LITTLE_ENDIAN__ 9145 return vec_perm( 9146 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9147 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9148 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9149 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9150 #else 9151 return vec_perm( 9152 __a, __b, 9153 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9154 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9155 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9156 #endif 9157 } 9158 9159 static __inline__ vector signed long long __ATTRS_o_ai 9160 vec_sld(vector signed long long __a, vector signed long long __b, 9161 unsigned const int __c) { 9162 unsigned char __d = __c & 0x0F; 9163 #ifdef __LITTLE_ENDIAN__ 9164 return vec_perm( 9165 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9166 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9167 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9168 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9169 #else 9170 return vec_perm( 9171 __a, __b, 9172 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9173 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9174 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9175 #endif 9176 } 9177 9178 static __inline__ vector unsigned long long __ATTRS_o_ai 9179 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 9180 unsigned const int __c) { 9181 unsigned char __d = __c & 0x0F; 9182 #ifdef __LITTLE_ENDIAN__ 9183 return vec_perm( 9184 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9185 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9186 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9187 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9188 #else 9189 return vec_perm( 9190 __a, __b, 9191 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9192 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9193 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9194 #endif 9195 } 9196 9197 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 9198 vector double __b, 9199 unsigned const int __c) { 9200 unsigned char __d = __c & 0x0F; 9201 #ifdef __LITTLE_ENDIAN__ 9202 return vec_perm( 9203 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9204 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9205 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9206 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9207 #else 9208 return vec_perm( 9209 __a, __b, 9210 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9211 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9212 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9213 #endif 9214 } 9215 #endif 9216 9217 /* vec_sldw */ 9218 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 9219 vector signed char __a, vector signed char __b, unsigned const int __c) { 9220 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9221 } 9222 9223 static __inline__ vector unsigned char __ATTRS_o_ai 9224 vec_sldw(vector unsigned char __a, vector unsigned char __b, 9225 unsigned const int __c) { 9226 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9227 } 9228 9229 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 9230 vector signed short __a, vector signed short __b, unsigned const int __c) { 9231 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9232 } 9233 9234 static __inline__ vector unsigned short __ATTRS_o_ai 9235 vec_sldw(vector unsigned short __a, vector unsigned short __b, 9236 unsigned const int __c) { 9237 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9238 } 9239 9240 static __inline__ vector signed int __ATTRS_o_ai 9241 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 9242 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9243 } 9244 9245 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 9246 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9247 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9248 } 9249 9250 static __inline__ vector float __ATTRS_o_ai vec_sldw( 9251 vector float __a, vector float __b, unsigned const int __c) { 9252 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9253 } 9254 9255 #ifdef __VSX__ 9256 static __inline__ vector signed long long __ATTRS_o_ai 9257 vec_sldw(vector signed long long __a, vector signed long long __b, 9258 unsigned const int __c) { 9259 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9260 } 9261 9262 static __inline__ vector unsigned long long __ATTRS_o_ai 9263 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 9264 unsigned const int __c) { 9265 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9266 } 9267 9268 static __inline__ vector double __ATTRS_o_ai vec_sldw( 9269 vector double __a, vector double __b, unsigned const int __c) { 9270 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9271 } 9272 #endif 9273 9274 #ifdef __POWER9_VECTOR__ 9275 /* vec_slv */ 9276 static __inline__ vector unsigned char __ATTRS_o_ai 9277 vec_slv(vector unsigned char __a, vector unsigned char __b) { 9278 return __builtin_altivec_vslv(__a, __b); 9279 } 9280 9281 /* vec_srv */ 9282 static __inline__ vector unsigned char __ATTRS_o_ai 9283 vec_srv(vector unsigned char __a, vector unsigned char __b) { 9284 return __builtin_altivec_vsrv(__a, __b); 9285 } 9286 #endif 9287 9288 /* vec_vsldoi */ 9289 9290 static __inline__ vector signed char __ATTRS_o_ai 9291 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 9292 unsigned char __d = __c & 0x0F; 9293 #ifdef __LITTLE_ENDIAN__ 9294 return vec_perm( 9295 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9296 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9297 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9298 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9299 #else 9300 return vec_perm( 9301 __a, __b, 9302 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9303 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9304 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9305 #endif 9306 } 9307 9308 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 9309 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 9310 unsigned char __d = __c & 0x0F; 9311 #ifdef __LITTLE_ENDIAN__ 9312 return vec_perm( 9313 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9314 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9315 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9316 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9317 #else 9318 return vec_perm( 9319 __a, __b, 9320 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9321 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9322 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9323 #endif 9324 } 9325 9326 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 9327 vector short __b, 9328 unsigned char __c) { 9329 unsigned char __d = __c & 0x0F; 9330 #ifdef __LITTLE_ENDIAN__ 9331 return vec_perm( 9332 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9333 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9334 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9335 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9336 #else 9337 return vec_perm( 9338 __a, __b, 9339 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9340 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9341 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9342 #endif 9343 } 9344 9345 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 9346 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 9347 unsigned char __d = __c & 0x0F; 9348 #ifdef __LITTLE_ENDIAN__ 9349 return vec_perm( 9350 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9351 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9352 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9353 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9354 #else 9355 return vec_perm( 9356 __a, __b, 9357 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9358 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9359 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9360 #endif 9361 } 9362 9363 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 9364 vector pixel __b, 9365 unsigned char __c) { 9366 unsigned char __d = __c & 0x0F; 9367 #ifdef __LITTLE_ENDIAN__ 9368 return vec_perm( 9369 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9370 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9371 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9372 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9373 #else 9374 return vec_perm( 9375 __a, __b, 9376 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9377 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9378 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9379 #endif 9380 } 9381 9382 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 9383 vector int __b, 9384 unsigned char __c) { 9385 unsigned char __d = __c & 0x0F; 9386 #ifdef __LITTLE_ENDIAN__ 9387 return vec_perm( 9388 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9389 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9390 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9391 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9392 #else 9393 return vec_perm( 9394 __a, __b, 9395 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9396 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9397 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9398 #endif 9399 } 9400 9401 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 9402 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 9403 unsigned char __d = __c & 0x0F; 9404 #ifdef __LITTLE_ENDIAN__ 9405 return vec_perm( 9406 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9407 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9408 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9409 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9410 #else 9411 return vec_perm( 9412 __a, __b, 9413 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9414 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9415 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9416 #endif 9417 } 9418 9419 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 9420 vector float __b, 9421 unsigned char __c) { 9422 unsigned char __d = __c & 0x0F; 9423 #ifdef __LITTLE_ENDIAN__ 9424 return vec_perm( 9425 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9426 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9427 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9428 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9429 #else 9430 return vec_perm( 9431 __a, __b, 9432 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9433 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9434 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9435 #endif 9436 } 9437 9438 /* vec_sll */ 9439 9440 static __inline__ vector signed char __ATTRS_o_ai 9441 vec_sll(vector signed char __a, vector unsigned char __b) { 9442 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9443 (vector int)__b); 9444 } 9445 9446 static __inline__ vector signed char __ATTRS_o_ai 9447 vec_sll(vector signed char __a, vector unsigned short __b) { 9448 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9449 (vector int)__b); 9450 } 9451 9452 static __inline__ vector signed char __ATTRS_o_ai 9453 vec_sll(vector signed char __a, vector unsigned int __b) { 9454 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9455 (vector int)__b); 9456 } 9457 9458 static __inline__ vector unsigned char __ATTRS_o_ai 9459 vec_sll(vector unsigned char __a, vector unsigned char __b) { 9460 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9461 (vector int)__b); 9462 } 9463 9464 static __inline__ vector unsigned char __ATTRS_o_ai 9465 vec_sll(vector unsigned char __a, vector unsigned short __b) { 9466 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9467 (vector int)__b); 9468 } 9469 9470 static __inline__ vector unsigned char __ATTRS_o_ai 9471 vec_sll(vector unsigned char __a, vector unsigned int __b) { 9472 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9473 (vector int)__b); 9474 } 9475 9476 static __inline__ vector bool char __ATTRS_o_ai 9477 vec_sll(vector bool char __a, vector unsigned char __b) { 9478 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9479 (vector int)__b); 9480 } 9481 9482 static __inline__ vector bool char __ATTRS_o_ai 9483 vec_sll(vector bool char __a, vector unsigned short __b) { 9484 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9485 (vector int)__b); 9486 } 9487 9488 static __inline__ vector bool char __ATTRS_o_ai 9489 vec_sll(vector bool char __a, vector unsigned int __b) { 9490 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9491 (vector int)__b); 9492 } 9493 9494 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9495 vector unsigned char __b) { 9496 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9497 } 9498 9499 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9500 vector unsigned short __b) { 9501 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9502 } 9503 9504 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9505 vector unsigned int __b) { 9506 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9507 } 9508 9509 static __inline__ vector unsigned short __ATTRS_o_ai 9510 vec_sll(vector unsigned short __a, vector unsigned char __b) { 9511 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9512 (vector int)__b); 9513 } 9514 9515 static __inline__ vector unsigned short __ATTRS_o_ai 9516 vec_sll(vector unsigned short __a, vector unsigned short __b) { 9517 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9518 (vector int)__b); 9519 } 9520 9521 static __inline__ vector unsigned short __ATTRS_o_ai 9522 vec_sll(vector unsigned short __a, vector unsigned int __b) { 9523 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9524 (vector int)__b); 9525 } 9526 9527 static __inline__ vector bool short __ATTRS_o_ai 9528 vec_sll(vector bool short __a, vector unsigned char __b) { 9529 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9530 (vector int)__b); 9531 } 9532 9533 static __inline__ vector bool short __ATTRS_o_ai 9534 vec_sll(vector bool short __a, vector unsigned short __b) { 9535 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9536 (vector int)__b); 9537 } 9538 9539 static __inline__ vector bool short __ATTRS_o_ai 9540 vec_sll(vector bool short __a, vector unsigned int __b) { 9541 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9542 (vector int)__b); 9543 } 9544 9545 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9546 vector unsigned char __b) { 9547 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9548 } 9549 9550 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9551 vector unsigned short __b) { 9552 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9553 } 9554 9555 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9556 vector unsigned int __b) { 9557 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9558 } 9559 9560 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9561 vector unsigned char __b) { 9562 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9563 } 9564 9565 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9566 vector unsigned short __b) { 9567 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9568 } 9569 9570 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9571 vector unsigned int __b) { 9572 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9573 } 9574 9575 static __inline__ vector unsigned int __ATTRS_o_ai 9576 vec_sll(vector unsigned int __a, vector unsigned char __b) { 9577 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9578 (vector int)__b); 9579 } 9580 9581 static __inline__ vector unsigned int __ATTRS_o_ai 9582 vec_sll(vector unsigned int __a, vector unsigned short __b) { 9583 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9584 (vector int)__b); 9585 } 9586 9587 static __inline__ vector unsigned int __ATTRS_o_ai 9588 vec_sll(vector unsigned int __a, vector unsigned int __b) { 9589 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9590 (vector int)__b); 9591 } 9592 9593 static __inline__ vector bool int __ATTRS_o_ai 9594 vec_sll(vector bool int __a, vector unsigned char __b) { 9595 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9596 (vector int)__b); 9597 } 9598 9599 static __inline__ vector bool int __ATTRS_o_ai 9600 vec_sll(vector bool int __a, vector unsigned short __b) { 9601 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9602 (vector int)__b); 9603 } 9604 9605 static __inline__ vector bool int __ATTRS_o_ai 9606 vec_sll(vector bool int __a, vector unsigned int __b) { 9607 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9608 (vector int)__b); 9609 } 9610 9611 #ifdef __VSX__ 9612 static __inline__ vector signed long long __ATTRS_o_ai 9613 vec_sll(vector signed long long __a, vector unsigned char __b) { 9614 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 9615 (vector int)__b); 9616 } 9617 9618 static __inline__ vector unsigned long long __ATTRS_o_ai 9619 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 9620 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 9621 (vector int)__b); 9622 } 9623 #endif 9624 9625 /* vec_vsl */ 9626 9627 static __inline__ vector signed char __ATTRS_o_ai 9628 vec_vsl(vector signed char __a, vector unsigned char __b) { 9629 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9630 (vector int)__b); 9631 } 9632 9633 static __inline__ vector signed char __ATTRS_o_ai 9634 vec_vsl(vector signed char __a, vector unsigned short __b) { 9635 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9636 (vector int)__b); 9637 } 9638 9639 static __inline__ vector signed char __ATTRS_o_ai 9640 vec_vsl(vector signed char __a, vector unsigned int __b) { 9641 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9642 (vector int)__b); 9643 } 9644 9645 static __inline__ vector unsigned char __ATTRS_o_ai 9646 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 9647 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9648 (vector int)__b); 9649 } 9650 9651 static __inline__ vector unsigned char __ATTRS_o_ai 9652 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 9653 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9654 (vector int)__b); 9655 } 9656 9657 static __inline__ vector unsigned char __ATTRS_o_ai 9658 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 9659 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9660 (vector int)__b); 9661 } 9662 9663 static __inline__ vector bool char __ATTRS_o_ai 9664 vec_vsl(vector bool char __a, vector unsigned char __b) { 9665 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9666 (vector int)__b); 9667 } 9668 9669 static __inline__ vector bool char __ATTRS_o_ai 9670 vec_vsl(vector bool char __a, vector unsigned short __b) { 9671 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9672 (vector int)__b); 9673 } 9674 9675 static __inline__ vector bool char __ATTRS_o_ai 9676 vec_vsl(vector bool char __a, vector unsigned int __b) { 9677 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9678 (vector int)__b); 9679 } 9680 9681 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9682 vector unsigned char __b) { 9683 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9684 } 9685 9686 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9687 vector unsigned short __b) { 9688 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9689 } 9690 9691 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9692 vector unsigned int __b) { 9693 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9694 } 9695 9696 static __inline__ vector unsigned short __ATTRS_o_ai 9697 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 9698 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9699 (vector int)__b); 9700 } 9701 9702 static __inline__ vector unsigned short __ATTRS_o_ai 9703 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 9704 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9705 (vector int)__b); 9706 } 9707 9708 static __inline__ vector unsigned short __ATTRS_o_ai 9709 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 9710 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9711 (vector int)__b); 9712 } 9713 9714 static __inline__ vector bool short __ATTRS_o_ai 9715 vec_vsl(vector bool short __a, vector unsigned char __b) { 9716 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9717 (vector int)__b); 9718 } 9719 9720 static __inline__ vector bool short __ATTRS_o_ai 9721 vec_vsl(vector bool short __a, vector unsigned short __b) { 9722 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9723 (vector int)__b); 9724 } 9725 9726 static __inline__ vector bool short __ATTRS_o_ai 9727 vec_vsl(vector bool short __a, vector unsigned int __b) { 9728 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9729 (vector int)__b); 9730 } 9731 9732 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9733 vector unsigned char __b) { 9734 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9735 } 9736 9737 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9738 vector unsigned short __b) { 9739 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9740 } 9741 9742 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9743 vector unsigned int __b) { 9744 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9745 } 9746 9747 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9748 vector unsigned char __b) { 9749 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9750 } 9751 9752 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9753 vector unsigned short __b) { 9754 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9755 } 9756 9757 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9758 vector unsigned int __b) { 9759 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9760 } 9761 9762 static __inline__ vector unsigned int __ATTRS_o_ai 9763 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 9764 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9765 (vector int)__b); 9766 } 9767 9768 static __inline__ vector unsigned int __ATTRS_o_ai 9769 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9770 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9771 (vector int)__b); 9772 } 9773 9774 static __inline__ vector unsigned int __ATTRS_o_ai 9775 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9776 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9777 (vector int)__b); 9778 } 9779 9780 static __inline__ vector bool int __ATTRS_o_ai 9781 vec_vsl(vector bool int __a, vector unsigned char __b) { 9782 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9783 (vector int)__b); 9784 } 9785 9786 static __inline__ vector bool int __ATTRS_o_ai 9787 vec_vsl(vector bool int __a, vector unsigned short __b) { 9788 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9789 (vector int)__b); 9790 } 9791 9792 static __inline__ vector bool int __ATTRS_o_ai 9793 vec_vsl(vector bool int __a, vector unsigned int __b) { 9794 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9795 (vector int)__b); 9796 } 9797 9798 /* vec_slo */ 9799 9800 static __inline__ vector signed char __ATTRS_o_ai 9801 vec_slo(vector signed char __a, vector signed char __b) { 9802 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9803 (vector int)__b); 9804 } 9805 9806 static __inline__ vector signed char __ATTRS_o_ai 9807 vec_slo(vector signed char __a, vector unsigned char __b) { 9808 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9809 (vector int)__b); 9810 } 9811 9812 static __inline__ vector unsigned char __ATTRS_o_ai 9813 vec_slo(vector unsigned char __a, vector signed char __b) { 9814 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9815 (vector int)__b); 9816 } 9817 9818 static __inline__ vector unsigned char __ATTRS_o_ai 9819 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9820 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9821 (vector int)__b); 9822 } 9823 9824 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9825 vector signed char __b) { 9826 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9827 } 9828 9829 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9830 vector unsigned char __b) { 9831 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9832 } 9833 9834 static __inline__ vector unsigned short __ATTRS_o_ai 9835 vec_slo(vector unsigned short __a, vector signed char __b) { 9836 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9837 (vector int)__b); 9838 } 9839 9840 static __inline__ vector unsigned short __ATTRS_o_ai 9841 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9842 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9843 (vector int)__b); 9844 } 9845 9846 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9847 vector signed char __b) { 9848 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9849 } 9850 9851 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9852 vector unsigned char __b) { 9853 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9854 } 9855 9856 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9857 vector signed char __b) { 9858 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9859 } 9860 9861 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9862 vector unsigned char __b) { 9863 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9864 } 9865 9866 static __inline__ vector unsigned int __ATTRS_o_ai 9867 vec_slo(vector unsigned int __a, vector signed char __b) { 9868 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9869 (vector int)__b); 9870 } 9871 9872 static __inline__ vector unsigned int __ATTRS_o_ai 9873 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9874 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9875 (vector int)__b); 9876 } 9877 9878 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9879 vector signed char __b) { 9880 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9881 } 9882 9883 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9884 vector unsigned char __b) { 9885 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9886 } 9887 9888 #ifdef __VSX__ 9889 static __inline__ vector signed long long __ATTRS_o_ai 9890 vec_slo(vector signed long long __a, vector signed char __b) { 9891 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9892 (vector int)__b); 9893 } 9894 9895 static __inline__ vector signed long long __ATTRS_o_ai 9896 vec_slo(vector signed long long __a, vector unsigned char __b) { 9897 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9898 (vector int)__b); 9899 } 9900 9901 static __inline__ vector unsigned long long __ATTRS_o_ai 9902 vec_slo(vector unsigned long long __a, vector signed char __b) { 9903 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9904 (vector int)__b); 9905 } 9906 9907 static __inline__ vector unsigned long long __ATTRS_o_ai 9908 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9909 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9910 (vector int)__b); 9911 } 9912 #endif 9913 9914 /* vec_vslo */ 9915 9916 static __inline__ vector signed char __ATTRS_o_ai 9917 vec_vslo(vector signed char __a, vector signed char __b) { 9918 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9919 (vector int)__b); 9920 } 9921 9922 static __inline__ vector signed char __ATTRS_o_ai 9923 vec_vslo(vector signed char __a, vector unsigned char __b) { 9924 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9925 (vector int)__b); 9926 } 9927 9928 static __inline__ vector unsigned char __ATTRS_o_ai 9929 vec_vslo(vector unsigned char __a, vector signed char __b) { 9930 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9931 (vector int)__b); 9932 } 9933 9934 static __inline__ vector unsigned char __ATTRS_o_ai 9935 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 9936 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9937 (vector int)__b); 9938 } 9939 9940 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9941 vector signed char __b) { 9942 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9943 } 9944 9945 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9946 vector unsigned char __b) { 9947 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9948 } 9949 9950 static __inline__ vector unsigned short __ATTRS_o_ai 9951 vec_vslo(vector unsigned short __a, vector signed char __b) { 9952 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9953 (vector int)__b); 9954 } 9955 9956 static __inline__ vector unsigned short __ATTRS_o_ai 9957 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 9958 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9959 (vector int)__b); 9960 } 9961 9962 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9963 vector signed char __b) { 9964 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9965 } 9966 9967 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9968 vector unsigned char __b) { 9969 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9970 } 9971 9972 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9973 vector signed char __b) { 9974 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9975 } 9976 9977 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9978 vector unsigned char __b) { 9979 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9980 } 9981 9982 static __inline__ vector unsigned int __ATTRS_o_ai 9983 vec_vslo(vector unsigned int __a, vector signed char __b) { 9984 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9985 (vector int)__b); 9986 } 9987 9988 static __inline__ vector unsigned int __ATTRS_o_ai 9989 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 9990 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9991 (vector int)__b); 9992 } 9993 9994 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9995 vector signed char __b) { 9996 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9997 } 9998 9999 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10000 vector unsigned char __b) { 10001 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10002 } 10003 10004 /* vec_splat */ 10005 10006 static __inline__ vector signed char __ATTRS_o_ai 10007 vec_splat(vector signed char __a, unsigned const int __b) { 10008 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10009 } 10010 10011 static __inline__ vector unsigned char __ATTRS_o_ai 10012 vec_splat(vector unsigned char __a, unsigned const int __b) { 10013 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10014 } 10015 10016 static __inline__ vector bool char __ATTRS_o_ai 10017 vec_splat(vector bool char __a, unsigned const int __b) { 10018 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10019 } 10020 10021 static __inline__ vector signed short __ATTRS_o_ai 10022 vec_splat(vector signed short __a, unsigned const int __b) { 10023 unsigned char b0 = (__b & 0x07) * 2; 10024 unsigned char b1 = b0 + 1; 10025 return vec_perm(__a, __a, 10026 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10027 b0, b1, b0, b1, b0, b1)); 10028 } 10029 10030 static __inline__ vector unsigned short __ATTRS_o_ai 10031 vec_splat(vector unsigned short __a, unsigned const int __b) { 10032 unsigned char b0 = (__b & 0x07) * 2; 10033 unsigned char b1 = b0 + 1; 10034 return vec_perm(__a, __a, 10035 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10036 b0, b1, b0, b1, b0, b1)); 10037 } 10038 10039 static __inline__ vector bool short __ATTRS_o_ai 10040 vec_splat(vector bool short __a, unsigned const int __b) { 10041 unsigned char b0 = (__b & 0x07) * 2; 10042 unsigned char b1 = b0 + 1; 10043 return vec_perm(__a, __a, 10044 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10045 b0, b1, b0, b1, b0, b1)); 10046 } 10047 10048 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 10049 unsigned const int __b) { 10050 unsigned char b0 = (__b & 0x07) * 2; 10051 unsigned char b1 = b0 + 1; 10052 return vec_perm(__a, __a, 10053 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10054 b0, b1, b0, b1, b0, b1)); 10055 } 10056 10057 static __inline__ vector signed int __ATTRS_o_ai 10058 vec_splat(vector signed int __a, unsigned const int __b) { 10059 unsigned char b0 = (__b & 0x03) * 4; 10060 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10061 return vec_perm(__a, __a, 10062 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10063 b2, b3, b0, b1, b2, b3)); 10064 } 10065 10066 static __inline__ vector unsigned int __ATTRS_o_ai 10067 vec_splat(vector unsigned int __a, unsigned const int __b) { 10068 unsigned char b0 = (__b & 0x03) * 4; 10069 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10070 return vec_perm(__a, __a, 10071 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10072 b2, b3, b0, b1, b2, b3)); 10073 } 10074 10075 static __inline__ vector bool int __ATTRS_o_ai 10076 vec_splat(vector bool int __a, unsigned const int __b) { 10077 unsigned char b0 = (__b & 0x03) * 4; 10078 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10079 return vec_perm(__a, __a, 10080 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10081 b2, b3, b0, b1, b2, b3)); 10082 } 10083 10084 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 10085 unsigned const int __b) { 10086 unsigned char b0 = (__b & 0x03) * 4; 10087 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10088 return vec_perm(__a, __a, 10089 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10090 b2, b3, b0, b1, b2, b3)); 10091 } 10092 10093 #ifdef __VSX__ 10094 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 10095 unsigned const int __b) { 10096 unsigned char b0 = (__b & 0x01) * 8; 10097 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10098 b6 = b0 + 6, b7 = b0 + 7; 10099 return vec_perm(__a, __a, 10100 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10101 b2, b3, b4, b5, b6, b7)); 10102 } 10103 static __inline__ vector bool long long __ATTRS_o_ai 10104 vec_splat(vector bool long long __a, unsigned const int __b) { 10105 unsigned char b0 = (__b & 0x01) * 8; 10106 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10107 b6 = b0 + 6, b7 = b0 + 7; 10108 return vec_perm(__a, __a, 10109 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10110 b2, b3, b4, b5, b6, b7)); 10111 } 10112 static __inline__ vector signed long long __ATTRS_o_ai 10113 vec_splat(vector signed long long __a, unsigned const int __b) { 10114 unsigned char b0 = (__b & 0x01) * 8; 10115 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10116 b6 = b0 + 6, b7 = b0 + 7; 10117 return vec_perm(__a, __a, 10118 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10119 b2, b3, b4, b5, b6, b7)); 10120 } 10121 static __inline__ vector unsigned long long __ATTRS_o_ai 10122 vec_splat(vector unsigned long long __a, unsigned const int __b) { 10123 unsigned char b0 = (__b & 0x01) * 8; 10124 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10125 b6 = b0 + 6, b7 = b0 + 7; 10126 return vec_perm(__a, __a, 10127 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10128 b2, b3, b4, b5, b6, b7)); 10129 } 10130 #endif 10131 10132 /* vec_vspltb */ 10133 10134 #define __builtin_altivec_vspltb vec_vspltb 10135 10136 static __inline__ vector signed char __ATTRS_o_ai 10137 vec_vspltb(vector signed char __a, unsigned char __b) { 10138 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10139 } 10140 10141 static __inline__ vector unsigned char __ATTRS_o_ai 10142 vec_vspltb(vector unsigned char __a, unsigned char __b) { 10143 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10144 } 10145 10146 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 10147 unsigned char __b) { 10148 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10149 } 10150 10151 /* vec_vsplth */ 10152 10153 #define __builtin_altivec_vsplth vec_vsplth 10154 10155 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 10156 unsigned char __b) { 10157 __b *= 2; 10158 unsigned char b1 = __b + 1; 10159 return vec_perm(__a, __a, 10160 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10161 __b, b1, __b, b1, __b, b1, __b, b1)); 10162 } 10163 10164 static __inline__ vector unsigned short __ATTRS_o_ai 10165 vec_vsplth(vector unsigned short __a, unsigned char __b) { 10166 __b *= 2; 10167 unsigned char b1 = __b + 1; 10168 return vec_perm(__a, __a, 10169 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10170 __b, b1, __b, b1, __b, b1, __b, b1)); 10171 } 10172 10173 static __inline__ vector bool short __ATTRS_o_ai 10174 vec_vsplth(vector bool short __a, unsigned char __b) { 10175 __b *= 2; 10176 unsigned char b1 = __b + 1; 10177 return vec_perm(__a, __a, 10178 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10179 __b, b1, __b, b1, __b, b1, __b, b1)); 10180 } 10181 10182 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 10183 unsigned char __b) { 10184 __b *= 2; 10185 unsigned char b1 = __b + 1; 10186 return vec_perm(__a, __a, 10187 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10188 __b, b1, __b, b1, __b, b1, __b, b1)); 10189 } 10190 10191 /* vec_vspltw */ 10192 10193 #define __builtin_altivec_vspltw vec_vspltw 10194 10195 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 10196 unsigned char __b) { 10197 __b *= 4; 10198 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10199 return vec_perm(__a, __a, 10200 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10201 b1, b2, b3, __b, b1, b2, b3)); 10202 } 10203 10204 static __inline__ vector unsigned int __ATTRS_o_ai 10205 vec_vspltw(vector unsigned int __a, unsigned char __b) { 10206 __b *= 4; 10207 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10208 return vec_perm(__a, __a, 10209 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10210 b1, b2, b3, __b, b1, b2, b3)); 10211 } 10212 10213 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 10214 unsigned char __b) { 10215 __b *= 4; 10216 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10217 return vec_perm(__a, __a, 10218 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10219 b1, b2, b3, __b, b1, b2, b3)); 10220 } 10221 10222 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 10223 unsigned char __b) { 10224 __b *= 4; 10225 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10226 return vec_perm(__a, __a, 10227 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10228 b1, b2, b3, __b, b1, b2, b3)); 10229 } 10230 10231 /* vec_splat_s8 */ 10232 10233 #define __builtin_altivec_vspltisb vec_splat_s8 10234 10235 // FIXME: parameter should be treated as 5-bit signed literal 10236 static __inline__ vector signed char __ATTRS_o_ai 10237 vec_splat_s8(signed char __a) { 10238 return (vector signed char)(__a); 10239 } 10240 10241 /* vec_vspltisb */ 10242 10243 // FIXME: parameter should be treated as 5-bit signed literal 10244 static __inline__ vector signed char __ATTRS_o_ai 10245 vec_vspltisb(signed char __a) { 10246 return (vector signed char)(__a); 10247 } 10248 10249 /* vec_splat_s16 */ 10250 10251 #define __builtin_altivec_vspltish vec_splat_s16 10252 10253 // FIXME: parameter should be treated as 5-bit signed literal 10254 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 10255 return (vector short)(__a); 10256 } 10257 10258 /* vec_vspltish */ 10259 10260 // FIXME: parameter should be treated as 5-bit signed literal 10261 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 10262 return (vector short)(__a); 10263 } 10264 10265 /* vec_splat_s32 */ 10266 10267 #define __builtin_altivec_vspltisw vec_splat_s32 10268 10269 // FIXME: parameter should be treated as 5-bit signed literal 10270 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 10271 return (vector int)(__a); 10272 } 10273 10274 /* vec_vspltisw */ 10275 10276 // FIXME: parameter should be treated as 5-bit signed literal 10277 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 10278 return (vector int)(__a); 10279 } 10280 10281 /* vec_splat_u8 */ 10282 10283 // FIXME: parameter should be treated as 5-bit signed literal 10284 static __inline__ vector unsigned char __ATTRS_o_ai 10285 vec_splat_u8(unsigned char __a) { 10286 return (vector unsigned char)(__a); 10287 } 10288 10289 /* vec_splat_u16 */ 10290 10291 // FIXME: parameter should be treated as 5-bit signed literal 10292 static __inline__ vector unsigned short __ATTRS_o_ai 10293 vec_splat_u16(signed char __a) { 10294 return (vector unsigned short)(__a); 10295 } 10296 10297 /* vec_splat_u32 */ 10298 10299 // FIXME: parameter should be treated as 5-bit signed literal 10300 static __inline__ vector unsigned int __ATTRS_o_ai 10301 vec_splat_u32(signed char __a) { 10302 return (vector unsigned int)(__a); 10303 } 10304 10305 /* vec_sr */ 10306 10307 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 10308 // than the length of __a. 10309 static __inline__ vector unsigned char __ATTRS_o_ai 10310 vec_sr(vector unsigned char __a, vector unsigned char __b) { 10311 return __a >> 10312 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 10313 } 10314 10315 static __inline__ vector signed char __ATTRS_o_ai 10316 vec_sr(vector signed char __a, vector unsigned char __b) { 10317 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 10318 } 10319 10320 static __inline__ vector unsigned short __ATTRS_o_ai 10321 vec_sr(vector unsigned short __a, vector unsigned short __b) { 10322 return __a >> 10323 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 10324 } 10325 10326 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 10327 vector unsigned short __b) { 10328 return (vector short)vec_sr((vector unsigned short)__a, __b); 10329 } 10330 10331 static __inline__ vector unsigned int __ATTRS_o_ai 10332 vec_sr(vector unsigned int __a, vector unsigned int __b) { 10333 return __a >> 10334 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 10335 } 10336 10337 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 10338 vector unsigned int __b) { 10339 return (vector int)vec_sr((vector unsigned int)__a, __b); 10340 } 10341 10342 #ifdef __POWER8_VECTOR__ 10343 static __inline__ vector unsigned long long __ATTRS_o_ai 10344 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10345 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 10346 __CHAR_BIT__)); 10347 } 10348 10349 static __inline__ vector long long __ATTRS_o_ai 10350 vec_sr(vector long long __a, vector unsigned long long __b) { 10351 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10352 } 10353 #else 10354 static __inline__ vector unsigned long long __ATTRS_o_ai 10355 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10356 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10357 10358 // Big endian element zero (the left doubleword) can be right shifted as-is. 10359 // However the shift amount must be in the right doubleword. 10360 // The other element needs to be swapped into the left doubleword and 10361 // shifted. Then the left doublewords of the two result vectors are merged. 10362 vector unsigned long long __swapshift = 10363 __builtin_shufflevector(__b, __b, 1, 0); 10364 vector unsigned long long __leftelt = 10365 (vector unsigned long long)__builtin_altivec_vsro( 10366 (vector signed int)__a, (vector signed int)__swapshift); 10367 #ifdef __LITTLE_ENDIAN__ 10368 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10369 (vector signed int)__leftelt, 10370 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0)); 10371 #else 10372 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10373 (vector signed int)__leftelt, 10374 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15)); 10375 #endif 10376 __a = __builtin_shufflevector(__a, __a, 1, 0); 10377 vector unsigned long long __rightelt = 10378 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a, 10379 (vector signed int)__b); 10380 #ifdef __LITTLE_ENDIAN__ 10381 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10382 (vector signed int)__rightelt, 10383 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 10384 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3); 10385 #else 10386 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10387 (vector signed int)__rightelt, 10388 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 10389 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2); 10390 #endif 10391 } 10392 10393 static __inline__ vector long long __ATTRS_o_ai 10394 vec_sr(vector long long __a, vector unsigned long long __b) { 10395 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10396 } 10397 #endif 10398 10399 /* vec_vsrb */ 10400 10401 #define __builtin_altivec_vsrb vec_vsrb 10402 10403 static __inline__ vector signed char __ATTRS_o_ai 10404 vec_vsrb(vector signed char __a, vector unsigned char __b) { 10405 return vec_sr(__a, __b); 10406 } 10407 10408 static __inline__ vector unsigned char __ATTRS_o_ai 10409 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 10410 return vec_sr(__a, __b); 10411 } 10412 10413 /* vec_vsrh */ 10414 10415 #define __builtin_altivec_vsrh vec_vsrh 10416 10417 static __inline__ vector short __ATTRS_o_ai 10418 vec_vsrh(vector short __a, vector unsigned short __b) { 10419 return vec_sr(__a, __b); 10420 } 10421 10422 static __inline__ vector unsigned short __ATTRS_o_ai 10423 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 10424 return vec_sr(__a, __b); 10425 } 10426 10427 /* vec_vsrw */ 10428 10429 #define __builtin_altivec_vsrw vec_vsrw 10430 10431 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 10432 vector unsigned int __b) { 10433 return vec_sr(__a, __b); 10434 } 10435 10436 static __inline__ vector unsigned int __ATTRS_o_ai 10437 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 10438 return vec_sr(__a, __b); 10439 } 10440 10441 /* vec_sra */ 10442 10443 static __inline__ vector signed char __ATTRS_o_ai 10444 vec_sra(vector signed char __a, vector unsigned char __b) { 10445 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10446 } 10447 10448 static __inline__ vector unsigned char __ATTRS_o_ai 10449 vec_sra(vector unsigned char __a, vector unsigned char __b) { 10450 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10451 } 10452 10453 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 10454 vector unsigned short __b) { 10455 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10456 } 10457 10458 static __inline__ vector unsigned short __ATTRS_o_ai 10459 vec_sra(vector unsigned short __a, vector unsigned short __b) { 10460 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10461 } 10462 10463 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 10464 vector unsigned int __b) { 10465 return __builtin_altivec_vsraw(__a, __b); 10466 } 10467 10468 static __inline__ vector unsigned int __ATTRS_o_ai 10469 vec_sra(vector unsigned int __a, vector unsigned int __b) { 10470 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10471 } 10472 10473 #ifdef __POWER8_VECTOR__ 10474 static __inline__ vector signed long long __ATTRS_o_ai 10475 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10476 return __a >> __b; 10477 } 10478 10479 static __inline__ vector unsigned long long __ATTRS_o_ai 10480 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10481 return (vector unsigned long long)((vector signed long long)__a >> __b); 10482 } 10483 #else 10484 static __inline__ vector signed long long __ATTRS_o_ai 10485 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10486 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10487 return __a >> __b; 10488 } 10489 10490 static __inline__ vector unsigned long long __ATTRS_o_ai 10491 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10492 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10493 return (vector unsigned long long)((vector signed long long)__a >> __b); 10494 } 10495 #endif 10496 10497 /* vec_vsrab */ 10498 10499 static __inline__ vector signed char __ATTRS_o_ai 10500 vec_vsrab(vector signed char __a, vector unsigned char __b) { 10501 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10502 } 10503 10504 static __inline__ vector unsigned char __ATTRS_o_ai 10505 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 10506 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10507 } 10508 10509 /* vec_vsrah */ 10510 10511 static __inline__ vector short __ATTRS_o_ai 10512 vec_vsrah(vector short __a, vector unsigned short __b) { 10513 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10514 } 10515 10516 static __inline__ vector unsigned short __ATTRS_o_ai 10517 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 10518 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10519 } 10520 10521 /* vec_vsraw */ 10522 10523 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 10524 vector unsigned int __b) { 10525 return __builtin_altivec_vsraw(__a, __b); 10526 } 10527 10528 static __inline__ vector unsigned int __ATTRS_o_ai 10529 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 10530 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10531 } 10532 10533 /* vec_srl */ 10534 10535 static __inline__ vector signed char __ATTRS_o_ai 10536 vec_srl(vector signed char __a, vector unsigned char __b) { 10537 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10538 (vector int)__b); 10539 } 10540 10541 static __inline__ vector signed char __ATTRS_o_ai 10542 vec_srl(vector signed char __a, vector unsigned short __b) { 10543 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10544 (vector int)__b); 10545 } 10546 10547 static __inline__ vector signed char __ATTRS_o_ai 10548 vec_srl(vector signed char __a, vector unsigned int __b) { 10549 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10550 (vector int)__b); 10551 } 10552 10553 static __inline__ vector unsigned char __ATTRS_o_ai 10554 vec_srl(vector unsigned char __a, vector unsigned char __b) { 10555 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10556 (vector int)__b); 10557 } 10558 10559 static __inline__ vector unsigned char __ATTRS_o_ai 10560 vec_srl(vector unsigned char __a, vector unsigned short __b) { 10561 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10562 (vector int)__b); 10563 } 10564 10565 static __inline__ vector unsigned char __ATTRS_o_ai 10566 vec_srl(vector unsigned char __a, vector unsigned int __b) { 10567 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10568 (vector int)__b); 10569 } 10570 10571 static __inline__ vector bool char __ATTRS_o_ai 10572 vec_srl(vector bool char __a, vector unsigned char __b) { 10573 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10574 (vector int)__b); 10575 } 10576 10577 static __inline__ vector bool char __ATTRS_o_ai 10578 vec_srl(vector bool char __a, vector unsigned short __b) { 10579 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10580 (vector int)__b); 10581 } 10582 10583 static __inline__ vector bool char __ATTRS_o_ai 10584 vec_srl(vector bool char __a, vector unsigned int __b) { 10585 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10586 (vector int)__b); 10587 } 10588 10589 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10590 vector unsigned char __b) { 10591 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10592 } 10593 10594 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10595 vector unsigned short __b) { 10596 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10597 } 10598 10599 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10600 vector unsigned int __b) { 10601 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10602 } 10603 10604 static __inline__ vector unsigned short __ATTRS_o_ai 10605 vec_srl(vector unsigned short __a, vector unsigned char __b) { 10606 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10607 (vector int)__b); 10608 } 10609 10610 static __inline__ vector unsigned short __ATTRS_o_ai 10611 vec_srl(vector unsigned short __a, vector unsigned short __b) { 10612 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10613 (vector int)__b); 10614 } 10615 10616 static __inline__ vector unsigned short __ATTRS_o_ai 10617 vec_srl(vector unsigned short __a, vector unsigned int __b) { 10618 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10619 (vector int)__b); 10620 } 10621 10622 static __inline__ vector bool short __ATTRS_o_ai 10623 vec_srl(vector bool short __a, vector unsigned char __b) { 10624 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10625 (vector int)__b); 10626 } 10627 10628 static __inline__ vector bool short __ATTRS_o_ai 10629 vec_srl(vector bool short __a, vector unsigned short __b) { 10630 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10631 (vector int)__b); 10632 } 10633 10634 static __inline__ vector bool short __ATTRS_o_ai 10635 vec_srl(vector bool short __a, vector unsigned int __b) { 10636 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10637 (vector int)__b); 10638 } 10639 10640 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10641 vector unsigned char __b) { 10642 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10643 } 10644 10645 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10646 vector unsigned short __b) { 10647 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10648 } 10649 10650 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10651 vector unsigned int __b) { 10652 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10653 } 10654 10655 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10656 vector unsigned char __b) { 10657 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10658 } 10659 10660 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10661 vector unsigned short __b) { 10662 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10663 } 10664 10665 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10666 vector unsigned int __b) { 10667 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10668 } 10669 10670 static __inline__ vector unsigned int __ATTRS_o_ai 10671 vec_srl(vector unsigned int __a, vector unsigned char __b) { 10672 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10673 (vector int)__b); 10674 } 10675 10676 static __inline__ vector unsigned int __ATTRS_o_ai 10677 vec_srl(vector unsigned int __a, vector unsigned short __b) { 10678 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10679 (vector int)__b); 10680 } 10681 10682 static __inline__ vector unsigned int __ATTRS_o_ai 10683 vec_srl(vector unsigned int __a, vector unsigned int __b) { 10684 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10685 (vector int)__b); 10686 } 10687 10688 static __inline__ vector bool int __ATTRS_o_ai 10689 vec_srl(vector bool int __a, vector unsigned char __b) { 10690 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10691 (vector int)__b); 10692 } 10693 10694 static __inline__ vector bool int __ATTRS_o_ai 10695 vec_srl(vector bool int __a, vector unsigned short __b) { 10696 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10697 (vector int)__b); 10698 } 10699 10700 static __inline__ vector bool int __ATTRS_o_ai 10701 vec_srl(vector bool int __a, vector unsigned int __b) { 10702 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10703 (vector int)__b); 10704 } 10705 10706 #ifdef __VSX__ 10707 static __inline__ vector signed long long __ATTRS_o_ai 10708 vec_srl(vector signed long long __a, vector unsigned char __b) { 10709 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 10710 (vector int)__b); 10711 } 10712 10713 static __inline__ vector unsigned long long __ATTRS_o_ai 10714 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 10715 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 10716 (vector int)__b); 10717 } 10718 #endif 10719 10720 /* vec_vsr */ 10721 10722 static __inline__ vector signed char __ATTRS_o_ai 10723 vec_vsr(vector signed char __a, vector unsigned char __b) { 10724 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10725 (vector int)__b); 10726 } 10727 10728 static __inline__ vector signed char __ATTRS_o_ai 10729 vec_vsr(vector signed char __a, vector unsigned short __b) { 10730 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10731 (vector int)__b); 10732 } 10733 10734 static __inline__ vector signed char __ATTRS_o_ai 10735 vec_vsr(vector signed char __a, vector unsigned int __b) { 10736 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10737 (vector int)__b); 10738 } 10739 10740 static __inline__ vector unsigned char __ATTRS_o_ai 10741 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 10742 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10743 (vector int)__b); 10744 } 10745 10746 static __inline__ vector unsigned char __ATTRS_o_ai 10747 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 10748 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10749 (vector int)__b); 10750 } 10751 10752 static __inline__ vector unsigned char __ATTRS_o_ai 10753 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 10754 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10755 (vector int)__b); 10756 } 10757 10758 static __inline__ vector bool char __ATTRS_o_ai 10759 vec_vsr(vector bool char __a, vector unsigned char __b) { 10760 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10761 (vector int)__b); 10762 } 10763 10764 static __inline__ vector bool char __ATTRS_o_ai 10765 vec_vsr(vector bool char __a, vector unsigned short __b) { 10766 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10767 (vector int)__b); 10768 } 10769 10770 static __inline__ vector bool char __ATTRS_o_ai 10771 vec_vsr(vector bool char __a, vector unsigned int __b) { 10772 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10773 (vector int)__b); 10774 } 10775 10776 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10777 vector unsigned char __b) { 10778 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10779 } 10780 10781 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10782 vector unsigned short __b) { 10783 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10784 } 10785 10786 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10787 vector unsigned int __b) { 10788 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10789 } 10790 10791 static __inline__ vector unsigned short __ATTRS_o_ai 10792 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 10793 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10794 (vector int)__b); 10795 } 10796 10797 static __inline__ vector unsigned short __ATTRS_o_ai 10798 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 10799 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10800 (vector int)__b); 10801 } 10802 10803 static __inline__ vector unsigned short __ATTRS_o_ai 10804 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 10805 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10806 (vector int)__b); 10807 } 10808 10809 static __inline__ vector bool short __ATTRS_o_ai 10810 vec_vsr(vector bool short __a, vector unsigned char __b) { 10811 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10812 (vector int)__b); 10813 } 10814 10815 static __inline__ vector bool short __ATTRS_o_ai 10816 vec_vsr(vector bool short __a, vector unsigned short __b) { 10817 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10818 (vector int)__b); 10819 } 10820 10821 static __inline__ vector bool short __ATTRS_o_ai 10822 vec_vsr(vector bool short __a, vector unsigned int __b) { 10823 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10824 (vector int)__b); 10825 } 10826 10827 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10828 vector unsigned char __b) { 10829 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10830 } 10831 10832 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10833 vector unsigned short __b) { 10834 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10835 } 10836 10837 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10838 vector unsigned int __b) { 10839 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10840 } 10841 10842 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10843 vector unsigned char __b) { 10844 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10845 } 10846 10847 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10848 vector unsigned short __b) { 10849 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10850 } 10851 10852 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10853 vector unsigned int __b) { 10854 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10855 } 10856 10857 static __inline__ vector unsigned int __ATTRS_o_ai 10858 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10859 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10860 (vector int)__b); 10861 } 10862 10863 static __inline__ vector unsigned int __ATTRS_o_ai 10864 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10865 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10866 (vector int)__b); 10867 } 10868 10869 static __inline__ vector unsigned int __ATTRS_o_ai 10870 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10871 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10872 (vector int)__b); 10873 } 10874 10875 static __inline__ vector bool int __ATTRS_o_ai 10876 vec_vsr(vector bool int __a, vector unsigned char __b) { 10877 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10878 (vector int)__b); 10879 } 10880 10881 static __inline__ vector bool int __ATTRS_o_ai 10882 vec_vsr(vector bool int __a, vector unsigned short __b) { 10883 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10884 (vector int)__b); 10885 } 10886 10887 static __inline__ vector bool int __ATTRS_o_ai 10888 vec_vsr(vector bool int __a, vector unsigned int __b) { 10889 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10890 (vector int)__b); 10891 } 10892 10893 /* vec_sro */ 10894 10895 static __inline__ vector signed char __ATTRS_o_ai 10896 vec_sro(vector signed char __a, vector signed char __b) { 10897 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10898 (vector int)__b); 10899 } 10900 10901 static __inline__ vector signed char __ATTRS_o_ai 10902 vec_sro(vector signed char __a, vector unsigned char __b) { 10903 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10904 (vector int)__b); 10905 } 10906 10907 static __inline__ vector unsigned char __ATTRS_o_ai 10908 vec_sro(vector unsigned char __a, vector signed char __b) { 10909 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10910 (vector int)__b); 10911 } 10912 10913 static __inline__ vector unsigned char __ATTRS_o_ai 10914 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10915 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10916 (vector int)__b); 10917 } 10918 10919 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10920 vector signed char __b) { 10921 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10922 } 10923 10924 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10925 vector unsigned char __b) { 10926 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10927 } 10928 10929 static __inline__ vector unsigned short __ATTRS_o_ai 10930 vec_sro(vector unsigned short __a, vector signed char __b) { 10931 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10932 (vector int)__b); 10933 } 10934 10935 static __inline__ vector unsigned short __ATTRS_o_ai 10936 vec_sro(vector unsigned short __a, vector unsigned char __b) { 10937 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10938 (vector int)__b); 10939 } 10940 10941 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10942 vector signed char __b) { 10943 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10944 } 10945 10946 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10947 vector unsigned char __b) { 10948 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10949 } 10950 10951 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10952 vector signed char __b) { 10953 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10954 } 10955 10956 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10957 vector unsigned char __b) { 10958 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10959 } 10960 10961 static __inline__ vector unsigned int __ATTRS_o_ai 10962 vec_sro(vector unsigned int __a, vector signed char __b) { 10963 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10964 (vector int)__b); 10965 } 10966 10967 static __inline__ vector unsigned int __ATTRS_o_ai 10968 vec_sro(vector unsigned int __a, vector unsigned char __b) { 10969 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10970 (vector int)__b); 10971 } 10972 10973 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10974 vector signed char __b) { 10975 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10976 } 10977 10978 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10979 vector unsigned char __b) { 10980 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10981 } 10982 10983 #ifdef __VSX__ 10984 static __inline__ vector signed long long __ATTRS_o_ai 10985 vec_sro(vector signed long long __a, vector signed char __b) { 10986 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10987 (vector int)__b); 10988 } 10989 10990 static __inline__ vector signed long long __ATTRS_o_ai 10991 vec_sro(vector signed long long __a, vector unsigned char __b) { 10992 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10993 (vector int)__b); 10994 } 10995 10996 static __inline__ vector unsigned long long __ATTRS_o_ai 10997 vec_sro(vector unsigned long long __a, vector signed char __b) { 10998 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10999 (vector int)__b); 11000 } 11001 11002 static __inline__ vector unsigned long long __ATTRS_o_ai 11003 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 11004 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11005 (vector int)__b); 11006 } 11007 #endif 11008 11009 /* vec_vsro */ 11010 11011 static __inline__ vector signed char __ATTRS_o_ai 11012 vec_vsro(vector signed char __a, vector signed char __b) { 11013 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11014 (vector int)__b); 11015 } 11016 11017 static __inline__ vector signed char __ATTRS_o_ai 11018 vec_vsro(vector signed char __a, vector unsigned char __b) { 11019 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11020 (vector int)__b); 11021 } 11022 11023 static __inline__ vector unsigned char __ATTRS_o_ai 11024 vec_vsro(vector unsigned char __a, vector signed char __b) { 11025 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11026 (vector int)__b); 11027 } 11028 11029 static __inline__ vector unsigned char __ATTRS_o_ai 11030 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 11031 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11032 (vector int)__b); 11033 } 11034 11035 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11036 vector signed char __b) { 11037 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11038 } 11039 11040 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11041 vector unsigned char __b) { 11042 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11043 } 11044 11045 static __inline__ vector unsigned short __ATTRS_o_ai 11046 vec_vsro(vector unsigned short __a, vector signed char __b) { 11047 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11048 (vector int)__b); 11049 } 11050 11051 static __inline__ vector unsigned short __ATTRS_o_ai 11052 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 11053 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11054 (vector int)__b); 11055 } 11056 11057 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11058 vector signed char __b) { 11059 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11060 } 11061 11062 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11063 vector unsigned char __b) { 11064 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11065 } 11066 11067 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11068 vector signed char __b) { 11069 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11070 } 11071 11072 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11073 vector unsigned char __b) { 11074 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11075 } 11076 11077 static __inline__ vector unsigned int __ATTRS_o_ai 11078 vec_vsro(vector unsigned int __a, vector signed char __b) { 11079 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11080 (vector int)__b); 11081 } 11082 11083 static __inline__ vector unsigned int __ATTRS_o_ai 11084 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 11085 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11086 (vector int)__b); 11087 } 11088 11089 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11090 vector signed char __b) { 11091 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11092 } 11093 11094 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11095 vector unsigned char __b) { 11096 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11097 } 11098 11099 /* vec_st */ 11100 11101 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11102 vector signed char *__c) { 11103 __builtin_altivec_stvx((vector int)__a, __b, __c); 11104 } 11105 11106 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11107 signed char *__c) { 11108 __builtin_altivec_stvx((vector int)__a, __b, __c); 11109 } 11110 11111 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11112 vector unsigned char *__c) { 11113 __builtin_altivec_stvx((vector int)__a, __b, __c); 11114 } 11115 11116 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11117 unsigned char *__c) { 11118 __builtin_altivec_stvx((vector int)__a, __b, __c); 11119 } 11120 11121 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11122 signed char *__c) { 11123 __builtin_altivec_stvx((vector int)__a, __b, __c); 11124 } 11125 11126 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11127 unsigned char *__c) { 11128 __builtin_altivec_stvx((vector int)__a, __b, __c); 11129 } 11130 11131 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11132 vector bool char *__c) { 11133 __builtin_altivec_stvx((vector int)__a, __b, __c); 11134 } 11135 11136 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11137 vector short *__c) { 11138 __builtin_altivec_stvx((vector int)__a, __b, __c); 11139 } 11140 11141 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11142 short *__c) { 11143 __builtin_altivec_stvx((vector int)__a, __b, __c); 11144 } 11145 11146 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11147 vector unsigned short *__c) { 11148 __builtin_altivec_stvx((vector int)__a, __b, __c); 11149 } 11150 11151 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11152 unsigned short *__c) { 11153 __builtin_altivec_stvx((vector int)__a, __b, __c); 11154 } 11155 11156 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11157 short *__c) { 11158 __builtin_altivec_stvx((vector int)__a, __b, __c); 11159 } 11160 11161 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11162 unsigned short *__c) { 11163 __builtin_altivec_stvx((vector int)__a, __b, __c); 11164 } 11165 11166 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11167 vector bool short *__c) { 11168 __builtin_altivec_stvx((vector int)__a, __b, __c); 11169 } 11170 11171 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11172 short *__c) { 11173 __builtin_altivec_stvx((vector int)__a, __b, __c); 11174 } 11175 11176 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11177 unsigned short *__c) { 11178 __builtin_altivec_stvx((vector int)__a, __b, __c); 11179 } 11180 11181 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11182 vector pixel *__c) { 11183 __builtin_altivec_stvx((vector int)__a, __b, __c); 11184 } 11185 11186 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, 11187 vector int *__c) { 11188 __builtin_altivec_stvx(__a, __b, __c); 11189 } 11190 11191 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) { 11192 __builtin_altivec_stvx(__a, __b, __c); 11193 } 11194 11195 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11196 vector unsigned int *__c) { 11197 __builtin_altivec_stvx((vector int)__a, __b, __c); 11198 } 11199 11200 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11201 unsigned int *__c) { 11202 __builtin_altivec_stvx((vector int)__a, __b, __c); 11203 } 11204 11205 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11206 int *__c) { 11207 __builtin_altivec_stvx((vector int)__a, __b, __c); 11208 } 11209 11210 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11211 unsigned int *__c) { 11212 __builtin_altivec_stvx((vector int)__a, __b, __c); 11213 } 11214 11215 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11216 vector bool int *__c) { 11217 __builtin_altivec_stvx((vector int)__a, __b, __c); 11218 } 11219 11220 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11221 vector float *__c) { 11222 __builtin_altivec_stvx((vector int)__a, __b, __c); 11223 } 11224 11225 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11226 float *__c) { 11227 __builtin_altivec_stvx((vector int)__a, __b, __c); 11228 } 11229 11230 /* vec_stvx */ 11231 11232 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11233 vector signed char *__c) { 11234 __builtin_altivec_stvx((vector int)__a, __b, __c); 11235 } 11236 11237 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11238 signed char *__c) { 11239 __builtin_altivec_stvx((vector int)__a, __b, __c); 11240 } 11241 11242 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11243 vector unsigned char *__c) { 11244 __builtin_altivec_stvx((vector int)__a, __b, __c); 11245 } 11246 11247 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11248 unsigned char *__c) { 11249 __builtin_altivec_stvx((vector int)__a, __b, __c); 11250 } 11251 11252 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11253 signed char *__c) { 11254 __builtin_altivec_stvx((vector int)__a, __b, __c); 11255 } 11256 11257 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11258 unsigned char *__c) { 11259 __builtin_altivec_stvx((vector int)__a, __b, __c); 11260 } 11261 11262 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11263 vector bool char *__c) { 11264 __builtin_altivec_stvx((vector int)__a, __b, __c); 11265 } 11266 11267 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11268 vector short *__c) { 11269 __builtin_altivec_stvx((vector int)__a, __b, __c); 11270 } 11271 11272 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11273 short *__c) { 11274 __builtin_altivec_stvx((vector int)__a, __b, __c); 11275 } 11276 11277 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11278 vector unsigned short *__c) { 11279 __builtin_altivec_stvx((vector int)__a, __b, __c); 11280 } 11281 11282 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11283 unsigned short *__c) { 11284 __builtin_altivec_stvx((vector int)__a, __b, __c); 11285 } 11286 11287 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11288 short *__c) { 11289 __builtin_altivec_stvx((vector int)__a, __b, __c); 11290 } 11291 11292 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11293 unsigned short *__c) { 11294 __builtin_altivec_stvx((vector int)__a, __b, __c); 11295 } 11296 11297 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11298 vector bool short *__c) { 11299 __builtin_altivec_stvx((vector int)__a, __b, __c); 11300 } 11301 11302 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11303 short *__c) { 11304 __builtin_altivec_stvx((vector int)__a, __b, __c); 11305 } 11306 11307 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11308 unsigned short *__c) { 11309 __builtin_altivec_stvx((vector int)__a, __b, __c); 11310 } 11311 11312 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11313 vector pixel *__c) { 11314 __builtin_altivec_stvx((vector int)__a, __b, __c); 11315 } 11316 11317 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11318 vector int *__c) { 11319 __builtin_altivec_stvx(__a, __b, __c); 11320 } 11321 11322 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11323 int *__c) { 11324 __builtin_altivec_stvx(__a, __b, __c); 11325 } 11326 11327 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11328 vector unsigned int *__c) { 11329 __builtin_altivec_stvx((vector int)__a, __b, __c); 11330 } 11331 11332 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11333 unsigned int *__c) { 11334 __builtin_altivec_stvx((vector int)__a, __b, __c); 11335 } 11336 11337 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11338 int *__c) { 11339 __builtin_altivec_stvx((vector int)__a, __b, __c); 11340 } 11341 11342 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11343 unsigned int *__c) { 11344 __builtin_altivec_stvx((vector int)__a, __b, __c); 11345 } 11346 11347 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11348 vector bool int *__c) { 11349 __builtin_altivec_stvx((vector int)__a, __b, __c); 11350 } 11351 11352 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11353 vector float *__c) { 11354 __builtin_altivec_stvx((vector int)__a, __b, __c); 11355 } 11356 11357 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11358 float *__c) { 11359 __builtin_altivec_stvx((vector int)__a, __b, __c); 11360 } 11361 11362 /* vec_ste */ 11363 11364 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, 11365 signed char *__c) { 11366 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11367 } 11368 11369 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b, 11370 unsigned char *__c) { 11371 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11372 } 11373 11374 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11375 signed char *__c) { 11376 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11377 } 11378 11379 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11380 unsigned char *__c) { 11381 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11382 } 11383 11384 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b, 11385 short *__c) { 11386 __builtin_altivec_stvehx(__a, __b, __c); 11387 } 11388 11389 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b, 11390 unsigned short *__c) { 11391 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11392 } 11393 11394 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11395 short *__c) { 11396 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11397 } 11398 11399 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11400 unsigned short *__c) { 11401 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11402 } 11403 11404 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11405 short *__c) { 11406 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11407 } 11408 11409 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11410 unsigned short *__c) { 11411 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11412 } 11413 11414 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) { 11415 __builtin_altivec_stvewx(__a, __b, __c); 11416 } 11417 11418 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b, 11419 unsigned int *__c) { 11420 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11421 } 11422 11423 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11424 int *__c) { 11425 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11426 } 11427 11428 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11429 unsigned int *__c) { 11430 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11431 } 11432 11433 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b, 11434 float *__c) { 11435 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11436 } 11437 11438 /* vec_stvebx */ 11439 11440 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, 11441 signed char *__c) { 11442 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11443 } 11444 11445 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 11446 long __b, unsigned char *__c) { 11447 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11448 } 11449 11450 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11451 signed char *__c) { 11452 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11453 } 11454 11455 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11456 unsigned char *__c) { 11457 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11458 } 11459 11460 /* vec_stvehx */ 11461 11462 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, 11463 short *__c) { 11464 __builtin_altivec_stvehx(__a, __b, __c); 11465 } 11466 11467 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 11468 long __b, unsigned short *__c) { 11469 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11470 } 11471 11472 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11473 short *__c) { 11474 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11475 } 11476 11477 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11478 unsigned short *__c) { 11479 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11480 } 11481 11482 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11483 short *__c) { 11484 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11485 } 11486 11487 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11488 unsigned short *__c) { 11489 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11490 } 11491 11492 /* vec_stvewx */ 11493 11494 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, 11495 int *__c) { 11496 __builtin_altivec_stvewx(__a, __b, __c); 11497 } 11498 11499 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b, 11500 unsigned int *__c) { 11501 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11502 } 11503 11504 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11505 int *__c) { 11506 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11507 } 11508 11509 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11510 unsigned int *__c) { 11511 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11512 } 11513 11514 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b, 11515 float *__c) { 11516 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11517 } 11518 11519 /* vec_stl */ 11520 11521 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11522 vector signed char *__c) { 11523 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11524 } 11525 11526 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11527 signed char *__c) { 11528 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11529 } 11530 11531 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11532 vector unsigned char *__c) { 11533 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11534 } 11535 11536 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11537 unsigned char *__c) { 11538 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11539 } 11540 11541 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11542 signed char *__c) { 11543 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11544 } 11545 11546 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11547 unsigned char *__c) { 11548 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11549 } 11550 11551 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11552 vector bool char *__c) { 11553 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11554 } 11555 11556 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11557 vector short *__c) { 11558 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11559 } 11560 11561 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11562 short *__c) { 11563 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11564 } 11565 11566 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11567 vector unsigned short *__c) { 11568 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11569 } 11570 11571 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11572 unsigned short *__c) { 11573 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11574 } 11575 11576 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11577 short *__c) { 11578 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11579 } 11580 11581 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11582 unsigned short *__c) { 11583 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11584 } 11585 11586 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11587 vector bool short *__c) { 11588 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11589 } 11590 11591 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11592 short *__c) { 11593 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11594 } 11595 11596 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11597 unsigned short *__c) { 11598 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11599 } 11600 11601 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11602 vector pixel *__c) { 11603 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11604 } 11605 11606 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 11607 vector int *__c) { 11608 __builtin_altivec_stvxl(__a, __b, __c); 11609 } 11610 11611 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 11612 __builtin_altivec_stvxl(__a, __b, __c); 11613 } 11614 11615 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11616 vector unsigned int *__c) { 11617 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11618 } 11619 11620 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11621 unsigned int *__c) { 11622 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11623 } 11624 11625 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11626 int *__c) { 11627 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11628 } 11629 11630 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11631 unsigned int *__c) { 11632 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11633 } 11634 11635 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11636 vector bool int *__c) { 11637 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11638 } 11639 11640 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11641 vector float *__c) { 11642 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11643 } 11644 11645 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11646 float *__c) { 11647 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11648 } 11649 11650 /* vec_stvxl */ 11651 11652 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11653 vector signed char *__c) { 11654 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11655 } 11656 11657 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11658 signed char *__c) { 11659 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11660 } 11661 11662 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11663 vector unsigned char *__c) { 11664 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11665 } 11666 11667 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11668 unsigned char *__c) { 11669 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11670 } 11671 11672 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11673 signed char *__c) { 11674 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11675 } 11676 11677 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11678 unsigned char *__c) { 11679 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11680 } 11681 11682 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11683 vector bool char *__c) { 11684 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11685 } 11686 11687 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11688 vector short *__c) { 11689 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11690 } 11691 11692 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11693 short *__c) { 11694 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11695 } 11696 11697 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11698 int __b, 11699 vector unsigned short *__c) { 11700 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11701 } 11702 11703 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11704 int __b, unsigned short *__c) { 11705 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11706 } 11707 11708 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11709 short *__c) { 11710 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11711 } 11712 11713 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11714 unsigned short *__c) { 11715 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11716 } 11717 11718 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11719 vector bool short *__c) { 11720 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11721 } 11722 11723 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11724 short *__c) { 11725 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11726 } 11727 11728 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11729 unsigned short *__c) { 11730 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11731 } 11732 11733 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11734 vector pixel *__c) { 11735 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11736 } 11737 11738 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11739 vector int *__c) { 11740 __builtin_altivec_stvxl(__a, __b, __c); 11741 } 11742 11743 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11744 int *__c) { 11745 __builtin_altivec_stvxl(__a, __b, __c); 11746 } 11747 11748 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11749 vector unsigned int *__c) { 11750 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11751 } 11752 11753 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11754 unsigned int *__c) { 11755 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11756 } 11757 11758 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11759 int *__c) { 11760 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11761 } 11762 11763 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11764 unsigned int *__c) { 11765 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11766 } 11767 11768 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11769 vector bool int *__c) { 11770 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11771 } 11772 11773 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11774 vector float *__c) { 11775 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11776 } 11777 11778 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11779 float *__c) { 11780 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11781 } 11782 11783 /* vec_sub */ 11784 11785 static __inline__ vector signed char __ATTRS_o_ai 11786 vec_sub(vector signed char __a, vector signed char __b) { 11787 return __a - __b; 11788 } 11789 11790 static __inline__ vector signed char __ATTRS_o_ai 11791 vec_sub(vector bool char __a, vector signed char __b) { 11792 return (vector signed char)__a - __b; 11793 } 11794 11795 static __inline__ vector signed char __ATTRS_o_ai 11796 vec_sub(vector signed char __a, vector bool char __b) { 11797 return __a - (vector signed char)__b; 11798 } 11799 11800 static __inline__ vector unsigned char __ATTRS_o_ai 11801 vec_sub(vector unsigned char __a, vector unsigned char __b) { 11802 return __a - __b; 11803 } 11804 11805 static __inline__ vector unsigned char __ATTRS_o_ai 11806 vec_sub(vector bool char __a, vector unsigned char __b) { 11807 return (vector unsigned char)__a - __b; 11808 } 11809 11810 static __inline__ vector unsigned char __ATTRS_o_ai 11811 vec_sub(vector unsigned char __a, vector bool char __b) { 11812 return __a - (vector unsigned char)__b; 11813 } 11814 11815 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11816 vector short __b) { 11817 return __a - __b; 11818 } 11819 11820 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 11821 vector short __b) { 11822 return (vector short)__a - __b; 11823 } 11824 11825 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11826 vector bool short __b) { 11827 return __a - (vector short)__b; 11828 } 11829 11830 static __inline__ vector unsigned short __ATTRS_o_ai 11831 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11832 return __a - __b; 11833 } 11834 11835 static __inline__ vector unsigned short __ATTRS_o_ai 11836 vec_sub(vector bool short __a, vector unsigned short __b) { 11837 return (vector unsigned short)__a - __b; 11838 } 11839 11840 static __inline__ vector unsigned short __ATTRS_o_ai 11841 vec_sub(vector unsigned short __a, vector bool short __b) { 11842 return __a - (vector unsigned short)__b; 11843 } 11844 11845 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11846 vector int __b) { 11847 return __a - __b; 11848 } 11849 11850 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11851 vector int __b) { 11852 return (vector int)__a - __b; 11853 } 11854 11855 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11856 vector bool int __b) { 11857 return __a - (vector int)__b; 11858 } 11859 11860 static __inline__ vector unsigned int __ATTRS_o_ai 11861 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11862 return __a - __b; 11863 } 11864 11865 static __inline__ vector unsigned int __ATTRS_o_ai 11866 vec_sub(vector bool int __a, vector unsigned int __b) { 11867 return (vector unsigned int)__a - __b; 11868 } 11869 11870 static __inline__ vector unsigned int __ATTRS_o_ai 11871 vec_sub(vector unsigned int __a, vector bool int __b) { 11872 return __a - (vector unsigned int)__b; 11873 } 11874 11875 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 11876 defined(__SIZEOF_INT128__) 11877 static __inline__ vector signed __int128 __ATTRS_o_ai 11878 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11879 return __a - __b; 11880 } 11881 11882 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11883 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11884 return __a - __b; 11885 } 11886 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) && 11887 // defined(__SIZEOF_INT128__) 11888 11889 #ifdef __VSX__ 11890 static __inline__ vector signed long long __ATTRS_o_ai 11891 vec_sub(vector signed long long __a, vector signed long long __b) { 11892 return __a - __b; 11893 } 11894 11895 static __inline__ vector unsigned long long __ATTRS_o_ai 11896 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11897 return __a - __b; 11898 } 11899 11900 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11901 vector double __b) { 11902 return __a - __b; 11903 } 11904 #endif 11905 11906 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11907 vector float __b) { 11908 return __a - __b; 11909 } 11910 11911 /* vec_vsububm */ 11912 11913 #define __builtin_altivec_vsububm vec_vsububm 11914 11915 static __inline__ vector signed char __ATTRS_o_ai 11916 vec_vsububm(vector signed char __a, vector signed char __b) { 11917 return __a - __b; 11918 } 11919 11920 static __inline__ vector signed char __ATTRS_o_ai 11921 vec_vsububm(vector bool char __a, vector signed char __b) { 11922 return (vector signed char)__a - __b; 11923 } 11924 11925 static __inline__ vector signed char __ATTRS_o_ai 11926 vec_vsububm(vector signed char __a, vector bool char __b) { 11927 return __a - (vector signed char)__b; 11928 } 11929 11930 static __inline__ vector unsigned char __ATTRS_o_ai 11931 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 11932 return __a - __b; 11933 } 11934 11935 static __inline__ vector unsigned char __ATTRS_o_ai 11936 vec_vsububm(vector bool char __a, vector unsigned char __b) { 11937 return (vector unsigned char)__a - __b; 11938 } 11939 11940 static __inline__ vector unsigned char __ATTRS_o_ai 11941 vec_vsububm(vector unsigned char __a, vector bool char __b) { 11942 return __a - (vector unsigned char)__b; 11943 } 11944 11945 /* vec_vsubuhm */ 11946 11947 #define __builtin_altivec_vsubuhm vec_vsubuhm 11948 11949 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11950 vector short __b) { 11951 return __a - __b; 11952 } 11953 11954 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 11955 vector short __b) { 11956 return (vector short)__a - __b; 11957 } 11958 11959 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11960 vector bool short __b) { 11961 return __a - (vector short)__b; 11962 } 11963 11964 static __inline__ vector unsigned short __ATTRS_o_ai 11965 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 11966 return __a - __b; 11967 } 11968 11969 static __inline__ vector unsigned short __ATTRS_o_ai 11970 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 11971 return (vector unsigned short)__a - __b; 11972 } 11973 11974 static __inline__ vector unsigned short __ATTRS_o_ai 11975 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 11976 return __a - (vector unsigned short)__b; 11977 } 11978 11979 /* vec_vsubuwm */ 11980 11981 #define __builtin_altivec_vsubuwm vec_vsubuwm 11982 11983 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11984 vector int __b) { 11985 return __a - __b; 11986 } 11987 11988 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 11989 vector int __b) { 11990 return (vector int)__a - __b; 11991 } 11992 11993 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11994 vector bool int __b) { 11995 return __a - (vector int)__b; 11996 } 11997 11998 static __inline__ vector unsigned int __ATTRS_o_ai 11999 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 12000 return __a - __b; 12001 } 12002 12003 static __inline__ vector unsigned int __ATTRS_o_ai 12004 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 12005 return (vector unsigned int)__a - __b; 12006 } 12007 12008 static __inline__ vector unsigned int __ATTRS_o_ai 12009 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 12010 return __a - (vector unsigned int)__b; 12011 } 12012 12013 /* vec_vsubfp */ 12014 12015 #define __builtin_altivec_vsubfp vec_vsubfp 12016 12017 static __inline__ vector float __attribute__((__always_inline__)) 12018 vec_vsubfp(vector float __a, vector float __b) { 12019 return __a - __b; 12020 } 12021 12022 /* vec_subc */ 12023 12024 static __inline__ vector signed int __ATTRS_o_ai 12025 vec_subc(vector signed int __a, vector signed int __b) { 12026 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 12027 (vector unsigned int) __b); 12028 } 12029 12030 static __inline__ vector unsigned int __ATTRS_o_ai 12031 vec_subc(vector unsigned int __a, vector unsigned int __b) { 12032 return __builtin_altivec_vsubcuw(__a, __b); 12033 } 12034 12035 #ifdef __POWER8_VECTOR__ 12036 #ifdef __SIZEOF_INT128__ 12037 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12038 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12039 return __builtin_altivec_vsubcuq(__a, __b); 12040 } 12041 12042 static __inline__ vector signed __int128 __ATTRS_o_ai 12043 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 12044 return __builtin_altivec_vsubcuq(__a, __b); 12045 } 12046 #endif 12047 12048 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12049 vec_subc_u128(vector unsigned char __a, vector unsigned char __b) { 12050 return (vector unsigned char)__builtin_altivec_vsubcuq(__a, __b); 12051 } 12052 #endif // __POWER8_VECTOR__ 12053 12054 /* vec_vsubcuw */ 12055 12056 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12057 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 12058 return __builtin_altivec_vsubcuw(__a, __b); 12059 } 12060 12061 /* vec_subs */ 12062 12063 static __inline__ vector signed char __ATTRS_o_ai 12064 vec_subs(vector signed char __a, vector signed char __b) { 12065 return __builtin_altivec_vsubsbs(__a, __b); 12066 } 12067 12068 static __inline__ vector signed char __ATTRS_o_ai 12069 vec_subs(vector bool char __a, vector signed char __b) { 12070 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12071 } 12072 12073 static __inline__ vector signed char __ATTRS_o_ai 12074 vec_subs(vector signed char __a, vector bool char __b) { 12075 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12076 } 12077 12078 static __inline__ vector unsigned char __ATTRS_o_ai 12079 vec_subs(vector unsigned char __a, vector unsigned char __b) { 12080 return __builtin_altivec_vsububs(__a, __b); 12081 } 12082 12083 static __inline__ vector unsigned char __ATTRS_o_ai 12084 vec_subs(vector bool char __a, vector unsigned char __b) { 12085 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12086 } 12087 12088 static __inline__ vector unsigned char __ATTRS_o_ai 12089 vec_subs(vector unsigned char __a, vector bool char __b) { 12090 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12091 } 12092 12093 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12094 vector short __b) { 12095 return __builtin_altivec_vsubshs(__a, __b); 12096 } 12097 12098 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 12099 vector short __b) { 12100 return __builtin_altivec_vsubshs((vector short)__a, __b); 12101 } 12102 12103 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12104 vector bool short __b) { 12105 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12106 } 12107 12108 static __inline__ vector unsigned short __ATTRS_o_ai 12109 vec_subs(vector unsigned short __a, vector unsigned short __b) { 12110 return __builtin_altivec_vsubuhs(__a, __b); 12111 } 12112 12113 static __inline__ vector unsigned short __ATTRS_o_ai 12114 vec_subs(vector bool short __a, vector unsigned short __b) { 12115 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12116 } 12117 12118 static __inline__ vector unsigned short __ATTRS_o_ai 12119 vec_subs(vector unsigned short __a, vector bool short __b) { 12120 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12121 } 12122 12123 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12124 vector int __b) { 12125 return __builtin_altivec_vsubsws(__a, __b); 12126 } 12127 12128 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 12129 vector int __b) { 12130 return __builtin_altivec_vsubsws((vector int)__a, __b); 12131 } 12132 12133 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12134 vector bool int __b) { 12135 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12136 } 12137 12138 static __inline__ vector unsigned int __ATTRS_o_ai 12139 vec_subs(vector unsigned int __a, vector unsigned int __b) { 12140 return __builtin_altivec_vsubuws(__a, __b); 12141 } 12142 12143 static __inline__ vector unsigned int __ATTRS_o_ai 12144 vec_subs(vector bool int __a, vector unsigned int __b) { 12145 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12146 } 12147 12148 static __inline__ vector unsigned int __ATTRS_o_ai 12149 vec_subs(vector unsigned int __a, vector bool int __b) { 12150 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12151 } 12152 12153 /* vec_vsubsbs */ 12154 12155 static __inline__ vector signed char __ATTRS_o_ai 12156 vec_vsubsbs(vector signed char __a, vector signed char __b) { 12157 return __builtin_altivec_vsubsbs(__a, __b); 12158 } 12159 12160 static __inline__ vector signed char __ATTRS_o_ai 12161 vec_vsubsbs(vector bool char __a, vector signed char __b) { 12162 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12163 } 12164 12165 static __inline__ vector signed char __ATTRS_o_ai 12166 vec_vsubsbs(vector signed char __a, vector bool char __b) { 12167 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12168 } 12169 12170 /* vec_vsububs */ 12171 12172 static __inline__ vector unsigned char __ATTRS_o_ai 12173 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 12174 return __builtin_altivec_vsububs(__a, __b); 12175 } 12176 12177 static __inline__ vector unsigned char __ATTRS_o_ai 12178 vec_vsububs(vector bool char __a, vector unsigned char __b) { 12179 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12180 } 12181 12182 static __inline__ vector unsigned char __ATTRS_o_ai 12183 vec_vsububs(vector unsigned char __a, vector bool char __b) { 12184 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12185 } 12186 12187 /* vec_vsubshs */ 12188 12189 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12190 vector short __b) { 12191 return __builtin_altivec_vsubshs(__a, __b); 12192 } 12193 12194 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 12195 vector short __b) { 12196 return __builtin_altivec_vsubshs((vector short)__a, __b); 12197 } 12198 12199 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12200 vector bool short __b) { 12201 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12202 } 12203 12204 /* vec_vsubuhs */ 12205 12206 static __inline__ vector unsigned short __ATTRS_o_ai 12207 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 12208 return __builtin_altivec_vsubuhs(__a, __b); 12209 } 12210 12211 static __inline__ vector unsigned short __ATTRS_o_ai 12212 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 12213 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12214 } 12215 12216 static __inline__ vector unsigned short __ATTRS_o_ai 12217 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 12218 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12219 } 12220 12221 /* vec_vsubsws */ 12222 12223 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12224 vector int __b) { 12225 return __builtin_altivec_vsubsws(__a, __b); 12226 } 12227 12228 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 12229 vector int __b) { 12230 return __builtin_altivec_vsubsws((vector int)__a, __b); 12231 } 12232 12233 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12234 vector bool int __b) { 12235 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12236 } 12237 12238 /* vec_vsubuws */ 12239 12240 static __inline__ vector unsigned int __ATTRS_o_ai 12241 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 12242 return __builtin_altivec_vsubuws(__a, __b); 12243 } 12244 12245 static __inline__ vector unsigned int __ATTRS_o_ai 12246 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 12247 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12248 } 12249 12250 static __inline__ vector unsigned int __ATTRS_o_ai 12251 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 12252 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12253 } 12254 12255 #ifdef __POWER8_VECTOR__ 12256 /* vec_vsubuqm */ 12257 12258 #ifdef __SIZEOF_INT128__ 12259 static __inline__ vector signed __int128 __ATTRS_o_ai 12260 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 12261 return __a - __b; 12262 } 12263 12264 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12265 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12266 return __a - __b; 12267 } 12268 #endif 12269 12270 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12271 vec_sub_u128(vector unsigned char __a, vector unsigned char __b) { 12272 return __builtin_altivec_vsubuqm(__a, __b); 12273 } 12274 12275 /* vec_vsubeuqm */ 12276 12277 #ifdef __SIZEOF_INT128__ 12278 static __inline__ vector signed __int128 __ATTRS_o_ai 12279 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 12280 vector signed __int128 __c) { 12281 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12282 } 12283 12284 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12285 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 12286 vector unsigned __int128 __c) { 12287 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12288 } 12289 12290 static __inline__ vector signed __int128 __ATTRS_o_ai 12291 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 12292 vector signed __int128 __c) { 12293 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12294 } 12295 12296 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12297 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 12298 vector unsigned __int128 __c) { 12299 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12300 } 12301 #endif 12302 12303 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12304 vec_sube_u128(vector unsigned char __a, vector unsigned char __b, 12305 vector unsigned char __c) { 12306 return (vector unsigned char)__builtin_altivec_vsubeuqm(__a, __b, __c); 12307 } 12308 12309 /* vec_vsubcuq */ 12310 12311 #ifdef __SIZEOF_INT128__ 12312 static __inline__ vector signed __int128 __ATTRS_o_ai 12313 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 12314 return __builtin_altivec_vsubcuq(__a, __b); 12315 } 12316 12317 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12318 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12319 return __builtin_altivec_vsubcuq(__a, __b); 12320 } 12321 12322 /* vec_vsubecuq */ 12323 12324 static __inline__ vector signed __int128 __ATTRS_o_ai 12325 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 12326 vector signed __int128 __c) { 12327 return __builtin_altivec_vsubecuq(__a, __b, __c); 12328 } 12329 12330 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12331 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 12332 vector unsigned __int128 __c) { 12333 return __builtin_altivec_vsubecuq(__a, __b, __c); 12334 } 12335 #endif 12336 12337 #ifdef __powerpc64__ 12338 static __inline__ vector signed int __ATTRS_o_ai 12339 vec_subec(vector signed int __a, vector signed int __b, 12340 vector signed int __c) { 12341 return vec_addec(__a, ~__b, __c); 12342 } 12343 12344 static __inline__ vector unsigned int __ATTRS_o_ai 12345 vec_subec(vector unsigned int __a, vector unsigned int __b, 12346 vector unsigned int __c) { 12347 return vec_addec(__a, ~__b, __c); 12348 } 12349 #endif 12350 12351 #ifdef __SIZEOF_INT128__ 12352 static __inline__ vector signed __int128 __ATTRS_o_ai 12353 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 12354 vector signed __int128 __c) { 12355 return __builtin_altivec_vsubecuq(__a, __b, __c); 12356 } 12357 12358 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12359 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 12360 vector unsigned __int128 __c) { 12361 return __builtin_altivec_vsubecuq(__a, __b, __c); 12362 } 12363 #endif 12364 12365 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12366 vec_subec_u128(vector unsigned char __a, vector unsigned char __b, 12367 vector unsigned char __c) { 12368 return (vector unsigned char)__builtin_altivec_vsubecuq(__a, __b, __c); 12369 } 12370 #endif // __POWER8_VECTOR__ 12371 12372 static __inline__ vector signed int __ATTRS_o_ai 12373 vec_sube(vector signed int __a, vector signed int __b, 12374 vector signed int __c) { 12375 vector signed int __mask = {1, 1, 1, 1}; 12376 vector signed int __carry = __c & __mask; 12377 return vec_adde(__a, ~__b, __carry); 12378 } 12379 12380 static __inline__ vector unsigned int __ATTRS_o_ai 12381 vec_sube(vector unsigned int __a, vector unsigned int __b, 12382 vector unsigned int __c) { 12383 vector unsigned int __mask = {1, 1, 1, 1}; 12384 vector unsigned int __carry = __c & __mask; 12385 return vec_adde(__a, ~__b, __carry); 12386 } 12387 /* vec_sum4s */ 12388 12389 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 12390 vector int __b) { 12391 return __builtin_altivec_vsum4sbs(__a, __b); 12392 } 12393 12394 static __inline__ vector unsigned int __ATTRS_o_ai 12395 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 12396 return __builtin_altivec_vsum4ubs(__a, __b); 12397 } 12398 12399 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 12400 vector int __b) { 12401 return __builtin_altivec_vsum4shs(__a, __b); 12402 } 12403 12404 /* vec_vsum4sbs */ 12405 12406 static __inline__ vector int __attribute__((__always_inline__)) 12407 vec_vsum4sbs(vector signed char __a, vector int __b) { 12408 return __builtin_altivec_vsum4sbs(__a, __b); 12409 } 12410 12411 /* vec_vsum4ubs */ 12412 12413 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12414 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 12415 return __builtin_altivec_vsum4ubs(__a, __b); 12416 } 12417 12418 /* vec_vsum4shs */ 12419 12420 static __inline__ vector int __attribute__((__always_inline__)) 12421 vec_vsum4shs(vector signed short __a, vector int __b) { 12422 return __builtin_altivec_vsum4shs(__a, __b); 12423 } 12424 12425 /* vec_sum2s */ 12426 12427 /* The vsum2sws instruction has a big-endian bias, so that the second 12428 input vector and the result always reference big-endian elements 12429 1 and 3 (little-endian element 0 and 2). For ease of porting the 12430 programmer wants elements 1 and 3 in both cases, so for little 12431 endian we must perform some permutes. */ 12432 12433 static __inline__ vector signed int __attribute__((__always_inline__)) 12434 vec_sum2s(vector int __a, vector int __b) { 12435 #ifdef __LITTLE_ENDIAN__ 12436 vector int __c = (vector signed int)vec_perm( 12437 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12438 8, 9, 10, 11)); 12439 __c = __builtin_altivec_vsum2sws(__a, __c); 12440 return (vector signed int)vec_perm( 12441 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12442 8, 9, 10, 11)); 12443 #else 12444 return __builtin_altivec_vsum2sws(__a, __b); 12445 #endif 12446 } 12447 12448 /* vec_vsum2sws */ 12449 12450 static __inline__ vector signed int __attribute__((__always_inline__)) 12451 vec_vsum2sws(vector int __a, vector int __b) { 12452 #ifdef __LITTLE_ENDIAN__ 12453 vector int __c = (vector signed int)vec_perm( 12454 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12455 8, 9, 10, 11)); 12456 __c = __builtin_altivec_vsum2sws(__a, __c); 12457 return (vector signed int)vec_perm( 12458 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12459 8, 9, 10, 11)); 12460 #else 12461 return __builtin_altivec_vsum2sws(__a, __b); 12462 #endif 12463 } 12464 12465 /* vec_sums */ 12466 12467 /* The vsumsws instruction has a big-endian bias, so that the second 12468 input vector and the result always reference big-endian element 3 12469 (little-endian element 0). For ease of porting the programmer 12470 wants element 3 in both cases, so for little endian we must perform 12471 some permutes. */ 12472 12473 static __inline__ vector signed int __attribute__((__always_inline__)) 12474 vec_sums(vector signed int __a, vector signed int __b) { 12475 #ifdef __LITTLE_ENDIAN__ 12476 __b = (vector signed int)vec_splat(__b, 3); 12477 __b = __builtin_altivec_vsumsws(__a, __b); 12478 return (vector signed int)(0, 0, 0, __b[0]); 12479 #else 12480 return __builtin_altivec_vsumsws(__a, __b); 12481 #endif 12482 } 12483 12484 /* vec_vsumsws */ 12485 12486 static __inline__ vector signed int __attribute__((__always_inline__)) 12487 vec_vsumsws(vector signed int __a, vector signed int __b) { 12488 #ifdef __LITTLE_ENDIAN__ 12489 __b = (vector signed int)vec_splat(__b, 3); 12490 __b = __builtin_altivec_vsumsws(__a, __b); 12491 return (vector signed int)(0, 0, 0, __b[0]); 12492 #else 12493 return __builtin_altivec_vsumsws(__a, __b); 12494 #endif 12495 } 12496 12497 /* vec_trunc */ 12498 12499 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 12500 #ifdef __VSX__ 12501 return __builtin_vsx_xvrspiz(__a); 12502 #else 12503 return __builtin_altivec_vrfiz(__a); 12504 #endif 12505 } 12506 12507 #ifdef __VSX__ 12508 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 12509 return __builtin_vsx_xvrdpiz(__a); 12510 } 12511 #endif 12512 12513 /* vec_roundz */ 12514 static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) { 12515 return vec_trunc(__a); 12516 } 12517 12518 #ifdef __VSX__ 12519 static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) { 12520 return vec_trunc(__a); 12521 } 12522 #endif 12523 12524 /* vec_vrfiz */ 12525 12526 static __inline__ vector float __attribute__((__always_inline__)) 12527 vec_vrfiz(vector float __a) { 12528 return __builtin_altivec_vrfiz(__a); 12529 } 12530 12531 /* vec_unpackh */ 12532 12533 /* The vector unpack instructions all have a big-endian bias, so for 12534 little endian we must reverse the meanings of "high" and "low." */ 12535 #ifdef __LITTLE_ENDIAN__ 12536 #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12537 #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12538 #else 12539 #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12540 #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12541 #endif 12542 12543 static __inline__ vector short __ATTRS_o_ai 12544 vec_unpackh(vector signed char __a) { 12545 #ifdef __LITTLE_ENDIAN__ 12546 return __builtin_altivec_vupklsb((vector char)__a); 12547 #else 12548 return __builtin_altivec_vupkhsb((vector char)__a); 12549 #endif 12550 } 12551 12552 static __inline__ vector bool short __ATTRS_o_ai 12553 vec_unpackh(vector bool char __a) { 12554 #ifdef __LITTLE_ENDIAN__ 12555 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12556 #else 12557 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12558 #endif 12559 } 12560 12561 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 12562 #ifdef __LITTLE_ENDIAN__ 12563 return __builtin_altivec_vupklsh(__a); 12564 #else 12565 return __builtin_altivec_vupkhsh(__a); 12566 #endif 12567 } 12568 12569 static __inline__ vector bool int __ATTRS_o_ai 12570 vec_unpackh(vector bool short __a) { 12571 #ifdef __LITTLE_ENDIAN__ 12572 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12573 #else 12574 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12575 #endif 12576 } 12577 12578 static __inline__ vector unsigned int __ATTRS_o_ai 12579 vec_unpackh(vector pixel __a) { 12580 #ifdef __LITTLE_ENDIAN__ 12581 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12582 #else 12583 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12584 #endif 12585 } 12586 12587 #ifdef __POWER8_VECTOR__ 12588 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 12589 #ifdef __LITTLE_ENDIAN__ 12590 return __builtin_altivec_vupklsw(__a); 12591 #else 12592 return __builtin_altivec_vupkhsw(__a); 12593 #endif 12594 } 12595 12596 static __inline__ vector bool long long __ATTRS_o_ai 12597 vec_unpackh(vector bool int __a) { 12598 #ifdef __LITTLE_ENDIAN__ 12599 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12600 #else 12601 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12602 #endif 12603 } 12604 12605 static __inline__ vector double __ATTRS_o_ai 12606 vec_unpackh(vector float __a) { 12607 return (vector double)(__a[0], __a[1]); 12608 } 12609 #endif 12610 12611 /* vec_vupkhsb */ 12612 12613 static __inline__ vector short __ATTRS_o_ai 12614 vec_vupkhsb(vector signed char __a) { 12615 #ifdef __LITTLE_ENDIAN__ 12616 return __builtin_altivec_vupklsb((vector char)__a); 12617 #else 12618 return __builtin_altivec_vupkhsb((vector char)__a); 12619 #endif 12620 } 12621 12622 static __inline__ vector bool short __ATTRS_o_ai 12623 vec_vupkhsb(vector bool char __a) { 12624 #ifdef __LITTLE_ENDIAN__ 12625 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12626 #else 12627 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12628 #endif 12629 } 12630 12631 /* vec_vupkhsh */ 12632 12633 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 12634 #ifdef __LITTLE_ENDIAN__ 12635 return __builtin_altivec_vupklsh(__a); 12636 #else 12637 return __builtin_altivec_vupkhsh(__a); 12638 #endif 12639 } 12640 12641 static __inline__ vector bool int __ATTRS_o_ai 12642 vec_vupkhsh(vector bool short __a) { 12643 #ifdef __LITTLE_ENDIAN__ 12644 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12645 #else 12646 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12647 #endif 12648 } 12649 12650 static __inline__ vector unsigned int __ATTRS_o_ai 12651 vec_vupkhsh(vector pixel __a) { 12652 #ifdef __LITTLE_ENDIAN__ 12653 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12654 #else 12655 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12656 #endif 12657 } 12658 12659 /* vec_vupkhsw */ 12660 12661 #ifdef __POWER8_VECTOR__ 12662 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 12663 #ifdef __LITTLE_ENDIAN__ 12664 return __builtin_altivec_vupklsw(__a); 12665 #else 12666 return __builtin_altivec_vupkhsw(__a); 12667 #endif 12668 } 12669 12670 static __inline__ vector bool long long __ATTRS_o_ai 12671 vec_vupkhsw(vector bool int __a) { 12672 #ifdef __LITTLE_ENDIAN__ 12673 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12674 #else 12675 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12676 #endif 12677 } 12678 #endif 12679 12680 /* vec_unpackl */ 12681 12682 static __inline__ vector short __ATTRS_o_ai 12683 vec_unpackl(vector signed char __a) { 12684 #ifdef __LITTLE_ENDIAN__ 12685 return __builtin_altivec_vupkhsb((vector char)__a); 12686 #else 12687 return __builtin_altivec_vupklsb((vector char)__a); 12688 #endif 12689 } 12690 12691 static __inline__ vector bool short __ATTRS_o_ai 12692 vec_unpackl(vector bool char __a) { 12693 #ifdef __LITTLE_ENDIAN__ 12694 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12695 #else 12696 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12697 #endif 12698 } 12699 12700 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 12701 #ifdef __LITTLE_ENDIAN__ 12702 return __builtin_altivec_vupkhsh(__a); 12703 #else 12704 return __builtin_altivec_vupklsh(__a); 12705 #endif 12706 } 12707 12708 static __inline__ vector bool int __ATTRS_o_ai 12709 vec_unpackl(vector bool short __a) { 12710 #ifdef __LITTLE_ENDIAN__ 12711 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12712 #else 12713 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12714 #endif 12715 } 12716 12717 static __inline__ vector unsigned int __ATTRS_o_ai 12718 vec_unpackl(vector pixel __a) { 12719 #ifdef __LITTLE_ENDIAN__ 12720 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12721 #else 12722 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12723 #endif 12724 } 12725 12726 #ifdef __POWER8_VECTOR__ 12727 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 12728 #ifdef __LITTLE_ENDIAN__ 12729 return __builtin_altivec_vupkhsw(__a); 12730 #else 12731 return __builtin_altivec_vupklsw(__a); 12732 #endif 12733 } 12734 12735 static __inline__ vector bool long long __ATTRS_o_ai 12736 vec_unpackl(vector bool int __a) { 12737 #ifdef __LITTLE_ENDIAN__ 12738 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12739 #else 12740 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12741 #endif 12742 } 12743 12744 static __inline__ vector double __ATTRS_o_ai 12745 vec_unpackl(vector float __a) { 12746 return (vector double)(__a[2], __a[3]); 12747 } 12748 #endif 12749 12750 /* vec_vupklsb */ 12751 12752 static __inline__ vector short __ATTRS_o_ai 12753 vec_vupklsb(vector signed char __a) { 12754 #ifdef __LITTLE_ENDIAN__ 12755 return __builtin_altivec_vupkhsb((vector char)__a); 12756 #else 12757 return __builtin_altivec_vupklsb((vector char)__a); 12758 #endif 12759 } 12760 12761 static __inline__ vector bool short __ATTRS_o_ai 12762 vec_vupklsb(vector bool char __a) { 12763 #ifdef __LITTLE_ENDIAN__ 12764 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12765 #else 12766 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12767 #endif 12768 } 12769 12770 /* vec_vupklsh */ 12771 12772 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 12773 #ifdef __LITTLE_ENDIAN__ 12774 return __builtin_altivec_vupkhsh(__a); 12775 #else 12776 return __builtin_altivec_vupklsh(__a); 12777 #endif 12778 } 12779 12780 static __inline__ vector bool int __ATTRS_o_ai 12781 vec_vupklsh(vector bool short __a) { 12782 #ifdef __LITTLE_ENDIAN__ 12783 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12784 #else 12785 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12786 #endif 12787 } 12788 12789 static __inline__ vector unsigned int __ATTRS_o_ai 12790 vec_vupklsh(vector pixel __a) { 12791 #ifdef __LITTLE_ENDIAN__ 12792 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12793 #else 12794 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12795 #endif 12796 } 12797 12798 /* vec_vupklsw */ 12799 12800 #ifdef __POWER8_VECTOR__ 12801 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 12802 #ifdef __LITTLE_ENDIAN__ 12803 return __builtin_altivec_vupkhsw(__a); 12804 #else 12805 return __builtin_altivec_vupklsw(__a); 12806 #endif 12807 } 12808 12809 static __inline__ vector bool long long __ATTRS_o_ai 12810 vec_vupklsw(vector bool int __a) { 12811 #ifdef __LITTLE_ENDIAN__ 12812 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12813 #else 12814 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12815 #endif 12816 } 12817 #endif 12818 12819 /* vec_vsx_ld */ 12820 12821 #ifdef __VSX__ 12822 12823 static __inline__ vector bool int __ATTRS_o_ai 12824 vec_vsx_ld(int __a, const vector bool int *__b) { 12825 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 12826 } 12827 12828 static __inline__ vector signed int __ATTRS_o_ai 12829 vec_vsx_ld(int __a, const vector signed int *__b) { 12830 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12831 } 12832 12833 static __inline__ vector signed int __ATTRS_o_ai 12834 vec_vsx_ld(int __a, const signed int *__b) { 12835 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12836 } 12837 12838 static __inline__ vector unsigned int __ATTRS_o_ai 12839 vec_vsx_ld(int __a, const vector unsigned int *__b) { 12840 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12841 } 12842 12843 static __inline__ vector unsigned int __ATTRS_o_ai 12844 vec_vsx_ld(int __a, const unsigned int *__b) { 12845 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12846 } 12847 12848 static __inline__ vector float __ATTRS_o_ai 12849 vec_vsx_ld(int __a, const vector float *__b) { 12850 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12851 } 12852 12853 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 12854 const float *__b) { 12855 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12856 } 12857 12858 static __inline__ vector signed long long __ATTRS_o_ai 12859 vec_vsx_ld(int __a, const vector signed long long *__b) { 12860 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 12861 } 12862 12863 static __inline__ vector unsigned long long __ATTRS_o_ai 12864 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 12865 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 12866 } 12867 12868 static __inline__ vector double __ATTRS_o_ai 12869 vec_vsx_ld(int __a, const vector double *__b) { 12870 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12871 } 12872 12873 static __inline__ vector double __ATTRS_o_ai 12874 vec_vsx_ld(int __a, const double *__b) { 12875 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12876 } 12877 12878 static __inline__ vector bool short __ATTRS_o_ai 12879 vec_vsx_ld(int __a, const vector bool short *__b) { 12880 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12881 } 12882 12883 static __inline__ vector signed short __ATTRS_o_ai 12884 vec_vsx_ld(int __a, const vector signed short *__b) { 12885 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12886 } 12887 12888 static __inline__ vector signed short __ATTRS_o_ai 12889 vec_vsx_ld(int __a, const signed short *__b) { 12890 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12891 } 12892 12893 static __inline__ vector unsigned short __ATTRS_o_ai 12894 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12895 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12896 } 12897 12898 static __inline__ vector unsigned short __ATTRS_o_ai 12899 vec_vsx_ld(int __a, const unsigned short *__b) { 12900 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12901 } 12902 12903 static __inline__ vector bool char __ATTRS_o_ai 12904 vec_vsx_ld(int __a, const vector bool char *__b) { 12905 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12906 } 12907 12908 static __inline__ vector signed char __ATTRS_o_ai 12909 vec_vsx_ld(int __a, const vector signed char *__b) { 12910 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12911 } 12912 12913 static __inline__ vector signed char __ATTRS_o_ai 12914 vec_vsx_ld(int __a, const signed char *__b) { 12915 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12916 } 12917 12918 static __inline__ vector unsigned char __ATTRS_o_ai 12919 vec_vsx_ld(int __a, const vector unsigned char *__b) { 12920 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12921 } 12922 12923 static __inline__ vector unsigned char __ATTRS_o_ai 12924 vec_vsx_ld(int __a, const unsigned char *__b) { 12925 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12926 } 12927 12928 #endif 12929 12930 /* vec_vsx_st */ 12931 12932 #ifdef __VSX__ 12933 12934 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12935 vector bool int *__c) { 12936 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12937 } 12938 12939 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12940 signed int *__c) { 12941 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12942 } 12943 12944 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12945 unsigned int *__c) { 12946 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12947 } 12948 12949 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12950 vector signed int *__c) { 12951 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12952 } 12953 12954 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12955 signed int *__c) { 12956 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12957 } 12958 12959 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12960 vector unsigned int *__c) { 12961 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12962 } 12963 12964 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12965 unsigned int *__c) { 12966 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12967 } 12968 12969 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12970 vector float *__c) { 12971 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12972 } 12973 12974 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12975 float *__c) { 12976 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12977 } 12978 12979 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 12980 int __b, 12981 vector signed long long *__c) { 12982 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12983 } 12984 12985 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 12986 int __b, 12987 vector unsigned long long *__c) { 12988 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12989 } 12990 12991 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12992 vector double *__c) { 12993 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12994 } 12995 12996 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12997 double *__c) { 12998 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12999 } 13000 13001 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13002 vector bool short *__c) { 13003 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13004 } 13005 13006 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13007 signed short *__c) { 13008 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13009 } 13010 13011 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13012 unsigned short *__c) { 13013 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13014 } 13015 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13016 vector signed short *__c) { 13017 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13018 } 13019 13020 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13021 signed short *__c) { 13022 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13023 } 13024 13025 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13026 int __b, 13027 vector unsigned short *__c) { 13028 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13029 } 13030 13031 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13032 int __b, unsigned short *__c) { 13033 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13034 } 13035 13036 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13037 vector bool char *__c) { 13038 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13039 } 13040 13041 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13042 signed char *__c) { 13043 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13044 } 13045 13046 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13047 unsigned char *__c) { 13048 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13049 } 13050 13051 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13052 vector signed char *__c) { 13053 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13054 } 13055 13056 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13057 signed char *__c) { 13058 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13059 } 13060 13061 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13062 int __b, 13063 vector unsigned char *__c) { 13064 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13065 } 13066 13067 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13068 int __b, unsigned char *__c) { 13069 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13070 } 13071 13072 #endif 13073 13074 #ifdef __VSX__ 13075 #define vec_xxpermdi __builtin_vsx_xxpermdi 13076 #define vec_xxsldwi __builtin_vsx_xxsldwi 13077 #define vec_permi(__a, __b, __c) \ 13078 _Generic((__a), vector signed long long \ 13079 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13080 (((__c)&0x1) + 2)), \ 13081 vector unsigned long long \ 13082 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13083 (((__c)&0x1) + 2)), \ 13084 vector double \ 13085 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13086 (((__c)&0x1) + 2))) 13087 #endif 13088 13089 /* vec_xor */ 13090 13091 #define __builtin_altivec_vxor vec_xor 13092 13093 static __inline__ vector signed char __ATTRS_o_ai 13094 vec_xor(vector signed char __a, vector signed char __b) { 13095 return __a ^ __b; 13096 } 13097 13098 static __inline__ vector signed char __ATTRS_o_ai 13099 vec_xor(vector bool char __a, vector signed char __b) { 13100 return (vector signed char)__a ^ __b; 13101 } 13102 13103 static __inline__ vector signed char __ATTRS_o_ai 13104 vec_xor(vector signed char __a, vector bool char __b) { 13105 return __a ^ (vector signed char)__b; 13106 } 13107 13108 static __inline__ vector unsigned char __ATTRS_o_ai 13109 vec_xor(vector unsigned char __a, vector unsigned char __b) { 13110 return __a ^ __b; 13111 } 13112 13113 static __inline__ vector unsigned char __ATTRS_o_ai 13114 vec_xor(vector bool char __a, vector unsigned char __b) { 13115 return (vector unsigned char)__a ^ __b; 13116 } 13117 13118 static __inline__ vector unsigned char __ATTRS_o_ai 13119 vec_xor(vector unsigned char __a, vector bool char __b) { 13120 return __a ^ (vector unsigned char)__b; 13121 } 13122 13123 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 13124 vector bool char __b) { 13125 return __a ^ __b; 13126 } 13127 13128 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13129 vector short __b) { 13130 return __a ^ __b; 13131 } 13132 13133 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 13134 vector short __b) { 13135 return (vector short)__a ^ __b; 13136 } 13137 13138 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13139 vector bool short __b) { 13140 return __a ^ (vector short)__b; 13141 } 13142 13143 static __inline__ vector unsigned short __ATTRS_o_ai 13144 vec_xor(vector unsigned short __a, vector unsigned short __b) { 13145 return __a ^ __b; 13146 } 13147 13148 static __inline__ vector unsigned short __ATTRS_o_ai 13149 vec_xor(vector bool short __a, vector unsigned short __b) { 13150 return (vector unsigned short)__a ^ __b; 13151 } 13152 13153 static __inline__ vector unsigned short __ATTRS_o_ai 13154 vec_xor(vector unsigned short __a, vector bool short __b) { 13155 return __a ^ (vector unsigned short)__b; 13156 } 13157 13158 static __inline__ vector bool short __ATTRS_o_ai 13159 vec_xor(vector bool short __a, vector bool short __b) { 13160 return __a ^ __b; 13161 } 13162 13163 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13164 vector int __b) { 13165 return __a ^ __b; 13166 } 13167 13168 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 13169 vector int __b) { 13170 return (vector int)__a ^ __b; 13171 } 13172 13173 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13174 vector bool int __b) { 13175 return __a ^ (vector int)__b; 13176 } 13177 13178 static __inline__ vector unsigned int __ATTRS_o_ai 13179 vec_xor(vector unsigned int __a, vector unsigned int __b) { 13180 return __a ^ __b; 13181 } 13182 13183 static __inline__ vector unsigned int __ATTRS_o_ai 13184 vec_xor(vector bool int __a, vector unsigned int __b) { 13185 return (vector unsigned int)__a ^ __b; 13186 } 13187 13188 static __inline__ vector unsigned int __ATTRS_o_ai 13189 vec_xor(vector unsigned int __a, vector bool int __b) { 13190 return __a ^ (vector unsigned int)__b; 13191 } 13192 13193 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 13194 vector bool int __b) { 13195 return __a ^ __b; 13196 } 13197 13198 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13199 vector float __b) { 13200 vector unsigned int __res = 13201 (vector unsigned int)__a ^ (vector unsigned int)__b; 13202 return (vector float)__res; 13203 } 13204 13205 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 13206 vector float __b) { 13207 vector unsigned int __res = 13208 (vector unsigned int)__a ^ (vector unsigned int)__b; 13209 return (vector float)__res; 13210 } 13211 13212 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13213 vector bool int __b) { 13214 vector unsigned int __res = 13215 (vector unsigned int)__a ^ (vector unsigned int)__b; 13216 return (vector float)__res; 13217 } 13218 13219 #ifdef __VSX__ 13220 static __inline__ vector signed long long __ATTRS_o_ai 13221 vec_xor(vector signed long long __a, vector signed long long __b) { 13222 return __a ^ __b; 13223 } 13224 13225 static __inline__ vector signed long long __ATTRS_o_ai 13226 vec_xor(vector bool long long __a, vector signed long long __b) { 13227 return (vector signed long long)__a ^ __b; 13228 } 13229 13230 static __inline__ vector signed long long __ATTRS_o_ai 13231 vec_xor(vector signed long long __a, vector bool long long __b) { 13232 return __a ^ (vector signed long long)__b; 13233 } 13234 13235 static __inline__ vector unsigned long long __ATTRS_o_ai 13236 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 13237 return __a ^ __b; 13238 } 13239 13240 static __inline__ vector unsigned long long __ATTRS_o_ai 13241 vec_xor(vector bool long long __a, vector unsigned long long __b) { 13242 return (vector unsigned long long)__a ^ __b; 13243 } 13244 13245 static __inline__ vector unsigned long long __ATTRS_o_ai 13246 vec_xor(vector unsigned long long __a, vector bool long long __b) { 13247 return __a ^ (vector unsigned long long)__b; 13248 } 13249 13250 static __inline__ vector bool long long __ATTRS_o_ai 13251 vec_xor(vector bool long long __a, vector bool long long __b) { 13252 return __a ^ __b; 13253 } 13254 13255 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 13256 vector double __b) { 13257 return (vector double)((vector unsigned long long)__a ^ 13258 (vector unsigned long long)__b); 13259 } 13260 13261 static __inline__ vector double __ATTRS_o_ai 13262 vec_xor(vector double __a, vector bool long long __b) { 13263 return (vector double)((vector unsigned long long)__a ^ 13264 (vector unsigned long long)__b); 13265 } 13266 13267 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 13268 vector double __b) { 13269 return (vector double)((vector unsigned long long)__a ^ 13270 (vector unsigned long long)__b); 13271 } 13272 #endif 13273 13274 /* vec_vxor */ 13275 13276 static __inline__ vector signed char __ATTRS_o_ai 13277 vec_vxor(vector signed char __a, vector signed char __b) { 13278 return __a ^ __b; 13279 } 13280 13281 static __inline__ vector signed char __ATTRS_o_ai 13282 vec_vxor(vector bool char __a, vector signed char __b) { 13283 return (vector signed char)__a ^ __b; 13284 } 13285 13286 static __inline__ vector signed char __ATTRS_o_ai 13287 vec_vxor(vector signed char __a, vector bool char __b) { 13288 return __a ^ (vector signed char)__b; 13289 } 13290 13291 static __inline__ vector unsigned char __ATTRS_o_ai 13292 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 13293 return __a ^ __b; 13294 } 13295 13296 static __inline__ vector unsigned char __ATTRS_o_ai 13297 vec_vxor(vector bool char __a, vector unsigned char __b) { 13298 return (vector unsigned char)__a ^ __b; 13299 } 13300 13301 static __inline__ vector unsigned char __ATTRS_o_ai 13302 vec_vxor(vector unsigned char __a, vector bool char __b) { 13303 return __a ^ (vector unsigned char)__b; 13304 } 13305 13306 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 13307 vector bool char __b) { 13308 return __a ^ __b; 13309 } 13310 13311 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13312 vector short __b) { 13313 return __a ^ __b; 13314 } 13315 13316 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 13317 vector short __b) { 13318 return (vector short)__a ^ __b; 13319 } 13320 13321 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13322 vector bool short __b) { 13323 return __a ^ (vector short)__b; 13324 } 13325 13326 static __inline__ vector unsigned short __ATTRS_o_ai 13327 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 13328 return __a ^ __b; 13329 } 13330 13331 static __inline__ vector unsigned short __ATTRS_o_ai 13332 vec_vxor(vector bool short __a, vector unsigned short __b) { 13333 return (vector unsigned short)__a ^ __b; 13334 } 13335 13336 static __inline__ vector unsigned short __ATTRS_o_ai 13337 vec_vxor(vector unsigned short __a, vector bool short __b) { 13338 return __a ^ (vector unsigned short)__b; 13339 } 13340 13341 static __inline__ vector bool short __ATTRS_o_ai 13342 vec_vxor(vector bool short __a, vector bool short __b) { 13343 return __a ^ __b; 13344 } 13345 13346 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13347 vector int __b) { 13348 return __a ^ __b; 13349 } 13350 13351 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 13352 vector int __b) { 13353 return (vector int)__a ^ __b; 13354 } 13355 13356 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13357 vector bool int __b) { 13358 return __a ^ (vector int)__b; 13359 } 13360 13361 static __inline__ vector unsigned int __ATTRS_o_ai 13362 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 13363 return __a ^ __b; 13364 } 13365 13366 static __inline__ vector unsigned int __ATTRS_o_ai 13367 vec_vxor(vector bool int __a, vector unsigned int __b) { 13368 return (vector unsigned int)__a ^ __b; 13369 } 13370 13371 static __inline__ vector unsigned int __ATTRS_o_ai 13372 vec_vxor(vector unsigned int __a, vector bool int __b) { 13373 return __a ^ (vector unsigned int)__b; 13374 } 13375 13376 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 13377 vector bool int __b) { 13378 return __a ^ __b; 13379 } 13380 13381 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13382 vector float __b) { 13383 vector unsigned int __res = 13384 (vector unsigned int)__a ^ (vector unsigned int)__b; 13385 return (vector float)__res; 13386 } 13387 13388 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 13389 vector float __b) { 13390 vector unsigned int __res = 13391 (vector unsigned int)__a ^ (vector unsigned int)__b; 13392 return (vector float)__res; 13393 } 13394 13395 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13396 vector bool int __b) { 13397 vector unsigned int __res = 13398 (vector unsigned int)__a ^ (vector unsigned int)__b; 13399 return (vector float)__res; 13400 } 13401 13402 #ifdef __VSX__ 13403 static __inline__ vector signed long long __ATTRS_o_ai 13404 vec_vxor(vector signed long long __a, vector signed long long __b) { 13405 return __a ^ __b; 13406 } 13407 13408 static __inline__ vector signed long long __ATTRS_o_ai 13409 vec_vxor(vector bool long long __a, vector signed long long __b) { 13410 return (vector signed long long)__a ^ __b; 13411 } 13412 13413 static __inline__ vector signed long long __ATTRS_o_ai 13414 vec_vxor(vector signed long long __a, vector bool long long __b) { 13415 return __a ^ (vector signed long long)__b; 13416 } 13417 13418 static __inline__ vector unsigned long long __ATTRS_o_ai 13419 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 13420 return __a ^ __b; 13421 } 13422 13423 static __inline__ vector unsigned long long __ATTRS_o_ai 13424 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 13425 return (vector unsigned long long)__a ^ __b; 13426 } 13427 13428 static __inline__ vector unsigned long long __ATTRS_o_ai 13429 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 13430 return __a ^ (vector unsigned long long)__b; 13431 } 13432 13433 static __inline__ vector bool long long __ATTRS_o_ai 13434 vec_vxor(vector bool long long __a, vector bool long long __b) { 13435 return __a ^ __b; 13436 } 13437 #endif 13438 13439 /* ------------------------ extensions for CBEA ----------------------------- */ 13440 13441 /* vec_extract */ 13442 13443 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 13444 unsigned int __b) { 13445 return __a[__b & 0xf]; 13446 } 13447 13448 static __inline__ unsigned char __ATTRS_o_ai 13449 vec_extract(vector unsigned char __a, unsigned int __b) { 13450 return __a[__b & 0xf]; 13451 } 13452 13453 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 13454 unsigned int __b) { 13455 return __a[__b & 0xf]; 13456 } 13457 13458 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 13459 unsigned int __b) { 13460 return __a[__b & 0x7]; 13461 } 13462 13463 static __inline__ unsigned short __ATTRS_o_ai 13464 vec_extract(vector unsigned short __a, unsigned int __b) { 13465 return __a[__b & 0x7]; 13466 } 13467 13468 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 13469 unsigned int __b) { 13470 return __a[__b & 0x7]; 13471 } 13472 13473 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 13474 unsigned int __b) { 13475 return __a[__b & 0x3]; 13476 } 13477 13478 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 13479 unsigned int __b) { 13480 return __a[__b & 0x3]; 13481 } 13482 13483 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 13484 unsigned int __b) { 13485 return __a[__b & 0x3]; 13486 } 13487 13488 #ifdef __VSX__ 13489 static __inline__ signed long long __ATTRS_o_ai 13490 vec_extract(vector signed long long __a, unsigned int __b) { 13491 return __a[__b & 0x1]; 13492 } 13493 13494 static __inline__ unsigned long long __ATTRS_o_ai 13495 vec_extract(vector unsigned long long __a, unsigned int __b) { 13496 return __a[__b & 0x1]; 13497 } 13498 13499 static __inline__ unsigned long long __ATTRS_o_ai 13500 vec_extract(vector bool long long __a, unsigned int __b) { 13501 return __a[__b & 0x1]; 13502 } 13503 13504 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, 13505 unsigned int __b) { 13506 return __a[__b & 0x1]; 13507 } 13508 #endif 13509 13510 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, 13511 unsigned int __b) { 13512 return __a[__b & 0x3]; 13513 } 13514 13515 #ifdef __POWER9_VECTOR__ 13516 13517 #define vec_insert4b __builtin_vsx_insertword 13518 #define vec_extract4b __builtin_vsx_extractuword 13519 13520 /* vec_extract_exp */ 13521 13522 static __inline__ vector unsigned int __ATTRS_o_ai 13523 vec_extract_exp(vector float __a) { 13524 return __builtin_vsx_xvxexpsp(__a); 13525 } 13526 13527 static __inline__ vector unsigned long long __ATTRS_o_ai 13528 vec_extract_exp(vector double __a) { 13529 return __builtin_vsx_xvxexpdp(__a); 13530 } 13531 13532 /* vec_extract_sig */ 13533 13534 static __inline__ vector unsigned int __ATTRS_o_ai 13535 vec_extract_sig(vector float __a) { 13536 return __builtin_vsx_xvxsigsp(__a); 13537 } 13538 13539 static __inline__ vector unsigned long long __ATTRS_o_ai 13540 vec_extract_sig (vector double __a) { 13541 return __builtin_vsx_xvxsigdp(__a); 13542 } 13543 13544 static __inline__ vector float __ATTRS_o_ai 13545 vec_extract_fp32_from_shorth(vector unsigned short __a) { 13546 vector unsigned short __b = 13547 #ifdef __LITTLE_ENDIAN__ 13548 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 13549 #else 13550 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 13551 #endif 13552 return __builtin_vsx_xvcvhpsp(__b); 13553 } 13554 13555 static __inline__ vector float __ATTRS_o_ai 13556 vec_extract_fp32_from_shortl(vector unsigned short __a) { 13557 vector unsigned short __b = 13558 #ifdef __LITTLE_ENDIAN__ 13559 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 13560 #else 13561 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 13562 #endif 13563 return __builtin_vsx_xvcvhpsp(__b); 13564 } 13565 #endif /* __POWER9_VECTOR__ */ 13566 13567 /* vec_insert */ 13568 13569 static __inline__ vector signed char __ATTRS_o_ai 13570 vec_insert(signed char __a, vector signed char __b, int __c) { 13571 __b[__c] = __a; 13572 return __b; 13573 } 13574 13575 static __inline__ vector unsigned char __ATTRS_o_ai 13576 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 13577 __b[__c] = __a; 13578 return __b; 13579 } 13580 13581 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 13582 vector bool char __b, 13583 int __c) { 13584 __b[__c] = __a; 13585 return __b; 13586 } 13587 13588 static __inline__ vector signed short __ATTRS_o_ai 13589 vec_insert(signed short __a, vector signed short __b, int __c) { 13590 __b[__c] = __a; 13591 return __b; 13592 } 13593 13594 static __inline__ vector unsigned short __ATTRS_o_ai 13595 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 13596 __b[__c] = __a; 13597 return __b; 13598 } 13599 13600 static __inline__ vector bool short __ATTRS_o_ai 13601 vec_insert(unsigned short __a, vector bool short __b, int __c) { 13602 __b[__c] = __a; 13603 return __b; 13604 } 13605 13606 static __inline__ vector signed int __ATTRS_o_ai 13607 vec_insert(signed int __a, vector signed int __b, int __c) { 13608 __b[__c] = __a; 13609 return __b; 13610 } 13611 13612 static __inline__ vector unsigned int __ATTRS_o_ai 13613 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 13614 __b[__c] = __a; 13615 return __b; 13616 } 13617 13618 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 13619 vector bool int __b, 13620 int __c) { 13621 __b[__c] = __a; 13622 return __b; 13623 } 13624 13625 #ifdef __VSX__ 13626 static __inline__ vector signed long long __ATTRS_o_ai 13627 vec_insert(signed long long __a, vector signed long long __b, int __c) { 13628 __b[__c] = __a; 13629 return __b; 13630 } 13631 13632 static __inline__ vector unsigned long long __ATTRS_o_ai 13633 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 13634 __b[__c] = __a; 13635 return __b; 13636 } 13637 13638 static __inline__ vector bool long long __ATTRS_o_ai 13639 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 13640 __b[__c] = __a; 13641 return __b; 13642 } 13643 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 13644 vector double __b, 13645 int __c) { 13646 __b[__c] = __a; 13647 return __b; 13648 } 13649 #endif 13650 13651 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 13652 vector float __b, 13653 int __c) { 13654 __b[__c] = __a; 13655 return __b; 13656 } 13657 13658 /* vec_lvlx */ 13659 13660 static __inline__ vector signed char __ATTRS_o_ai 13661 vec_lvlx(int __a, const signed char *__b) { 13662 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13663 vec_lvsl(__a, __b)); 13664 } 13665 13666 static __inline__ vector signed char __ATTRS_o_ai 13667 vec_lvlx(int __a, const vector signed char *__b) { 13668 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13669 vec_lvsl(__a, (unsigned char *)__b)); 13670 } 13671 13672 static __inline__ vector unsigned char __ATTRS_o_ai 13673 vec_lvlx(int __a, const unsigned char *__b) { 13674 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13675 vec_lvsl(__a, __b)); 13676 } 13677 13678 static __inline__ vector unsigned char __ATTRS_o_ai 13679 vec_lvlx(int __a, const vector unsigned char *__b) { 13680 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13681 vec_lvsl(__a, (unsigned char *)__b)); 13682 } 13683 13684 static __inline__ vector bool char __ATTRS_o_ai 13685 vec_lvlx(int __a, const vector bool char *__b) { 13686 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 13687 vec_lvsl(__a, (unsigned char *)__b)); 13688 } 13689 13690 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13691 const short *__b) { 13692 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13693 } 13694 13695 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13696 const vector short *__b) { 13697 return vec_perm(vec_ld(__a, __b), (vector short)(0), 13698 vec_lvsl(__a, (unsigned char *)__b)); 13699 } 13700 13701 static __inline__ vector unsigned short __ATTRS_o_ai 13702 vec_lvlx(int __a, const unsigned short *__b) { 13703 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13704 vec_lvsl(__a, __b)); 13705 } 13706 13707 static __inline__ vector unsigned short __ATTRS_o_ai 13708 vec_lvlx(int __a, const vector unsigned short *__b) { 13709 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13710 vec_lvsl(__a, (unsigned char *)__b)); 13711 } 13712 13713 static __inline__ vector bool short __ATTRS_o_ai 13714 vec_lvlx(int __a, const vector bool short *__b) { 13715 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 13716 vec_lvsl(__a, (unsigned char *)__b)); 13717 } 13718 13719 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 13720 const vector pixel *__b) { 13721 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 13722 vec_lvsl(__a, (unsigned char *)__b)); 13723 } 13724 13725 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 13726 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13727 } 13728 13729 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 13730 const vector int *__b) { 13731 return vec_perm(vec_ld(__a, __b), (vector int)(0), 13732 vec_lvsl(__a, (unsigned char *)__b)); 13733 } 13734 13735 static __inline__ vector unsigned int __ATTRS_o_ai 13736 vec_lvlx(int __a, const unsigned int *__b) { 13737 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13738 vec_lvsl(__a, __b)); 13739 } 13740 13741 static __inline__ vector unsigned int __ATTRS_o_ai 13742 vec_lvlx(int __a, const vector unsigned int *__b) { 13743 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13744 vec_lvsl(__a, (unsigned char *)__b)); 13745 } 13746 13747 static __inline__ vector bool int __ATTRS_o_ai 13748 vec_lvlx(int __a, const vector bool int *__b) { 13749 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 13750 vec_lvsl(__a, (unsigned char *)__b)); 13751 } 13752 13753 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13754 const float *__b) { 13755 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13756 } 13757 13758 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13759 const vector float *__b) { 13760 return vec_perm(vec_ld(__a, __b), (vector float)(0), 13761 vec_lvsl(__a, (unsigned char *)__b)); 13762 } 13763 13764 /* vec_lvlxl */ 13765 13766 static __inline__ vector signed char __ATTRS_o_ai 13767 vec_lvlxl(int __a, const signed char *__b) { 13768 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13769 vec_lvsl(__a, __b)); 13770 } 13771 13772 static __inline__ vector signed char __ATTRS_o_ai 13773 vec_lvlxl(int __a, const vector signed char *__b) { 13774 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13775 vec_lvsl(__a, (unsigned char *)__b)); 13776 } 13777 13778 static __inline__ vector unsigned char __ATTRS_o_ai 13779 vec_lvlxl(int __a, const unsigned char *__b) { 13780 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13781 vec_lvsl(__a, __b)); 13782 } 13783 13784 static __inline__ vector unsigned char __ATTRS_o_ai 13785 vec_lvlxl(int __a, const vector unsigned char *__b) { 13786 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13787 vec_lvsl(__a, (unsigned char *)__b)); 13788 } 13789 13790 static __inline__ vector bool char __ATTRS_o_ai 13791 vec_lvlxl(int __a, const vector bool char *__b) { 13792 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 13793 vec_lvsl(__a, (unsigned char *)__b)); 13794 } 13795 13796 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13797 const short *__b) { 13798 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13799 } 13800 13801 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13802 const vector short *__b) { 13803 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 13804 vec_lvsl(__a, (unsigned char *)__b)); 13805 } 13806 13807 static __inline__ vector unsigned short __ATTRS_o_ai 13808 vec_lvlxl(int __a, const unsigned short *__b) { 13809 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13810 vec_lvsl(__a, __b)); 13811 } 13812 13813 static __inline__ vector unsigned short __ATTRS_o_ai 13814 vec_lvlxl(int __a, const vector unsigned short *__b) { 13815 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13816 vec_lvsl(__a, (unsigned char *)__b)); 13817 } 13818 13819 static __inline__ vector bool short __ATTRS_o_ai 13820 vec_lvlxl(int __a, const vector bool short *__b) { 13821 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 13822 vec_lvsl(__a, (unsigned char *)__b)); 13823 } 13824 13825 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 13826 const vector pixel *__b) { 13827 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 13828 vec_lvsl(__a, (unsigned char *)__b)); 13829 } 13830 13831 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 13832 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13833 } 13834 13835 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 13836 const vector int *__b) { 13837 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 13838 vec_lvsl(__a, (unsigned char *)__b)); 13839 } 13840 13841 static __inline__ vector unsigned int __ATTRS_o_ai 13842 vec_lvlxl(int __a, const unsigned int *__b) { 13843 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13844 vec_lvsl(__a, __b)); 13845 } 13846 13847 static __inline__ vector unsigned int __ATTRS_o_ai 13848 vec_lvlxl(int __a, const vector unsigned int *__b) { 13849 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13850 vec_lvsl(__a, (unsigned char *)__b)); 13851 } 13852 13853 static __inline__ vector bool int __ATTRS_o_ai 13854 vec_lvlxl(int __a, const vector bool int *__b) { 13855 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 13856 vec_lvsl(__a, (unsigned char *)__b)); 13857 } 13858 13859 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13860 const float *__b) { 13861 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13862 } 13863 13864 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13865 vector float *__b) { 13866 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 13867 vec_lvsl(__a, (unsigned char *)__b)); 13868 } 13869 13870 /* vec_lvrx */ 13871 13872 static __inline__ vector signed char __ATTRS_o_ai 13873 vec_lvrx(int __a, const signed char *__b) { 13874 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13875 vec_lvsl(__a, __b)); 13876 } 13877 13878 static __inline__ vector signed char __ATTRS_o_ai 13879 vec_lvrx(int __a, const vector signed char *__b) { 13880 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13881 vec_lvsl(__a, (unsigned char *)__b)); 13882 } 13883 13884 static __inline__ vector unsigned char __ATTRS_o_ai 13885 vec_lvrx(int __a, const unsigned char *__b) { 13886 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13887 vec_lvsl(__a, __b)); 13888 } 13889 13890 static __inline__ vector unsigned char __ATTRS_o_ai 13891 vec_lvrx(int __a, const vector unsigned char *__b) { 13892 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13893 vec_lvsl(__a, (unsigned char *)__b)); 13894 } 13895 13896 static __inline__ vector bool char __ATTRS_o_ai 13897 vec_lvrx(int __a, const vector bool char *__b) { 13898 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13899 vec_lvsl(__a, (unsigned char *)__b)); 13900 } 13901 13902 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13903 const short *__b) { 13904 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13905 } 13906 13907 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13908 const vector short *__b) { 13909 return vec_perm((vector short)(0), vec_ld(__a, __b), 13910 vec_lvsl(__a, (unsigned char *)__b)); 13911 } 13912 13913 static __inline__ vector unsigned short __ATTRS_o_ai 13914 vec_lvrx(int __a, const unsigned short *__b) { 13915 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13916 vec_lvsl(__a, __b)); 13917 } 13918 13919 static __inline__ vector unsigned short __ATTRS_o_ai 13920 vec_lvrx(int __a, const vector unsigned short *__b) { 13921 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13922 vec_lvsl(__a, (unsigned char *)__b)); 13923 } 13924 13925 static __inline__ vector bool short __ATTRS_o_ai 13926 vec_lvrx(int __a, const vector bool short *__b) { 13927 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 13928 vec_lvsl(__a, (unsigned char *)__b)); 13929 } 13930 13931 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 13932 const vector pixel *__b) { 13933 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 13934 vec_lvsl(__a, (unsigned char *)__b)); 13935 } 13936 13937 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 13938 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13939 } 13940 13941 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 13942 const vector int *__b) { 13943 return vec_perm((vector int)(0), vec_ld(__a, __b), 13944 vec_lvsl(__a, (unsigned char *)__b)); 13945 } 13946 13947 static __inline__ vector unsigned int __ATTRS_o_ai 13948 vec_lvrx(int __a, const unsigned int *__b) { 13949 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13950 vec_lvsl(__a, __b)); 13951 } 13952 13953 static __inline__ vector unsigned int __ATTRS_o_ai 13954 vec_lvrx(int __a, const vector unsigned int *__b) { 13955 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13956 vec_lvsl(__a, (unsigned char *)__b)); 13957 } 13958 13959 static __inline__ vector bool int __ATTRS_o_ai 13960 vec_lvrx(int __a, const vector bool int *__b) { 13961 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 13962 vec_lvsl(__a, (unsigned char *)__b)); 13963 } 13964 13965 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13966 const float *__b) { 13967 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13968 } 13969 13970 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13971 const vector float *__b) { 13972 return vec_perm((vector float)(0), vec_ld(__a, __b), 13973 vec_lvsl(__a, (unsigned char *)__b)); 13974 } 13975 13976 /* vec_lvrxl */ 13977 13978 static __inline__ vector signed char __ATTRS_o_ai 13979 vec_lvrxl(int __a, const signed char *__b) { 13980 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13981 vec_lvsl(__a, __b)); 13982 } 13983 13984 static __inline__ vector signed char __ATTRS_o_ai 13985 vec_lvrxl(int __a, const vector signed char *__b) { 13986 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13987 vec_lvsl(__a, (unsigned char *)__b)); 13988 } 13989 13990 static __inline__ vector unsigned char __ATTRS_o_ai 13991 vec_lvrxl(int __a, const unsigned char *__b) { 13992 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13993 vec_lvsl(__a, __b)); 13994 } 13995 13996 static __inline__ vector unsigned char __ATTRS_o_ai 13997 vec_lvrxl(int __a, const vector unsigned char *__b) { 13998 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13999 vec_lvsl(__a, (unsigned char *)__b)); 14000 } 14001 14002 static __inline__ vector bool char __ATTRS_o_ai 14003 vec_lvrxl(int __a, const vector bool char *__b) { 14004 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 14005 vec_lvsl(__a, (unsigned char *)__b)); 14006 } 14007 14008 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14009 const short *__b) { 14010 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14011 } 14012 14013 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14014 const vector short *__b) { 14015 return vec_perm((vector short)(0), vec_ldl(__a, __b), 14016 vec_lvsl(__a, (unsigned char *)__b)); 14017 } 14018 14019 static __inline__ vector unsigned short __ATTRS_o_ai 14020 vec_lvrxl(int __a, const unsigned short *__b) { 14021 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14022 vec_lvsl(__a, __b)); 14023 } 14024 14025 static __inline__ vector unsigned short __ATTRS_o_ai 14026 vec_lvrxl(int __a, const vector unsigned short *__b) { 14027 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14028 vec_lvsl(__a, (unsigned char *)__b)); 14029 } 14030 14031 static __inline__ vector bool short __ATTRS_o_ai 14032 vec_lvrxl(int __a, const vector bool short *__b) { 14033 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 14034 vec_lvsl(__a, (unsigned char *)__b)); 14035 } 14036 14037 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 14038 const vector pixel *__b) { 14039 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 14040 vec_lvsl(__a, (unsigned char *)__b)); 14041 } 14042 14043 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 14044 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14045 } 14046 14047 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 14048 const vector int *__b) { 14049 return vec_perm((vector int)(0), vec_ldl(__a, __b), 14050 vec_lvsl(__a, (unsigned char *)__b)); 14051 } 14052 14053 static __inline__ vector unsigned int __ATTRS_o_ai 14054 vec_lvrxl(int __a, const unsigned int *__b) { 14055 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14056 vec_lvsl(__a, __b)); 14057 } 14058 14059 static __inline__ vector unsigned int __ATTRS_o_ai 14060 vec_lvrxl(int __a, const vector unsigned int *__b) { 14061 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14062 vec_lvsl(__a, (unsigned char *)__b)); 14063 } 14064 14065 static __inline__ vector bool int __ATTRS_o_ai 14066 vec_lvrxl(int __a, const vector bool int *__b) { 14067 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 14068 vec_lvsl(__a, (unsigned char *)__b)); 14069 } 14070 14071 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14072 const float *__b) { 14073 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14074 } 14075 14076 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14077 const vector float *__b) { 14078 return vec_perm((vector float)(0), vec_ldl(__a, __b), 14079 vec_lvsl(__a, (unsigned char *)__b)); 14080 } 14081 14082 /* vec_stvlx */ 14083 14084 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14085 signed char *__c) { 14086 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14087 __c); 14088 } 14089 14090 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14091 vector signed char *__c) { 14092 return vec_st( 14093 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14094 __b, __c); 14095 } 14096 14097 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14098 unsigned char *__c) { 14099 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14100 __c); 14101 } 14102 14103 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14104 vector unsigned char *__c) { 14105 return vec_st( 14106 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14107 __b, __c); 14108 } 14109 14110 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 14111 vector bool char *__c) { 14112 return vec_st( 14113 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14114 __b, __c); 14115 } 14116 14117 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14118 short *__c) { 14119 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14120 __c); 14121 } 14122 14123 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14124 vector short *__c) { 14125 return vec_st( 14126 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14127 __b, __c); 14128 } 14129 14130 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14131 int __b, unsigned short *__c) { 14132 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14133 __c); 14134 } 14135 14136 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14137 int __b, 14138 vector unsigned short *__c) { 14139 return vec_st( 14140 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14141 __b, __c); 14142 } 14143 14144 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 14145 vector bool short *__c) { 14146 return vec_st( 14147 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14148 __b, __c); 14149 } 14150 14151 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 14152 vector pixel *__c) { 14153 return vec_st( 14154 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14155 __b, __c); 14156 } 14157 14158 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14159 int *__c) { 14160 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14161 __c); 14162 } 14163 14164 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14165 vector int *__c) { 14166 return vec_st( 14167 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14168 __b, __c); 14169 } 14170 14171 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14172 unsigned int *__c) { 14173 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14174 __c); 14175 } 14176 14177 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14178 vector unsigned int *__c) { 14179 return vec_st( 14180 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14181 __b, __c); 14182 } 14183 14184 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 14185 vector bool int *__c) { 14186 return vec_st( 14187 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14188 __b, __c); 14189 } 14190 14191 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 14192 vector float *__c) { 14193 return vec_st( 14194 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14195 __b, __c); 14196 } 14197 14198 /* vec_stvlxl */ 14199 14200 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14201 signed char *__c) { 14202 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14203 __c); 14204 } 14205 14206 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14207 vector signed char *__c) { 14208 return vec_stl( 14209 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14210 __b, __c); 14211 } 14212 14213 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14214 int __b, unsigned char *__c) { 14215 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14216 __c); 14217 } 14218 14219 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14220 int __b, 14221 vector unsigned char *__c) { 14222 return vec_stl( 14223 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14224 __b, __c); 14225 } 14226 14227 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 14228 vector bool char *__c) { 14229 return vec_stl( 14230 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14231 __b, __c); 14232 } 14233 14234 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14235 short *__c) { 14236 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14237 __c); 14238 } 14239 14240 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14241 vector short *__c) { 14242 return vec_stl( 14243 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14244 __b, __c); 14245 } 14246 14247 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14248 int __b, unsigned short *__c) { 14249 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14250 __c); 14251 } 14252 14253 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14254 int __b, 14255 vector unsigned short *__c) { 14256 return vec_stl( 14257 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14258 __b, __c); 14259 } 14260 14261 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 14262 vector bool short *__c) { 14263 return vec_stl( 14264 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14265 __b, __c); 14266 } 14267 14268 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 14269 vector pixel *__c) { 14270 return vec_stl( 14271 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14272 __b, __c); 14273 } 14274 14275 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14276 int *__c) { 14277 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14278 __c); 14279 } 14280 14281 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14282 vector int *__c) { 14283 return vec_stl( 14284 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14285 __b, __c); 14286 } 14287 14288 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14289 unsigned int *__c) { 14290 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14291 __c); 14292 } 14293 14294 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14295 vector unsigned int *__c) { 14296 return vec_stl( 14297 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14298 __b, __c); 14299 } 14300 14301 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 14302 vector bool int *__c) { 14303 return vec_stl( 14304 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14305 __b, __c); 14306 } 14307 14308 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 14309 vector float *__c) { 14310 return vec_stl( 14311 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14312 __b, __c); 14313 } 14314 14315 /* vec_stvrx */ 14316 14317 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14318 signed char *__c) { 14319 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14320 __c); 14321 } 14322 14323 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14324 vector signed char *__c) { 14325 return vec_st( 14326 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14327 __b, __c); 14328 } 14329 14330 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14331 unsigned char *__c) { 14332 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14333 __c); 14334 } 14335 14336 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14337 vector unsigned char *__c) { 14338 return vec_st( 14339 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14340 __b, __c); 14341 } 14342 14343 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 14344 vector bool char *__c) { 14345 return vec_st( 14346 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14347 __b, __c); 14348 } 14349 14350 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14351 short *__c) { 14352 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14353 __c); 14354 } 14355 14356 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14357 vector short *__c) { 14358 return vec_st( 14359 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14360 __b, __c); 14361 } 14362 14363 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14364 int __b, unsigned short *__c) { 14365 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14366 __c); 14367 } 14368 14369 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14370 int __b, 14371 vector unsigned short *__c) { 14372 return vec_st( 14373 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14374 __b, __c); 14375 } 14376 14377 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 14378 vector bool short *__c) { 14379 return vec_st( 14380 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14381 __b, __c); 14382 } 14383 14384 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 14385 vector pixel *__c) { 14386 return vec_st( 14387 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14388 __b, __c); 14389 } 14390 14391 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14392 int *__c) { 14393 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14394 __c); 14395 } 14396 14397 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14398 vector int *__c) { 14399 return vec_st( 14400 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14401 __b, __c); 14402 } 14403 14404 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14405 unsigned int *__c) { 14406 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14407 __c); 14408 } 14409 14410 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14411 vector unsigned int *__c) { 14412 return vec_st( 14413 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14414 __b, __c); 14415 } 14416 14417 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 14418 vector bool int *__c) { 14419 return vec_st( 14420 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14421 __b, __c); 14422 } 14423 14424 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 14425 vector float *__c) { 14426 return vec_st( 14427 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14428 __b, __c); 14429 } 14430 14431 /* vec_stvrxl */ 14432 14433 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14434 signed char *__c) { 14435 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14436 __c); 14437 } 14438 14439 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14440 vector signed char *__c) { 14441 return vec_stl( 14442 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14443 __b, __c); 14444 } 14445 14446 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14447 int __b, unsigned char *__c) { 14448 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14449 __c); 14450 } 14451 14452 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14453 int __b, 14454 vector unsigned char *__c) { 14455 return vec_stl( 14456 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14457 __b, __c); 14458 } 14459 14460 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 14461 vector bool char *__c) { 14462 return vec_stl( 14463 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14464 __b, __c); 14465 } 14466 14467 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14468 short *__c) { 14469 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14470 __c); 14471 } 14472 14473 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14474 vector short *__c) { 14475 return vec_stl( 14476 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14477 __b, __c); 14478 } 14479 14480 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14481 int __b, unsigned short *__c) { 14482 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14483 __c); 14484 } 14485 14486 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14487 int __b, 14488 vector unsigned short *__c) { 14489 return vec_stl( 14490 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14491 __b, __c); 14492 } 14493 14494 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 14495 vector bool short *__c) { 14496 return vec_stl( 14497 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14498 __b, __c); 14499 } 14500 14501 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 14502 vector pixel *__c) { 14503 return vec_stl( 14504 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14505 __b, __c); 14506 } 14507 14508 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14509 int *__c) { 14510 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14511 __c); 14512 } 14513 14514 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14515 vector int *__c) { 14516 return vec_stl( 14517 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14518 __b, __c); 14519 } 14520 14521 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14522 unsigned int *__c) { 14523 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14524 __c); 14525 } 14526 14527 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14528 vector unsigned int *__c) { 14529 return vec_stl( 14530 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14531 __b, __c); 14532 } 14533 14534 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 14535 vector bool int *__c) { 14536 return vec_stl( 14537 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14538 __b, __c); 14539 } 14540 14541 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 14542 vector float *__c) { 14543 return vec_stl( 14544 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14545 __b, __c); 14546 } 14547 14548 /* vec_promote */ 14549 14550 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 14551 int __b) { 14552 vector signed char __res = (vector signed char)(0); 14553 __res[__b & 0x7] = __a; 14554 return __res; 14555 } 14556 14557 static __inline__ vector unsigned char __ATTRS_o_ai 14558 vec_promote(unsigned char __a, int __b) { 14559 vector unsigned char __res = (vector unsigned char)(0); 14560 __res[__b & 0x7] = __a; 14561 return __res; 14562 } 14563 14564 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 14565 vector short __res = (vector short)(0); 14566 __res[__b & 0x7] = __a; 14567 return __res; 14568 } 14569 14570 static __inline__ vector unsigned short __ATTRS_o_ai 14571 vec_promote(unsigned short __a, int __b) { 14572 vector unsigned short __res = (vector unsigned short)(0); 14573 __res[__b & 0x7] = __a; 14574 return __res; 14575 } 14576 14577 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 14578 vector int __res = (vector int)(0); 14579 __res[__b & 0x3] = __a; 14580 return __res; 14581 } 14582 14583 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 14584 int __b) { 14585 vector unsigned int __res = (vector unsigned int)(0); 14586 __res[__b & 0x3] = __a; 14587 return __res; 14588 } 14589 14590 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 14591 vector float __res = (vector float)(0); 14592 __res[__b & 0x3] = __a; 14593 return __res; 14594 } 14595 14596 #ifdef __VSX__ 14597 static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) { 14598 vector double __res = (vector double)(0); 14599 __res[__b & 0x1] = __a; 14600 return __res; 14601 } 14602 14603 static __inline__ vector signed long long __ATTRS_o_ai 14604 vec_promote(signed long long __a, int __b) { 14605 vector signed long long __res = (vector signed long long)(0); 14606 __res[__b & 0x1] = __a; 14607 return __res; 14608 } 14609 14610 static __inline__ vector unsigned long long __ATTRS_o_ai 14611 vec_promote(unsigned long long __a, int __b) { 14612 vector unsigned long long __res = (vector unsigned long long)(0); 14613 __res[__b & 0x1] = __a; 14614 return __res; 14615 } 14616 #endif 14617 14618 /* vec_splats */ 14619 14620 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 14621 return (vector signed char)(__a); 14622 } 14623 14624 static __inline__ vector unsigned char __ATTRS_o_ai 14625 vec_splats(unsigned char __a) { 14626 return (vector unsigned char)(__a); 14627 } 14628 14629 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 14630 return (vector short)(__a); 14631 } 14632 14633 static __inline__ vector unsigned short __ATTRS_o_ai 14634 vec_splats(unsigned short __a) { 14635 return (vector unsigned short)(__a); 14636 } 14637 14638 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 14639 return (vector int)(__a); 14640 } 14641 14642 static __inline__ vector unsigned int __ATTRS_o_ai 14643 vec_splats(unsigned int __a) { 14644 return (vector unsigned int)(__a); 14645 } 14646 14647 #ifdef __VSX__ 14648 static __inline__ vector signed long long __ATTRS_o_ai 14649 vec_splats(signed long long __a) { 14650 return (vector signed long long)(__a); 14651 } 14652 14653 static __inline__ vector unsigned long long __ATTRS_o_ai 14654 vec_splats(unsigned long long __a) { 14655 return (vector unsigned long long)(__a); 14656 } 14657 14658 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 14659 defined(__SIZEOF_INT128__) 14660 static __inline__ vector signed __int128 __ATTRS_o_ai 14661 vec_splats(signed __int128 __a) { 14662 return (vector signed __int128)(__a); 14663 } 14664 14665 static __inline__ vector unsigned __int128 __ATTRS_o_ai 14666 vec_splats(unsigned __int128 __a) { 14667 return (vector unsigned __int128)(__a); 14668 } 14669 14670 #endif 14671 14672 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 14673 return (vector double)(__a); 14674 } 14675 #endif 14676 14677 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 14678 return (vector float)(__a); 14679 } 14680 14681 /* ----------------------------- predicates --------------------------------- */ 14682 14683 /* vec_all_eq */ 14684 14685 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14686 vector signed char __b) { 14687 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14688 (vector char)__b); 14689 } 14690 14691 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14692 vector bool char __b) { 14693 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14694 (vector char)__b); 14695 } 14696 14697 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14698 vector unsigned char __b) { 14699 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14700 (vector char)__b); 14701 } 14702 14703 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14704 vector bool char __b) { 14705 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14706 (vector char)__b); 14707 } 14708 14709 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14710 vector signed char __b) { 14711 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14712 (vector char)__b); 14713 } 14714 14715 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14716 vector unsigned char __b) { 14717 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14718 (vector char)__b); 14719 } 14720 14721 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14722 vector bool char __b) { 14723 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14724 (vector char)__b); 14725 } 14726 14727 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14728 vector short __b) { 14729 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 14730 } 14731 14732 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14733 vector bool short __b) { 14734 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 14735 } 14736 14737 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14738 vector unsigned short __b) { 14739 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14740 (vector short)__b); 14741 } 14742 14743 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14744 vector bool short __b) { 14745 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14746 (vector short)__b); 14747 } 14748 14749 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14750 vector short __b) { 14751 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14752 (vector short)__b); 14753 } 14754 14755 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14756 vector unsigned short __b) { 14757 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14758 (vector short)__b); 14759 } 14760 14761 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14762 vector bool short __b) { 14763 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14764 (vector short)__b); 14765 } 14766 14767 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 14768 vector pixel __b) { 14769 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14770 (vector short)__b); 14771 } 14772 14773 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 14774 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 14775 } 14776 14777 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 14778 vector bool int __b) { 14779 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 14780 } 14781 14782 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14783 vector unsigned int __b) { 14784 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14785 (vector int)__b); 14786 } 14787 14788 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14789 vector bool int __b) { 14790 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14791 (vector int)__b); 14792 } 14793 14794 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14795 vector int __b) { 14796 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14797 (vector int)__b); 14798 } 14799 14800 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14801 vector unsigned int __b) { 14802 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14803 (vector int)__b); 14804 } 14805 14806 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14807 vector bool int __b) { 14808 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14809 (vector int)__b); 14810 } 14811 14812 #ifdef __VSX__ 14813 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 14814 vector signed long long __b) { 14815 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 14816 } 14817 14818 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 14819 vector bool long long __b) { 14820 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b); 14821 } 14822 14823 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14824 vector unsigned long long __b) { 14825 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14826 (vector long long)__b); 14827 } 14828 14829 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14830 vector bool long long __b) { 14831 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14832 (vector long long)__b); 14833 } 14834 14835 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14836 vector long long __b) { 14837 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14838 (vector long long)__b); 14839 } 14840 14841 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14842 vector unsigned long long __b) { 14843 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14844 (vector long long)__b); 14845 } 14846 14847 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14848 vector bool long long __b) { 14849 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14850 (vector long long)__b); 14851 } 14852 #endif 14853 14854 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 14855 vector float __b) { 14856 #ifdef __VSX__ 14857 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 14858 #else 14859 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 14860 #endif 14861 } 14862 14863 #ifdef __VSX__ 14864 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 14865 vector double __b) { 14866 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 14867 } 14868 #endif 14869 14870 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 14871 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, 14872 vector signed __int128 __b) { 14873 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14874 } 14875 14876 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, 14877 vector unsigned __int128 __b) { 14878 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14879 } 14880 #endif 14881 14882 /* vec_all_ge */ 14883 14884 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14885 vector signed char __b) { 14886 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 14887 } 14888 14889 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14890 vector bool char __b) { 14891 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 14892 } 14893 14894 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14895 vector unsigned char __b) { 14896 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 14897 } 14898 14899 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14900 vector bool char __b) { 14901 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 14902 } 14903 14904 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14905 vector signed char __b) { 14906 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a); 14907 } 14908 14909 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14910 vector unsigned char __b) { 14911 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 14912 } 14913 14914 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14915 vector bool char __b) { 14916 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14917 (vector unsigned char)__a); 14918 } 14919 14920 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14921 vector short __b) { 14922 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 14923 } 14924 14925 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14926 vector bool short __b) { 14927 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 14928 } 14929 14930 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14931 vector unsigned short __b) { 14932 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 14933 } 14934 14935 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14936 vector bool short __b) { 14937 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14938 __a); 14939 } 14940 14941 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14942 vector short __b) { 14943 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a); 14944 } 14945 14946 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14947 vector unsigned short __b) { 14948 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 14949 (vector unsigned short)__a); 14950 } 14951 14952 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14953 vector bool short __b) { 14954 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14955 (vector unsigned short)__a); 14956 } 14957 14958 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 14959 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 14960 } 14961 14962 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 14963 vector bool int __b) { 14964 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 14965 } 14966 14967 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14968 vector unsigned int __b) { 14969 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 14970 } 14971 14972 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14973 vector bool int __b) { 14974 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 14975 } 14976 14977 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14978 vector int __b) { 14979 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a); 14980 } 14981 14982 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14983 vector unsigned int __b) { 14984 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 14985 } 14986 14987 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14988 vector bool int __b) { 14989 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14990 (vector unsigned int)__a); 14991 } 14992 14993 #ifdef __VSX__ 14994 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14995 vector signed long long __b) { 14996 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 14997 } 14998 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14999 vector bool long long __b) { 15000 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 15001 __a); 15002 } 15003 15004 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15005 vector unsigned long long __b) { 15006 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 15007 } 15008 15009 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15010 vector bool long long __b) { 15011 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15012 __a); 15013 } 15014 15015 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15016 vector signed long long __b) { 15017 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, 15018 (vector signed long long)__a); 15019 } 15020 15021 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15022 vector unsigned long long __b) { 15023 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 15024 (vector unsigned long long)__a); 15025 } 15026 15027 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15028 vector bool long long __b) { 15029 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15030 (vector unsigned long long)__a); 15031 } 15032 #endif 15033 15034 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 15035 vector float __b) { 15036 #ifdef __VSX__ 15037 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 15038 #else 15039 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 15040 #endif 15041 } 15042 15043 #ifdef __VSX__ 15044 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 15045 vector double __b) { 15046 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 15047 } 15048 #endif 15049 15050 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15051 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, 15052 vector signed __int128 __b) { 15053 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); 15054 } 15055 15056 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, 15057 vector unsigned __int128 __b) { 15058 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); 15059 } 15060 #endif 15061 15062 /* vec_all_gt */ 15063 15064 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15065 vector signed char __b) { 15066 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 15067 } 15068 15069 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15070 vector bool char __b) { 15071 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 15072 } 15073 15074 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15075 vector unsigned char __b) { 15076 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 15077 } 15078 15079 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15080 vector bool char __b) { 15081 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 15082 } 15083 15084 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15085 vector signed char __b) { 15086 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b); 15087 } 15088 15089 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15090 vector unsigned char __b) { 15091 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 15092 } 15093 15094 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15095 vector bool char __b) { 15096 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 15097 (vector unsigned char)__b); 15098 } 15099 15100 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15101 vector short __b) { 15102 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 15103 } 15104 15105 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15106 vector bool short __b) { 15107 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 15108 } 15109 15110 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15111 vector unsigned short __b) { 15112 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 15113 } 15114 15115 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15116 vector bool short __b) { 15117 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 15118 (vector unsigned short)__b); 15119 } 15120 15121 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15122 vector short __b) { 15123 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b); 15124 } 15125 15126 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15127 vector unsigned short __b) { 15128 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15129 __b); 15130 } 15131 15132 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15133 vector bool short __b) { 15134 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15135 (vector unsigned short)__b); 15136 } 15137 15138 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 15139 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 15140 } 15141 15142 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 15143 vector bool int __b) { 15144 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 15145 } 15146 15147 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15148 vector unsigned int __b) { 15149 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 15150 } 15151 15152 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15153 vector bool int __b) { 15154 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 15155 } 15156 15157 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15158 vector int __b) { 15159 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b); 15160 } 15161 15162 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15163 vector unsigned int __b) { 15164 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 15165 } 15166 15167 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15168 vector bool int __b) { 15169 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 15170 (vector unsigned int)__b); 15171 } 15172 15173 #ifdef __VSX__ 15174 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15175 vector signed long long __b) { 15176 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 15177 } 15178 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15179 vector bool long long __b) { 15180 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 15181 (vector signed long long)__b); 15182 } 15183 15184 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15185 vector unsigned long long __b) { 15186 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 15187 } 15188 15189 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15190 vector bool long long __b) { 15191 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 15192 (vector unsigned long long)__b); 15193 } 15194 15195 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15196 vector signed long long __b) { 15197 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a, 15198 __b); 15199 } 15200 15201 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15202 vector unsigned long long __b) { 15203 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15204 __b); 15205 } 15206 15207 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15208 vector bool long long __b) { 15209 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15210 (vector unsigned long long)__b); 15211 } 15212 #endif 15213 15214 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 15215 vector float __b) { 15216 #ifdef __VSX__ 15217 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 15218 #else 15219 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 15220 #endif 15221 } 15222 15223 #ifdef __VSX__ 15224 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 15225 vector double __b) { 15226 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 15227 } 15228 #endif 15229 15230 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15231 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, 15232 vector signed __int128 __b) { 15233 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); 15234 } 15235 15236 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, 15237 vector unsigned __int128 __b) { 15238 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); 15239 } 15240 #endif 15241 15242 /* vec_all_in */ 15243 15244 static __inline__ int __attribute__((__always_inline__)) 15245 vec_all_in(vector float __a, vector float __b) { 15246 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 15247 } 15248 15249 /* vec_all_le */ 15250 15251 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15252 vector signed char __b) { 15253 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 15254 } 15255 15256 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15257 vector bool char __b) { 15258 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 15259 } 15260 15261 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15262 vector unsigned char __b) { 15263 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 15264 } 15265 15266 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15267 vector bool char __b) { 15268 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 15269 } 15270 15271 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15272 vector signed char __b) { 15273 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b); 15274 } 15275 15276 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15277 vector unsigned char __b) { 15278 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 15279 } 15280 15281 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15282 vector bool char __b) { 15283 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 15284 (vector unsigned char)__b); 15285 } 15286 15287 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15288 vector short __b) { 15289 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 15290 } 15291 15292 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15293 vector bool short __b) { 15294 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 15295 } 15296 15297 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15298 vector unsigned short __b) { 15299 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 15300 } 15301 15302 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15303 vector bool short __b) { 15304 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 15305 (vector unsigned short)__b); 15306 } 15307 15308 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15309 vector short __b) { 15310 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b); 15311 } 15312 15313 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15314 vector unsigned short __b) { 15315 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15316 __b); 15317 } 15318 15319 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15320 vector bool short __b) { 15321 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15322 (vector unsigned short)__b); 15323 } 15324 15325 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 15326 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 15327 } 15328 15329 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 15330 vector bool int __b) { 15331 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 15332 } 15333 15334 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15335 vector unsigned int __b) { 15336 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 15337 } 15338 15339 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15340 vector bool int __b) { 15341 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 15342 } 15343 15344 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15345 vector int __b) { 15346 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b); 15347 } 15348 15349 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15350 vector unsigned int __b) { 15351 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 15352 } 15353 15354 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15355 vector bool int __b) { 15356 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 15357 (vector unsigned int)__b); 15358 } 15359 15360 #ifdef __VSX__ 15361 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15362 vector signed long long __b) { 15363 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 15364 } 15365 15366 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15367 vector unsigned long long __b) { 15368 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 15369 } 15370 15371 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15372 vector bool long long __b) { 15373 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 15374 (vector signed long long)__b); 15375 } 15376 15377 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15378 vector bool long long __b) { 15379 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 15380 (vector unsigned long long)__b); 15381 } 15382 15383 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15384 vector signed long long __b) { 15385 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a, 15386 __b); 15387 } 15388 15389 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15390 vector unsigned long long __b) { 15391 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15392 __b); 15393 } 15394 15395 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15396 vector bool long long __b) { 15397 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15398 (vector unsigned long long)__b); 15399 } 15400 #endif 15401 15402 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 15403 vector float __b) { 15404 #ifdef __VSX__ 15405 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 15406 #else 15407 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 15408 #endif 15409 } 15410 15411 #ifdef __VSX__ 15412 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 15413 vector double __b) { 15414 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 15415 } 15416 #endif 15417 15418 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15419 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, 15420 vector signed __int128 __b) { 15421 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); 15422 } 15423 15424 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, 15425 vector unsigned __int128 __b) { 15426 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); 15427 } 15428 #endif 15429 15430 /* vec_all_lt */ 15431 15432 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15433 vector signed char __b) { 15434 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 15435 } 15436 15437 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15438 vector bool char __b) { 15439 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 15440 } 15441 15442 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15443 vector unsigned char __b) { 15444 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 15445 } 15446 15447 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15448 vector bool char __b) { 15449 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 15450 } 15451 15452 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15453 vector signed char __b) { 15454 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a); 15455 } 15456 15457 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15458 vector unsigned char __b) { 15459 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 15460 } 15461 15462 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15463 vector bool char __b) { 15464 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 15465 (vector unsigned char)__a); 15466 } 15467 15468 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15469 vector short __b) { 15470 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 15471 } 15472 15473 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15474 vector bool short __b) { 15475 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 15476 } 15477 15478 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15479 vector unsigned short __b) { 15480 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 15481 } 15482 15483 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15484 vector bool short __b) { 15485 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15486 __a); 15487 } 15488 15489 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15490 vector short __b) { 15491 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a); 15492 } 15493 15494 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15495 vector unsigned short __b) { 15496 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 15497 (vector unsigned short)__a); 15498 } 15499 15500 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15501 vector bool short __b) { 15502 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15503 (vector unsigned short)__a); 15504 } 15505 15506 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 15507 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 15508 } 15509 15510 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 15511 vector bool int __b) { 15512 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 15513 } 15514 15515 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15516 vector unsigned int __b) { 15517 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 15518 } 15519 15520 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15521 vector bool int __b) { 15522 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 15523 } 15524 15525 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15526 vector int __b) { 15527 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a); 15528 } 15529 15530 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15531 vector unsigned int __b) { 15532 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 15533 } 15534 15535 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15536 vector bool int __b) { 15537 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 15538 (vector unsigned int)__a); 15539 } 15540 15541 #ifdef __VSX__ 15542 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15543 vector signed long long __b) { 15544 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 15545 } 15546 15547 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15548 vector unsigned long long __b) { 15549 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 15550 } 15551 15552 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15553 vector bool long long __b) { 15554 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 15555 __a); 15556 } 15557 15558 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15559 vector bool long long __b) { 15560 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15561 __a); 15562 } 15563 15564 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15565 vector signed long long __b) { 15566 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, 15567 (vector signed long long)__a); 15568 } 15569 15570 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15571 vector unsigned long long __b) { 15572 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 15573 (vector unsigned long long)__a); 15574 } 15575 15576 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15577 vector bool long long __b) { 15578 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15579 (vector unsigned long long)__a); 15580 } 15581 #endif 15582 15583 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 15584 vector float __b) { 15585 #ifdef __VSX__ 15586 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 15587 #else 15588 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 15589 #endif 15590 } 15591 15592 #ifdef __VSX__ 15593 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 15594 vector double __b) { 15595 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 15596 } 15597 #endif 15598 15599 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15600 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a, 15601 vector signed __int128 __b) { 15602 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a); 15603 } 15604 15605 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a, 15606 vector unsigned __int128 __b) { 15607 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a); 15608 } 15609 #endif 15610 15611 /* vec_all_nan */ 15612 15613 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 15614 #ifdef __VSX__ 15615 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 15616 #else 15617 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 15618 #endif 15619 } 15620 15621 #ifdef __VSX__ 15622 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 15623 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 15624 } 15625 #endif 15626 15627 /* vec_all_ne */ 15628 15629 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15630 vector signed char __b) { 15631 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15632 (vector char)__b); 15633 } 15634 15635 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15636 vector bool char __b) { 15637 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15638 (vector char)__b); 15639 } 15640 15641 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15642 vector unsigned char __b) { 15643 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15644 (vector char)__b); 15645 } 15646 15647 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15648 vector bool char __b) { 15649 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15650 (vector char)__b); 15651 } 15652 15653 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15654 vector signed char __b) { 15655 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15656 (vector char)__b); 15657 } 15658 15659 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15660 vector unsigned char __b) { 15661 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15662 (vector char)__b); 15663 } 15664 15665 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15666 vector bool char __b) { 15667 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15668 (vector char)__b); 15669 } 15670 15671 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15672 vector short __b) { 15673 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 15674 } 15675 15676 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15677 vector bool short __b) { 15678 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 15679 } 15680 15681 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15682 vector unsigned short __b) { 15683 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15684 (vector short)__b); 15685 } 15686 15687 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15688 vector bool short __b) { 15689 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15690 (vector short)__b); 15691 } 15692 15693 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15694 vector short __b) { 15695 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15696 (vector short)__b); 15697 } 15698 15699 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15700 vector unsigned short __b) { 15701 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15702 (vector short)__b); 15703 } 15704 15705 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15706 vector bool short __b) { 15707 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15708 (vector short)__b); 15709 } 15710 15711 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 15712 vector pixel __b) { 15713 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15714 (vector short)__b); 15715 } 15716 15717 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 15718 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 15719 } 15720 15721 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 15722 vector bool int __b) { 15723 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 15724 } 15725 15726 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15727 vector unsigned int __b) { 15728 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15729 (vector int)__b); 15730 } 15731 15732 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15733 vector bool int __b) { 15734 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15735 (vector int)__b); 15736 } 15737 15738 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15739 vector int __b) { 15740 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15741 (vector int)__b); 15742 } 15743 15744 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15745 vector unsigned int __b) { 15746 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15747 (vector int)__b); 15748 } 15749 15750 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15751 vector bool int __b) { 15752 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15753 (vector int)__b); 15754 } 15755 15756 #ifdef __VSX__ 15757 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15758 vector signed long long __b) { 15759 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 15760 } 15761 15762 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15763 vector unsigned long long __b) { 15764 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 15765 (vector long long)__b); 15766 } 15767 15768 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15769 vector bool long long __b) { 15770 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 15771 (vector signed long long)__b); 15772 } 15773 15774 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15775 vector bool long long __b) { 15776 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15777 (vector signed long long)__b); 15778 } 15779 15780 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15781 vector signed long long __b) { 15782 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15783 (vector signed long long)__b); 15784 } 15785 15786 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15787 vector unsigned long long __b) { 15788 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15789 (vector signed long long)__b); 15790 } 15791 15792 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15793 vector bool long long __b) { 15794 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15795 (vector signed long long)__b); 15796 } 15797 #endif 15798 15799 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 15800 vector float __b) { 15801 #ifdef __VSX__ 15802 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); 15803 #else 15804 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 15805 #endif 15806 } 15807 15808 #ifdef __VSX__ 15809 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 15810 vector double __b) { 15811 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 15812 } 15813 #endif 15814 15815 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15816 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a, 15817 vector signed __int128 __b) { 15818 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15819 } 15820 15821 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a, 15822 vector unsigned __int128 __b) { 15823 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15824 } 15825 #endif 15826 15827 /* vec_all_nge */ 15828 15829 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 15830 vector float __b) { 15831 #ifdef __VSX__ 15832 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 15833 #else 15834 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 15835 #endif 15836 } 15837 15838 #ifdef __VSX__ 15839 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 15840 vector double __b) { 15841 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 15842 } 15843 #endif 15844 15845 /* vec_all_ngt */ 15846 15847 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 15848 vector float __b) { 15849 #ifdef __VSX__ 15850 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 15851 #else 15852 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 15853 #endif 15854 } 15855 15856 #ifdef __VSX__ 15857 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 15858 vector double __b) { 15859 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 15860 } 15861 #endif 15862 15863 /* vec_all_nle */ 15864 15865 static __inline__ int __ATTRS_o_ai 15866 vec_all_nle(vector float __a, vector float __b) { 15867 #ifdef __VSX__ 15868 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a); 15869 #else 15870 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 15871 #endif 15872 } 15873 15874 #ifdef __VSX__ 15875 static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a, 15876 vector double __b) { 15877 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a); 15878 } 15879 #endif 15880 15881 /* vec_all_nlt */ 15882 15883 static __inline__ int __ATTRS_o_ai 15884 vec_all_nlt(vector float __a, vector float __b) { 15885 #ifdef __VSX__ 15886 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a); 15887 #else 15888 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 15889 #endif 15890 } 15891 15892 #ifdef __VSX__ 15893 static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a, 15894 vector double __b) { 15895 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a); 15896 } 15897 #endif 15898 15899 /* vec_all_numeric */ 15900 15901 static __inline__ int __ATTRS_o_ai 15902 vec_all_numeric(vector float __a) { 15903 #ifdef __VSX__ 15904 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a); 15905 #else 15906 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 15907 #endif 15908 } 15909 15910 #ifdef __VSX__ 15911 static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) { 15912 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a); 15913 } 15914 #endif 15915 15916 /* vec_any_eq */ 15917 15918 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15919 vector signed char __b) { 15920 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15921 (vector char)__b); 15922 } 15923 15924 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15925 vector bool char __b) { 15926 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15927 (vector char)__b); 15928 } 15929 15930 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15931 vector unsigned char __b) { 15932 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15933 (vector char)__b); 15934 } 15935 15936 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15937 vector bool char __b) { 15938 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15939 (vector char)__b); 15940 } 15941 15942 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15943 vector signed char __b) { 15944 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15945 (vector char)__b); 15946 } 15947 15948 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15949 vector unsigned char __b) { 15950 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15951 (vector char)__b); 15952 } 15953 15954 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15955 vector bool char __b) { 15956 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15957 (vector char)__b); 15958 } 15959 15960 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 15961 vector short __b) { 15962 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 15963 } 15964 15965 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 15966 vector bool short __b) { 15967 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 15968 } 15969 15970 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 15971 vector unsigned short __b) { 15972 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15973 (vector short)__b); 15974 } 15975 15976 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 15977 vector bool short __b) { 15978 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15979 (vector short)__b); 15980 } 15981 15982 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 15983 vector short __b) { 15984 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15985 (vector short)__b); 15986 } 15987 15988 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 15989 vector unsigned short __b) { 15990 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15991 (vector short)__b); 15992 } 15993 15994 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 15995 vector bool short __b) { 15996 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 15997 (vector short)__b); 15998 } 15999 16000 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 16001 vector pixel __b) { 16002 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16003 (vector short)__b); 16004 } 16005 16006 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 16007 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 16008 } 16009 16010 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 16011 vector bool int __b) { 16012 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 16013 } 16014 16015 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16016 vector unsigned int __b) { 16017 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16018 (vector int)__b); 16019 } 16020 16021 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16022 vector bool int __b) { 16023 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16024 (vector int)__b); 16025 } 16026 16027 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16028 vector int __b) { 16029 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16030 (vector int)__b); 16031 } 16032 16033 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16034 vector unsigned int __b) { 16035 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16036 (vector int)__b); 16037 } 16038 16039 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16040 vector bool int __b) { 16041 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16042 (vector int)__b); 16043 } 16044 16045 #ifdef __VSX__ 16046 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16047 vector signed long long __b) { 16048 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 16049 } 16050 16051 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16052 vector unsigned long long __b) { 16053 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 16054 (vector long long)__b); 16055 } 16056 16057 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16058 vector bool long long __b) { 16059 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 16060 (vector signed long long)__b); 16061 } 16062 16063 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16064 vector bool long long __b) { 16065 return __builtin_altivec_vcmpequd_p( 16066 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16067 } 16068 16069 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16070 vector signed long long __b) { 16071 return __builtin_altivec_vcmpequd_p( 16072 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16073 } 16074 16075 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16076 vector unsigned long long __b) { 16077 return __builtin_altivec_vcmpequd_p( 16078 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16079 } 16080 16081 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16082 vector bool long long __b) { 16083 return __builtin_altivec_vcmpequd_p( 16084 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16085 } 16086 #endif 16087 16088 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 16089 vector float __b) { 16090 #ifdef __VSX__ 16091 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 16092 #else 16093 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 16094 #endif 16095 } 16096 16097 #ifdef __VSX__ 16098 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 16099 vector double __b) { 16100 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 16101 } 16102 #endif 16103 16104 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16105 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a, 16106 vector signed __int128 __b) { 16107 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16108 } 16109 16110 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a, 16111 vector unsigned __int128 __b) { 16112 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16113 } 16114 #endif 16115 16116 /* vec_any_ge */ 16117 16118 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16119 vector signed char __b) { 16120 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 16121 } 16122 16123 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16124 vector bool char __b) { 16125 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 16126 __a); 16127 } 16128 16129 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16130 vector unsigned char __b) { 16131 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 16132 } 16133 16134 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16135 vector bool char __b) { 16136 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16137 __a); 16138 } 16139 16140 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16141 vector signed char __b) { 16142 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, 16143 (vector signed char)__a); 16144 } 16145 16146 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16147 vector unsigned char __b) { 16148 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 16149 (vector unsigned char)__a); 16150 } 16151 16152 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16153 vector bool char __b) { 16154 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16155 (vector unsigned char)__a); 16156 } 16157 16158 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16159 vector short __b) { 16160 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 16161 } 16162 16163 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16164 vector bool short __b) { 16165 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 16166 } 16167 16168 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16169 vector unsigned short __b) { 16170 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 16171 } 16172 16173 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16174 vector bool short __b) { 16175 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16176 __a); 16177 } 16178 16179 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16180 vector short __b) { 16181 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, 16182 (vector signed short)__a); 16183 } 16184 16185 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16186 vector unsigned short __b) { 16187 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 16188 (vector unsigned short)__a); 16189 } 16190 16191 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16192 vector bool short __b) { 16193 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16194 (vector unsigned short)__a); 16195 } 16196 16197 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 16198 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 16199 } 16200 16201 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 16202 vector bool int __b) { 16203 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 16204 } 16205 16206 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16207 vector unsigned int __b) { 16208 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 16209 } 16210 16211 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16212 vector bool int __b) { 16213 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16214 __a); 16215 } 16216 16217 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16218 vector int __b) { 16219 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, 16220 (vector signed int)__a); 16221 } 16222 16223 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16224 vector unsigned int __b) { 16225 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 16226 (vector unsigned int)__a); 16227 } 16228 16229 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16230 vector bool int __b) { 16231 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16232 (vector unsigned int)__a); 16233 } 16234 16235 #ifdef __VSX__ 16236 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16237 vector signed long long __b) { 16238 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 16239 } 16240 16241 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16242 vector unsigned long long __b) { 16243 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 16244 } 16245 16246 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16247 vector bool long long __b) { 16248 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16249 (vector signed long long)__b, __a); 16250 } 16251 16252 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16253 vector bool long long __b) { 16254 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16255 (vector unsigned long long)__b, __a); 16256 } 16257 16258 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16259 vector signed long long __b) { 16260 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, 16261 (vector signed long long)__a); 16262 } 16263 16264 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16265 vector unsigned long long __b) { 16266 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 16267 (vector unsigned long long)__a); 16268 } 16269 16270 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16271 vector bool long long __b) { 16272 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16273 (vector unsigned long long)__b, 16274 (vector unsigned long long)__a); 16275 } 16276 #endif 16277 16278 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 16279 vector float __b) { 16280 #ifdef __VSX__ 16281 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 16282 #else 16283 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 16284 #endif 16285 } 16286 16287 #ifdef __VSX__ 16288 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 16289 vector double __b) { 16290 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 16291 } 16292 #endif 16293 16294 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16295 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, 16296 vector signed __int128 __b) { 16297 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); 16298 } 16299 16300 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, 16301 vector unsigned __int128 __b) { 16302 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); 16303 } 16304 #endif 16305 16306 /* vec_any_gt */ 16307 16308 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16309 vector signed char __b) { 16310 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 16311 } 16312 16313 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16314 vector bool char __b) { 16315 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 16316 (vector signed char)__b); 16317 } 16318 16319 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16320 vector unsigned char __b) { 16321 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 16322 } 16323 16324 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16325 vector bool char __b) { 16326 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 16327 (vector unsigned char)__b); 16328 } 16329 16330 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16331 vector signed char __b) { 16332 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a, 16333 __b); 16334 } 16335 16336 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16337 vector unsigned char __b) { 16338 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16339 __b); 16340 } 16341 16342 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16343 vector bool char __b) { 16344 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16345 (vector unsigned char)__b); 16346 } 16347 16348 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16349 vector short __b) { 16350 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 16351 } 16352 16353 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16354 vector bool short __b) { 16355 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 16356 } 16357 16358 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16359 vector unsigned short __b) { 16360 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 16361 } 16362 16363 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16364 vector bool short __b) { 16365 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 16366 (vector unsigned short)__b); 16367 } 16368 16369 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16370 vector short __b) { 16371 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a, 16372 __b); 16373 } 16374 16375 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16376 vector unsigned short __b) { 16377 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16378 __b); 16379 } 16380 16381 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16382 vector bool short __b) { 16383 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16384 (vector unsigned short)__b); 16385 } 16386 16387 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 16388 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 16389 } 16390 16391 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 16392 vector bool int __b) { 16393 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 16394 } 16395 16396 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16397 vector unsigned int __b) { 16398 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 16399 } 16400 16401 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16402 vector bool int __b) { 16403 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 16404 (vector unsigned int)__b); 16405 } 16406 16407 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16408 vector int __b) { 16409 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a, 16410 __b); 16411 } 16412 16413 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16414 vector unsigned int __b) { 16415 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16416 __b); 16417 } 16418 16419 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16420 vector bool int __b) { 16421 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16422 (vector unsigned int)__b); 16423 } 16424 16425 #ifdef __VSX__ 16426 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16427 vector signed long long __b) { 16428 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 16429 } 16430 16431 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16432 vector unsigned long long __b) { 16433 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 16434 } 16435 16436 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16437 vector bool long long __b) { 16438 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 16439 (vector signed long long)__b); 16440 } 16441 16442 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16443 vector bool long long __b) { 16444 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 16445 (vector unsigned long long)__b); 16446 } 16447 16448 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16449 vector signed long long __b) { 16450 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16451 (vector signed long long)__a, __b); 16452 } 16453 16454 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16455 vector unsigned long long __b) { 16456 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16457 (vector unsigned long long)__a, __b); 16458 } 16459 16460 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16461 vector bool long long __b) { 16462 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16463 (vector unsigned long long)__a, 16464 (vector unsigned long long)__b); 16465 } 16466 #endif 16467 16468 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 16469 vector float __b) { 16470 #ifdef __VSX__ 16471 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 16472 #else 16473 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 16474 #endif 16475 } 16476 16477 #ifdef __VSX__ 16478 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 16479 vector double __b) { 16480 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 16481 } 16482 #endif 16483 16484 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16485 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, 16486 vector signed __int128 __b) { 16487 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); 16488 } 16489 16490 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, 16491 vector unsigned __int128 __b) { 16492 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); 16493 } 16494 #endif 16495 16496 /* vec_any_le */ 16497 16498 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16499 vector signed char __b) { 16500 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 16501 } 16502 16503 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16504 vector bool char __b) { 16505 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 16506 (vector signed char)__b); 16507 } 16508 16509 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16510 vector unsigned char __b) { 16511 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 16512 } 16513 16514 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16515 vector bool char __b) { 16516 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 16517 (vector unsigned char)__b); 16518 } 16519 16520 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16521 vector signed char __b) { 16522 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a, 16523 __b); 16524 } 16525 16526 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16527 vector unsigned char __b) { 16528 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16529 __b); 16530 } 16531 16532 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16533 vector bool char __b) { 16534 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16535 (vector unsigned char)__b); 16536 } 16537 16538 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16539 vector short __b) { 16540 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 16541 } 16542 16543 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16544 vector bool short __b) { 16545 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 16546 } 16547 16548 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16549 vector unsigned short __b) { 16550 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 16551 } 16552 16553 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16554 vector bool short __b) { 16555 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 16556 (vector unsigned short)__b); 16557 } 16558 16559 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16560 vector short __b) { 16561 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a, 16562 __b); 16563 } 16564 16565 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16566 vector unsigned short __b) { 16567 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16568 __b); 16569 } 16570 16571 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16572 vector bool short __b) { 16573 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16574 (vector unsigned short)__b); 16575 } 16576 16577 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 16578 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 16579 } 16580 16581 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 16582 vector bool int __b) { 16583 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 16584 } 16585 16586 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16587 vector unsigned int __b) { 16588 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 16589 } 16590 16591 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16592 vector bool int __b) { 16593 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 16594 (vector unsigned int)__b); 16595 } 16596 16597 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16598 vector int __b) { 16599 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a, 16600 __b); 16601 } 16602 16603 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16604 vector unsigned int __b) { 16605 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16606 __b); 16607 } 16608 16609 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16610 vector bool int __b) { 16611 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16612 (vector unsigned int)__b); 16613 } 16614 16615 #ifdef __VSX__ 16616 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16617 vector signed long long __b) { 16618 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 16619 } 16620 16621 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16622 vector unsigned long long __b) { 16623 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 16624 } 16625 16626 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16627 vector bool long long __b) { 16628 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 16629 (vector signed long long)__b); 16630 } 16631 16632 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16633 vector bool long long __b) { 16634 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 16635 (vector unsigned long long)__b); 16636 } 16637 16638 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16639 vector signed long long __b) { 16640 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16641 (vector signed long long)__a, __b); 16642 } 16643 16644 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16645 vector unsigned long long __b) { 16646 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16647 (vector unsigned long long)__a, __b); 16648 } 16649 16650 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16651 vector bool long long __b) { 16652 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16653 (vector unsigned long long)__a, 16654 (vector unsigned long long)__b); 16655 } 16656 #endif 16657 16658 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 16659 vector float __b) { 16660 #ifdef __VSX__ 16661 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 16662 #else 16663 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 16664 #endif 16665 } 16666 16667 #ifdef __VSX__ 16668 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 16669 vector double __b) { 16670 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 16671 } 16672 #endif 16673 16674 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16675 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, 16676 vector signed __int128 __b) { 16677 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); 16678 } 16679 16680 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, 16681 vector unsigned __int128 __b) { 16682 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); 16683 } 16684 #endif 16685 16686 /* vec_any_lt */ 16687 16688 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16689 vector signed char __b) { 16690 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 16691 } 16692 16693 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16694 vector bool char __b) { 16695 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 16696 __a); 16697 } 16698 16699 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16700 vector unsigned char __b) { 16701 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 16702 } 16703 16704 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16705 vector bool char __b) { 16706 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16707 __a); 16708 } 16709 16710 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16711 vector signed char __b) { 16712 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, 16713 (vector signed char)__a); 16714 } 16715 16716 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16717 vector unsigned char __b) { 16718 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 16719 (vector unsigned char)__a); 16720 } 16721 16722 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16723 vector bool char __b) { 16724 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16725 (vector unsigned char)__a); 16726 } 16727 16728 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16729 vector short __b) { 16730 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 16731 } 16732 16733 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16734 vector bool short __b) { 16735 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 16736 } 16737 16738 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16739 vector unsigned short __b) { 16740 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 16741 } 16742 16743 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16744 vector bool short __b) { 16745 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16746 __a); 16747 } 16748 16749 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16750 vector short __b) { 16751 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, 16752 (vector signed short)__a); 16753 } 16754 16755 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16756 vector unsigned short __b) { 16757 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 16758 (vector unsigned short)__a); 16759 } 16760 16761 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16762 vector bool short __b) { 16763 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16764 (vector unsigned short)__a); 16765 } 16766 16767 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 16768 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 16769 } 16770 16771 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 16772 vector bool int __b) { 16773 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 16774 } 16775 16776 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16777 vector unsigned int __b) { 16778 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 16779 } 16780 16781 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16782 vector bool int __b) { 16783 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16784 __a); 16785 } 16786 16787 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16788 vector int __b) { 16789 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, 16790 (vector signed int)__a); 16791 } 16792 16793 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16794 vector unsigned int __b) { 16795 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 16796 (vector unsigned int)__a); 16797 } 16798 16799 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16800 vector bool int __b) { 16801 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16802 (vector unsigned int)__a); 16803 } 16804 16805 #ifdef __VSX__ 16806 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16807 vector signed long long __b) { 16808 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 16809 } 16810 16811 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16812 vector unsigned long long __b) { 16813 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 16814 } 16815 16816 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16817 vector bool long long __b) { 16818 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16819 (vector signed long long)__b, __a); 16820 } 16821 16822 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16823 vector bool long long __b) { 16824 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16825 (vector unsigned long long)__b, __a); 16826 } 16827 16828 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16829 vector signed long long __b) { 16830 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, 16831 (vector signed long long)__a); 16832 } 16833 16834 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16835 vector unsigned long long __b) { 16836 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 16837 (vector unsigned long long)__a); 16838 } 16839 16840 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16841 vector bool long long __b) { 16842 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16843 (vector unsigned long long)__b, 16844 (vector unsigned long long)__a); 16845 } 16846 #endif 16847 16848 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 16849 vector float __b) { 16850 #ifdef __VSX__ 16851 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 16852 #else 16853 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 16854 #endif 16855 } 16856 16857 #ifdef __VSX__ 16858 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 16859 vector double __b) { 16860 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 16861 } 16862 #endif 16863 16864 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16865 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, 16866 vector signed __int128 __b) { 16867 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); 16868 } 16869 16870 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, 16871 vector unsigned __int128 __b) { 16872 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); 16873 } 16874 #endif 16875 16876 /* vec_any_nan */ 16877 16878 static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) { 16879 #ifdef __VSX__ 16880 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a); 16881 #else 16882 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 16883 #endif 16884 } 16885 #ifdef __VSX__ 16886 static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) { 16887 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a); 16888 } 16889 #endif 16890 16891 /* vec_any_ne */ 16892 16893 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16894 vector signed char __b) { 16895 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16896 (vector char)__b); 16897 } 16898 16899 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16900 vector bool char __b) { 16901 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16902 (vector char)__b); 16903 } 16904 16905 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16906 vector unsigned char __b) { 16907 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16908 (vector char)__b); 16909 } 16910 16911 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16912 vector bool char __b) { 16913 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16914 (vector char)__b); 16915 } 16916 16917 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16918 vector signed char __b) { 16919 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16920 (vector char)__b); 16921 } 16922 16923 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16924 vector unsigned char __b) { 16925 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16926 (vector char)__b); 16927 } 16928 16929 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16930 vector bool char __b) { 16931 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16932 (vector char)__b); 16933 } 16934 16935 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16936 vector short __b) { 16937 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 16938 } 16939 16940 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16941 vector bool short __b) { 16942 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 16943 } 16944 16945 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16946 vector unsigned short __b) { 16947 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16948 (vector short)__b); 16949 } 16950 16951 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16952 vector bool short __b) { 16953 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16954 (vector short)__b); 16955 } 16956 16957 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16958 vector short __b) { 16959 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16960 (vector short)__b); 16961 } 16962 16963 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16964 vector unsigned short __b) { 16965 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16966 (vector short)__b); 16967 } 16968 16969 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16970 vector bool short __b) { 16971 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16972 (vector short)__b); 16973 } 16974 16975 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 16976 vector pixel __b) { 16977 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16978 (vector short)__b); 16979 } 16980 16981 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 16982 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 16983 } 16984 16985 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 16986 vector bool int __b) { 16987 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 16988 } 16989 16990 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 16991 vector unsigned int __b) { 16992 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16993 (vector int)__b); 16994 } 16995 16996 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 16997 vector bool int __b) { 16998 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16999 (vector int)__b); 17000 } 17001 17002 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17003 vector int __b) { 17004 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17005 (vector int)__b); 17006 } 17007 17008 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17009 vector unsigned int __b) { 17010 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17011 (vector int)__b); 17012 } 17013 17014 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17015 vector bool int __b) { 17016 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17017 (vector int)__b); 17018 } 17019 17020 #ifdef __VSX__ 17021 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17022 vector signed long long __b) { 17023 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 17024 } 17025 17026 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17027 vector unsigned long long __b) { 17028 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, 17029 (vector long long)__b); 17030 } 17031 17032 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17033 vector bool long long __b) { 17034 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, 17035 (vector signed long long)__b); 17036 } 17037 17038 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17039 vector bool long long __b) { 17040 return __builtin_altivec_vcmpequd_p( 17041 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17042 } 17043 17044 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17045 vector signed long long __b) { 17046 return __builtin_altivec_vcmpequd_p( 17047 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17048 } 17049 17050 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17051 vector unsigned long long __b) { 17052 return __builtin_altivec_vcmpequd_p( 17053 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17054 } 17055 17056 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17057 vector bool long long __b) { 17058 return __builtin_altivec_vcmpequd_p( 17059 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17060 } 17061 #endif 17062 17063 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 17064 vector float __b) { 17065 #ifdef __VSX__ 17066 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 17067 #else 17068 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 17069 #endif 17070 } 17071 17072 #ifdef __VSX__ 17073 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 17074 vector double __b) { 17075 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 17076 } 17077 #endif 17078 17079 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 17080 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, 17081 vector signed __int128 __b) { 17082 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17083 } 17084 17085 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, 17086 vector unsigned __int128 __b) { 17087 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17088 } 17089 #endif 17090 17091 /* vec_any_nge */ 17092 17093 static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, 17094 vector float __b) { 17095 #ifdef __VSX__ 17096 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b); 17097 #else 17098 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 17099 #endif 17100 } 17101 17102 #ifdef __VSX__ 17103 static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a, 17104 vector double __b) { 17105 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b); 17106 } 17107 #endif 17108 17109 /* vec_any_ngt */ 17110 17111 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, 17112 vector float __b) { 17113 #ifdef __VSX__ 17114 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b); 17115 #else 17116 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 17117 #endif 17118 } 17119 17120 #ifdef __VSX__ 17121 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a, 17122 vector double __b) { 17123 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b); 17124 } 17125 #endif 17126 17127 /* vec_any_nle */ 17128 17129 static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, 17130 vector float __b) { 17131 #ifdef __VSX__ 17132 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a); 17133 #else 17134 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 17135 #endif 17136 } 17137 17138 #ifdef __VSX__ 17139 static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a, 17140 vector double __b) { 17141 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a); 17142 } 17143 #endif 17144 17145 /* vec_any_nlt */ 17146 17147 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, 17148 vector float __b) { 17149 #ifdef __VSX__ 17150 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a); 17151 #else 17152 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 17153 #endif 17154 } 17155 17156 #ifdef __VSX__ 17157 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a, 17158 vector double __b) { 17159 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a); 17160 } 17161 #endif 17162 17163 /* vec_any_numeric */ 17164 17165 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) { 17166 #ifdef __VSX__ 17167 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a); 17168 #else 17169 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 17170 #endif 17171 } 17172 17173 #ifdef __VSX__ 17174 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) { 17175 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a); 17176 } 17177 #endif 17178 17179 /* vec_any_out */ 17180 17181 static __inline__ int __attribute__((__always_inline__)) 17182 vec_any_out(vector float __a, vector float __b) { 17183 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 17184 } 17185 17186 /* Power 8 Crypto functions 17187 Note: We diverge from the current GCC implementation with regard 17188 to cryptography and related functions as follows: 17189 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 17190 - The remaining ones are only available on Power8 and up so 17191 require -mpower8-vector 17192 The justification for this is that export requirements require that 17193 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 17194 support). As a result, we need to be able to turn off support for those. 17195 The remaining ones (currently controlled by -mcrypto for GCC) still 17196 need to be provided on compliant hardware even if Vector.Crypto is not 17197 provided. 17198 */ 17199 #ifdef __CRYPTO__ 17200 #define vec_sbox_be __builtin_altivec_crypto_vsbox 17201 #define vec_cipher_be __builtin_altivec_crypto_vcipher 17202 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 17203 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 17204 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 17205 17206 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17207 __builtin_crypto_vsbox(vector unsigned long long __a) { 17208 return __builtin_altivec_crypto_vsbox(__a); 17209 } 17210 17211 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17212 __builtin_crypto_vcipher(vector unsigned long long __a, 17213 vector unsigned long long __b) { 17214 return __builtin_altivec_crypto_vcipher(__a, __b); 17215 } 17216 17217 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17218 __builtin_crypto_vcipherlast(vector unsigned long long __a, 17219 vector unsigned long long __b) { 17220 return __builtin_altivec_crypto_vcipherlast(__a, __b); 17221 } 17222 17223 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17224 __builtin_crypto_vncipher(vector unsigned long long __a, 17225 vector unsigned long long __b) { 17226 return __builtin_altivec_crypto_vncipher(__a, __b); 17227 } 17228 17229 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17230 __builtin_crypto_vncipherlast(vector unsigned long long __a, 17231 vector unsigned long long __b) { 17232 return __builtin_altivec_crypto_vncipherlast(__a, __b); 17233 } 17234 17235 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 17236 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 17237 17238 #define vec_shasigma_be(X, Y, Z) \ 17239 _Generic((X), vector unsigned int \ 17240 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 17241 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 17242 #endif 17243 17244 #ifdef __POWER8_VECTOR__ 17245 static __inline__ vector bool char __ATTRS_o_ai 17246 vec_permxor(vector bool char __a, vector bool char __b, 17247 vector bool char __c) { 17248 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17249 } 17250 17251 static __inline__ vector signed char __ATTRS_o_ai 17252 vec_permxor(vector signed char __a, vector signed char __b, 17253 vector signed char __c) { 17254 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17255 } 17256 17257 static __inline__ vector unsigned char __ATTRS_o_ai 17258 vec_permxor(vector unsigned char __a, vector unsigned char __b, 17259 vector unsigned char __c) { 17260 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17261 } 17262 17263 static __inline__ vector unsigned char __ATTRS_o_ai 17264 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 17265 vector unsigned char __c) { 17266 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17267 } 17268 17269 static __inline__ vector unsigned short __ATTRS_o_ai 17270 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 17271 vector unsigned short __c) { 17272 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 17273 (vector unsigned char)__a, (vector unsigned char)__b, 17274 (vector unsigned char)__c); 17275 } 17276 17277 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 17278 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 17279 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 17280 (vector unsigned char)__a, (vector unsigned char)__b, 17281 (vector unsigned char)__c); 17282 } 17283 17284 static __inline__ vector unsigned long long __ATTRS_o_ai 17285 __builtin_crypto_vpermxor(vector unsigned long long __a, 17286 vector unsigned long long __b, 17287 vector unsigned long long __c) { 17288 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 17289 (vector unsigned char)__a, (vector unsigned char)__b, 17290 (vector unsigned char)__c); 17291 } 17292 17293 static __inline__ vector unsigned char __ATTRS_o_ai 17294 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 17295 return __builtin_altivec_crypto_vpmsumb(__a, __b); 17296 } 17297 17298 static __inline__ vector unsigned short __ATTRS_o_ai 17299 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 17300 return __builtin_altivec_crypto_vpmsumh(__a, __b); 17301 } 17302 17303 static __inline__ vector unsigned int __ATTRS_o_ai 17304 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 17305 return __builtin_altivec_crypto_vpmsumw(__a, __b); 17306 } 17307 17308 static __inline__ vector unsigned long long __ATTRS_o_ai 17309 __builtin_crypto_vpmsumb(vector unsigned long long __a, 17310 vector unsigned long long __b) { 17311 return __builtin_altivec_crypto_vpmsumd(__a, __b); 17312 } 17313 17314 static __inline__ vector signed char __ATTRS_o_ai 17315 vec_vgbbd(vector signed char __a) { 17316 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17317 } 17318 17319 #define vec_pmsum_be __builtin_crypto_vpmsumb 17320 #define vec_gb __builtin_altivec_vgbbd 17321 17322 static __inline__ vector unsigned char __ATTRS_o_ai 17323 vec_vgbbd(vector unsigned char __a) { 17324 return __builtin_altivec_vgbbd(__a); 17325 } 17326 17327 static __inline__ vector signed long long __ATTRS_o_ai 17328 vec_gbb(vector signed long long __a) { 17329 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17330 } 17331 17332 static __inline__ vector unsigned long long __ATTRS_o_ai 17333 vec_gbb(vector unsigned long long __a) { 17334 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17335 } 17336 17337 static __inline__ vector long long __ATTRS_o_ai 17338 vec_vbpermq(vector signed char __a, vector signed char __b) { 17339 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17340 (vector unsigned char)__b); 17341 } 17342 17343 static __inline__ vector long long __ATTRS_o_ai 17344 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 17345 return __builtin_altivec_vbpermq(__a, __b); 17346 } 17347 17348 #if defined(__powerpc64__) && defined(__SIZEOF_INT128__) 17349 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17350 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 17351 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17352 (vector unsigned char)__b); 17353 } 17354 #endif 17355 #endif 17356 17357 17358 /* vec_reve */ 17359 17360 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 17361 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17362 5, 4, 3, 2, 1, 0); 17363 } 17364 17365 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 17366 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17367 5, 4, 3, 2, 1, 0); 17368 } 17369 17370 static inline __ATTRS_o_ai vector unsigned char 17371 vec_reve(vector unsigned char __a) { 17372 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17373 5, 4, 3, 2, 1, 0); 17374 } 17375 17376 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 17377 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17378 } 17379 17380 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 17381 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17382 } 17383 17384 static inline __ATTRS_o_ai vector unsigned int 17385 vec_reve(vector unsigned int __a) { 17386 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17387 } 17388 17389 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 17390 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17391 } 17392 17393 static inline __ATTRS_o_ai vector signed short 17394 vec_reve(vector signed short __a) { 17395 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17396 } 17397 17398 static inline __ATTRS_o_ai vector unsigned short 17399 vec_reve(vector unsigned short __a) { 17400 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17401 } 17402 17403 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 17404 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17405 } 17406 17407 #ifdef __VSX__ 17408 static inline __ATTRS_o_ai vector bool long long 17409 vec_reve(vector bool long long __a) { 17410 return __builtin_shufflevector(__a, __a, 1, 0); 17411 } 17412 17413 static inline __ATTRS_o_ai vector signed long long 17414 vec_reve(vector signed long long __a) { 17415 return __builtin_shufflevector(__a, __a, 1, 0); 17416 } 17417 17418 static inline __ATTRS_o_ai vector unsigned long long 17419 vec_reve(vector unsigned long long __a) { 17420 return __builtin_shufflevector(__a, __a, 1, 0); 17421 } 17422 17423 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 17424 return __builtin_shufflevector(__a, __a, 1, 0); 17425 } 17426 #endif 17427 17428 /* vec_revb */ 17429 static __inline__ vector bool char __ATTRS_o_ai 17430 vec_revb(vector bool char __a) { 17431 return __a; 17432 } 17433 17434 static __inline__ vector signed char __ATTRS_o_ai 17435 vec_revb(vector signed char __a) { 17436 return __a; 17437 } 17438 17439 static __inline__ vector unsigned char __ATTRS_o_ai 17440 vec_revb(vector unsigned char __a) { 17441 return __a; 17442 } 17443 17444 static __inline__ vector bool short __ATTRS_o_ai 17445 vec_revb(vector bool short __a) { 17446 vector unsigned char __indices = 17447 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17448 return vec_perm(__a, __a, __indices); 17449 } 17450 17451 static __inline__ vector signed short __ATTRS_o_ai 17452 vec_revb(vector signed short __a) { 17453 vector unsigned char __indices = 17454 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17455 return vec_perm(__a, __a, __indices); 17456 } 17457 17458 static __inline__ vector unsigned short __ATTRS_o_ai 17459 vec_revb(vector unsigned short __a) { 17460 vector unsigned char __indices = 17461 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17462 return vec_perm(__a, __a, __indices); 17463 } 17464 17465 static __inline__ vector bool int __ATTRS_o_ai 17466 vec_revb(vector bool int __a) { 17467 vector unsigned char __indices = 17468 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17469 return vec_perm(__a, __a, __indices); 17470 } 17471 17472 static __inline__ vector signed int __ATTRS_o_ai 17473 vec_revb(vector signed int __a) { 17474 vector unsigned char __indices = 17475 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17476 return vec_perm(__a, __a, __indices); 17477 } 17478 17479 static __inline__ vector unsigned int __ATTRS_o_ai 17480 vec_revb(vector unsigned int __a) { 17481 vector unsigned char __indices = 17482 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17483 return vec_perm(__a, __a, __indices); 17484 } 17485 17486 static __inline__ vector float __ATTRS_o_ai 17487 vec_revb(vector float __a) { 17488 vector unsigned char __indices = 17489 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17490 return vec_perm(__a, __a, __indices); 17491 } 17492 17493 #ifdef __VSX__ 17494 static __inline__ vector bool long long __ATTRS_o_ai 17495 vec_revb(vector bool long long __a) { 17496 vector unsigned char __indices = 17497 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17498 return vec_perm(__a, __a, __indices); 17499 } 17500 17501 static __inline__ vector signed long long __ATTRS_o_ai 17502 vec_revb(vector signed long long __a) { 17503 vector unsigned char __indices = 17504 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17505 return vec_perm(__a, __a, __indices); 17506 } 17507 17508 static __inline__ vector unsigned long long __ATTRS_o_ai 17509 vec_revb(vector unsigned long long __a) { 17510 vector unsigned char __indices = 17511 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17512 return vec_perm(__a, __a, __indices); 17513 } 17514 17515 static __inline__ vector double __ATTRS_o_ai 17516 vec_revb(vector double __a) { 17517 vector unsigned char __indices = 17518 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17519 return vec_perm(__a, __a, __indices); 17520 } 17521 #endif /* End __VSX__ */ 17522 17523 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17524 defined(__SIZEOF_INT128__) 17525 static __inline__ vector signed __int128 __ATTRS_o_ai 17526 vec_revb(vector signed __int128 __a) { 17527 vector unsigned char __indices = 17528 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17529 return (vector signed __int128)vec_perm((vector signed int)__a, 17530 (vector signed int)__a, 17531 __indices); 17532 } 17533 17534 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17535 vec_revb(vector unsigned __int128 __a) { 17536 vector unsigned char __indices = 17537 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17538 return (vector unsigned __int128)vec_perm((vector signed int)__a, 17539 (vector signed int)__a, 17540 __indices); 17541 } 17542 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 17543 17544 /* vec_xl */ 17545 17546 #define vec_xld2 vec_xl 17547 #define vec_xlw4 vec_xl 17548 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 17549 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 17550 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 17551 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 17552 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 17553 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 17554 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 17555 17556 static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, 17557 const signed char *__ptr) { 17558 return *(unaligned_vec_schar *)(__ptr + __offset); 17559 } 17560 17561 static inline __ATTRS_o_ai vector unsigned char 17562 vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) { 17563 return *(unaligned_vec_uchar*)(__ptr + __offset); 17564 } 17565 17566 static inline __ATTRS_o_ai vector signed short 17567 vec_xl(ptrdiff_t __offset, const signed short *__ptr) { 17568 signed char *__addr = (signed char *)__ptr + __offset; 17569 return *(unaligned_vec_sshort *)__addr; 17570 } 17571 17572 static inline __ATTRS_o_ai vector unsigned short 17573 vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) { 17574 signed char *__addr = (signed char *)__ptr + __offset; 17575 return *(unaligned_vec_ushort *)__addr; 17576 } 17577 17578 static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset, 17579 const signed int *__ptr) { 17580 signed char *__addr = (signed char *)__ptr + __offset; 17581 return *(unaligned_vec_sint *)__addr; 17582 } 17583 17584 static inline __ATTRS_o_ai vector unsigned int 17585 vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) { 17586 signed char *__addr = (signed char *)__ptr + __offset; 17587 return *(unaligned_vec_uint *)__addr; 17588 } 17589 17590 static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset, 17591 const float *__ptr) { 17592 signed char *__addr = (signed char *)__ptr + __offset; 17593 return *(unaligned_vec_float *)__addr; 17594 } 17595 17596 #ifdef __VSX__ 17597 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 17598 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 17599 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 17600 17601 static inline __ATTRS_o_ai vector signed long long 17602 vec_xl(ptrdiff_t __offset, const signed long long *__ptr) { 17603 signed char *__addr = (signed char *)__ptr + __offset; 17604 return *(unaligned_vec_sll *)__addr; 17605 } 17606 17607 static inline __ATTRS_o_ai vector unsigned long long 17608 vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) { 17609 signed char *__addr = (signed char *)__ptr + __offset; 17610 return *(unaligned_vec_ull *)__addr; 17611 } 17612 17613 static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset, 17614 const double *__ptr) { 17615 signed char *__addr = (signed char *)__ptr + __offset; 17616 return *(unaligned_vec_double *)__addr; 17617 } 17618 #endif 17619 17620 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17621 defined(__SIZEOF_INT128__) 17622 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 17623 typedef vector unsigned __int128 unaligned_vec_ui128 17624 __attribute__((aligned(1))); 17625 static inline __ATTRS_o_ai vector signed __int128 17626 vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) { 17627 signed char *__addr = (signed char *)__ptr + __offset; 17628 return *(unaligned_vec_si128 *)__addr; 17629 } 17630 17631 static inline __ATTRS_o_ai vector unsigned __int128 17632 vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) { 17633 signed char *__addr = (signed char *)__ptr + __offset; 17634 return *(unaligned_vec_ui128 *)__addr; 17635 } 17636 #endif 17637 17638 /* vec_xl_be */ 17639 17640 #ifdef __LITTLE_ENDIAN__ 17641 static __inline__ vector signed char __ATTRS_o_ai 17642 vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) { 17643 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17644 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17645 13, 12, 11, 10, 9, 8); 17646 } 17647 17648 static __inline__ vector unsigned char __ATTRS_o_ai 17649 vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) { 17650 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17651 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17652 13, 12, 11, 10, 9, 8); 17653 } 17654 17655 static __inline__ vector signed short __ATTRS_o_ai 17656 vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) { 17657 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17658 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17659 } 17660 17661 static __inline__ vector unsigned short __ATTRS_o_ai 17662 vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) { 17663 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17664 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17665 } 17666 17667 static __inline__ vector signed int __ATTRS_o_ai 17668 vec_xl_be(signed long long __offset, const signed int *__ptr) { 17669 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17670 } 17671 17672 static __inline__ vector unsigned int __ATTRS_o_ai 17673 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 17674 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17675 } 17676 17677 static __inline__ vector float __ATTRS_o_ai 17678 vec_xl_be(signed long long __offset, const float *__ptr) { 17679 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17680 } 17681 17682 #ifdef __VSX__ 17683 static __inline__ vector signed long long __ATTRS_o_ai 17684 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 17685 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17686 } 17687 17688 static __inline__ vector unsigned long long __ATTRS_o_ai 17689 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 17690 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17691 } 17692 17693 static __inline__ vector double __ATTRS_o_ai 17694 vec_xl_be(signed long long __offset, const double *__ptr) { 17695 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17696 } 17697 #endif 17698 17699 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17700 defined(__SIZEOF_INT128__) 17701 static __inline__ vector signed __int128 __ATTRS_o_ai 17702 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 17703 return vec_xl(__offset, __ptr); 17704 } 17705 17706 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17707 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 17708 return vec_xl(__offset, __ptr); 17709 } 17710 #endif 17711 #else 17712 #define vec_xl_be vec_xl 17713 #endif 17714 17715 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17716 defined(__SIZEOF_INT128__) 17717 17718 /* vect_xl_sext */ 17719 17720 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17721 vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) { 17722 return (vector unsigned __int128)*(__pointer + __offset); 17723 } 17724 17725 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17726 vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) { 17727 return (vector unsigned __int128)*(__pointer + __offset); 17728 } 17729 17730 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17731 vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) { 17732 return (vector unsigned __int128)*(__pointer + __offset); 17733 } 17734 17735 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17736 vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) { 17737 return (vector unsigned __int128)*(__pointer + __offset); 17738 } 17739 17740 /* vec_xl_zext */ 17741 17742 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17743 vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) { 17744 return (vector unsigned __int128)*(__pointer + __offset); 17745 } 17746 17747 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17748 vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) { 17749 return (vector unsigned __int128)*(__pointer + __offset); 17750 } 17751 17752 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17753 vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) { 17754 return (vector unsigned __int128)*(__pointer + __offset); 17755 } 17756 17757 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17758 vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) { 17759 return (vector unsigned __int128)*(__pointer + __offset); 17760 } 17761 17762 #endif 17763 17764 /* vec_xlds */ 17765 #ifdef __VSX__ 17766 static __inline__ vector signed long long __ATTRS_o_ai 17767 vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) { 17768 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset); 17769 return (vector signed long long) *__addr; 17770 } 17771 17772 static __inline__ vector unsigned long long __ATTRS_o_ai 17773 vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) { 17774 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset); 17775 return (unaligned_vec_ull) *__addr; 17776 } 17777 17778 static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset, 17779 const double *__ptr) { 17780 double *__addr = (double*)((signed char *)__ptr + __offset); 17781 return (unaligned_vec_double) *__addr; 17782 } 17783 17784 /* vec_load_splats */ 17785 static __inline__ vector signed int __ATTRS_o_ai 17786 vec_load_splats(signed long long __offset, const signed int *__ptr) { 17787 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17788 return (vector signed int)*__addr; 17789 } 17790 17791 static __inline__ vector signed int __ATTRS_o_ai 17792 vec_load_splats(unsigned long long __offset, const signed int *__ptr) { 17793 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17794 return (vector signed int)*__addr; 17795 } 17796 17797 static __inline__ vector unsigned int __ATTRS_o_ai 17798 vec_load_splats(signed long long __offset, const unsigned int *__ptr) { 17799 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17800 return (vector unsigned int)*__addr; 17801 } 17802 17803 static __inline__ vector unsigned int __ATTRS_o_ai 17804 vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) { 17805 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17806 return (vector unsigned int)*__addr; 17807 } 17808 17809 static __inline__ vector float __ATTRS_o_ai 17810 vec_load_splats(signed long long __offset, const float *__ptr) { 17811 float *__addr = (float*)((signed char *)__ptr + __offset); 17812 return (vector float)*__addr; 17813 } 17814 17815 static __inline__ vector float __ATTRS_o_ai 17816 vec_load_splats(unsigned long long __offset, const float *__ptr) { 17817 float *__addr = (float*)((signed char *)__ptr + __offset); 17818 return (vector float)*__addr; 17819 } 17820 #endif 17821 17822 /* vec_xst */ 17823 17824 #define vec_xstd2 vec_xst 17825 #define vec_xstw4 vec_xst 17826 static inline __ATTRS_o_ai void 17827 vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) { 17828 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 17829 } 17830 17831 static inline __ATTRS_o_ai void 17832 vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) { 17833 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 17834 } 17835 17836 static inline __ATTRS_o_ai void 17837 vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) { 17838 signed char *__addr = (signed char *)__ptr + __offset; 17839 *(unaligned_vec_sshort *)__addr = __vec; 17840 } 17841 17842 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 17843 ptrdiff_t __offset, 17844 unsigned short *__ptr) { 17845 signed char *__addr = (signed char *)__ptr + __offset; 17846 *(unaligned_vec_ushort *)__addr = __vec; 17847 } 17848 17849 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 17850 ptrdiff_t __offset, signed int *__ptr) { 17851 signed char *__addr = (signed char *)__ptr + __offset; 17852 *(unaligned_vec_sint *)__addr = __vec; 17853 } 17854 17855 static inline __ATTRS_o_ai void 17856 vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) { 17857 signed char *__addr = (signed char *)__ptr + __offset; 17858 *(unaligned_vec_uint *)__addr = __vec; 17859 } 17860 17861 static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset, 17862 float *__ptr) { 17863 signed char *__addr = (signed char *)__ptr + __offset; 17864 *(unaligned_vec_float *)__addr = __vec; 17865 } 17866 17867 #ifdef __VSX__ 17868 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 17869 ptrdiff_t __offset, 17870 signed long long *__ptr) { 17871 signed char *__addr = (signed char *)__ptr + __offset; 17872 *(unaligned_vec_sll *)__addr = __vec; 17873 } 17874 17875 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 17876 ptrdiff_t __offset, 17877 unsigned long long *__ptr) { 17878 signed char *__addr = (signed char *)__ptr + __offset; 17879 *(unaligned_vec_ull *)__addr = __vec; 17880 } 17881 17882 static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset, 17883 double *__ptr) { 17884 signed char *__addr = (signed char *)__ptr + __offset; 17885 *(unaligned_vec_double *)__addr = __vec; 17886 } 17887 #endif 17888 17889 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17890 defined(__SIZEOF_INT128__) 17891 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 17892 ptrdiff_t __offset, 17893 signed __int128 *__ptr) { 17894 signed char *__addr = (signed char *)__ptr + __offset; 17895 *(unaligned_vec_si128 *)__addr = __vec; 17896 } 17897 17898 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 17899 ptrdiff_t __offset, 17900 unsigned __int128 *__ptr) { 17901 signed char *__addr = (signed char *)__ptr + __offset; 17902 *(unaligned_vec_ui128 *)__addr = __vec; 17903 } 17904 #endif 17905 17906 /* vec_xst_trunc */ 17907 17908 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17909 defined(__SIZEOF_INT128__) 17910 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17911 ptrdiff_t __offset, 17912 signed char *__ptr) { 17913 *(__ptr + __offset) = (signed char)__vec[0]; 17914 } 17915 17916 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17917 ptrdiff_t __offset, 17918 unsigned char *__ptr) { 17919 *(__ptr + __offset) = (unsigned char)__vec[0]; 17920 } 17921 17922 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17923 ptrdiff_t __offset, 17924 signed short *__ptr) { 17925 *(__ptr + __offset) = (signed short)__vec[0]; 17926 } 17927 17928 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17929 ptrdiff_t __offset, 17930 unsigned short *__ptr) { 17931 *(__ptr + __offset) = (unsigned short)__vec[0]; 17932 } 17933 17934 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17935 ptrdiff_t __offset, 17936 signed int *__ptr) { 17937 *(__ptr + __offset) = (signed int)__vec[0]; 17938 } 17939 17940 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17941 ptrdiff_t __offset, 17942 unsigned int *__ptr) { 17943 *(__ptr + __offset) = (unsigned int)__vec[0]; 17944 } 17945 17946 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17947 ptrdiff_t __offset, 17948 signed long long *__ptr) { 17949 *(__ptr + __offset) = (signed long long)__vec[0]; 17950 } 17951 17952 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17953 ptrdiff_t __offset, 17954 unsigned long long *__ptr) { 17955 *(__ptr + __offset) = (unsigned long long)__vec[0]; 17956 } 17957 #endif 17958 17959 /* vec_xst_be */ 17960 17961 #ifdef __LITTLE_ENDIAN__ 17962 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 17963 signed long long __offset, 17964 signed char *__ptr) { 17965 vector signed char __tmp = 17966 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17967 13, 12, 11, 10, 9, 8); 17968 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17969 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17970 } 17971 17972 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 17973 signed long long __offset, 17974 unsigned char *__ptr) { 17975 vector unsigned char __tmp = 17976 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17977 13, 12, 11, 10, 9, 8); 17978 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17979 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17980 } 17981 17982 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 17983 signed long long __offset, 17984 signed short *__ptr) { 17985 vector signed short __tmp = 17986 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17987 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17988 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17989 } 17990 17991 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 17992 signed long long __offset, 17993 unsigned short *__ptr) { 17994 vector unsigned short __tmp = 17995 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17996 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17997 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17998 } 17999 18000 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 18001 signed long long __offset, 18002 signed int *__ptr) { 18003 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 18004 } 18005 18006 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 18007 signed long long __offset, 18008 unsigned int *__ptr) { 18009 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18010 } 18011 18012 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 18013 signed long long __offset, 18014 float *__ptr) { 18015 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18016 } 18017 18018 #ifdef __VSX__ 18019 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 18020 signed long long __offset, 18021 signed long long *__ptr) { 18022 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18023 } 18024 18025 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 18026 signed long long __offset, 18027 unsigned long long *__ptr) { 18028 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18029 } 18030 18031 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 18032 signed long long __offset, 18033 double *__ptr) { 18034 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18035 } 18036 #endif 18037 18038 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 18039 defined(__SIZEOF_INT128__) 18040 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 18041 signed long long __offset, 18042 signed __int128 *__ptr) { 18043 vec_xst(__vec, __offset, __ptr); 18044 } 18045 18046 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 18047 signed long long __offset, 18048 unsigned __int128 *__ptr) { 18049 vec_xst(__vec, __offset, __ptr); 18050 } 18051 #endif 18052 #else 18053 #define vec_xst_be vec_xst 18054 #endif 18055 18056 #ifdef __POWER9_VECTOR__ 18057 #define vec_test_data_class(__a, __b) \ 18058 _Generic( \ 18059 (__a), vector float \ 18060 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 18061 vector double \ 18062 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 18063 (__b))) 18064 18065 #endif /* #ifdef __POWER9_VECTOR__ */ 18066 18067 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 18068 return -__a; 18069 } 18070 18071 #ifdef __VSX__ 18072 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 18073 return -__a; 18074 } 18075 18076 #endif 18077 18078 #ifdef __VSX__ 18079 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 18080 return -__a; 18081 } 18082 #endif 18083 18084 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 18085 return -__a; 18086 } 18087 18088 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 18089 return -__a; 18090 } 18091 18092 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 18093 return -__a; 18094 } 18095 18096 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 18097 return - vec_abs(__a); 18098 } 18099 18100 #ifdef __VSX__ 18101 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 18102 return - vec_abs(__a); 18103 } 18104 18105 #endif 18106 18107 #ifdef __POWER8_VECTOR__ 18108 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 18109 return __builtin_altivec_vminsd(__a, -__a); 18110 } 18111 #endif 18112 18113 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 18114 return __builtin_altivec_vminsw(__a, -__a); 18115 } 18116 18117 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 18118 return __builtin_altivec_vminsh(__a, -__a); 18119 } 18120 18121 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 18122 return __builtin_altivec_vminsb(__a, -__a); 18123 } 18124 18125 static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, 18126 vector float __b) { 18127 return __builtin_ppc_recipdivf(__a, __b); 18128 } 18129 18130 #ifdef __VSX__ 18131 static vector double __ATTRS_o_ai vec_recipdiv(vector double __a, 18132 vector double __b) { 18133 return __builtin_ppc_recipdivd(__a, __b); 18134 } 18135 #endif 18136 18137 #ifdef __POWER10_VECTOR__ 18138 18139 /* vec_extractm */ 18140 18141 static __inline__ unsigned int __ATTRS_o_ai 18142 vec_extractm(vector unsigned char __a) { 18143 return __builtin_altivec_vextractbm(__a); 18144 } 18145 18146 static __inline__ unsigned int __ATTRS_o_ai 18147 vec_extractm(vector unsigned short __a) { 18148 return __builtin_altivec_vextracthm(__a); 18149 } 18150 18151 static __inline__ unsigned int __ATTRS_o_ai 18152 vec_extractm(vector unsigned int __a) { 18153 return __builtin_altivec_vextractwm(__a); 18154 } 18155 18156 static __inline__ unsigned int __ATTRS_o_ai 18157 vec_extractm(vector unsigned long long __a) { 18158 return __builtin_altivec_vextractdm(__a); 18159 } 18160 18161 #ifdef __SIZEOF_INT128__ 18162 static __inline__ unsigned int __ATTRS_o_ai 18163 vec_extractm(vector unsigned __int128 __a) { 18164 return __builtin_altivec_vextractqm(__a); 18165 } 18166 #endif 18167 18168 /* vec_expandm */ 18169 18170 static __inline__ vector unsigned char __ATTRS_o_ai 18171 vec_expandm(vector unsigned char __a) { 18172 return __builtin_altivec_vexpandbm(__a); 18173 } 18174 18175 static __inline__ vector unsigned short __ATTRS_o_ai 18176 vec_expandm(vector unsigned short __a) { 18177 return __builtin_altivec_vexpandhm(__a); 18178 } 18179 18180 static __inline__ vector unsigned int __ATTRS_o_ai 18181 vec_expandm(vector unsigned int __a) { 18182 return __builtin_altivec_vexpandwm(__a); 18183 } 18184 18185 static __inline__ vector unsigned long long __ATTRS_o_ai 18186 vec_expandm(vector unsigned long long __a) { 18187 return __builtin_altivec_vexpanddm(__a); 18188 } 18189 18190 #ifdef __SIZEOF_INT128__ 18191 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18192 vec_expandm(vector unsigned __int128 __a) { 18193 return __builtin_altivec_vexpandqm(__a); 18194 } 18195 #endif 18196 18197 /* vec_cntm */ 18198 18199 #define vec_cntm(__a, __mp) \ 18200 _Generic((__a), vector unsigned char \ 18201 : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)), \ 18202 vector unsigned short \ 18203 : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)), \ 18204 vector unsigned int \ 18205 : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)), \ 18206 vector unsigned long long \ 18207 : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp))) 18208 18209 /* vec_gen[b|h|w|d|q]m */ 18210 18211 static __inline__ vector unsigned char __ATTRS_o_ai 18212 vec_genbm(unsigned long long __bm) { 18213 return __builtin_altivec_mtvsrbm(__bm); 18214 } 18215 18216 static __inline__ vector unsigned short __ATTRS_o_ai 18217 vec_genhm(unsigned long long __bm) { 18218 return __builtin_altivec_mtvsrhm(__bm); 18219 } 18220 18221 static __inline__ vector unsigned int __ATTRS_o_ai 18222 vec_genwm(unsigned long long __bm) { 18223 return __builtin_altivec_mtvsrwm(__bm); 18224 } 18225 18226 static __inline__ vector unsigned long long __ATTRS_o_ai 18227 vec_gendm(unsigned long long __bm) { 18228 return __builtin_altivec_mtvsrdm(__bm); 18229 } 18230 18231 #ifdef __SIZEOF_INT128__ 18232 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18233 vec_genqm(unsigned long long __bm) { 18234 return __builtin_altivec_mtvsrqm(__bm); 18235 } 18236 #endif 18237 18238 /* vec_pdep */ 18239 18240 static __inline__ vector unsigned long long __ATTRS_o_ai 18241 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 18242 return __builtin_altivec_vpdepd(__a, __b); 18243 } 18244 18245 /* vec_pext */ 18246 18247 static __inline__ vector unsigned long long __ATTRS_o_ai 18248 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 18249 return __builtin_altivec_vpextd(__a, __b); 18250 } 18251 18252 /* vec_cfuge */ 18253 18254 static __inline__ vector unsigned long long __ATTRS_o_ai 18255 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 18256 return __builtin_altivec_vcfuged(__a, __b); 18257 } 18258 18259 /* vec_gnb */ 18260 18261 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 18262 18263 /* vec_ternarylogic */ 18264 #ifdef __VSX__ 18265 #ifdef __SIZEOF_INT128__ 18266 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18267 _Generic((__a), vector unsigned char \ 18268 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18269 (vector unsigned long long)(__b), \ 18270 (vector unsigned long long)(__c), (__imm)), \ 18271 vector unsigned short \ 18272 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18273 (vector unsigned long long)(__b), \ 18274 (vector unsigned long long)(__c), (__imm)), \ 18275 vector unsigned int \ 18276 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18277 (vector unsigned long long)(__b), \ 18278 (vector unsigned long long)(__c), (__imm)), \ 18279 vector unsigned long long \ 18280 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18281 (vector unsigned long long)(__b), \ 18282 (vector unsigned long long)(__c), (__imm)), \ 18283 vector unsigned __int128 \ 18284 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18285 (vector unsigned long long)(__b), \ 18286 (vector unsigned long long)(__c), (__imm))) 18287 #else 18288 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18289 _Generic((__a), vector unsigned char \ 18290 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18291 (vector unsigned long long)(__b), \ 18292 (vector unsigned long long)(__c), (__imm)), \ 18293 vector unsigned short \ 18294 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18295 (vector unsigned long long)(__b), \ 18296 (vector unsigned long long)(__c), (__imm)), \ 18297 vector unsigned int \ 18298 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18299 (vector unsigned long long)(__b), \ 18300 (vector unsigned long long)(__c), (__imm)), \ 18301 vector unsigned long long \ 18302 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18303 (vector unsigned long long)(__b), \ 18304 (vector unsigned long long)(__c), (__imm))) 18305 #endif /* __SIZEOF_INT128__ */ 18306 #endif /* __VSX__ */ 18307 18308 /* vec_genpcvm */ 18309 18310 #ifdef __VSX__ 18311 #define vec_genpcvm(__a, __imm) \ 18312 _Generic((__a), vector unsigned char \ 18313 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ 18314 vector unsigned short \ 18315 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ 18316 vector unsigned int \ 18317 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ 18318 vector unsigned long long \ 18319 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) 18320 #endif /* __VSX__ */ 18321 18322 /* vec_clrl */ 18323 18324 static __inline__ vector signed char __ATTRS_o_ai 18325 vec_clrl(vector signed char __a, unsigned int __n) { 18326 #ifdef __LITTLE_ENDIAN__ 18327 return __builtin_altivec_vclrrb(__a, __n); 18328 #else 18329 return __builtin_altivec_vclrlb( __a, __n); 18330 #endif 18331 } 18332 18333 static __inline__ vector unsigned char __ATTRS_o_ai 18334 vec_clrl(vector unsigned char __a, unsigned int __n) { 18335 #ifdef __LITTLE_ENDIAN__ 18336 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18337 #else 18338 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18339 #endif 18340 } 18341 18342 /* vec_clrr */ 18343 18344 static __inline__ vector signed char __ATTRS_o_ai 18345 vec_clrr(vector signed char __a, unsigned int __n) { 18346 #ifdef __LITTLE_ENDIAN__ 18347 return __builtin_altivec_vclrlb(__a, __n); 18348 #else 18349 return __builtin_altivec_vclrrb( __a, __n); 18350 #endif 18351 } 18352 18353 static __inline__ vector unsigned char __ATTRS_o_ai 18354 vec_clrr(vector unsigned char __a, unsigned int __n) { 18355 #ifdef __LITTLE_ENDIAN__ 18356 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18357 #else 18358 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18359 #endif 18360 } 18361 18362 /* vec_cntlzm */ 18363 18364 static __inline__ vector unsigned long long __ATTRS_o_ai 18365 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 18366 return __builtin_altivec_vclzdm(__a, __b); 18367 } 18368 18369 /* vec_cnttzm */ 18370 18371 static __inline__ vector unsigned long long __ATTRS_o_ai 18372 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 18373 return __builtin_altivec_vctzdm(__a, __b); 18374 } 18375 18376 /* vec_mod */ 18377 18378 static __inline__ vector signed int __ATTRS_o_ai 18379 vec_mod(vector signed int __a, vector signed int __b) { 18380 return __a % __b; 18381 } 18382 18383 static __inline__ vector unsigned int __ATTRS_o_ai 18384 vec_mod(vector unsigned int __a, vector unsigned int __b) { 18385 return __a % __b; 18386 } 18387 18388 static __inline__ vector signed long long __ATTRS_o_ai 18389 vec_mod(vector signed long long __a, vector signed long long __b) { 18390 return __a % __b; 18391 } 18392 18393 static __inline__ vector unsigned long long __ATTRS_o_ai 18394 vec_mod(vector unsigned long long __a, vector unsigned long long __b) { 18395 return __a % __b; 18396 } 18397 18398 #ifdef __SIZEOF_INT128__ 18399 static __inline__ vector signed __int128 __ATTRS_o_ai 18400 vec_mod(vector signed __int128 __a, vector signed __int128 __b) { 18401 return __a % __b; 18402 } 18403 18404 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18405 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18406 return __a % __b; 18407 } 18408 #endif 18409 18410 /* vec_sldbi */ 18411 18412 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) 18413 18414 /* vec_srdbi */ 18415 18416 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) 18417 18418 /* vec_insertl */ 18419 18420 static __inline__ vector unsigned char __ATTRS_o_ai 18421 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18422 #ifdef __LITTLE_ENDIAN__ 18423 return __builtin_altivec_vinsbrx(__b, __c, __a); 18424 #else 18425 return __builtin_altivec_vinsblx(__b, __c, __a); 18426 #endif 18427 } 18428 18429 static __inline__ vector unsigned short __ATTRS_o_ai 18430 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18431 #ifdef __LITTLE_ENDIAN__ 18432 return __builtin_altivec_vinshrx(__b, __c, __a); 18433 #else 18434 return __builtin_altivec_vinshlx(__b, __c, __a); 18435 #endif 18436 } 18437 18438 static __inline__ vector unsigned int __ATTRS_o_ai 18439 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18440 #ifdef __LITTLE_ENDIAN__ 18441 return __builtin_altivec_vinswrx(__b, __c, __a); 18442 #else 18443 return __builtin_altivec_vinswlx(__b, __c, __a); 18444 #endif 18445 } 18446 18447 static __inline__ vector unsigned long long __ATTRS_o_ai 18448 vec_insertl(unsigned long long __a, vector unsigned long long __b, 18449 unsigned int __c) { 18450 #ifdef __LITTLE_ENDIAN__ 18451 return __builtin_altivec_vinsdrx(__b, __c, __a); 18452 #else 18453 return __builtin_altivec_vinsdlx(__b, __c, __a); 18454 #endif 18455 } 18456 18457 static __inline__ vector unsigned char __ATTRS_o_ai 18458 vec_insertl(vector unsigned char __a, vector unsigned char __b, 18459 unsigned int __c) { 18460 #ifdef __LITTLE_ENDIAN__ 18461 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18462 #else 18463 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18464 #endif 18465 } 18466 18467 static __inline__ vector unsigned short __ATTRS_o_ai 18468 vec_insertl(vector unsigned short __a, vector unsigned short __b, 18469 unsigned int __c) { 18470 #ifdef __LITTLE_ENDIAN__ 18471 return __builtin_altivec_vinshvrx(__b, __c, __a); 18472 #else 18473 return __builtin_altivec_vinshvlx(__b, __c, __a); 18474 #endif 18475 } 18476 18477 static __inline__ vector unsigned int __ATTRS_o_ai 18478 vec_insertl(vector unsigned int __a, vector unsigned int __b, 18479 unsigned int __c) { 18480 #ifdef __LITTLE_ENDIAN__ 18481 return __builtin_altivec_vinswvrx(__b, __c, __a); 18482 #else 18483 return __builtin_altivec_vinswvlx(__b, __c, __a); 18484 #endif 18485 } 18486 18487 /* vec_inserth */ 18488 18489 static __inline__ vector unsigned char __ATTRS_o_ai 18490 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18491 #ifdef __LITTLE_ENDIAN__ 18492 return __builtin_altivec_vinsblx(__b, __c, __a); 18493 #else 18494 return __builtin_altivec_vinsbrx(__b, __c, __a); 18495 #endif 18496 } 18497 18498 static __inline__ vector unsigned short __ATTRS_o_ai 18499 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18500 #ifdef __LITTLE_ENDIAN__ 18501 return __builtin_altivec_vinshlx(__b, __c, __a); 18502 #else 18503 return __builtin_altivec_vinshrx(__b, __c, __a); 18504 #endif 18505 } 18506 18507 static __inline__ vector unsigned int __ATTRS_o_ai 18508 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18509 #ifdef __LITTLE_ENDIAN__ 18510 return __builtin_altivec_vinswlx(__b, __c, __a); 18511 #else 18512 return __builtin_altivec_vinswrx(__b, __c, __a); 18513 #endif 18514 } 18515 18516 static __inline__ vector unsigned long long __ATTRS_o_ai 18517 vec_inserth(unsigned long long __a, vector unsigned long long __b, 18518 unsigned int __c) { 18519 #ifdef __LITTLE_ENDIAN__ 18520 return __builtin_altivec_vinsdlx(__b, __c, __a); 18521 #else 18522 return __builtin_altivec_vinsdrx(__b, __c, __a); 18523 #endif 18524 } 18525 18526 static __inline__ vector unsigned char __ATTRS_o_ai 18527 vec_inserth(vector unsigned char __a, vector unsigned char __b, 18528 unsigned int __c) { 18529 #ifdef __LITTLE_ENDIAN__ 18530 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18531 #else 18532 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18533 #endif 18534 } 18535 18536 static __inline__ vector unsigned short __ATTRS_o_ai 18537 vec_inserth(vector unsigned short __a, vector unsigned short __b, 18538 unsigned int __c) { 18539 #ifdef __LITTLE_ENDIAN__ 18540 return __builtin_altivec_vinshvlx(__b, __c, __a); 18541 #else 18542 return __builtin_altivec_vinshvrx(__b, __c, __a); 18543 #endif 18544 } 18545 18546 static __inline__ vector unsigned int __ATTRS_o_ai 18547 vec_inserth(vector unsigned int __a, vector unsigned int __b, 18548 unsigned int __c) { 18549 #ifdef __LITTLE_ENDIAN__ 18550 return __builtin_altivec_vinswvlx(__b, __c, __a); 18551 #else 18552 return __builtin_altivec_vinswvrx(__b, __c, __a); 18553 #endif 18554 } 18555 18556 /* vec_extractl */ 18557 18558 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18559 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18560 #ifdef __LITTLE_ENDIAN__ 18561 return __builtin_altivec_vextdubvrx(__a, __b, __c); 18562 #else 18563 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); 18564 return vec_sld(__ret, __ret, 8); 18565 #endif 18566 } 18567 18568 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18569 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18570 #ifdef __LITTLE_ENDIAN__ 18571 return __builtin_altivec_vextduhvrx(__a, __b, __c); 18572 #else 18573 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); 18574 return vec_sld(__ret, __ret, 8); 18575 #endif 18576 } 18577 18578 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18579 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18580 #ifdef __LITTLE_ENDIAN__ 18581 return __builtin_altivec_vextduwvrx(__a, __b, __c); 18582 #else 18583 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); 18584 return vec_sld(__ret, __ret, 8); 18585 #endif 18586 } 18587 18588 static __inline__ vector unsigned long long __ATTRS_o_ai 18589 vec_extractl(vector unsigned long long __a, vector unsigned long long __b, 18590 unsigned int __c) { 18591 #ifdef __LITTLE_ENDIAN__ 18592 return __builtin_altivec_vextddvrx(__a, __b, __c); 18593 #else 18594 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); 18595 return vec_sld(__ret, __ret, 8); 18596 #endif 18597 } 18598 18599 /* vec_extracth */ 18600 18601 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18602 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18603 #ifdef __LITTLE_ENDIAN__ 18604 return __builtin_altivec_vextdubvlx(__a, __b, __c); 18605 #else 18606 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); 18607 return vec_sld(__ret, __ret, 8); 18608 #endif 18609 } 18610 18611 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18612 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18613 #ifdef __LITTLE_ENDIAN__ 18614 return __builtin_altivec_vextduhvlx(__a, __b, __c); 18615 #else 18616 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); 18617 return vec_sld(__ret, __ret, 8); 18618 #endif 18619 } 18620 18621 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18622 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18623 #ifdef __LITTLE_ENDIAN__ 18624 return __builtin_altivec_vextduwvlx(__a, __b, __c); 18625 #else 18626 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); 18627 return vec_sld(__ret, __ret, 8); 18628 #endif 18629 } 18630 18631 static __inline__ vector unsigned long long __ATTRS_o_ai 18632 vec_extracth(vector unsigned long long __a, vector unsigned long long __b, 18633 unsigned int __c) { 18634 #ifdef __LITTLE_ENDIAN__ 18635 return __builtin_altivec_vextddvlx(__a, __b, __c); 18636 #else 18637 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); 18638 return vec_sld(__ret, __ret, 8); 18639 #endif 18640 } 18641 18642 #ifdef __VSX__ 18643 18644 /* vec_permx */ 18645 18646 #define vec_permx(__a, __b, __c, __d) \ 18647 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) 18648 18649 /* vec_blendv */ 18650 18651 static __inline__ vector signed char __ATTRS_o_ai 18652 vec_blendv(vector signed char __a, vector signed char __b, 18653 vector unsigned char __c) { 18654 return __builtin_vsx_xxblendvb(__a, __b, __c); 18655 } 18656 18657 static __inline__ vector unsigned char __ATTRS_o_ai 18658 vec_blendv(vector unsigned char __a, vector unsigned char __b, 18659 vector unsigned char __c) { 18660 return __builtin_vsx_xxblendvb(__a, __b, __c); 18661 } 18662 18663 static __inline__ vector signed short __ATTRS_o_ai 18664 vec_blendv(vector signed short __a, vector signed short __b, 18665 vector unsigned short __c) { 18666 return __builtin_vsx_xxblendvh(__a, __b, __c); 18667 } 18668 18669 static __inline__ vector unsigned short __ATTRS_o_ai 18670 vec_blendv(vector unsigned short __a, vector unsigned short __b, 18671 vector unsigned short __c) { 18672 return __builtin_vsx_xxblendvh(__a, __b, __c); 18673 } 18674 18675 static __inline__ vector signed int __ATTRS_o_ai 18676 vec_blendv(vector signed int __a, vector signed int __b, 18677 vector unsigned int __c) { 18678 return __builtin_vsx_xxblendvw(__a, __b, __c); 18679 } 18680 18681 static __inline__ vector unsigned int __ATTRS_o_ai 18682 vec_blendv(vector unsigned int __a, vector unsigned int __b, 18683 vector unsigned int __c) { 18684 return __builtin_vsx_xxblendvw(__a, __b, __c); 18685 } 18686 18687 static __inline__ vector signed long long __ATTRS_o_ai 18688 vec_blendv(vector signed long long __a, vector signed long long __b, 18689 vector unsigned long long __c) { 18690 return __builtin_vsx_xxblendvd(__a, __b, __c); 18691 } 18692 18693 static __inline__ vector unsigned long long __ATTRS_o_ai 18694 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 18695 vector unsigned long long __c) { 18696 return __builtin_vsx_xxblendvd(__a, __b, __c); 18697 } 18698 18699 static __inline__ vector float __ATTRS_o_ai 18700 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 18701 return __builtin_vsx_xxblendvw(__a, __b, __c); 18702 } 18703 18704 static __inline__ vector double __ATTRS_o_ai 18705 vec_blendv(vector double __a, vector double __b, 18706 vector unsigned long long __c) { 18707 return __builtin_vsx_xxblendvd(__a, __b, __c); 18708 } 18709 18710 /* vec_replace_elt */ 18711 18712 #define vec_replace_elt __builtin_altivec_vec_replace_elt 18713 18714 /* vec_replace_unaligned */ 18715 18716 #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned 18717 18718 /* vec_splati */ 18719 18720 #define vec_splati(__a) \ 18721 _Generic((__a), signed int \ 18722 : ((vector signed int)__a), unsigned int \ 18723 : ((vector unsigned int)__a), float \ 18724 : ((vector float)__a)) 18725 18726 /* vec_spatid */ 18727 18728 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 18729 return ((vector double)((double)__a)); 18730 } 18731 18732 /* vec_splati_ins */ 18733 18734 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 18735 vector signed int __a, const unsigned int __b, const signed int __c) { 18736 #ifdef __LITTLE_ENDIAN__ 18737 __a[1 - __b] = __c; 18738 __a[3 - __b] = __c; 18739 #else 18740 __a[__b] = __c; 18741 __a[2 + __b] = __c; 18742 #endif 18743 return __a; 18744 } 18745 18746 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 18747 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 18748 #ifdef __LITTLE_ENDIAN__ 18749 __a[1 - __b] = __c; 18750 __a[3 - __b] = __c; 18751 #else 18752 __a[__b] = __c; 18753 __a[2 + __b] = __c; 18754 #endif 18755 return __a; 18756 } 18757 18758 static __inline__ vector float __ATTRS_o_ai 18759 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 18760 #ifdef __LITTLE_ENDIAN__ 18761 __a[1 - __b] = __c; 18762 __a[3 - __b] = __c; 18763 #else 18764 __a[__b] = __c; 18765 __a[2 + __b] = __c; 18766 #endif 18767 return __a; 18768 } 18769 18770 /* vec_test_lsbb_all_ones */ 18771 18772 static __inline__ int __ATTRS_o_ai 18773 vec_test_lsbb_all_ones(vector unsigned char __a) { 18774 return __builtin_vsx_xvtlsbb(__a, 1); 18775 } 18776 18777 /* vec_test_lsbb_all_zeros */ 18778 18779 static __inline__ int __ATTRS_o_ai 18780 vec_test_lsbb_all_zeros(vector unsigned char __a) { 18781 return __builtin_vsx_xvtlsbb(__a, 0); 18782 } 18783 #endif /* __VSX__ */ 18784 18785 /* vec_stril */ 18786 18787 static __inline__ vector unsigned char __ATTRS_o_ai 18788 vec_stril(vector unsigned char __a) { 18789 #ifdef __LITTLE_ENDIAN__ 18790 return __builtin_altivec_vstribr((vector signed char)__a); 18791 #else 18792 return __builtin_altivec_vstribl((vector signed char)__a); 18793 #endif 18794 } 18795 18796 static __inline__ vector signed char __ATTRS_o_ai 18797 vec_stril(vector signed char __a) { 18798 #ifdef __LITTLE_ENDIAN__ 18799 return __builtin_altivec_vstribr(__a); 18800 #else 18801 return __builtin_altivec_vstribl(__a); 18802 #endif 18803 } 18804 18805 static __inline__ vector unsigned short __ATTRS_o_ai 18806 vec_stril(vector unsigned short __a) { 18807 #ifdef __LITTLE_ENDIAN__ 18808 return __builtin_altivec_vstrihr((vector signed short)__a); 18809 #else 18810 return __builtin_altivec_vstrihl((vector signed short)__a); 18811 #endif 18812 } 18813 18814 static __inline__ vector signed short __ATTRS_o_ai 18815 vec_stril(vector signed short __a) { 18816 #ifdef __LITTLE_ENDIAN__ 18817 return __builtin_altivec_vstrihr(__a); 18818 #else 18819 return __builtin_altivec_vstrihl(__a); 18820 #endif 18821 } 18822 18823 /* vec_stril_p */ 18824 18825 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { 18826 #ifdef __LITTLE_ENDIAN__ 18827 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18828 #else 18829 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18830 #endif 18831 } 18832 18833 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { 18834 #ifdef __LITTLE_ENDIAN__ 18835 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18836 #else 18837 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18838 #endif 18839 } 18840 18841 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { 18842 #ifdef __LITTLE_ENDIAN__ 18843 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18844 #else 18845 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18846 #endif 18847 } 18848 18849 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { 18850 #ifdef __LITTLE_ENDIAN__ 18851 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18852 #else 18853 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18854 #endif 18855 } 18856 18857 /* vec_strir */ 18858 18859 static __inline__ vector unsigned char __ATTRS_o_ai 18860 vec_strir(vector unsigned char __a) { 18861 #ifdef __LITTLE_ENDIAN__ 18862 return __builtin_altivec_vstribl((vector signed char)__a); 18863 #else 18864 return __builtin_altivec_vstribr((vector signed char)__a); 18865 #endif 18866 } 18867 18868 static __inline__ vector signed char __ATTRS_o_ai 18869 vec_strir(vector signed char __a) { 18870 #ifdef __LITTLE_ENDIAN__ 18871 return __builtin_altivec_vstribl(__a); 18872 #else 18873 return __builtin_altivec_vstribr(__a); 18874 #endif 18875 } 18876 18877 static __inline__ vector unsigned short __ATTRS_o_ai 18878 vec_strir(vector unsigned short __a) { 18879 #ifdef __LITTLE_ENDIAN__ 18880 return __builtin_altivec_vstrihl((vector signed short)__a); 18881 #else 18882 return __builtin_altivec_vstrihr((vector signed short)__a); 18883 #endif 18884 } 18885 18886 static __inline__ vector signed short __ATTRS_o_ai 18887 vec_strir(vector signed short __a) { 18888 #ifdef __LITTLE_ENDIAN__ 18889 return __builtin_altivec_vstrihl(__a); 18890 #else 18891 return __builtin_altivec_vstrihr(__a); 18892 #endif 18893 } 18894 18895 /* vec_strir_p */ 18896 18897 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { 18898 #ifdef __LITTLE_ENDIAN__ 18899 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18900 #else 18901 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18902 #endif 18903 } 18904 18905 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { 18906 #ifdef __LITTLE_ENDIAN__ 18907 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18908 #else 18909 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18910 #endif 18911 } 18912 18913 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { 18914 #ifdef __LITTLE_ENDIAN__ 18915 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18916 #else 18917 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18918 #endif 18919 } 18920 18921 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { 18922 #ifdef __LITTLE_ENDIAN__ 18923 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18924 #else 18925 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18926 #endif 18927 } 18928 18929 /* vs[l | r | ra] */ 18930 18931 #ifdef __SIZEOF_INT128__ 18932 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18933 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18934 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18935 __CHAR_BIT__)); 18936 } 18937 18938 static __inline__ vector signed __int128 __ATTRS_o_ai 18939 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { 18940 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18941 __CHAR_BIT__)); 18942 } 18943 18944 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18945 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18946 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18947 __CHAR_BIT__)); 18948 } 18949 18950 static __inline__ vector signed __int128 __ATTRS_o_ai 18951 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { 18952 return ( 18953 vector signed __int128)(((vector unsigned __int128)__a) >> 18954 (__b % 18955 (vector unsigned __int128)(sizeof( 18956 unsigned __int128) * 18957 __CHAR_BIT__))); 18958 } 18959 18960 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18961 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18962 return ( 18963 vector unsigned __int128)(((vector signed __int128)__a) >> 18964 (__b % 18965 (vector unsigned __int128)(sizeof( 18966 unsigned __int128) * 18967 __CHAR_BIT__))); 18968 } 18969 18970 static __inline__ vector signed __int128 __ATTRS_o_ai 18971 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { 18972 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18973 __CHAR_BIT__)); 18974 } 18975 18976 #endif /* __SIZEOF_INT128__ */ 18977 #endif /* __POWER10_VECTOR__ */ 18978 18979 #undef __ATTRS_o_ai 18980 18981 #endif /* __ALTIVEC_H */ 18982