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 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 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 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 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 vector unsigned int __res = 316 (vector unsigned int)__a + (vector unsigned int)__b; 317 vector unsigned int __carry = __builtin_altivec_vaddcuw( 318 (vector unsigned int)__a, (vector unsigned int)__b); 319 #ifdef __LITTLE_ENDIAN__ 320 __carry = __builtin_shufflevector(__carry, __carry, 3, 0, 1, 2); 321 #else 322 __carry = __builtin_shufflevector(__carry, __carry, 1, 2, 3, 0); 323 #endif 324 return (vector signed long long)(__res + __carry); 325 } 326 327 static __inline__ vector unsigned long long __ATTRS_o_ai 328 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 329 return (vector unsigned long long)vec_add((vector signed long long)__a, 330 (vector signed long long)__b); 331 } 332 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 333 334 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 335 vector float __b) { 336 return __a + __b; 337 } 338 339 #ifdef __VSX__ 340 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 341 vector double __b) { 342 return __a + __b; 343 } 344 #endif // __VSX__ 345 346 /* vec_adde */ 347 348 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 349 #ifdef __SIZEOF_INT128__ 350 static __inline__ vector signed __int128 __ATTRS_o_ai 351 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 352 vector signed __int128 __c) { 353 return __builtin_altivec_vaddeuqm(__a, __b, __c); 354 } 355 356 static __inline__ vector unsigned __int128 __ATTRS_o_ai 357 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 358 vector unsigned __int128 __c) { 359 return __builtin_altivec_vaddeuqm(__a, __b, __c); 360 } 361 #endif 362 363 static __inline__ vector unsigned char __attribute__((__always_inline__)) 364 vec_adde_u128(vector unsigned char __a, vector unsigned char __b, 365 vector unsigned char __c) { 366 return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c); 367 } 368 #endif 369 370 static __inline__ vector signed int __ATTRS_o_ai 371 vec_adde(vector signed int __a, vector signed int __b, 372 vector signed int __c) { 373 vector signed int __mask = {1, 1, 1, 1}; 374 vector signed int __carry = __c & __mask; 375 return vec_add(vec_add(__a, __b), __carry); 376 } 377 378 static __inline__ vector unsigned int __ATTRS_o_ai 379 vec_adde(vector unsigned int __a, vector unsigned int __b, 380 vector unsigned int __c) { 381 vector unsigned int __mask = {1, 1, 1, 1}; 382 vector unsigned int __carry = __c & __mask; 383 return vec_add(vec_add(__a, __b), __carry); 384 } 385 386 /* vec_addec */ 387 388 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 389 #ifdef __SIZEOF_INT128__ 390 static __inline__ vector signed __int128 __ATTRS_o_ai 391 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 392 vector signed __int128 __c) { 393 return __builtin_altivec_vaddecuq(__a, __b, __c); 394 } 395 396 static __inline__ vector unsigned __int128 __ATTRS_o_ai 397 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 398 vector unsigned __int128 __c) { 399 return __builtin_altivec_vaddecuq(__a, __b, __c); 400 } 401 #endif 402 403 static __inline__ vector unsigned char __attribute__((__always_inline__)) 404 vec_addec_u128(vector unsigned char __a, vector unsigned char __b, 405 vector unsigned char __c) { 406 return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c); 407 } 408 409 static __inline__ vector signed int __ATTRS_o_ai 410 vec_addec(vector signed int __a, vector signed int __b, 411 vector signed int __c) { 412 413 signed int __result[4]; 414 for (int i = 0; i < 4; i++) { 415 unsigned int __tempa = (unsigned int) __a[i]; 416 unsigned int __tempb = (unsigned int) __b[i]; 417 unsigned int __tempc = (unsigned int) __c[i]; 418 __tempc = __tempc & 0x00000001; 419 unsigned long long __longa = (unsigned long long) __tempa; 420 unsigned long long __longb = (unsigned long long) __tempb; 421 unsigned long long __longc = (unsigned long long) __tempc; 422 unsigned long long __sum = __longa + __longb + __longc; 423 unsigned long long __res = (__sum >> 32) & 0x01; 424 unsigned long long __tempres = (unsigned int) __res; 425 __result[i] = (signed int) __tempres; 426 } 427 428 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; 429 return ret; 430 } 431 432 static __inline__ vector unsigned int __ATTRS_o_ai 433 vec_addec(vector unsigned int __a, vector unsigned int __b, 434 vector unsigned int __c) { 435 436 unsigned int __result[4]; 437 for (int i = 0; i < 4; i++) { 438 unsigned int __tempc = __c[i] & 1; 439 unsigned long long __longa = (unsigned long long) __a[i]; 440 unsigned long long __longb = (unsigned long long) __b[i]; 441 unsigned long long __longc = (unsigned long long) __tempc; 442 unsigned long long __sum = __longa + __longb + __longc; 443 unsigned long long __res = (__sum >> 32) & 0x01; 444 unsigned long long __tempres = (unsigned int) __res; 445 __result[i] = (signed int) __tempres; 446 } 447 448 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; 449 return ret; 450 } 451 452 #endif 453 454 /* vec_vaddubm */ 455 456 #define __builtin_altivec_vaddubm vec_vaddubm 457 458 static __inline__ vector signed char __ATTRS_o_ai 459 vec_vaddubm(vector signed char __a, vector signed char __b) { 460 return __a + __b; 461 } 462 463 static __inline__ vector signed char __ATTRS_o_ai 464 vec_vaddubm(vector bool char __a, vector signed char __b) { 465 return (vector signed char)__a + __b; 466 } 467 468 static __inline__ vector signed char __ATTRS_o_ai 469 vec_vaddubm(vector signed char __a, vector bool char __b) { 470 return __a + (vector signed char)__b; 471 } 472 473 static __inline__ vector unsigned char __ATTRS_o_ai 474 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 475 return __a + __b; 476 } 477 478 static __inline__ vector unsigned char __ATTRS_o_ai 479 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 480 return (vector unsigned char)__a + __b; 481 } 482 483 static __inline__ vector unsigned char __ATTRS_o_ai 484 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 485 return __a + (vector unsigned char)__b; 486 } 487 488 /* vec_vadduhm */ 489 490 #define __builtin_altivec_vadduhm vec_vadduhm 491 492 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 493 vector short __b) { 494 return __a + __b; 495 } 496 497 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 498 vector short __b) { 499 return (vector short)__a + __b; 500 } 501 502 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 503 vector bool short __b) { 504 return __a + (vector short)__b; 505 } 506 507 static __inline__ vector unsigned short __ATTRS_o_ai 508 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 509 return __a + __b; 510 } 511 512 static __inline__ vector unsigned short __ATTRS_o_ai 513 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 514 return (vector unsigned short)__a + __b; 515 } 516 517 static __inline__ vector unsigned short __ATTRS_o_ai 518 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 519 return __a + (vector unsigned short)__b; 520 } 521 522 /* vec_vadduwm */ 523 524 #define __builtin_altivec_vadduwm vec_vadduwm 525 526 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 527 vector int __b) { 528 return __a + __b; 529 } 530 531 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 532 vector int __b) { 533 return (vector int)__a + __b; 534 } 535 536 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 537 vector bool int __b) { 538 return __a + (vector int)__b; 539 } 540 541 static __inline__ vector unsigned int __ATTRS_o_ai 542 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 543 return __a + __b; 544 } 545 546 static __inline__ vector unsigned int __ATTRS_o_ai 547 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 548 return (vector unsigned int)__a + __b; 549 } 550 551 static __inline__ vector unsigned int __ATTRS_o_ai 552 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 553 return __a + (vector unsigned int)__b; 554 } 555 556 /* vec_vaddfp */ 557 558 #define __builtin_altivec_vaddfp vec_vaddfp 559 560 static __inline__ vector float __attribute__((__always_inline__)) 561 vec_vaddfp(vector float __a, vector float __b) { 562 return __a + __b; 563 } 564 565 /* vec_addc */ 566 567 static __inline__ vector signed int __ATTRS_o_ai 568 vec_addc(vector signed int __a, vector signed int __b) { 569 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 570 (vector unsigned int)__b); 571 } 572 573 static __inline__ vector unsigned int __ATTRS_o_ai 574 vec_addc(vector unsigned int __a, vector unsigned int __b) { 575 return __builtin_altivec_vaddcuw(__a, __b); 576 } 577 578 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 579 #ifdef __SIZEOF_INT128__ 580 static __inline__ vector signed __int128 __ATTRS_o_ai 581 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 582 return (vector signed __int128)__builtin_altivec_vaddcuq( 583 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 584 } 585 586 static __inline__ vector unsigned __int128 __ATTRS_o_ai 587 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 588 return __builtin_altivec_vaddcuq(__a, __b); 589 } 590 #endif 591 592 static __inline__ vector unsigned char __attribute__((__always_inline__)) 593 vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { 594 return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b); 595 } 596 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 597 598 /* vec_vaddcuw */ 599 600 static __inline__ vector unsigned int __attribute__((__always_inline__)) 601 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 602 return __builtin_altivec_vaddcuw(__a, __b); 603 } 604 605 /* vec_adds */ 606 607 static __inline__ vector signed char __ATTRS_o_ai 608 vec_adds(vector signed char __a, vector signed char __b) { 609 return __builtin_altivec_vaddsbs(__a, __b); 610 } 611 612 static __inline__ vector signed char __ATTRS_o_ai 613 vec_adds(vector bool char __a, vector signed char __b) { 614 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 615 } 616 617 static __inline__ vector signed char __ATTRS_o_ai 618 vec_adds(vector signed char __a, vector bool char __b) { 619 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 620 } 621 622 static __inline__ vector unsigned char __ATTRS_o_ai 623 vec_adds(vector unsigned char __a, vector unsigned char __b) { 624 return __builtin_altivec_vaddubs(__a, __b); 625 } 626 627 static __inline__ vector unsigned char __ATTRS_o_ai 628 vec_adds(vector bool char __a, vector unsigned char __b) { 629 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 630 } 631 632 static __inline__ vector unsigned char __ATTRS_o_ai 633 vec_adds(vector unsigned char __a, vector bool char __b) { 634 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 635 } 636 637 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 638 vector short __b) { 639 return __builtin_altivec_vaddshs(__a, __b); 640 } 641 642 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 643 vector short __b) { 644 return __builtin_altivec_vaddshs((vector short)__a, __b); 645 } 646 647 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 648 vector bool short __b) { 649 return __builtin_altivec_vaddshs(__a, (vector short)__b); 650 } 651 652 static __inline__ vector unsigned short __ATTRS_o_ai 653 vec_adds(vector unsigned short __a, vector unsigned short __b) { 654 return __builtin_altivec_vadduhs(__a, __b); 655 } 656 657 static __inline__ vector unsigned short __ATTRS_o_ai 658 vec_adds(vector bool short __a, vector unsigned short __b) { 659 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 660 } 661 662 static __inline__ vector unsigned short __ATTRS_o_ai 663 vec_adds(vector unsigned short __a, vector bool short __b) { 664 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 665 } 666 667 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 668 vector int __b) { 669 return __builtin_altivec_vaddsws(__a, __b); 670 } 671 672 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 673 vector int __b) { 674 return __builtin_altivec_vaddsws((vector int)__a, __b); 675 } 676 677 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 678 vector bool int __b) { 679 return __builtin_altivec_vaddsws(__a, (vector int)__b); 680 } 681 682 static __inline__ vector unsigned int __ATTRS_o_ai 683 vec_adds(vector unsigned int __a, vector unsigned int __b) { 684 return __builtin_altivec_vadduws(__a, __b); 685 } 686 687 static __inline__ vector unsigned int __ATTRS_o_ai 688 vec_adds(vector bool int __a, vector unsigned int __b) { 689 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 690 } 691 692 static __inline__ vector unsigned int __ATTRS_o_ai 693 vec_adds(vector unsigned int __a, vector bool int __b) { 694 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 695 } 696 697 /* vec_vaddsbs */ 698 699 static __inline__ vector signed char __ATTRS_o_ai 700 vec_vaddsbs(vector signed char __a, vector signed char __b) { 701 return __builtin_altivec_vaddsbs(__a, __b); 702 } 703 704 static __inline__ vector signed char __ATTRS_o_ai 705 vec_vaddsbs(vector bool char __a, vector signed char __b) { 706 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 707 } 708 709 static __inline__ vector signed char __ATTRS_o_ai 710 vec_vaddsbs(vector signed char __a, vector bool char __b) { 711 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 712 } 713 714 /* vec_vaddubs */ 715 716 static __inline__ vector unsigned char __ATTRS_o_ai 717 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 718 return __builtin_altivec_vaddubs(__a, __b); 719 } 720 721 static __inline__ vector unsigned char __ATTRS_o_ai 722 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 723 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 724 } 725 726 static __inline__ vector unsigned char __ATTRS_o_ai 727 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 728 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 729 } 730 731 /* vec_vaddshs */ 732 733 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 734 vector short __b) { 735 return __builtin_altivec_vaddshs(__a, __b); 736 } 737 738 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 739 vector short __b) { 740 return __builtin_altivec_vaddshs((vector short)__a, __b); 741 } 742 743 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 744 vector bool short __b) { 745 return __builtin_altivec_vaddshs(__a, (vector short)__b); 746 } 747 748 /* vec_vadduhs */ 749 750 static __inline__ vector unsigned short __ATTRS_o_ai 751 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 752 return __builtin_altivec_vadduhs(__a, __b); 753 } 754 755 static __inline__ vector unsigned short __ATTRS_o_ai 756 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 757 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 758 } 759 760 static __inline__ vector unsigned short __ATTRS_o_ai 761 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 762 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 763 } 764 765 /* vec_vaddsws */ 766 767 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 768 vector int __b) { 769 return __builtin_altivec_vaddsws(__a, __b); 770 } 771 772 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 773 vector int __b) { 774 return __builtin_altivec_vaddsws((vector int)__a, __b); 775 } 776 777 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 778 vector bool int __b) { 779 return __builtin_altivec_vaddsws(__a, (vector int)__b); 780 } 781 782 /* vec_vadduws */ 783 784 static __inline__ vector unsigned int __ATTRS_o_ai 785 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 786 return __builtin_altivec_vadduws(__a, __b); 787 } 788 789 static __inline__ vector unsigned int __ATTRS_o_ai 790 vec_vadduws(vector bool int __a, vector unsigned int __b) { 791 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 792 } 793 794 static __inline__ vector unsigned int __ATTRS_o_ai 795 vec_vadduws(vector unsigned int __a, vector bool int __b) { 796 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 797 } 798 799 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 800 defined(__SIZEOF_INT128__) 801 /* vec_vadduqm */ 802 803 static __inline__ vector signed __int128 __ATTRS_o_ai 804 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 805 return __a + __b; 806 } 807 808 static __inline__ vector unsigned __int128 __ATTRS_o_ai 809 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 810 return __a + __b; 811 } 812 813 /* vec_vaddeuqm */ 814 815 static __inline__ vector signed __int128 __ATTRS_o_ai 816 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 817 vector signed __int128 __c) { 818 return __builtin_altivec_vaddeuqm(__a, __b, __c); 819 } 820 821 static __inline__ vector unsigned __int128 __ATTRS_o_ai 822 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 823 vector unsigned __int128 __c) { 824 return __builtin_altivec_vaddeuqm(__a, __b, __c); 825 } 826 827 /* vec_vaddcuq */ 828 829 static __inline__ vector signed __int128 __ATTRS_o_ai 830 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 831 return __builtin_altivec_vaddcuq(__a, __b); 832 } 833 834 static __inline__ vector unsigned __int128 __ATTRS_o_ai 835 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 836 return __builtin_altivec_vaddcuq(__a, __b); 837 } 838 839 /* vec_vaddecuq */ 840 841 static __inline__ vector signed __int128 __ATTRS_o_ai 842 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 843 vector signed __int128 __c) { 844 return __builtin_altivec_vaddecuq(__a, __b, __c); 845 } 846 847 static __inline__ vector unsigned __int128 __ATTRS_o_ai 848 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 849 vector unsigned __int128 __c) { 850 return __builtin_altivec_vaddecuq(__a, __b, __c); 851 } 852 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 853 854 /* vec_and */ 855 856 #define __builtin_altivec_vand vec_and 857 858 static __inline__ vector signed char __ATTRS_o_ai 859 vec_and(vector signed char __a, vector signed char __b) { 860 return __a & __b; 861 } 862 863 static __inline__ vector signed char __ATTRS_o_ai 864 vec_and(vector bool char __a, vector signed char __b) { 865 return (vector signed char)__a & __b; 866 } 867 868 static __inline__ vector signed char __ATTRS_o_ai 869 vec_and(vector signed char __a, vector bool char __b) { 870 return __a & (vector signed char)__b; 871 } 872 873 static __inline__ vector unsigned char __ATTRS_o_ai 874 vec_and(vector unsigned char __a, vector unsigned char __b) { 875 return __a & __b; 876 } 877 878 static __inline__ vector unsigned char __ATTRS_o_ai 879 vec_and(vector bool char __a, vector unsigned char __b) { 880 return (vector unsigned char)__a & __b; 881 } 882 883 static __inline__ vector unsigned char __ATTRS_o_ai 884 vec_and(vector unsigned char __a, vector bool char __b) { 885 return __a & (vector unsigned char)__b; 886 } 887 888 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 889 vector bool char __b) { 890 return __a & __b; 891 } 892 893 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 894 vector short __b) { 895 return __a & __b; 896 } 897 898 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 899 vector short __b) { 900 return (vector short)__a & __b; 901 } 902 903 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 904 vector bool short __b) { 905 return __a & (vector short)__b; 906 } 907 908 static __inline__ vector unsigned short __ATTRS_o_ai 909 vec_and(vector unsigned short __a, vector unsigned short __b) { 910 return __a & __b; 911 } 912 913 static __inline__ vector unsigned short __ATTRS_o_ai 914 vec_and(vector bool short __a, vector unsigned short __b) { 915 return (vector unsigned short)__a & __b; 916 } 917 918 static __inline__ vector unsigned short __ATTRS_o_ai 919 vec_and(vector unsigned short __a, vector bool short __b) { 920 return __a & (vector unsigned short)__b; 921 } 922 923 static __inline__ vector bool short __ATTRS_o_ai 924 vec_and(vector bool short __a, vector bool short __b) { 925 return __a & __b; 926 } 927 928 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 929 vector int __b) { 930 return __a & __b; 931 } 932 933 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 934 vector int __b) { 935 return (vector int)__a & __b; 936 } 937 938 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 939 vector bool int __b) { 940 return __a & (vector int)__b; 941 } 942 943 static __inline__ vector unsigned int __ATTRS_o_ai 944 vec_and(vector unsigned int __a, vector unsigned int __b) { 945 return __a & __b; 946 } 947 948 static __inline__ vector unsigned int __ATTRS_o_ai 949 vec_and(vector bool int __a, vector unsigned int __b) { 950 return (vector unsigned int)__a & __b; 951 } 952 953 static __inline__ vector unsigned int __ATTRS_o_ai 954 vec_and(vector unsigned int __a, vector bool int __b) { 955 return __a & (vector unsigned int)__b; 956 } 957 958 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 959 vector bool int __b) { 960 return __a & __b; 961 } 962 963 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 964 vector float __b) { 965 vector unsigned int __res = 966 (vector unsigned int)__a & (vector unsigned int)__b; 967 return (vector float)__res; 968 } 969 970 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 971 vector float __b) { 972 vector unsigned int __res = 973 (vector unsigned int)__a & (vector unsigned int)__b; 974 return (vector float)__res; 975 } 976 977 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 978 vector bool int __b) { 979 vector unsigned int __res = 980 (vector unsigned int)__a & (vector unsigned int)__b; 981 return (vector float)__res; 982 } 983 984 #ifdef __VSX__ 985 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 986 vector double __b) { 987 vector unsigned long long __res = 988 (vector unsigned long long)__a & (vector unsigned long long)__b; 989 return (vector double)__res; 990 } 991 992 static __inline__ vector double __ATTRS_o_ai 993 vec_and(vector double __a, vector bool long long __b) { 994 vector unsigned long long __res = 995 (vector unsigned long long)__a & (vector unsigned long long)__b; 996 return (vector double)__res; 997 } 998 999 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 1000 vector double __b) { 1001 vector unsigned long long __res = 1002 (vector unsigned long long)__a & (vector unsigned long long)__b; 1003 return (vector double)__res; 1004 } 1005 1006 static __inline__ vector signed long long __ATTRS_o_ai 1007 vec_and(vector signed long long __a, vector signed long long __b) { 1008 return __a & __b; 1009 } 1010 1011 static __inline__ vector signed long long __ATTRS_o_ai 1012 vec_and(vector bool long long __a, vector signed long long __b) { 1013 return (vector signed long long)__a & __b; 1014 } 1015 1016 static __inline__ vector signed long long __ATTRS_o_ai 1017 vec_and(vector signed long long __a, vector bool long long __b) { 1018 return __a & (vector signed long long)__b; 1019 } 1020 1021 static __inline__ vector unsigned long long __ATTRS_o_ai 1022 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 1023 return __a & __b; 1024 } 1025 1026 static __inline__ vector unsigned long long __ATTRS_o_ai 1027 vec_and(vector bool long long __a, vector unsigned long long __b) { 1028 return (vector unsigned long long)__a & __b; 1029 } 1030 1031 static __inline__ vector unsigned long long __ATTRS_o_ai 1032 vec_and(vector unsigned long long __a, vector bool long long __b) { 1033 return __a & (vector unsigned long long)__b; 1034 } 1035 1036 static __inline__ vector bool long long __ATTRS_o_ai 1037 vec_and(vector bool long long __a, vector bool long long __b) { 1038 return __a & __b; 1039 } 1040 #endif 1041 1042 /* vec_vand */ 1043 1044 static __inline__ vector signed char __ATTRS_o_ai 1045 vec_vand(vector signed char __a, vector signed char __b) { 1046 return __a & __b; 1047 } 1048 1049 static __inline__ vector signed char __ATTRS_o_ai 1050 vec_vand(vector bool char __a, vector signed char __b) { 1051 return (vector signed char)__a & __b; 1052 } 1053 1054 static __inline__ vector signed char __ATTRS_o_ai 1055 vec_vand(vector signed char __a, vector bool char __b) { 1056 return __a & (vector signed char)__b; 1057 } 1058 1059 static __inline__ vector unsigned char __ATTRS_o_ai 1060 vec_vand(vector unsigned char __a, vector unsigned char __b) { 1061 return __a & __b; 1062 } 1063 1064 static __inline__ vector unsigned char __ATTRS_o_ai 1065 vec_vand(vector bool char __a, vector unsigned char __b) { 1066 return (vector unsigned char)__a & __b; 1067 } 1068 1069 static __inline__ vector unsigned char __ATTRS_o_ai 1070 vec_vand(vector unsigned char __a, vector bool char __b) { 1071 return __a & (vector unsigned char)__b; 1072 } 1073 1074 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 1075 vector bool char __b) { 1076 return __a & __b; 1077 } 1078 1079 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1080 vector short __b) { 1081 return __a & __b; 1082 } 1083 1084 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 1085 vector short __b) { 1086 return (vector short)__a & __b; 1087 } 1088 1089 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1090 vector bool short __b) { 1091 return __a & (vector short)__b; 1092 } 1093 1094 static __inline__ vector unsigned short __ATTRS_o_ai 1095 vec_vand(vector unsigned short __a, vector unsigned short __b) { 1096 return __a & __b; 1097 } 1098 1099 static __inline__ vector unsigned short __ATTRS_o_ai 1100 vec_vand(vector bool short __a, vector unsigned short __b) { 1101 return (vector unsigned short)__a & __b; 1102 } 1103 1104 static __inline__ vector unsigned short __ATTRS_o_ai 1105 vec_vand(vector unsigned short __a, vector bool short __b) { 1106 return __a & (vector unsigned short)__b; 1107 } 1108 1109 static __inline__ vector bool short __ATTRS_o_ai 1110 vec_vand(vector bool short __a, vector bool short __b) { 1111 return __a & __b; 1112 } 1113 1114 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1115 vector int __b) { 1116 return __a & __b; 1117 } 1118 1119 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 1120 vector int __b) { 1121 return (vector int)__a & __b; 1122 } 1123 1124 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1125 vector bool int __b) { 1126 return __a & (vector int)__b; 1127 } 1128 1129 static __inline__ vector unsigned int __ATTRS_o_ai 1130 vec_vand(vector unsigned int __a, vector unsigned int __b) { 1131 return __a & __b; 1132 } 1133 1134 static __inline__ vector unsigned int __ATTRS_o_ai 1135 vec_vand(vector bool int __a, vector unsigned int __b) { 1136 return (vector unsigned int)__a & __b; 1137 } 1138 1139 static __inline__ vector unsigned int __ATTRS_o_ai 1140 vec_vand(vector unsigned int __a, vector bool int __b) { 1141 return __a & (vector unsigned int)__b; 1142 } 1143 1144 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1145 vector bool int __b) { 1146 return __a & __b; 1147 } 1148 1149 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1150 vector float __b) { 1151 vector unsigned int __res = 1152 (vector unsigned int)__a & (vector unsigned int)__b; 1153 return (vector float)__res; 1154 } 1155 1156 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1157 vector float __b) { 1158 vector unsigned int __res = 1159 (vector unsigned int)__a & (vector unsigned int)__b; 1160 return (vector float)__res; 1161 } 1162 1163 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1164 vector bool int __b) { 1165 vector unsigned int __res = 1166 (vector unsigned int)__a & (vector unsigned int)__b; 1167 return (vector float)__res; 1168 } 1169 1170 #ifdef __VSX__ 1171 static __inline__ vector signed long long __ATTRS_o_ai 1172 vec_vand(vector signed long long __a, vector signed long long __b) { 1173 return __a & __b; 1174 } 1175 1176 static __inline__ vector signed long long __ATTRS_o_ai 1177 vec_vand(vector bool long long __a, vector signed long long __b) { 1178 return (vector signed long long)__a & __b; 1179 } 1180 1181 static __inline__ vector signed long long __ATTRS_o_ai 1182 vec_vand(vector signed long long __a, vector bool long long __b) { 1183 return __a & (vector signed long long)__b; 1184 } 1185 1186 static __inline__ vector unsigned long long __ATTRS_o_ai 1187 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1188 return __a & __b; 1189 } 1190 1191 static __inline__ vector unsigned long long __ATTRS_o_ai 1192 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1193 return (vector unsigned long long)__a & __b; 1194 } 1195 1196 static __inline__ vector unsigned long long __ATTRS_o_ai 1197 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1198 return __a & (vector unsigned long long)__b; 1199 } 1200 1201 static __inline__ vector bool long long __ATTRS_o_ai 1202 vec_vand(vector bool long long __a, vector bool long long __b) { 1203 return __a & __b; 1204 } 1205 #endif 1206 1207 /* vec_andc */ 1208 1209 #define __builtin_altivec_vandc vec_andc 1210 1211 static __inline__ vector signed char __ATTRS_o_ai 1212 vec_andc(vector signed char __a, vector signed char __b) { 1213 return __a & ~__b; 1214 } 1215 1216 static __inline__ vector signed char __ATTRS_o_ai 1217 vec_andc(vector bool char __a, vector signed char __b) { 1218 return (vector signed char)__a & ~__b; 1219 } 1220 1221 static __inline__ vector signed char __ATTRS_o_ai 1222 vec_andc(vector signed char __a, vector bool char __b) { 1223 return __a & ~(vector signed char)__b; 1224 } 1225 1226 static __inline__ vector unsigned char __ATTRS_o_ai 1227 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1228 return __a & ~__b; 1229 } 1230 1231 static __inline__ vector unsigned char __ATTRS_o_ai 1232 vec_andc(vector bool char __a, vector unsigned char __b) { 1233 return (vector unsigned char)__a & ~__b; 1234 } 1235 1236 static __inline__ vector unsigned char __ATTRS_o_ai 1237 vec_andc(vector unsigned char __a, vector bool char __b) { 1238 return __a & ~(vector unsigned char)__b; 1239 } 1240 1241 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1242 vector bool char __b) { 1243 return __a & ~__b; 1244 } 1245 1246 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1247 vector short __b) { 1248 return __a & ~__b; 1249 } 1250 1251 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1252 vector short __b) { 1253 return (vector short)__a & ~__b; 1254 } 1255 1256 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1257 vector bool short __b) { 1258 return __a & ~(vector short)__b; 1259 } 1260 1261 static __inline__ vector unsigned short __ATTRS_o_ai 1262 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1263 return __a & ~__b; 1264 } 1265 1266 static __inline__ vector unsigned short __ATTRS_o_ai 1267 vec_andc(vector bool short __a, vector unsigned short __b) { 1268 return (vector unsigned short)__a & ~__b; 1269 } 1270 1271 static __inline__ vector unsigned short __ATTRS_o_ai 1272 vec_andc(vector unsigned short __a, vector bool short __b) { 1273 return __a & ~(vector unsigned short)__b; 1274 } 1275 1276 static __inline__ vector bool short __ATTRS_o_ai 1277 vec_andc(vector bool short __a, vector bool short __b) { 1278 return __a & ~__b; 1279 } 1280 1281 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1282 vector int __b) { 1283 return __a & ~__b; 1284 } 1285 1286 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1287 vector int __b) { 1288 return (vector int)__a & ~__b; 1289 } 1290 1291 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1292 vector bool int __b) { 1293 return __a & ~(vector int)__b; 1294 } 1295 1296 static __inline__ vector unsigned int __ATTRS_o_ai 1297 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1298 return __a & ~__b; 1299 } 1300 1301 static __inline__ vector unsigned int __ATTRS_o_ai 1302 vec_andc(vector bool int __a, vector unsigned int __b) { 1303 return (vector unsigned int)__a & ~__b; 1304 } 1305 1306 static __inline__ vector unsigned int __ATTRS_o_ai 1307 vec_andc(vector unsigned int __a, vector bool int __b) { 1308 return __a & ~(vector unsigned int)__b; 1309 } 1310 1311 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1312 vector bool int __b) { 1313 return __a & ~__b; 1314 } 1315 1316 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1317 vector float __b) { 1318 vector unsigned int __res = 1319 (vector unsigned int)__a & ~(vector unsigned int)__b; 1320 return (vector float)__res; 1321 } 1322 1323 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1324 vector float __b) { 1325 vector unsigned int __res = 1326 (vector unsigned int)__a & ~(vector unsigned int)__b; 1327 return (vector float)__res; 1328 } 1329 1330 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1331 vector bool int __b) { 1332 vector unsigned int __res = 1333 (vector unsigned int)__a & ~(vector unsigned int)__b; 1334 return (vector float)__res; 1335 } 1336 1337 #ifdef __VSX__ 1338 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1339 vector double __b) { 1340 vector unsigned long long __res = 1341 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1342 return (vector double)__res; 1343 } 1344 1345 static __inline__ vector double __ATTRS_o_ai 1346 vec_andc(vector double __a, vector bool long long __b) { 1347 vector unsigned long long __res = 1348 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1349 return (vector double)__res; 1350 } 1351 1352 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1353 vector double __b) { 1354 vector unsigned long long __res = 1355 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1356 return (vector double)__res; 1357 } 1358 1359 static __inline__ vector signed long long __ATTRS_o_ai 1360 vec_andc(vector signed long long __a, vector signed long long __b) { 1361 return __a & ~__b; 1362 } 1363 1364 static __inline__ vector signed long long __ATTRS_o_ai 1365 vec_andc(vector bool long long __a, vector signed long long __b) { 1366 return (vector signed long long)__a & ~__b; 1367 } 1368 1369 static __inline__ vector signed long long __ATTRS_o_ai 1370 vec_andc(vector signed long long __a, vector bool long long __b) { 1371 return __a & ~(vector signed long long)__b; 1372 } 1373 1374 static __inline__ vector unsigned long long __ATTRS_o_ai 1375 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1376 return __a & ~__b; 1377 } 1378 1379 static __inline__ vector unsigned long long __ATTRS_o_ai 1380 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1381 return (vector unsigned long long)__a & ~__b; 1382 } 1383 1384 static __inline__ vector unsigned long long __ATTRS_o_ai 1385 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1386 return __a & ~(vector unsigned long long)__b; 1387 } 1388 1389 static __inline__ vector bool long long __ATTRS_o_ai 1390 vec_andc(vector bool long long __a, vector bool long long __b) { 1391 return __a & ~__b; 1392 } 1393 #endif 1394 1395 /* vec_vandc */ 1396 1397 static __inline__ vector signed char __ATTRS_o_ai 1398 vec_vandc(vector signed char __a, vector signed char __b) { 1399 return __a & ~__b; 1400 } 1401 1402 static __inline__ vector signed char __ATTRS_o_ai 1403 vec_vandc(vector bool char __a, vector signed char __b) { 1404 return (vector signed char)__a & ~__b; 1405 } 1406 1407 static __inline__ vector signed char __ATTRS_o_ai 1408 vec_vandc(vector signed char __a, vector bool char __b) { 1409 return __a & ~(vector signed char)__b; 1410 } 1411 1412 static __inline__ vector unsigned char __ATTRS_o_ai 1413 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1414 return __a & ~__b; 1415 } 1416 1417 static __inline__ vector unsigned char __ATTRS_o_ai 1418 vec_vandc(vector bool char __a, vector unsigned char __b) { 1419 return (vector unsigned char)__a & ~__b; 1420 } 1421 1422 static __inline__ vector unsigned char __ATTRS_o_ai 1423 vec_vandc(vector unsigned char __a, vector bool char __b) { 1424 return __a & ~(vector unsigned char)__b; 1425 } 1426 1427 static __inline__ vector bool char __ATTRS_o_ai 1428 vec_vandc(vector bool char __a, vector bool char __b) { 1429 return __a & ~__b; 1430 } 1431 1432 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1433 vector short __b) { 1434 return __a & ~__b; 1435 } 1436 1437 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1438 vector short __b) { 1439 return (vector short)__a & ~__b; 1440 } 1441 1442 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1443 vector bool short __b) { 1444 return __a & ~(vector short)__b; 1445 } 1446 1447 static __inline__ vector unsigned short __ATTRS_o_ai 1448 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1449 return __a & ~__b; 1450 } 1451 1452 static __inline__ vector unsigned short __ATTRS_o_ai 1453 vec_vandc(vector bool short __a, vector unsigned short __b) { 1454 return (vector unsigned short)__a & ~__b; 1455 } 1456 1457 static __inline__ vector unsigned short __ATTRS_o_ai 1458 vec_vandc(vector unsigned short __a, vector bool short __b) { 1459 return __a & ~(vector unsigned short)__b; 1460 } 1461 1462 static __inline__ vector bool short __ATTRS_o_ai 1463 vec_vandc(vector bool short __a, vector bool short __b) { 1464 return __a & ~__b; 1465 } 1466 1467 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1468 vector int __b) { 1469 return __a & ~__b; 1470 } 1471 1472 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1473 vector int __b) { 1474 return (vector int)__a & ~__b; 1475 } 1476 1477 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1478 vector bool int __b) { 1479 return __a & ~(vector int)__b; 1480 } 1481 1482 static __inline__ vector unsigned int __ATTRS_o_ai 1483 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1484 return __a & ~__b; 1485 } 1486 1487 static __inline__ vector unsigned int __ATTRS_o_ai 1488 vec_vandc(vector bool int __a, vector unsigned int __b) { 1489 return (vector unsigned int)__a & ~__b; 1490 } 1491 1492 static __inline__ vector unsigned int __ATTRS_o_ai 1493 vec_vandc(vector unsigned int __a, vector bool int __b) { 1494 return __a & ~(vector unsigned int)__b; 1495 } 1496 1497 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1498 vector bool int __b) { 1499 return __a & ~__b; 1500 } 1501 1502 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1503 vector float __b) { 1504 vector unsigned int __res = 1505 (vector unsigned int)__a & ~(vector unsigned int)__b; 1506 return (vector float)__res; 1507 } 1508 1509 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1510 vector float __b) { 1511 vector unsigned int __res = 1512 (vector unsigned int)__a & ~(vector unsigned int)__b; 1513 return (vector float)__res; 1514 } 1515 1516 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1517 vector bool int __b) { 1518 vector unsigned int __res = 1519 (vector unsigned int)__a & ~(vector unsigned int)__b; 1520 return (vector float)__res; 1521 } 1522 1523 #ifdef __VSX__ 1524 static __inline__ vector signed long long __ATTRS_o_ai 1525 vec_vandc(vector signed long long __a, vector signed long long __b) { 1526 return __a & ~__b; 1527 } 1528 1529 static __inline__ vector signed long long __ATTRS_o_ai 1530 vec_vandc(vector bool long long __a, vector signed long long __b) { 1531 return (vector signed long long)__a & ~__b; 1532 } 1533 1534 static __inline__ vector signed long long __ATTRS_o_ai 1535 vec_vandc(vector signed long long __a, vector bool long long __b) { 1536 return __a & ~(vector signed long long)__b; 1537 } 1538 1539 static __inline__ vector unsigned long long __ATTRS_o_ai 1540 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1541 return __a & ~__b; 1542 } 1543 1544 static __inline__ vector unsigned long long __ATTRS_o_ai 1545 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1546 return (vector unsigned long long)__a & ~__b; 1547 } 1548 1549 static __inline__ vector unsigned long long __ATTRS_o_ai 1550 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1551 return __a & ~(vector unsigned long long)__b; 1552 } 1553 1554 static __inline__ vector bool long long __ATTRS_o_ai 1555 vec_vandc(vector bool long long __a, vector bool long long __b) { 1556 return __a & ~__b; 1557 } 1558 #endif 1559 1560 /* vec_avg */ 1561 1562 static __inline__ vector signed char __ATTRS_o_ai 1563 vec_avg(vector signed char __a, vector signed char __b) { 1564 return __builtin_altivec_vavgsb(__a, __b); 1565 } 1566 1567 static __inline__ vector unsigned char __ATTRS_o_ai 1568 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1569 return __builtin_altivec_vavgub(__a, __b); 1570 } 1571 1572 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1573 vector short __b) { 1574 return __builtin_altivec_vavgsh(__a, __b); 1575 } 1576 1577 static __inline__ vector unsigned short __ATTRS_o_ai 1578 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1579 return __builtin_altivec_vavguh(__a, __b); 1580 } 1581 1582 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1583 vector int __b) { 1584 return __builtin_altivec_vavgsw(__a, __b); 1585 } 1586 1587 static __inline__ vector unsigned int __ATTRS_o_ai 1588 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1589 return __builtin_altivec_vavguw(__a, __b); 1590 } 1591 1592 /* vec_vavgsb */ 1593 1594 static __inline__ vector signed char __attribute__((__always_inline__)) 1595 vec_vavgsb(vector signed char __a, vector signed char __b) { 1596 return __builtin_altivec_vavgsb(__a, __b); 1597 } 1598 1599 /* vec_vavgub */ 1600 1601 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1602 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1603 return __builtin_altivec_vavgub(__a, __b); 1604 } 1605 1606 /* vec_vavgsh */ 1607 1608 static __inline__ vector short __attribute__((__always_inline__)) 1609 vec_vavgsh(vector short __a, vector short __b) { 1610 return __builtin_altivec_vavgsh(__a, __b); 1611 } 1612 1613 /* vec_vavguh */ 1614 1615 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1616 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1617 return __builtin_altivec_vavguh(__a, __b); 1618 } 1619 1620 /* vec_vavgsw */ 1621 1622 static __inline__ vector int __attribute__((__always_inline__)) 1623 vec_vavgsw(vector int __a, vector int __b) { 1624 return __builtin_altivec_vavgsw(__a, __b); 1625 } 1626 1627 /* vec_vavguw */ 1628 1629 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1630 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1631 return __builtin_altivec_vavguw(__a, __b); 1632 } 1633 1634 /* vec_ceil */ 1635 1636 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1637 #ifdef __VSX__ 1638 return __builtin_vsx_xvrspip(__a); 1639 #else 1640 return __builtin_altivec_vrfip(__a); 1641 #endif 1642 } 1643 1644 #ifdef __VSX__ 1645 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1646 return __builtin_vsx_xvrdpip(__a); 1647 } 1648 #endif 1649 1650 /* vec_roundp */ 1651 static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { 1652 return vec_ceil(__a); 1653 } 1654 1655 #ifdef __VSX__ 1656 static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { 1657 return vec_ceil(__a); 1658 } 1659 #endif 1660 1661 /* vec_vrfip */ 1662 1663 static __inline__ vector float __attribute__((__always_inline__)) 1664 vec_vrfip(vector float __a) { 1665 return __builtin_altivec_vrfip(__a); 1666 } 1667 1668 /* vec_cmpb */ 1669 1670 static __inline__ vector int __attribute__((__always_inline__)) 1671 vec_cmpb(vector float __a, vector float __b) { 1672 return __builtin_altivec_vcmpbfp(__a, __b); 1673 } 1674 1675 /* vec_vcmpbfp */ 1676 1677 static __inline__ vector int __attribute__((__always_inline__)) 1678 vec_vcmpbfp(vector float __a, vector float __b) { 1679 return __builtin_altivec_vcmpbfp(__a, __b); 1680 } 1681 1682 /* vec_cmpeq */ 1683 1684 static __inline__ vector bool char __ATTRS_o_ai 1685 vec_cmpeq(vector signed char __a, vector signed char __b) { 1686 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1687 (vector char)__b); 1688 } 1689 1690 static __inline__ vector bool char __ATTRS_o_ai 1691 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1692 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1693 (vector char)__b); 1694 } 1695 1696 static __inline__ vector bool char __ATTRS_o_ai 1697 vec_cmpeq(vector bool char __a, vector bool char __b) { 1698 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1699 (vector char)__b); 1700 } 1701 1702 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1703 vector short __b) { 1704 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1705 } 1706 1707 static __inline__ vector bool short __ATTRS_o_ai 1708 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1709 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1710 (vector short)__b); 1711 } 1712 1713 static __inline__ vector bool short __ATTRS_o_ai 1714 vec_cmpeq(vector bool short __a, vector bool short __b) { 1715 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1716 (vector short)__b); 1717 } 1718 1719 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1720 vector int __b) { 1721 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1722 } 1723 1724 static __inline__ vector bool int __ATTRS_o_ai 1725 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1726 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1727 (vector int)__b); 1728 } 1729 1730 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, 1731 vector bool int __b) { 1732 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1733 (vector int)__b); 1734 } 1735 1736 #ifdef __POWER8_VECTOR__ 1737 static __inline__ vector bool long long __ATTRS_o_ai 1738 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1739 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1740 } 1741 1742 static __inline__ vector bool long long __ATTRS_o_ai 1743 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1744 return (vector bool long long)__builtin_altivec_vcmpequd( 1745 (vector long long)__a, (vector long long)__b); 1746 } 1747 1748 static __inline__ vector bool long long __ATTRS_o_ai 1749 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1750 return (vector bool long long)__builtin_altivec_vcmpequd( 1751 (vector long long)__a, (vector long long)__b); 1752 } 1753 #elif defined(__VSX__) 1754 static __inline__ vector bool long long __ATTRS_o_ai 1755 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1756 vector bool int __wordcmp = 1757 vec_cmpeq((vector signed int)__a, (vector signed int)__b); 1758 #ifdef __LITTLE_ENDIAN__ 1759 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); 1760 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, 1761 1, 3, 3); 1762 #else 1763 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); 1764 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, 1765 0, 2, 2); 1766 #endif 1767 } 1768 1769 static __inline__ vector bool long long __ATTRS_o_ai 1770 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1771 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1772 } 1773 1774 static __inline__ vector bool long long __ATTRS_o_ai 1775 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1776 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1777 } 1778 #endif 1779 1780 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1781 vector float __b) { 1782 #ifdef __VSX__ 1783 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1784 #else 1785 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1786 #endif 1787 } 1788 1789 #ifdef __VSX__ 1790 static __inline__ vector bool long long __ATTRS_o_ai 1791 vec_cmpeq(vector double __a, vector double __b) { 1792 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1793 } 1794 #endif 1795 1796 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1797 static __inline__ vector bool __int128 __ATTRS_o_ai 1798 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { 1799 return (vector bool __int128)__builtin_altivec_vcmpequq( 1800 (vector bool __int128)__a, (vector bool __int128)__b); 1801 } 1802 1803 static __inline__ vector bool __int128 __ATTRS_o_ai 1804 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1805 return (vector bool __int128)__builtin_altivec_vcmpequq( 1806 (vector bool __int128)__a, (vector bool __int128)__b); 1807 } 1808 #endif 1809 1810 #ifdef __POWER9_VECTOR__ 1811 /* vec_cmpne */ 1812 1813 static __inline__ vector bool char __ATTRS_o_ai 1814 vec_cmpne(vector bool char __a, vector bool char __b) { 1815 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1816 (vector char)__b); 1817 } 1818 1819 static __inline__ vector bool char __ATTRS_o_ai 1820 vec_cmpne(vector signed char __a, vector signed char __b) { 1821 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1822 (vector char)__b); 1823 } 1824 1825 static __inline__ vector bool char __ATTRS_o_ai 1826 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1827 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1828 (vector char)__b); 1829 } 1830 1831 static __inline__ vector bool short __ATTRS_o_ai 1832 vec_cmpne(vector bool short __a, vector bool short __b) { 1833 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1834 (vector short)__b); 1835 } 1836 1837 static __inline__ vector bool short __ATTRS_o_ai 1838 vec_cmpne(vector signed short __a, vector signed short __b) { 1839 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1840 (vector short)__b); 1841 } 1842 1843 static __inline__ vector bool short __ATTRS_o_ai 1844 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1845 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1846 (vector short)__b); 1847 } 1848 1849 static __inline__ vector bool int __ATTRS_o_ai 1850 vec_cmpne(vector bool int __a, vector bool int __b) { 1851 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1852 (vector int)__b); 1853 } 1854 1855 static __inline__ vector bool int __ATTRS_o_ai 1856 vec_cmpne(vector signed int __a, vector signed int __b) { 1857 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1858 (vector int)__b); 1859 } 1860 1861 static __inline__ vector bool int __ATTRS_o_ai 1862 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1863 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1864 (vector int)__b); 1865 } 1866 1867 static __inline__ vector bool int __ATTRS_o_ai 1868 vec_cmpne(vector float __a, vector float __b) { 1869 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1870 (vector int)__b); 1871 } 1872 1873 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1874 static __inline__ vector bool __int128 __ATTRS_o_ai 1875 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1876 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1877 (vector bool __int128)__a, (vector bool __int128)__b)); 1878 } 1879 1880 static __inline__ vector bool __int128 __ATTRS_o_ai 1881 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { 1882 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1883 (vector bool __int128)__a, (vector bool __int128)__b)); 1884 } 1885 #endif 1886 1887 /* vec_cmpnez */ 1888 1889 static __inline__ vector bool char __ATTRS_o_ai 1890 vec_cmpnez(vector signed char __a, vector signed char __b) { 1891 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1892 (vector char)__b); 1893 } 1894 1895 static __inline__ vector bool char __ATTRS_o_ai 1896 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1897 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1898 (vector char)__b); 1899 } 1900 1901 static __inline__ vector bool short __ATTRS_o_ai 1902 vec_cmpnez(vector signed short __a, vector signed short __b) { 1903 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1904 (vector short)__b); 1905 } 1906 1907 static __inline__ vector bool short __ATTRS_o_ai 1908 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1909 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1910 (vector short)__b); 1911 } 1912 1913 static __inline__ vector bool int __ATTRS_o_ai 1914 vec_cmpnez(vector signed int __a, vector signed int __b) { 1915 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1916 (vector int)__b); 1917 } 1918 1919 static __inline__ vector bool int __ATTRS_o_ai 1920 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1921 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1922 (vector int)__b); 1923 } 1924 1925 static __inline__ signed int __ATTRS_o_ai 1926 vec_cntlz_lsbb(vector signed char __a) { 1927 #ifdef __LITTLE_ENDIAN__ 1928 return __builtin_altivec_vctzlsbb(__a); 1929 #else 1930 return __builtin_altivec_vclzlsbb(__a); 1931 #endif 1932 } 1933 1934 static __inline__ signed int __ATTRS_o_ai 1935 vec_cntlz_lsbb(vector unsigned char __a) { 1936 #ifdef __LITTLE_ENDIAN__ 1937 return __builtin_altivec_vctzlsbb(__a); 1938 #else 1939 return __builtin_altivec_vclzlsbb(__a); 1940 #endif 1941 } 1942 1943 static __inline__ signed int __ATTRS_o_ai 1944 vec_cnttz_lsbb(vector signed char __a) { 1945 #ifdef __LITTLE_ENDIAN__ 1946 return __builtin_altivec_vclzlsbb(__a); 1947 #else 1948 return __builtin_altivec_vctzlsbb(__a); 1949 #endif 1950 } 1951 1952 static __inline__ signed int __ATTRS_o_ai 1953 vec_cnttz_lsbb(vector unsigned char __a) { 1954 #ifdef __LITTLE_ENDIAN__ 1955 return __builtin_altivec_vclzlsbb(__a); 1956 #else 1957 return __builtin_altivec_vctzlsbb(__a); 1958 #endif 1959 } 1960 1961 static __inline__ vector unsigned int __ATTRS_o_ai 1962 vec_parity_lsbb(vector unsigned int __a) { 1963 return __builtin_altivec_vprtybw(__a); 1964 } 1965 1966 static __inline__ vector unsigned int __ATTRS_o_ai 1967 vec_parity_lsbb(vector signed int __a) { 1968 return __builtin_altivec_vprtybw(__a); 1969 } 1970 1971 #ifdef __SIZEOF_INT128__ 1972 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1973 vec_parity_lsbb(vector unsigned __int128 __a) { 1974 return __builtin_altivec_vprtybq(__a); 1975 } 1976 1977 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1978 vec_parity_lsbb(vector signed __int128 __a) { 1979 return __builtin_altivec_vprtybq(__a); 1980 } 1981 #endif 1982 1983 static __inline__ vector unsigned long long __ATTRS_o_ai 1984 vec_parity_lsbb(vector unsigned long long __a) { 1985 return __builtin_altivec_vprtybd(__a); 1986 } 1987 1988 static __inline__ vector unsigned long long __ATTRS_o_ai 1989 vec_parity_lsbb(vector signed long long __a) { 1990 return __builtin_altivec_vprtybd(__a); 1991 } 1992 1993 #else 1994 /* vec_cmpne */ 1995 1996 static __inline__ vector bool char __ATTRS_o_ai 1997 vec_cmpne(vector bool char __a, vector bool char __b) { 1998 return ~(vec_cmpeq(__a, __b)); 1999 } 2000 2001 static __inline__ vector bool char __ATTRS_o_ai 2002 vec_cmpne(vector signed char __a, vector signed char __b) { 2003 return ~(vec_cmpeq(__a, __b)); 2004 } 2005 2006 static __inline__ vector bool char __ATTRS_o_ai 2007 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 2008 return ~(vec_cmpeq(__a, __b)); 2009 } 2010 2011 static __inline__ vector bool short __ATTRS_o_ai 2012 vec_cmpne(vector bool short __a, vector bool short __b) { 2013 return ~(vec_cmpeq(__a, __b)); 2014 } 2015 2016 static __inline__ vector bool short __ATTRS_o_ai 2017 vec_cmpne(vector signed short __a, vector signed short __b) { 2018 return ~(vec_cmpeq(__a, __b)); 2019 } 2020 2021 static __inline__ vector bool short __ATTRS_o_ai 2022 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 2023 return ~(vec_cmpeq(__a, __b)); 2024 } 2025 2026 static __inline__ vector bool int __ATTRS_o_ai 2027 vec_cmpne(vector bool int __a, vector bool int __b) { 2028 return ~(vec_cmpeq(__a, __b)); 2029 } 2030 2031 static __inline__ vector bool int __ATTRS_o_ai 2032 vec_cmpne(vector signed int __a, vector signed int __b) { 2033 return ~(vec_cmpeq(__a, __b)); 2034 } 2035 2036 static __inline__ vector bool int __ATTRS_o_ai 2037 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 2038 return ~(vec_cmpeq(__a, __b)); 2039 } 2040 2041 static __inline__ vector bool int __ATTRS_o_ai 2042 vec_cmpne(vector float __a, vector float __b) { 2043 return ~(vec_cmpeq(__a, __b)); 2044 } 2045 #endif 2046 2047 #ifdef __POWER8_VECTOR__ 2048 static __inline__ vector bool long long __ATTRS_o_ai 2049 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2050 return (vector bool long long) 2051 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2052 } 2053 2054 static __inline__ vector bool long long __ATTRS_o_ai 2055 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2056 return (vector bool long long) 2057 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2058 } 2059 2060 static __inline__ vector bool long long __ATTRS_o_ai 2061 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2062 return (vector bool long long) 2063 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2064 } 2065 #elif defined(__VSX__) 2066 static __inline__ vector bool long long __ATTRS_o_ai 2067 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2068 return (vector bool long long)~( 2069 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2070 } 2071 2072 static __inline__ vector bool long long __ATTRS_o_ai 2073 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2074 return (vector bool long long)~( 2075 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2076 } 2077 2078 static __inline__ vector bool long long __ATTRS_o_ai 2079 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2080 return (vector bool long long)~( 2081 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2082 } 2083 #endif 2084 2085 #ifdef __VSX__ 2086 static __inline__ vector bool long long __ATTRS_o_ai 2087 vec_cmpne(vector double __a, vector double __b) { 2088 return (vector bool long long) 2089 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2090 } 2091 #endif 2092 2093 /* vec_cmpgt */ 2094 2095 static __inline__ vector bool char __ATTRS_o_ai 2096 vec_cmpgt(vector signed char __a, vector signed char __b) { 2097 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2098 } 2099 2100 static __inline__ vector bool char __ATTRS_o_ai 2101 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 2102 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2103 } 2104 2105 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 2106 vector short __b) { 2107 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2108 } 2109 2110 static __inline__ vector bool short __ATTRS_o_ai 2111 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 2112 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2113 } 2114 2115 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 2116 vector int __b) { 2117 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2118 } 2119 2120 static __inline__ vector bool int __ATTRS_o_ai 2121 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 2122 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2123 } 2124 2125 #ifdef __POWER8_VECTOR__ 2126 static __inline__ vector bool long long __ATTRS_o_ai 2127 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2128 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 2129 } 2130 2131 static __inline__ vector bool long long __ATTRS_o_ai 2132 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2133 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2134 } 2135 #elif defined(__VSX__) 2136 static __inline__ vector bool long long __ATTRS_o_ai 2137 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2138 vector signed int __sgtw = (vector signed int)vec_cmpgt( 2139 (vector signed int)__a, (vector signed int)__b); 2140 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2141 (vector unsigned int)__a, (vector unsigned int)__b); 2142 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2143 (vector signed int)__a, (vector signed int)__b); 2144 #ifdef __LITTLE_ENDIAN__ 2145 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2146 __sgtw |= (vector signed int)__ugtw; 2147 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, 2148 3); 2149 #else 2150 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2151 __sgtw |= (vector signed int)__ugtw; 2152 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, 2153 2); 2154 #endif 2155 } 2156 2157 static __inline__ vector bool long long __ATTRS_o_ai 2158 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2159 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2160 (vector unsigned int)__a, (vector unsigned int)__b); 2161 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2162 (vector signed int)__a, (vector signed int)__b); 2163 #ifdef __LITTLE_ENDIAN__ 2164 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2165 __ugtw |= __eqw; 2166 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, 2167 3); 2168 #else 2169 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2170 __ugtw |= __eqw; 2171 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, 2172 2); 2173 #endif 2174 } 2175 #endif 2176 2177 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2178 vector float __b) { 2179 #ifdef __VSX__ 2180 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2181 #else 2182 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2183 #endif 2184 } 2185 2186 #ifdef __VSX__ 2187 static __inline__ vector bool long long __ATTRS_o_ai 2188 vec_cmpgt(vector double __a, vector double __b) { 2189 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2190 } 2191 #endif 2192 2193 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2194 static __inline__ vector bool __int128 __ATTRS_o_ai 2195 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { 2196 return (vector bool __int128)__builtin_altivec_vcmpgtsq( 2197 (vector bool __int128)__a, (vector bool __int128)__b); 2198 } 2199 2200 static __inline__ vector bool __int128 __ATTRS_o_ai 2201 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2202 return (vector bool __int128)__builtin_altivec_vcmpgtuq( 2203 (vector bool __int128)__a, (vector bool __int128)__b); 2204 } 2205 #endif 2206 2207 /* vec_cmpge */ 2208 2209 static __inline__ vector bool char __ATTRS_o_ai 2210 vec_cmpge(vector signed char __a, vector signed char __b) { 2211 return ~(vec_cmpgt(__b, __a)); 2212 } 2213 2214 static __inline__ vector bool char __ATTRS_o_ai 2215 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2216 return ~(vec_cmpgt(__b, __a)); 2217 } 2218 2219 static __inline__ vector bool short __ATTRS_o_ai 2220 vec_cmpge(vector signed short __a, vector signed short __b) { 2221 return ~(vec_cmpgt(__b, __a)); 2222 } 2223 2224 static __inline__ vector bool short __ATTRS_o_ai 2225 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2226 return ~(vec_cmpgt(__b, __a)); 2227 } 2228 2229 static __inline__ vector bool int __ATTRS_o_ai 2230 vec_cmpge(vector signed int __a, vector signed int __b) { 2231 return ~(vec_cmpgt(__b, __a)); 2232 } 2233 2234 static __inline__ vector bool int __ATTRS_o_ai 2235 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2236 return ~(vec_cmpgt(__b, __a)); 2237 } 2238 2239 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2240 vector float __b) { 2241 #ifdef __VSX__ 2242 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2243 #else 2244 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2245 #endif 2246 } 2247 2248 #ifdef __VSX__ 2249 static __inline__ vector bool long long __ATTRS_o_ai 2250 vec_cmpge(vector double __a, vector double __b) { 2251 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2252 } 2253 2254 static __inline__ vector bool long long __ATTRS_o_ai 2255 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2256 return ~(vec_cmpgt(__b, __a)); 2257 } 2258 2259 static __inline__ vector bool long long __ATTRS_o_ai 2260 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2261 return ~(vec_cmpgt(__b, __a)); 2262 } 2263 #endif 2264 2265 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2266 static __inline__ vector bool __int128 __ATTRS_o_ai 2267 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { 2268 return ~(vec_cmpgt(__b, __a)); 2269 } 2270 2271 static __inline__ vector bool __int128 __ATTRS_o_ai 2272 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2273 return ~(vec_cmpgt(__b, __a)); 2274 } 2275 #endif 2276 2277 /* vec_vcmpgefp */ 2278 2279 static __inline__ vector bool int __attribute__((__always_inline__)) 2280 vec_vcmpgefp(vector float __a, vector float __b) { 2281 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2282 } 2283 2284 /* vec_vcmpgtsb */ 2285 2286 static __inline__ vector bool char __attribute__((__always_inline__)) 2287 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2288 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2289 } 2290 2291 /* vec_vcmpgtub */ 2292 2293 static __inline__ vector bool char __attribute__((__always_inline__)) 2294 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2295 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2296 } 2297 2298 /* vec_vcmpgtsh */ 2299 2300 static __inline__ vector bool short __attribute__((__always_inline__)) 2301 vec_vcmpgtsh(vector short __a, vector short __b) { 2302 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2303 } 2304 2305 /* vec_vcmpgtuh */ 2306 2307 static __inline__ vector bool short __attribute__((__always_inline__)) 2308 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2309 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2310 } 2311 2312 /* vec_vcmpgtsw */ 2313 2314 static __inline__ vector bool int __attribute__((__always_inline__)) 2315 vec_vcmpgtsw(vector int __a, vector int __b) { 2316 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2317 } 2318 2319 /* vec_vcmpgtuw */ 2320 2321 static __inline__ vector bool int __attribute__((__always_inline__)) 2322 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2323 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2324 } 2325 2326 /* vec_vcmpgtfp */ 2327 2328 static __inline__ vector bool int __attribute__((__always_inline__)) 2329 vec_vcmpgtfp(vector float __a, vector float __b) { 2330 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2331 } 2332 2333 /* vec_cmple */ 2334 2335 static __inline__ vector bool char __ATTRS_o_ai 2336 vec_cmple(vector signed char __a, vector signed char __b) { 2337 return vec_cmpge(__b, __a); 2338 } 2339 2340 static __inline__ vector bool char __ATTRS_o_ai 2341 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2342 return vec_cmpge(__b, __a); 2343 } 2344 2345 static __inline__ vector bool short __ATTRS_o_ai 2346 vec_cmple(vector signed short __a, vector signed short __b) { 2347 return vec_cmpge(__b, __a); 2348 } 2349 2350 static __inline__ vector bool short __ATTRS_o_ai 2351 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2352 return vec_cmpge(__b, __a); 2353 } 2354 2355 static __inline__ vector bool int __ATTRS_o_ai 2356 vec_cmple(vector signed int __a, vector signed int __b) { 2357 return vec_cmpge(__b, __a); 2358 } 2359 2360 static __inline__ vector bool int __ATTRS_o_ai 2361 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2362 return vec_cmpge(__b, __a); 2363 } 2364 2365 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2366 vector float __b) { 2367 return vec_cmpge(__b, __a); 2368 } 2369 2370 #ifdef __VSX__ 2371 static __inline__ vector bool long long __ATTRS_o_ai 2372 vec_cmple(vector double __a, vector double __b) { 2373 return vec_cmpge(__b, __a); 2374 } 2375 2376 static __inline__ vector bool long long __ATTRS_o_ai 2377 vec_cmple(vector signed long long __a, vector signed long long __b) { 2378 return vec_cmpge(__b, __a); 2379 } 2380 2381 static __inline__ vector bool long long __ATTRS_o_ai 2382 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2383 return vec_cmpge(__b, __a); 2384 } 2385 #endif 2386 2387 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2388 static __inline__ vector bool __int128 __ATTRS_o_ai 2389 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { 2390 return vec_cmpge(__b, __a); 2391 } 2392 2393 static __inline__ vector bool __int128 __ATTRS_o_ai 2394 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2395 return vec_cmpge(__b, __a); 2396 } 2397 #endif 2398 2399 /* vec_cmplt */ 2400 2401 static __inline__ vector bool char __ATTRS_o_ai 2402 vec_cmplt(vector signed char __a, vector signed char __b) { 2403 return vec_cmpgt(__b, __a); 2404 } 2405 2406 static __inline__ vector bool char __ATTRS_o_ai 2407 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2408 return vec_cmpgt(__b, __a); 2409 } 2410 2411 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2412 vector short __b) { 2413 return vec_cmpgt(__b, __a); 2414 } 2415 2416 static __inline__ vector bool short __ATTRS_o_ai 2417 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2418 return vec_cmpgt(__b, __a); 2419 } 2420 2421 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2422 vector int __b) { 2423 return vec_cmpgt(__b, __a); 2424 } 2425 2426 static __inline__ vector bool int __ATTRS_o_ai 2427 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2428 return vec_cmpgt(__b, __a); 2429 } 2430 2431 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2432 vector float __b) { 2433 return vec_cmpgt(__b, __a); 2434 } 2435 2436 #ifdef __VSX__ 2437 static __inline__ vector bool long long __ATTRS_o_ai 2438 vec_cmplt(vector double __a, vector double __b) { 2439 return vec_cmpgt(__b, __a); 2440 } 2441 #endif 2442 2443 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2444 static __inline__ vector bool __int128 __ATTRS_o_ai 2445 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { 2446 return vec_cmpgt(__b, __a); 2447 } 2448 2449 static __inline__ vector bool __int128 __ATTRS_o_ai 2450 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2451 return vec_cmpgt(__b, __a); 2452 } 2453 #endif 2454 2455 #ifdef __VSX__ 2456 static __inline__ vector bool long long __ATTRS_o_ai 2457 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2458 return vec_cmpgt(__b, __a); 2459 } 2460 2461 static __inline__ vector bool long long __ATTRS_o_ai 2462 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2463 return vec_cmpgt(__b, __a); 2464 } 2465 #endif 2466 2467 #ifdef __POWER8_VECTOR__ 2468 /* vec_popcnt */ 2469 2470 static __inline__ vector signed char __ATTRS_o_ai 2471 vec_popcnt(vector signed char __a) { 2472 return __builtin_altivec_vpopcntb(__a); 2473 } 2474 static __inline__ vector unsigned char __ATTRS_o_ai 2475 vec_popcnt(vector unsigned char __a) { 2476 return __builtin_altivec_vpopcntb(__a); 2477 } 2478 static __inline__ vector signed short __ATTRS_o_ai 2479 vec_popcnt(vector signed short __a) { 2480 return __builtin_altivec_vpopcnth(__a); 2481 } 2482 static __inline__ vector unsigned short __ATTRS_o_ai 2483 vec_popcnt(vector unsigned short __a) { 2484 return __builtin_altivec_vpopcnth(__a); 2485 } 2486 static __inline__ vector signed int __ATTRS_o_ai 2487 vec_popcnt(vector signed int __a) { 2488 return __builtin_altivec_vpopcntw(__a); 2489 } 2490 static __inline__ vector unsigned int __ATTRS_o_ai 2491 vec_popcnt(vector unsigned int __a) { 2492 return __builtin_altivec_vpopcntw(__a); 2493 } 2494 static __inline__ vector signed long long __ATTRS_o_ai 2495 vec_popcnt(vector signed long long __a) { 2496 return __builtin_altivec_vpopcntd(__a); 2497 } 2498 static __inline__ vector unsigned long long __ATTRS_o_ai 2499 vec_popcnt(vector unsigned long long __a) { 2500 return __builtin_altivec_vpopcntd(__a); 2501 } 2502 2503 #define vec_vclz vec_cntlz 2504 /* vec_cntlz */ 2505 2506 static __inline__ vector signed char __ATTRS_o_ai 2507 vec_cntlz(vector signed char __a) { 2508 return __builtin_altivec_vclzb(__a); 2509 } 2510 static __inline__ vector unsigned char __ATTRS_o_ai 2511 vec_cntlz(vector unsigned char __a) { 2512 return __builtin_altivec_vclzb(__a); 2513 } 2514 static __inline__ vector signed short __ATTRS_o_ai 2515 vec_cntlz(vector signed short __a) { 2516 return __builtin_altivec_vclzh(__a); 2517 } 2518 static __inline__ vector unsigned short __ATTRS_o_ai 2519 vec_cntlz(vector unsigned short __a) { 2520 return __builtin_altivec_vclzh(__a); 2521 } 2522 static __inline__ vector signed int __ATTRS_o_ai 2523 vec_cntlz(vector signed int __a) { 2524 return __builtin_altivec_vclzw(__a); 2525 } 2526 static __inline__ vector unsigned int __ATTRS_o_ai 2527 vec_cntlz(vector unsigned int __a) { 2528 return __builtin_altivec_vclzw(__a); 2529 } 2530 static __inline__ vector signed long long __ATTRS_o_ai 2531 vec_cntlz(vector signed long long __a) { 2532 return __builtin_altivec_vclzd(__a); 2533 } 2534 static __inline__ vector unsigned long long __ATTRS_o_ai 2535 vec_cntlz(vector unsigned long long __a) { 2536 return __builtin_altivec_vclzd(__a); 2537 } 2538 #endif 2539 2540 #ifdef __POWER9_VECTOR__ 2541 2542 /* vec_cnttz */ 2543 2544 static __inline__ vector signed char __ATTRS_o_ai 2545 vec_cnttz(vector signed char __a) { 2546 return __builtin_altivec_vctzb(__a); 2547 } 2548 static __inline__ vector unsigned char __ATTRS_o_ai 2549 vec_cnttz(vector unsigned char __a) { 2550 return __builtin_altivec_vctzb(__a); 2551 } 2552 static __inline__ vector signed short __ATTRS_o_ai 2553 vec_cnttz(vector signed short __a) { 2554 return __builtin_altivec_vctzh(__a); 2555 } 2556 static __inline__ vector unsigned short __ATTRS_o_ai 2557 vec_cnttz(vector unsigned short __a) { 2558 return __builtin_altivec_vctzh(__a); 2559 } 2560 static __inline__ vector signed int __ATTRS_o_ai 2561 vec_cnttz(vector signed int __a) { 2562 return __builtin_altivec_vctzw(__a); 2563 } 2564 static __inline__ vector unsigned int __ATTRS_o_ai 2565 vec_cnttz(vector unsigned int __a) { 2566 return __builtin_altivec_vctzw(__a); 2567 } 2568 static __inline__ vector signed long long __ATTRS_o_ai 2569 vec_cnttz(vector signed long long __a) { 2570 return __builtin_altivec_vctzd(__a); 2571 } 2572 static __inline__ vector unsigned long long __ATTRS_o_ai 2573 vec_cnttz(vector unsigned long long __a) { 2574 return __builtin_altivec_vctzd(__a); 2575 } 2576 2577 /* vec_first_match_index */ 2578 2579 static __inline__ unsigned __ATTRS_o_ai 2580 vec_first_match_index(vector signed char __a, vector signed char __b) { 2581 vector unsigned long long __res = 2582 #ifdef __LITTLE_ENDIAN__ 2583 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2584 #else 2585 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2586 #endif 2587 if (__res[0] == 64) { 2588 return (__res[1] + 64) >> 3; 2589 } 2590 return __res[0] >> 3; 2591 } 2592 2593 static __inline__ unsigned __ATTRS_o_ai 2594 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2595 vector unsigned long long __res = 2596 #ifdef __LITTLE_ENDIAN__ 2597 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2598 #else 2599 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2600 #endif 2601 if (__res[0] == 64) { 2602 return (__res[1] + 64) >> 3; 2603 } 2604 return __res[0] >> 3; 2605 } 2606 2607 static __inline__ unsigned __ATTRS_o_ai 2608 vec_first_match_index(vector signed short __a, vector signed short __b) { 2609 vector unsigned long long __res = 2610 #ifdef __LITTLE_ENDIAN__ 2611 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2612 #else 2613 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2614 #endif 2615 if (__res[0] == 64) { 2616 return (__res[1] + 64) >> 4; 2617 } 2618 return __res[0] >> 4; 2619 } 2620 2621 static __inline__ unsigned __ATTRS_o_ai 2622 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2623 vector unsigned long long __res = 2624 #ifdef __LITTLE_ENDIAN__ 2625 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2626 #else 2627 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2628 #endif 2629 if (__res[0] == 64) { 2630 return (__res[1] + 64) >> 4; 2631 } 2632 return __res[0] >> 4; 2633 } 2634 2635 static __inline__ unsigned __ATTRS_o_ai 2636 vec_first_match_index(vector signed int __a, vector signed int __b) { 2637 vector unsigned long long __res = 2638 #ifdef __LITTLE_ENDIAN__ 2639 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2640 #else 2641 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2642 #endif 2643 if (__res[0] == 64) { 2644 return (__res[1] + 64) >> 5; 2645 } 2646 return __res[0] >> 5; 2647 } 2648 2649 static __inline__ unsigned __ATTRS_o_ai 2650 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2651 vector unsigned long long __res = 2652 #ifdef __LITTLE_ENDIAN__ 2653 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2654 #else 2655 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2656 #endif 2657 if (__res[0] == 64) { 2658 return (__res[1] + 64) >> 5; 2659 } 2660 return __res[0] >> 5; 2661 } 2662 2663 /* vec_first_match_or_eos_index */ 2664 2665 static __inline__ unsigned __ATTRS_o_ai 2666 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2667 /* Compare the result of the comparison of two vectors with either and OR the 2668 result. Either the elements are equal or one will equal the comparison 2669 result if either is zero. 2670 */ 2671 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2672 vector bool char __tmp2 = __tmp1 | 2673 vec_cmpeq((vector signed char)__tmp1, __a) | 2674 vec_cmpeq((vector signed char)__tmp1, __b); 2675 2676 vector unsigned long long __res = 2677 #ifdef __LITTLE_ENDIAN__ 2678 vec_cnttz((vector unsigned long long)__tmp2); 2679 #else 2680 vec_cntlz((vector unsigned long long)__tmp2); 2681 #endif 2682 if (__res[0] == 64) { 2683 return (__res[1] + 64) >> 3; 2684 } 2685 return __res[0] >> 3; 2686 } 2687 2688 static __inline__ unsigned __ATTRS_o_ai 2689 vec_first_match_or_eos_index(vector unsigned char __a, 2690 vector unsigned char __b) { 2691 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2692 vector bool char __tmp2 = __tmp1 | 2693 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2694 vec_cmpeq((vector unsigned char)__tmp1, __b); 2695 2696 vector unsigned long long __res = 2697 #ifdef __LITTLE_ENDIAN__ 2698 vec_cnttz((vector unsigned long long)__tmp2); 2699 #else 2700 vec_cntlz((vector unsigned long long)__tmp2); 2701 #endif 2702 if (__res[0] == 64) { 2703 return (__res[1] + 64) >> 3; 2704 } 2705 return __res[0] >> 3; 2706 } 2707 2708 static __inline__ unsigned __ATTRS_o_ai 2709 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2710 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2711 vector bool short __tmp2 = __tmp1 | 2712 vec_cmpeq((vector signed short)__tmp1, __a) | 2713 vec_cmpeq((vector signed short)__tmp1, __b); 2714 2715 vector unsigned long long __res = 2716 #ifdef __LITTLE_ENDIAN__ 2717 vec_cnttz((vector unsigned long long)__tmp2); 2718 #else 2719 vec_cntlz((vector unsigned long long)__tmp2); 2720 #endif 2721 if (__res[0] == 64) { 2722 return (__res[1] + 64) >> 4; 2723 } 2724 return __res[0] >> 4; 2725 } 2726 2727 static __inline__ unsigned __ATTRS_o_ai 2728 vec_first_match_or_eos_index(vector unsigned short __a, 2729 vector unsigned short __b) { 2730 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2731 vector bool short __tmp2 = __tmp1 | 2732 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2733 vec_cmpeq((vector unsigned short)__tmp1, __b); 2734 2735 vector unsigned long long __res = 2736 #ifdef __LITTLE_ENDIAN__ 2737 vec_cnttz((vector unsigned long long)__tmp2); 2738 #else 2739 vec_cntlz((vector unsigned long long)__tmp2); 2740 #endif 2741 if (__res[0] == 64) { 2742 return (__res[1] + 64) >> 4; 2743 } 2744 return __res[0] >> 4; 2745 } 2746 2747 static __inline__ unsigned __ATTRS_o_ai 2748 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2749 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2750 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2751 vec_cmpeq((vector signed int)__tmp1, __b); 2752 2753 vector unsigned long long __res = 2754 #ifdef __LITTLE_ENDIAN__ 2755 vec_cnttz((vector unsigned long long)__tmp2); 2756 #else 2757 vec_cntlz((vector unsigned long long)__tmp2); 2758 #endif 2759 if (__res[0] == 64) { 2760 return (__res[1] + 64) >> 5; 2761 } 2762 return __res[0] >> 5; 2763 } 2764 2765 static __inline__ unsigned __ATTRS_o_ai 2766 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2767 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2768 vector bool int __tmp2 = __tmp1 | 2769 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2770 vec_cmpeq((vector unsigned int)__tmp1, __b); 2771 2772 vector unsigned long long __res = 2773 #ifdef __LITTLE_ENDIAN__ 2774 vec_cnttz((vector unsigned long long)__tmp2); 2775 #else 2776 vec_cntlz((vector unsigned long long)__tmp2); 2777 #endif 2778 if (__res[0] == 64) { 2779 return (__res[1] + 64) >> 5; 2780 } 2781 return __res[0] >> 5; 2782 } 2783 2784 /* vec_first_mismatch_index */ 2785 2786 static __inline__ unsigned __ATTRS_o_ai 2787 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2788 vector unsigned long long __res = 2789 #ifdef __LITTLE_ENDIAN__ 2790 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2791 #else 2792 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2793 #endif 2794 if (__res[0] == 64) { 2795 return (__res[1] + 64) >> 3; 2796 } 2797 return __res[0] >> 3; 2798 } 2799 2800 static __inline__ unsigned __ATTRS_o_ai 2801 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2802 vector unsigned long long __res = 2803 #ifdef __LITTLE_ENDIAN__ 2804 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2805 #else 2806 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2807 #endif 2808 if (__res[0] == 64) { 2809 return (__res[1] + 64) >> 3; 2810 } 2811 return __res[0] >> 3; 2812 } 2813 2814 static __inline__ unsigned __ATTRS_o_ai 2815 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2816 vector unsigned long long __res = 2817 #ifdef __LITTLE_ENDIAN__ 2818 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2819 #else 2820 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2821 #endif 2822 if (__res[0] == 64) { 2823 return (__res[1] + 64) >> 4; 2824 } 2825 return __res[0] >> 4; 2826 } 2827 2828 static __inline__ unsigned __ATTRS_o_ai 2829 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2830 vector unsigned long long __res = 2831 #ifdef __LITTLE_ENDIAN__ 2832 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2833 #else 2834 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2835 #endif 2836 if (__res[0] == 64) { 2837 return (__res[1] + 64) >> 4; 2838 } 2839 return __res[0] >> 4; 2840 } 2841 2842 static __inline__ unsigned __ATTRS_o_ai 2843 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2844 vector unsigned long long __res = 2845 #ifdef __LITTLE_ENDIAN__ 2846 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2847 #else 2848 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2849 #endif 2850 if (__res[0] == 64) { 2851 return (__res[1] + 64) >> 5; 2852 } 2853 return __res[0] >> 5; 2854 } 2855 2856 static __inline__ unsigned __ATTRS_o_ai 2857 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2858 vector unsigned long long __res = 2859 #ifdef __LITTLE_ENDIAN__ 2860 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2861 #else 2862 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2863 #endif 2864 if (__res[0] == 64) { 2865 return (__res[1] + 64) >> 5; 2866 } 2867 return __res[0] >> 5; 2868 } 2869 2870 /* vec_first_mismatch_or_eos_index */ 2871 2872 static __inline__ unsigned __ATTRS_o_ai 2873 vec_first_mismatch_or_eos_index(vector signed char __a, 2874 vector signed char __b) { 2875 vector unsigned long long __res = 2876 #ifdef __LITTLE_ENDIAN__ 2877 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2878 #else 2879 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2880 #endif 2881 if (__res[0] == 64) { 2882 return (__res[1] + 64) >> 3; 2883 } 2884 return __res[0] >> 3; 2885 } 2886 2887 static __inline__ unsigned __ATTRS_o_ai 2888 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2889 vector unsigned char __b) { 2890 vector unsigned long long __res = 2891 #ifdef __LITTLE_ENDIAN__ 2892 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2893 #else 2894 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2895 #endif 2896 if (__res[0] == 64) { 2897 return (__res[1] + 64) >> 3; 2898 } 2899 return __res[0] >> 3; 2900 } 2901 2902 static __inline__ unsigned __ATTRS_o_ai 2903 vec_first_mismatch_or_eos_index(vector signed short __a, 2904 vector signed short __b) { 2905 vector unsigned long long __res = 2906 #ifdef __LITTLE_ENDIAN__ 2907 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2908 #else 2909 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2910 #endif 2911 if (__res[0] == 64) { 2912 return (__res[1] + 64) >> 4; 2913 } 2914 return __res[0] >> 4; 2915 } 2916 2917 static __inline__ unsigned __ATTRS_o_ai 2918 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2919 vector unsigned short __b) { 2920 vector unsigned long long __res = 2921 #ifdef __LITTLE_ENDIAN__ 2922 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2923 #else 2924 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2925 #endif 2926 if (__res[0] == 64) { 2927 return (__res[1] + 64) >> 4; 2928 } 2929 return __res[0] >> 4; 2930 } 2931 2932 static __inline__ unsigned __ATTRS_o_ai 2933 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2934 vector unsigned long long __res = 2935 #ifdef __LITTLE_ENDIAN__ 2936 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2937 #else 2938 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2939 #endif 2940 if (__res[0] == 64) { 2941 return (__res[1] + 64) >> 5; 2942 } 2943 return __res[0] >> 5; 2944 } 2945 2946 static __inline__ unsigned __ATTRS_o_ai 2947 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2948 vector unsigned int __b) { 2949 vector unsigned long long __res = 2950 #ifdef __LITTLE_ENDIAN__ 2951 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2952 #else 2953 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2954 #endif 2955 if (__res[0] == 64) { 2956 return (__res[1] + 64) >> 5; 2957 } 2958 return __res[0] >> 5; 2959 } 2960 2961 static __inline__ vector double __ATTRS_o_ai 2962 vec_insert_exp(vector double __a, vector unsigned long long __b) { 2963 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 2964 } 2965 2966 static __inline__ vector double __ATTRS_o_ai 2967 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 2968 return __builtin_vsx_xviexpdp(__a,__b); 2969 } 2970 2971 static __inline__ vector float __ATTRS_o_ai 2972 vec_insert_exp(vector float __a, vector unsigned int __b) { 2973 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 2974 } 2975 2976 static __inline__ vector float __ATTRS_o_ai 2977 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 2978 return __builtin_vsx_xviexpsp(__a,__b); 2979 } 2980 2981 #if defined(__powerpc64__) 2982 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 2983 size_t __b) { 2984 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 2985 } 2986 2987 static __inline__ vector unsigned char __ATTRS_o_ai 2988 vec_xl_len(const unsigned char *__a, size_t __b) { 2989 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 2990 } 2991 2992 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 2993 size_t __b) { 2994 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 2995 } 2996 2997 static __inline__ vector unsigned short __ATTRS_o_ai 2998 vec_xl_len(const unsigned short *__a, size_t __b) { 2999 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 3000 } 3001 3002 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 3003 size_t __b) { 3004 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 3005 } 3006 3007 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 3008 size_t __b) { 3009 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 3010 } 3011 3012 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 3013 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 3014 } 3015 3016 #ifdef __SIZEOF_INT128__ 3017 static __inline__ vector signed __int128 __ATTRS_o_ai 3018 vec_xl_len(const signed __int128 *__a, size_t __b) { 3019 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3020 } 3021 3022 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3023 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 3024 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3025 } 3026 #endif 3027 3028 static __inline__ vector signed long long __ATTRS_o_ai 3029 vec_xl_len(const signed long long *__a, size_t __b) { 3030 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3031 } 3032 3033 static __inline__ vector unsigned long long __ATTRS_o_ai 3034 vec_xl_len(const unsigned long long *__a, size_t __b) { 3035 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3036 } 3037 3038 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 3039 size_t __b) { 3040 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 3041 } 3042 3043 static __inline__ vector unsigned char __ATTRS_o_ai 3044 vec_xl_len_r(const unsigned char *__a, size_t __b) { 3045 vector unsigned char __res = 3046 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 3047 #ifdef __LITTLE_ENDIAN__ 3048 vector unsigned char __mask = 3049 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 3050 __res = (vector unsigned char)__builtin_altivec_vperm_4si( 3051 (vector int)__res, (vector int)__res, __mask); 3052 #endif 3053 return __res; 3054 } 3055 3056 // vec_xst_len 3057 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 3058 unsigned char *__b, 3059 size_t __c) { 3060 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3061 } 3062 3063 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed char __a, 3064 signed char *__b, 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 short __a, 3069 signed short *__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 unsigned short __a, 3074 unsigned short *__b, 3075 size_t __c) { 3076 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3077 } 3078 3079 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 3080 signed int *__b, 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 unsigned int __a, 3085 unsigned 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 float __a, float *__b, 3090 size_t __c) { 3091 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3092 } 3093 3094 #ifdef __SIZEOF_INT128__ 3095 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 3096 signed __int128 *__b, 3097 size_t __c) { 3098 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3099 } 3100 3101 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, 3102 unsigned __int128 *__b, 3103 size_t __c) { 3104 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3105 } 3106 #endif 3107 3108 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 3109 signed long long *__b, 3110 size_t __c) { 3111 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3112 } 3113 3114 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 3115 unsigned long long *__b, 3116 size_t __c) { 3117 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3118 } 3119 3120 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__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_r(vector unsigned char __a, 3126 unsigned char *__b, 3127 size_t __c) { 3128 #ifdef __LITTLE_ENDIAN__ 3129 vector unsigned char __mask = 3130 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 3131 vector unsigned char __res = 3132 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); 3133 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 3134 #else 3135 return __builtin_vsx_stxvll((vector int)__a, __b, (__c << 56)); 3136 #endif 3137 } 3138 #endif 3139 #endif 3140 3141 /* vec_cpsgn */ 3142 3143 #ifdef __VSX__ 3144 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 3145 vector float __b) { 3146 return __builtin_vsx_xvcpsgnsp(__b, __a); 3147 } 3148 3149 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 3150 vector double __b) { 3151 return __builtin_vsx_xvcpsgndp(__b, __a); 3152 } 3153 #endif 3154 3155 /* vec_ctf */ 3156 3157 #ifdef __VSX__ 3158 // There are some functions that have different signatures with the XL compiler 3159 // from those in Clang/GCC and documented in the PVIPR. This macro ensures that 3160 // the XL-compatible signatures are used for those functions. 3161 #ifdef __XL_COMPAT_ALTIVEC__ 3162 #define vec_ctf(__a, __b) \ 3163 _Generic((__a), vector int \ 3164 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3165 vector unsigned int \ 3166 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3167 (__b)), \ 3168 vector unsigned long long \ 3169 : (__builtin_vsx_xvcvuxdsp((vector unsigned long long)(__a)) * \ 3170 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \ 3171 vector signed long long \ 3172 : (__builtin_vsx_xvcvsxdsp((vector signed long long)(__a)) * \ 3173 (vector float)(vector unsigned)((0x7f - (__b)) << 23))) 3174 #else // __XL_COMPAT_ALTIVEC__ 3175 #define vec_ctf(__a, __b) \ 3176 _Generic((__a), vector int \ 3177 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3178 vector unsigned int \ 3179 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3180 (__b)), \ 3181 vector unsigned long long \ 3182 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3183 vector double) * \ 3184 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3185 << 52)), \ 3186 vector signed long long \ 3187 : (__builtin_convertvector((vector signed long long)(__a), \ 3188 vector double) * \ 3189 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3190 << 52))) 3191 #endif // __XL_COMPAT_ALTIVEC__ 3192 #else 3193 #define vec_ctf(__a, __b) \ 3194 _Generic((__a), vector int \ 3195 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3196 vector unsigned int \ 3197 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3198 (__b))) 3199 #endif 3200 3201 /* vec_ctd */ 3202 #ifdef __VSX__ 3203 #define vec_ctd(__a, __b) \ 3204 _Generic((__a), vector signed int \ 3205 : (vec_doublee((vector signed int)(__a)) * \ 3206 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3207 << 52)), \ 3208 vector unsigned int \ 3209 : (vec_doublee((vector unsigned int)(__a)) * \ 3210 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3211 << 52)), \ 3212 vector unsigned long long \ 3213 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3214 vector double) * \ 3215 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3216 << 52)), \ 3217 vector signed long long \ 3218 : (__builtin_convertvector((vector signed long long)(__a), \ 3219 vector double) * \ 3220 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3221 << 52))) 3222 #endif // __VSX__ 3223 3224 /* vec_vcfsx */ 3225 3226 #define vec_vcfux __builtin_altivec_vcfux 3227 /* vec_vcfux */ 3228 3229 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 3230 3231 /* vec_cts */ 3232 3233 #ifdef __VSX__ 3234 #ifdef __XL_COMPAT_ALTIVEC__ 3235 #define vec_cts(__a, __b) \ 3236 _Generic((__a), vector float \ 3237 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3238 vector double \ 3239 : __extension__({ \ 3240 vector double __ret = \ 3241 (vector double)(__a) * \ 3242 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3243 << 52); \ 3244 __builtin_vsx_xvcvdpsxws(__ret); \ 3245 })) 3246 #else // __XL_COMPAT_ALTIVEC__ 3247 #define vec_cts(__a, __b) \ 3248 _Generic((__a), vector float \ 3249 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3250 vector double \ 3251 : __extension__({ \ 3252 vector double __ret = \ 3253 (vector double)(__a) * \ 3254 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3255 << 52); \ 3256 __builtin_convertvector(__ret, vector signed long long); \ 3257 })) 3258 #endif // __XL_COMPAT_ALTIVEC__ 3259 #else 3260 #define vec_cts __builtin_altivec_vctsxs 3261 #endif 3262 3263 /* vec_vctsxs */ 3264 3265 #define vec_vctsxs __builtin_altivec_vctsxs 3266 3267 /* vec_ctu */ 3268 3269 #ifdef __VSX__ 3270 #ifdef __XL_COMPAT_ALTIVEC__ 3271 #define vec_ctu(__a, __b) \ 3272 _Generic((__a), vector float \ 3273 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3274 vector double \ 3275 : __extension__({ \ 3276 vector double __ret = \ 3277 (vector double)(__a) * \ 3278 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3279 << 52); \ 3280 __builtin_vsx_xvcvdpuxws(__ret); \ 3281 })) 3282 #else // __XL_COMPAT_ALTIVEC__ 3283 #define vec_ctu(__a, __b) \ 3284 _Generic((__a), vector float \ 3285 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3286 vector double \ 3287 : __extension__({ \ 3288 vector double __ret = \ 3289 (vector double)(__a) * \ 3290 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3291 << 52); \ 3292 __builtin_convertvector(__ret, vector unsigned long long); \ 3293 })) 3294 #endif // __XL_COMPAT_ALTIVEC__ 3295 #else 3296 #define vec_ctu __builtin_altivec_vctuxs 3297 #endif 3298 3299 #ifdef __LITTLE_ENDIAN__ 3300 /* vec_ctsl */ 3301 3302 #ifdef __VSX__ 3303 #define vec_ctsl(__a, __b) \ 3304 _Generic((__a), vector float \ 3305 : __extension__({ \ 3306 vector float __ret = \ 3307 (vector float)(__a) * \ 3308 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3309 __builtin_vsx_xvcvspsxds( \ 3310 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3311 }), \ 3312 vector double \ 3313 : __extension__({ \ 3314 vector double __ret = \ 3315 (vector double)(__a) * \ 3316 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3317 << 52); \ 3318 __builtin_convertvector(__ret, vector signed long long); \ 3319 })) 3320 3321 /* vec_ctul */ 3322 3323 #define vec_ctul(__a, __b) \ 3324 _Generic((__a), vector float \ 3325 : __extension__({ \ 3326 vector float __ret = \ 3327 (vector float)(__a) * \ 3328 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3329 __builtin_vsx_xvcvspuxds( \ 3330 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3331 }), \ 3332 vector double \ 3333 : __extension__({ \ 3334 vector double __ret = \ 3335 (vector double)(__a) * \ 3336 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3337 << 52); \ 3338 __builtin_convertvector(__ret, vector unsigned long long); \ 3339 })) 3340 #endif 3341 #else // __LITTLE_ENDIAN__ 3342 /* vec_ctsl */ 3343 3344 #ifdef __VSX__ 3345 #define vec_ctsl(__a, __b) \ 3346 _Generic((__a), vector float \ 3347 : __extension__({ \ 3348 vector float __ret = \ 3349 (vector float)(__a) * \ 3350 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3351 __builtin_vsx_xvcvspsxds(__ret); \ 3352 }), \ 3353 vector double \ 3354 : __extension__({ \ 3355 vector double __ret = \ 3356 (vector double)(__a) * \ 3357 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3358 << 52); \ 3359 __builtin_convertvector(__ret, vector signed long long); \ 3360 })) 3361 3362 /* vec_ctul */ 3363 3364 #define vec_ctul(__a, __b) \ 3365 _Generic((__a), vector float \ 3366 : __extension__({ \ 3367 vector float __ret = \ 3368 (vector float)(__a) * \ 3369 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3370 __builtin_vsx_xvcvspuxds(__ret); \ 3371 }), \ 3372 vector double \ 3373 : __extension__({ \ 3374 vector double __ret = \ 3375 (vector double)(__a) * \ 3376 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3377 << 52); \ 3378 __builtin_convertvector(__ret, vector unsigned long long); \ 3379 })) 3380 #endif 3381 #endif // __LITTLE_ENDIAN__ 3382 3383 /* vec_vctuxs */ 3384 3385 #define vec_vctuxs __builtin_altivec_vctuxs 3386 3387 /* vec_signext */ 3388 3389 #ifdef __POWER9_VECTOR__ 3390 static __inline__ vector signed int __ATTRS_o_ai 3391 vec_signexti(vector signed char __a) { 3392 return __builtin_altivec_vextsb2w(__a); 3393 } 3394 3395 static __inline__ vector signed int __ATTRS_o_ai 3396 vec_signexti(vector signed short __a) { 3397 return __builtin_altivec_vextsh2w(__a); 3398 } 3399 3400 static __inline__ vector signed long long __ATTRS_o_ai 3401 vec_signextll(vector signed char __a) { 3402 return __builtin_altivec_vextsb2d(__a); 3403 } 3404 3405 static __inline__ vector signed long long __ATTRS_o_ai 3406 vec_signextll(vector signed short __a) { 3407 return __builtin_altivec_vextsh2d(__a); 3408 } 3409 3410 static __inline__ vector signed long long __ATTRS_o_ai 3411 vec_signextll(vector signed int __a) { 3412 return __builtin_altivec_vextsw2d(__a); 3413 } 3414 #endif 3415 3416 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3417 static __inline__ vector signed __int128 __ATTRS_o_ai 3418 vec_signextq(vector signed long long __a) { 3419 return __builtin_altivec_vextsd2q(__a); 3420 } 3421 #endif 3422 3423 /* vec_signed */ 3424 3425 static __inline__ vector signed int __ATTRS_o_ai 3426 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3427 3428 static __inline__ vector signed int __ATTRS_o_ai 3429 vec_signed(vector float __a) { 3430 return __builtin_convertvector(__a, vector signed int); 3431 } 3432 3433 #ifdef __VSX__ 3434 static __inline__ vector signed long long __ATTRS_o_ai 3435 vec_signed(vector double __a) { 3436 return __builtin_convertvector(__a, vector signed long long); 3437 } 3438 3439 static __inline__ vector signed int __attribute__((__always_inline__)) 3440 vec_signed2(vector double __a, vector double __b) { 3441 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3442 } 3443 3444 static __inline__ vector signed int __ATTRS_o_ai 3445 vec_signede(vector double __a) { 3446 #ifdef __LITTLE_ENDIAN__ 3447 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3448 return vec_sld(__ret, __ret, 12); 3449 #else 3450 return __builtin_vsx_xvcvdpsxws(__a); 3451 #endif 3452 } 3453 3454 static __inline__ vector signed int __ATTRS_o_ai 3455 vec_signedo(vector double __a) { 3456 #ifdef __LITTLE_ENDIAN__ 3457 return __builtin_vsx_xvcvdpsxws(__a); 3458 #else 3459 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3460 return vec_sld(__ret, __ret, 12); 3461 #endif 3462 } 3463 #endif 3464 3465 /* vec_unsigned */ 3466 3467 static __inline__ vector unsigned int __ATTRS_o_ai 3468 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3469 3470 static __inline__ vector unsigned int __ATTRS_o_ai 3471 vec_unsigned(vector float __a) { 3472 return __builtin_convertvector(__a, vector unsigned int); 3473 } 3474 3475 #ifdef __VSX__ 3476 static __inline__ vector unsigned long long __ATTRS_o_ai 3477 vec_unsigned(vector double __a) { 3478 return __builtin_convertvector(__a, vector unsigned long long); 3479 } 3480 3481 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3482 vec_unsigned2(vector double __a, vector double __b) { 3483 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3484 } 3485 3486 static __inline__ vector unsigned int __ATTRS_o_ai 3487 vec_unsignede(vector double __a) { 3488 #ifdef __LITTLE_ENDIAN__ 3489 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3490 return vec_sld(__ret, __ret, 12); 3491 #else 3492 return __builtin_vsx_xvcvdpuxws(__a); 3493 #endif 3494 } 3495 3496 static __inline__ vector unsigned int __ATTRS_o_ai 3497 vec_unsignedo(vector double __a) { 3498 #ifdef __LITTLE_ENDIAN__ 3499 return __builtin_vsx_xvcvdpuxws(__a); 3500 #else 3501 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3502 return vec_sld(__ret, __ret, 12); 3503 #endif 3504 } 3505 #endif 3506 3507 /* vec_float */ 3508 3509 static __inline__ vector float __ATTRS_o_ai 3510 vec_sld(vector float, vector float, unsigned const int __c); 3511 3512 static __inline__ vector float __ATTRS_o_ai 3513 vec_float(vector signed int __a) { 3514 return __builtin_convertvector(__a, vector float); 3515 } 3516 3517 static __inline__ vector float __ATTRS_o_ai 3518 vec_float(vector unsigned int __a) { 3519 return __builtin_convertvector(__a, vector float); 3520 } 3521 3522 #ifdef __VSX__ 3523 static __inline__ vector float __ATTRS_o_ai 3524 vec_float2(vector signed long long __a, vector signed long long __b) { 3525 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3526 } 3527 3528 static __inline__ vector float __ATTRS_o_ai 3529 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3530 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3531 } 3532 3533 static __inline__ vector float __ATTRS_o_ai 3534 vec_float2(vector double __a, vector double __b) { 3535 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3536 } 3537 3538 static __inline__ vector float __ATTRS_o_ai 3539 vec_floate(vector signed long long __a) { 3540 #ifdef __LITTLE_ENDIAN__ 3541 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3542 return vec_sld(__ret, __ret, 12); 3543 #else 3544 return __builtin_vsx_xvcvsxdsp(__a); 3545 #endif 3546 } 3547 3548 static __inline__ vector float __ATTRS_o_ai 3549 vec_floate(vector unsigned long long __a) { 3550 #ifdef __LITTLE_ENDIAN__ 3551 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3552 return vec_sld(__ret, __ret, 12); 3553 #else 3554 return __builtin_vsx_xvcvuxdsp(__a); 3555 #endif 3556 } 3557 3558 static __inline__ vector float __ATTRS_o_ai 3559 vec_floate(vector double __a) { 3560 #ifdef __LITTLE_ENDIAN__ 3561 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3562 return vec_sld(__ret, __ret, 12); 3563 #else 3564 return __builtin_vsx_xvcvdpsp(__a); 3565 #endif 3566 } 3567 3568 static __inline__ vector float __ATTRS_o_ai 3569 vec_floato(vector signed long long __a) { 3570 #ifdef __LITTLE_ENDIAN__ 3571 return __builtin_vsx_xvcvsxdsp(__a); 3572 #else 3573 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3574 return vec_sld(__ret, __ret, 12); 3575 #endif 3576 } 3577 3578 static __inline__ vector float __ATTRS_o_ai 3579 vec_floato(vector unsigned long long __a) { 3580 #ifdef __LITTLE_ENDIAN__ 3581 return __builtin_vsx_xvcvuxdsp(__a); 3582 #else 3583 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3584 return vec_sld(__ret, __ret, 12); 3585 #endif 3586 } 3587 3588 static __inline__ vector float __ATTRS_o_ai 3589 vec_floato(vector double __a) { 3590 #ifdef __LITTLE_ENDIAN__ 3591 return __builtin_vsx_xvcvdpsp(__a); 3592 #else 3593 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3594 return vec_sld(__ret, __ret, 12); 3595 #endif 3596 } 3597 #endif 3598 3599 /* vec_double */ 3600 3601 #ifdef __VSX__ 3602 static __inline__ vector double __ATTRS_o_ai 3603 vec_double(vector signed long long __a) { 3604 return __builtin_convertvector(__a, vector double); 3605 } 3606 3607 static __inline__ vector double __ATTRS_o_ai 3608 vec_double(vector unsigned long long __a) { 3609 return __builtin_convertvector(__a, vector double); 3610 } 3611 3612 static __inline__ vector double __ATTRS_o_ai 3613 vec_doublee(vector signed int __a) { 3614 #ifdef __LITTLE_ENDIAN__ 3615 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3616 #else 3617 return __builtin_vsx_xvcvsxwdp(__a); 3618 #endif 3619 } 3620 3621 static __inline__ vector double __ATTRS_o_ai 3622 vec_doublee(vector unsigned int __a) { 3623 #ifdef __LITTLE_ENDIAN__ 3624 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3625 #else 3626 return __builtin_vsx_xvcvuxwdp(__a); 3627 #endif 3628 } 3629 3630 static __inline__ vector double __ATTRS_o_ai 3631 vec_doublee(vector float __a) { 3632 #ifdef __LITTLE_ENDIAN__ 3633 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3634 #else 3635 return __builtin_vsx_xvcvspdp(__a); 3636 #endif 3637 } 3638 3639 static __inline__ vector double __ATTRS_o_ai 3640 vec_doubleh(vector signed int __a) { 3641 vector double __ret = {__a[0], __a[1]}; 3642 return __ret; 3643 } 3644 3645 static __inline__ vector double __ATTRS_o_ai 3646 vec_doubleh(vector unsigned int __a) { 3647 vector double __ret = {__a[0], __a[1]}; 3648 return __ret; 3649 } 3650 3651 static __inline__ vector double __ATTRS_o_ai 3652 vec_doubleh(vector float __a) { 3653 vector double __ret = {__a[0], __a[1]}; 3654 return __ret; 3655 } 3656 3657 static __inline__ vector double __ATTRS_o_ai 3658 vec_doublel(vector signed int __a) { 3659 vector double __ret = {__a[2], __a[3]}; 3660 return __ret; 3661 } 3662 3663 static __inline__ vector double __ATTRS_o_ai 3664 vec_doublel(vector unsigned int __a) { 3665 vector double __ret = {__a[2], __a[3]}; 3666 return __ret; 3667 } 3668 3669 static __inline__ vector double __ATTRS_o_ai 3670 vec_doublel(vector float __a) { 3671 vector double __ret = {__a[2], __a[3]}; 3672 return __ret; 3673 } 3674 3675 static __inline__ vector double __ATTRS_o_ai 3676 vec_doubleo(vector signed int __a) { 3677 #ifdef __LITTLE_ENDIAN__ 3678 return __builtin_vsx_xvcvsxwdp(__a); 3679 #else 3680 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3681 #endif 3682 } 3683 3684 static __inline__ vector double __ATTRS_o_ai 3685 vec_doubleo(vector unsigned int __a) { 3686 #ifdef __LITTLE_ENDIAN__ 3687 return __builtin_vsx_xvcvuxwdp(__a); 3688 #else 3689 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3690 #endif 3691 } 3692 3693 static __inline__ vector double __ATTRS_o_ai 3694 vec_doubleo(vector float __a) { 3695 #ifdef __LITTLE_ENDIAN__ 3696 return __builtin_vsx_xvcvspdp(__a); 3697 #else 3698 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3699 #endif 3700 } 3701 3702 /* vec_cvf */ 3703 static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) { 3704 return vec_doublee(__a); 3705 } 3706 3707 static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) { 3708 return vec_floate(__a); 3709 } 3710 #endif 3711 3712 /* vec_div */ 3713 3714 /* Integer vector divides (vectors are scalarized, elements divided 3715 and the vectors reassembled). 3716 */ 3717 static __inline__ vector signed char __ATTRS_o_ai 3718 vec_div(vector signed char __a, vector signed char __b) { 3719 return __a / __b; 3720 } 3721 3722 static __inline__ vector unsigned char __ATTRS_o_ai 3723 vec_div(vector unsigned char __a, vector unsigned char __b) { 3724 return __a / __b; 3725 } 3726 3727 static __inline__ vector signed short __ATTRS_o_ai 3728 vec_div(vector signed short __a, vector signed short __b) { 3729 return __a / __b; 3730 } 3731 3732 static __inline__ vector unsigned short __ATTRS_o_ai 3733 vec_div(vector unsigned short __a, vector unsigned short __b) { 3734 return __a / __b; 3735 } 3736 3737 static __inline__ vector signed int __ATTRS_o_ai 3738 vec_div(vector signed int __a, vector signed int __b) { 3739 return __a / __b; 3740 } 3741 3742 static __inline__ vector unsigned int __ATTRS_o_ai 3743 vec_div(vector unsigned int __a, vector unsigned int __b) { 3744 return __a / __b; 3745 } 3746 3747 #ifdef __VSX__ 3748 static __inline__ vector signed long long __ATTRS_o_ai 3749 vec_div(vector signed long long __a, vector signed long long __b) { 3750 return __a / __b; 3751 } 3752 3753 static __inline__ vector unsigned long long __ATTRS_o_ai 3754 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3755 return __a / __b; 3756 } 3757 3758 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3759 vector float __b) { 3760 return __a / __b; 3761 } 3762 3763 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3764 vector double __b) { 3765 return __a / __b; 3766 } 3767 #endif 3768 3769 /* vec_dive */ 3770 3771 #ifdef __POWER10_VECTOR__ 3772 static __inline__ vector signed int __ATTRS_o_ai 3773 vec_dive(vector signed int __a, vector signed int __b) { 3774 return __builtin_altivec_vdivesw(__a, __b); 3775 } 3776 3777 static __inline__ vector unsigned int __ATTRS_o_ai 3778 vec_dive(vector unsigned int __a, vector unsigned int __b) { 3779 return __builtin_altivec_vdiveuw(__a, __b); 3780 } 3781 3782 static __inline__ vector signed long long __ATTRS_o_ai 3783 vec_dive(vector signed long long __a, vector signed long long __b) { 3784 return __builtin_altivec_vdivesd(__a, __b); 3785 } 3786 3787 static __inline__ vector unsigned long long __ATTRS_o_ai 3788 vec_dive(vector unsigned long long __a, vector unsigned long long __b) { 3789 return __builtin_altivec_vdiveud(__a, __b); 3790 } 3791 3792 #ifdef __SIZEOF_INT128__ 3793 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3794 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3795 return __builtin_altivec_vdiveuq(__a, __b); 3796 } 3797 3798 static __inline__ vector signed __int128 __ATTRS_o_ai 3799 vec_dive(vector signed __int128 __a, vector signed __int128 __b) { 3800 return __builtin_altivec_vdivesq(__a, __b); 3801 } 3802 #endif 3803 #endif 3804 3805 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3806 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3807 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3808 return __a / __b; 3809 } 3810 3811 static __inline__ vector signed __int128 __ATTRS_o_ai 3812 vec_div(vector signed __int128 __a, vector signed __int128 __b) { 3813 return __a / __b; 3814 } 3815 #endif /* __POWER10_VECTOR__ */ 3816 3817 /* vec_xvtdiv */ 3818 3819 #ifdef __VSX__ 3820 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, 3821 vector double __b) { 3822 return __builtin_vsx_xvtdivdp(__a, __b); 3823 } 3824 3825 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, 3826 vector float __b) { 3827 return __builtin_vsx_xvtdivsp(__a, __b); 3828 } 3829 #endif 3830 3831 /* vec_dss */ 3832 3833 #define vec_dss __builtin_altivec_dss 3834 3835 /* vec_dssall */ 3836 3837 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3838 __builtin_altivec_dssall(); 3839 } 3840 3841 /* vec_dst */ 3842 #define vec_dst(__PTR, __CW, __STR) \ 3843 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) 3844 3845 /* vec_dstst */ 3846 #define vec_dstst(__PTR, __CW, __STR) \ 3847 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) 3848 3849 /* vec_dststt */ 3850 #define vec_dststt(__PTR, __CW, __STR) \ 3851 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) 3852 3853 /* vec_dstt */ 3854 #define vec_dstt(__PTR, __CW, __STR) \ 3855 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) 3856 3857 /* vec_eqv */ 3858 3859 #ifdef __POWER8_VECTOR__ 3860 static __inline__ vector signed char __ATTRS_o_ai 3861 vec_eqv(vector signed char __a, vector signed char __b) { 3862 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3863 (vector unsigned int)__b); 3864 } 3865 3866 static __inline__ vector unsigned char __ATTRS_o_ai 3867 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3868 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3869 (vector unsigned int)__b); 3870 } 3871 3872 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3873 vector bool char __b) { 3874 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3875 (vector unsigned int)__b); 3876 } 3877 3878 static __inline__ vector signed short __ATTRS_o_ai 3879 vec_eqv(vector signed short __a, vector signed short __b) { 3880 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3881 (vector unsigned int)__b); 3882 } 3883 3884 static __inline__ vector unsigned short __ATTRS_o_ai 3885 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3886 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3887 (vector unsigned int)__b); 3888 } 3889 3890 static __inline__ vector bool short __ATTRS_o_ai 3891 vec_eqv(vector bool short __a, vector bool short __b) { 3892 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3893 (vector unsigned int)__b); 3894 } 3895 3896 static __inline__ vector signed int __ATTRS_o_ai 3897 vec_eqv(vector signed int __a, vector signed int __b) { 3898 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3899 (vector unsigned int)__b); 3900 } 3901 3902 static __inline__ vector unsigned int __ATTRS_o_ai 3903 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3904 return __builtin_vsx_xxleqv(__a, __b); 3905 } 3906 3907 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3908 vector bool int __b) { 3909 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3910 (vector unsigned int)__b); 3911 } 3912 3913 static __inline__ vector signed long long __ATTRS_o_ai 3914 vec_eqv(vector signed long long __a, vector signed long long __b) { 3915 return (vector signed long long)__builtin_vsx_xxleqv( 3916 (vector unsigned int)__a, (vector unsigned int)__b); 3917 } 3918 3919 static __inline__ vector unsigned long long __ATTRS_o_ai 3920 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3921 return (vector unsigned long long)__builtin_vsx_xxleqv( 3922 (vector unsigned int)__a, (vector unsigned int)__b); 3923 } 3924 3925 static __inline__ vector bool long long __ATTRS_o_ai 3926 vec_eqv(vector bool long long __a, vector bool long long __b) { 3927 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3928 (vector unsigned int)__b); 3929 } 3930 3931 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3932 vector float __b) { 3933 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3934 (vector unsigned int)__b); 3935 } 3936 3937 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3938 vector double __b) { 3939 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3940 (vector unsigned int)__b); 3941 } 3942 #endif 3943 3944 /* vec_expte */ 3945 3946 static __inline__ vector float __attribute__((__always_inline__)) 3947 vec_expte(vector float __a) { 3948 return __builtin_altivec_vexptefp(__a); 3949 } 3950 3951 /* vec_vexptefp */ 3952 3953 static __inline__ vector float __attribute__((__always_inline__)) 3954 vec_vexptefp(vector float __a) { 3955 return __builtin_altivec_vexptefp(__a); 3956 } 3957 3958 /* vec_floor */ 3959 3960 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 3961 #ifdef __VSX__ 3962 return __builtin_vsx_xvrspim(__a); 3963 #else 3964 return __builtin_altivec_vrfim(__a); 3965 #endif 3966 } 3967 3968 #ifdef __VSX__ 3969 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 3970 return __builtin_vsx_xvrdpim(__a); 3971 } 3972 #endif 3973 3974 /* vec_roundm */ 3975 static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { 3976 return vec_floor(__a); 3977 } 3978 3979 #ifdef __VSX__ 3980 static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { 3981 return vec_floor(__a); 3982 } 3983 #endif 3984 3985 /* vec_vrfim */ 3986 3987 static __inline__ vector float __attribute__((__always_inline__)) 3988 vec_vrfim(vector float __a) { 3989 return __builtin_altivec_vrfim(__a); 3990 } 3991 3992 /* vec_ld */ 3993 3994 static __inline__ vector signed char __ATTRS_o_ai 3995 vec_ld(int __a, const vector signed char *__b) { 3996 return (vector signed char)__builtin_altivec_lvx(__a, __b); 3997 } 3998 3999 static __inline__ vector signed char __ATTRS_o_ai 4000 vec_ld(int __a, const signed char *__b) { 4001 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4002 } 4003 4004 static __inline__ vector unsigned char __ATTRS_o_ai 4005 vec_ld(int __a, const vector unsigned char *__b) { 4006 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4007 } 4008 4009 static __inline__ vector unsigned char __ATTRS_o_ai 4010 vec_ld(int __a, const unsigned char *__b) { 4011 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4012 } 4013 4014 static __inline__ vector bool char __ATTRS_o_ai 4015 vec_ld(int __a, const vector bool char *__b) { 4016 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4017 } 4018 4019 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, 4020 const vector short *__b) { 4021 return (vector short)__builtin_altivec_lvx(__a, __b); 4022 } 4023 4024 static __inline__ vector short __ATTRS_o_ai vec_ld(int __a, const short *__b) { 4025 return (vector short)__builtin_altivec_lvx(__a, __b); 4026 } 4027 4028 static __inline__ vector unsigned short __ATTRS_o_ai 4029 vec_ld(int __a, const vector unsigned short *__b) { 4030 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4031 } 4032 4033 static __inline__ vector unsigned short __ATTRS_o_ai 4034 vec_ld(int __a, const unsigned short *__b) { 4035 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4036 } 4037 4038 static __inline__ vector bool short __ATTRS_o_ai 4039 vec_ld(int __a, const vector bool short *__b) { 4040 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4041 } 4042 4043 static __inline__ vector pixel __ATTRS_o_ai vec_ld(int __a, 4044 const vector pixel *__b) { 4045 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4046 } 4047 4048 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, 4049 const vector int *__b) { 4050 return (vector int)__builtin_altivec_lvx(__a, __b); 4051 } 4052 4053 static __inline__ vector int __ATTRS_o_ai vec_ld(int __a, const int *__b) { 4054 return (vector int)__builtin_altivec_lvx(__a, __b); 4055 } 4056 4057 static __inline__ vector unsigned int __ATTRS_o_ai 4058 vec_ld(int __a, const vector unsigned int *__b) { 4059 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4060 } 4061 4062 static __inline__ vector unsigned int __ATTRS_o_ai 4063 vec_ld(int __a, const unsigned int *__b) { 4064 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4065 } 4066 4067 static __inline__ vector bool int __ATTRS_o_ai 4068 vec_ld(int __a, const vector bool int *__b) { 4069 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4070 } 4071 4072 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, 4073 const vector float *__b) { 4074 return (vector float)__builtin_altivec_lvx(__a, __b); 4075 } 4076 4077 static __inline__ vector float __ATTRS_o_ai vec_ld(int __a, const float *__b) { 4078 return (vector float)__builtin_altivec_lvx(__a, __b); 4079 } 4080 4081 /* vec_lvx */ 4082 4083 static __inline__ vector signed char __ATTRS_o_ai 4084 vec_lvx(int __a, const vector signed char *__b) { 4085 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4086 } 4087 4088 static __inline__ vector signed char __ATTRS_o_ai 4089 vec_lvx(int __a, const signed char *__b) { 4090 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4091 } 4092 4093 static __inline__ vector unsigned char __ATTRS_o_ai 4094 vec_lvx(int __a, const vector unsigned char *__b) { 4095 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4096 } 4097 4098 static __inline__ vector unsigned char __ATTRS_o_ai 4099 vec_lvx(int __a, const unsigned char *__b) { 4100 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4101 } 4102 4103 static __inline__ vector bool char __ATTRS_o_ai 4104 vec_lvx(int __a, const vector bool char *__b) { 4105 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4106 } 4107 4108 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, 4109 const vector short *__b) { 4110 return (vector short)__builtin_altivec_lvx(__a, __b); 4111 } 4112 4113 static __inline__ vector short __ATTRS_o_ai vec_lvx(int __a, const short *__b) { 4114 return (vector short)__builtin_altivec_lvx(__a, __b); 4115 } 4116 4117 static __inline__ vector unsigned short __ATTRS_o_ai 4118 vec_lvx(int __a, const vector unsigned short *__b) { 4119 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4120 } 4121 4122 static __inline__ vector unsigned short __ATTRS_o_ai 4123 vec_lvx(int __a, const unsigned short *__b) { 4124 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4125 } 4126 4127 static __inline__ vector bool short __ATTRS_o_ai 4128 vec_lvx(int __a, const vector bool short *__b) { 4129 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4130 } 4131 4132 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(int __a, 4133 const vector pixel *__b) { 4134 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4135 } 4136 4137 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, 4138 const vector int *__b) { 4139 return (vector int)__builtin_altivec_lvx(__a, __b); 4140 } 4141 4142 static __inline__ vector int __ATTRS_o_ai vec_lvx(int __a, const int *__b) { 4143 return (vector int)__builtin_altivec_lvx(__a, __b); 4144 } 4145 4146 static __inline__ vector unsigned int __ATTRS_o_ai 4147 vec_lvx(int __a, const vector unsigned int *__b) { 4148 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4149 } 4150 4151 static __inline__ vector unsigned int __ATTRS_o_ai 4152 vec_lvx(int __a, const unsigned int *__b) { 4153 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4154 } 4155 4156 static __inline__ vector bool int __ATTRS_o_ai 4157 vec_lvx(int __a, const vector bool int *__b) { 4158 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4159 } 4160 4161 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, 4162 const vector float *__b) { 4163 return (vector float)__builtin_altivec_lvx(__a, __b); 4164 } 4165 4166 static __inline__ vector float __ATTRS_o_ai vec_lvx(int __a, const float *__b) { 4167 return (vector float)__builtin_altivec_lvx(__a, __b); 4168 } 4169 4170 /* vec_lde */ 4171 4172 static __inline__ vector signed char __ATTRS_o_ai 4173 vec_lde(int __a, const signed char *__b) { 4174 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4175 } 4176 4177 static __inline__ vector unsigned char __ATTRS_o_ai 4178 vec_lde(int __a, const unsigned char *__b) { 4179 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4180 } 4181 4182 static __inline__ vector short __ATTRS_o_ai vec_lde(int __a, const short *__b) { 4183 return (vector short)__builtin_altivec_lvehx(__a, __b); 4184 } 4185 4186 static __inline__ vector unsigned short __ATTRS_o_ai 4187 vec_lde(int __a, const unsigned short *__b) { 4188 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4189 } 4190 4191 static __inline__ vector int __ATTRS_o_ai vec_lde(int __a, const int *__b) { 4192 return (vector int)__builtin_altivec_lvewx(__a, __b); 4193 } 4194 4195 static __inline__ vector unsigned int __ATTRS_o_ai 4196 vec_lde(int __a, const unsigned int *__b) { 4197 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4198 } 4199 4200 static __inline__ vector float __ATTRS_o_ai vec_lde(int __a, const float *__b) { 4201 return (vector float)__builtin_altivec_lvewx(__a, __b); 4202 } 4203 4204 /* vec_lvebx */ 4205 4206 static __inline__ vector signed char __ATTRS_o_ai 4207 vec_lvebx(int __a, const signed char *__b) { 4208 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4209 } 4210 4211 static __inline__ vector unsigned char __ATTRS_o_ai 4212 vec_lvebx(int __a, const unsigned char *__b) { 4213 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4214 } 4215 4216 /* vec_lvehx */ 4217 4218 static __inline__ vector short __ATTRS_o_ai vec_lvehx(int __a, 4219 const short *__b) { 4220 return (vector short)__builtin_altivec_lvehx(__a, __b); 4221 } 4222 4223 static __inline__ vector unsigned short __ATTRS_o_ai 4224 vec_lvehx(int __a, const unsigned short *__b) { 4225 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4226 } 4227 4228 /* vec_lvewx */ 4229 4230 static __inline__ vector int __ATTRS_o_ai vec_lvewx(int __a, const int *__b) { 4231 return (vector int)__builtin_altivec_lvewx(__a, __b); 4232 } 4233 4234 static __inline__ vector unsigned int __ATTRS_o_ai 4235 vec_lvewx(int __a, const unsigned int *__b) { 4236 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4237 } 4238 4239 static __inline__ vector float __ATTRS_o_ai vec_lvewx(int __a, 4240 const float *__b) { 4241 return (vector float)__builtin_altivec_lvewx(__a, __b); 4242 } 4243 4244 /* vec_ldl */ 4245 4246 static __inline__ vector signed char __ATTRS_o_ai 4247 vec_ldl(int __a, const vector signed char *__b) { 4248 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4249 } 4250 4251 static __inline__ vector signed char __ATTRS_o_ai 4252 vec_ldl(int __a, const signed char *__b) { 4253 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4254 } 4255 4256 static __inline__ vector unsigned char __ATTRS_o_ai 4257 vec_ldl(int __a, const vector unsigned char *__b) { 4258 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4259 } 4260 4261 static __inline__ vector unsigned char __ATTRS_o_ai 4262 vec_ldl(int __a, const unsigned char *__b) { 4263 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4264 } 4265 4266 static __inline__ vector bool char __ATTRS_o_ai 4267 vec_ldl(int __a, const vector bool char *__b) { 4268 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4269 } 4270 4271 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, 4272 const vector short *__b) { 4273 return (vector short)__builtin_altivec_lvxl(__a, __b); 4274 } 4275 4276 static __inline__ vector short __ATTRS_o_ai vec_ldl(int __a, const short *__b) { 4277 return (vector short)__builtin_altivec_lvxl(__a, __b); 4278 } 4279 4280 static __inline__ vector unsigned short __ATTRS_o_ai 4281 vec_ldl(int __a, const vector unsigned short *__b) { 4282 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4283 } 4284 4285 static __inline__ vector unsigned short __ATTRS_o_ai 4286 vec_ldl(int __a, const unsigned short *__b) { 4287 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4288 } 4289 4290 static __inline__ vector bool short __ATTRS_o_ai 4291 vec_ldl(int __a, const vector bool short *__b) { 4292 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4293 } 4294 4295 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(int __a, 4296 const vector pixel *__b) { 4297 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 4298 } 4299 4300 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, 4301 const vector int *__b) { 4302 return (vector int)__builtin_altivec_lvxl(__a, __b); 4303 } 4304 4305 static __inline__ vector int __ATTRS_o_ai vec_ldl(int __a, const int *__b) { 4306 return (vector int)__builtin_altivec_lvxl(__a, __b); 4307 } 4308 4309 static __inline__ vector unsigned int __ATTRS_o_ai 4310 vec_ldl(int __a, const vector unsigned int *__b) { 4311 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4312 } 4313 4314 static __inline__ vector unsigned int __ATTRS_o_ai 4315 vec_ldl(int __a, const unsigned int *__b) { 4316 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4317 } 4318 4319 static __inline__ vector bool int __ATTRS_o_ai 4320 vec_ldl(int __a, const vector bool int *__b) { 4321 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4322 } 4323 4324 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, 4325 const vector float *__b) { 4326 return (vector float)__builtin_altivec_lvxl(__a, __b); 4327 } 4328 4329 static __inline__ vector float __ATTRS_o_ai vec_ldl(int __a, const float *__b) { 4330 return (vector float)__builtin_altivec_lvxl(__a, __b); 4331 } 4332 4333 /* vec_lvxl */ 4334 4335 static __inline__ vector signed char __ATTRS_o_ai 4336 vec_lvxl(int __a, const vector signed char *__b) { 4337 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4338 } 4339 4340 static __inline__ vector signed char __ATTRS_o_ai 4341 vec_lvxl(int __a, const signed char *__b) { 4342 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4343 } 4344 4345 static __inline__ vector unsigned char __ATTRS_o_ai 4346 vec_lvxl(int __a, const vector unsigned char *__b) { 4347 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4348 } 4349 4350 static __inline__ vector unsigned char __ATTRS_o_ai 4351 vec_lvxl(int __a, const unsigned char *__b) { 4352 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4353 } 4354 4355 static __inline__ vector bool char __ATTRS_o_ai 4356 vec_lvxl(int __a, const vector bool char *__b) { 4357 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4358 } 4359 4360 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 4361 const vector short *__b) { 4362 return (vector short)__builtin_altivec_lvxl(__a, __b); 4363 } 4364 4365 static __inline__ vector short __ATTRS_o_ai vec_lvxl(int __a, 4366 const short *__b) { 4367 return (vector short)__builtin_altivec_lvxl(__a, __b); 4368 } 4369 4370 static __inline__ vector unsigned short __ATTRS_o_ai 4371 vec_lvxl(int __a, const vector unsigned short *__b) { 4372 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4373 } 4374 4375 static __inline__ vector unsigned short __ATTRS_o_ai 4376 vec_lvxl(int __a, const unsigned short *__b) { 4377 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4378 } 4379 4380 static __inline__ vector bool short __ATTRS_o_ai 4381 vec_lvxl(int __a, const vector bool short *__b) { 4382 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4383 } 4384 4385 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(int __a, 4386 const vector pixel *__b) { 4387 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 4388 } 4389 4390 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, 4391 const vector int *__b) { 4392 return (vector int)__builtin_altivec_lvxl(__a, __b); 4393 } 4394 4395 static __inline__ vector int __ATTRS_o_ai vec_lvxl(int __a, const int *__b) { 4396 return (vector int)__builtin_altivec_lvxl(__a, __b); 4397 } 4398 4399 static __inline__ vector unsigned int __ATTRS_o_ai 4400 vec_lvxl(int __a, const vector unsigned int *__b) { 4401 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4402 } 4403 4404 static __inline__ vector unsigned int __ATTRS_o_ai 4405 vec_lvxl(int __a, const unsigned int *__b) { 4406 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4407 } 4408 4409 static __inline__ vector bool int __ATTRS_o_ai 4410 vec_lvxl(int __a, const vector bool int *__b) { 4411 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4412 } 4413 4414 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 4415 const vector float *__b) { 4416 return (vector float)__builtin_altivec_lvxl(__a, __b); 4417 } 4418 4419 static __inline__ vector float __ATTRS_o_ai vec_lvxl(int __a, 4420 const float *__b) { 4421 return (vector float)__builtin_altivec_lvxl(__a, __b); 4422 } 4423 4424 /* vec_loge */ 4425 4426 static __inline__ vector float __attribute__((__always_inline__)) 4427 vec_loge(vector float __a) { 4428 return __builtin_altivec_vlogefp(__a); 4429 } 4430 4431 /* vec_vlogefp */ 4432 4433 static __inline__ vector float __attribute__((__always_inline__)) 4434 vec_vlogefp(vector float __a) { 4435 return __builtin_altivec_vlogefp(__a); 4436 } 4437 4438 /* vec_lvsl */ 4439 4440 #ifdef __LITTLE_ENDIAN__ 4441 static __inline__ vector unsigned char __ATTRS_o_ai 4442 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4443 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 4444 vector unsigned char mask = 4445 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4446 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4447 7, 6, 5, 4, 3, 2, 1, 0}; 4448 return vec_perm(mask, mask, reverse); 4449 } 4450 #else 4451 static __inline__ vector unsigned char __ATTRS_o_ai 4452 vec_lvsl(int __a, const signed char *__b) { 4453 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4454 } 4455 #endif 4456 4457 #ifdef __LITTLE_ENDIAN__ 4458 static __inline__ vector unsigned char __ATTRS_o_ai 4459 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4460 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 4461 vector unsigned char mask = 4462 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4463 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4464 7, 6, 5, 4, 3, 2, 1, 0}; 4465 return vec_perm(mask, mask, reverse); 4466 } 4467 #else 4468 static __inline__ vector unsigned char __ATTRS_o_ai 4469 vec_lvsl(int __a, const unsigned char *__b) { 4470 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4471 } 4472 #endif 4473 4474 #ifdef __LITTLE_ENDIAN__ 4475 static __inline__ vector unsigned char __ATTRS_o_ai 4476 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4477 loads/stores"))) vec_lvsl(int __a, const short *__b) { 4478 vector unsigned char mask = 4479 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4480 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4481 7, 6, 5, 4, 3, 2, 1, 0}; 4482 return vec_perm(mask, mask, reverse); 4483 } 4484 #else 4485 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4486 const short *__b) { 4487 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4488 } 4489 #endif 4490 4491 #ifdef __LITTLE_ENDIAN__ 4492 static __inline__ vector unsigned char __ATTRS_o_ai 4493 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4494 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4495 vector unsigned char mask = 4496 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4497 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4498 7, 6, 5, 4, 3, 2, 1, 0}; 4499 return vec_perm(mask, mask, reverse); 4500 } 4501 #else 4502 static __inline__ vector unsigned char __ATTRS_o_ai 4503 vec_lvsl(int __a, const unsigned short *__b) { 4504 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4505 } 4506 #endif 4507 4508 #ifdef __LITTLE_ENDIAN__ 4509 static __inline__ vector unsigned char __ATTRS_o_ai 4510 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4511 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4512 vector unsigned char mask = 4513 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4514 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4515 7, 6, 5, 4, 3, 2, 1, 0}; 4516 return vec_perm(mask, mask, reverse); 4517 } 4518 #else 4519 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4520 const int *__b) { 4521 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4522 } 4523 #endif 4524 4525 #ifdef __LITTLE_ENDIAN__ 4526 static __inline__ vector unsigned char __ATTRS_o_ai 4527 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4528 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4529 vector unsigned char mask = 4530 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4531 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4532 7, 6, 5, 4, 3, 2, 1, 0}; 4533 return vec_perm(mask, mask, reverse); 4534 } 4535 #else 4536 static __inline__ vector unsigned char __ATTRS_o_ai 4537 vec_lvsl(int __a, const unsigned int *__b) { 4538 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4539 } 4540 #endif 4541 4542 #ifdef __LITTLE_ENDIAN__ 4543 static __inline__ vector unsigned char __ATTRS_o_ai 4544 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4545 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4546 vector unsigned char mask = 4547 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4548 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4549 7, 6, 5, 4, 3, 2, 1, 0}; 4550 return vec_perm(mask, mask, reverse); 4551 } 4552 #else 4553 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4554 const float *__b) { 4555 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4556 } 4557 #endif 4558 4559 /* vec_lvsr */ 4560 4561 #ifdef __LITTLE_ENDIAN__ 4562 static __inline__ vector unsigned char __ATTRS_o_ai 4563 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4564 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4565 vector unsigned char mask = 4566 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4567 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4568 7, 6, 5, 4, 3, 2, 1, 0}; 4569 return vec_perm(mask, mask, reverse); 4570 } 4571 #else 4572 static __inline__ vector unsigned char __ATTRS_o_ai 4573 vec_lvsr(int __a, const signed char *__b) { 4574 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4575 } 4576 #endif 4577 4578 #ifdef __LITTLE_ENDIAN__ 4579 static __inline__ vector unsigned char __ATTRS_o_ai 4580 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4581 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4582 vector unsigned char mask = 4583 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4584 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4585 7, 6, 5, 4, 3, 2, 1, 0}; 4586 return vec_perm(mask, mask, reverse); 4587 } 4588 #else 4589 static __inline__ vector unsigned char __ATTRS_o_ai 4590 vec_lvsr(int __a, const unsigned char *__b) { 4591 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4592 } 4593 #endif 4594 4595 #ifdef __LITTLE_ENDIAN__ 4596 static __inline__ vector unsigned char __ATTRS_o_ai 4597 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4598 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4599 vector unsigned char mask = 4600 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4601 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4602 7, 6, 5, 4, 3, 2, 1, 0}; 4603 return vec_perm(mask, mask, reverse); 4604 } 4605 #else 4606 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4607 const short *__b) { 4608 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4609 } 4610 #endif 4611 4612 #ifdef __LITTLE_ENDIAN__ 4613 static __inline__ vector unsigned char __ATTRS_o_ai 4614 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4615 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4616 vector unsigned char mask = 4617 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4618 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4619 7, 6, 5, 4, 3, 2, 1, 0}; 4620 return vec_perm(mask, mask, reverse); 4621 } 4622 #else 4623 static __inline__ vector unsigned char __ATTRS_o_ai 4624 vec_lvsr(int __a, const unsigned short *__b) { 4625 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4626 } 4627 #endif 4628 4629 #ifdef __LITTLE_ENDIAN__ 4630 static __inline__ vector unsigned char __ATTRS_o_ai 4631 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4632 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4633 vector unsigned char mask = 4634 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4635 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4636 7, 6, 5, 4, 3, 2, 1, 0}; 4637 return vec_perm(mask, mask, reverse); 4638 } 4639 #else 4640 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4641 const int *__b) { 4642 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4643 } 4644 #endif 4645 4646 #ifdef __LITTLE_ENDIAN__ 4647 static __inline__ vector unsigned char __ATTRS_o_ai 4648 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4649 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4650 vector unsigned char mask = 4651 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4652 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4653 7, 6, 5, 4, 3, 2, 1, 0}; 4654 return vec_perm(mask, mask, reverse); 4655 } 4656 #else 4657 static __inline__ vector unsigned char __ATTRS_o_ai 4658 vec_lvsr(int __a, const unsigned int *__b) { 4659 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4660 } 4661 #endif 4662 4663 #ifdef __LITTLE_ENDIAN__ 4664 static __inline__ vector unsigned char __ATTRS_o_ai 4665 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4666 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4667 vector unsigned char mask = 4668 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4669 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4670 7, 6, 5, 4, 3, 2, 1, 0}; 4671 return vec_perm(mask, mask, reverse); 4672 } 4673 #else 4674 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4675 const float *__b) { 4676 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4677 } 4678 #endif 4679 4680 /* vec_madd */ 4681 static __inline__ vector signed short __ATTRS_o_ai 4682 vec_mladd(vector signed short, vector signed short, vector signed short); 4683 static __inline__ vector signed short __ATTRS_o_ai 4684 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4685 static __inline__ vector signed short __ATTRS_o_ai 4686 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4687 static __inline__ vector unsigned short __ATTRS_o_ai 4688 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4689 4690 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4691 vector signed short __a, vector signed short __b, vector signed short __c) { 4692 return vec_mladd(__a, __b, __c); 4693 } 4694 4695 static __inline__ vector signed short __ATTRS_o_ai 4696 vec_madd(vector signed short __a, vector unsigned short __b, 4697 vector unsigned short __c) { 4698 return vec_mladd(__a, __b, __c); 4699 } 4700 4701 static __inline__ vector signed short __ATTRS_o_ai 4702 vec_madd(vector unsigned short __a, vector signed short __b, 4703 vector signed short __c) { 4704 return vec_mladd(__a, __b, __c); 4705 } 4706 4707 static __inline__ vector unsigned short __ATTRS_o_ai 4708 vec_madd(vector unsigned short __a, vector unsigned short __b, 4709 vector unsigned short __c) { 4710 return vec_mladd(__a, __b, __c); 4711 } 4712 4713 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4714 vector float __b, 4715 vector float __c) { 4716 #ifdef __VSX__ 4717 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4718 #else 4719 return __builtin_altivec_vmaddfp(__a, __b, __c); 4720 #endif 4721 } 4722 4723 #ifdef __VSX__ 4724 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4725 vector double __b, 4726 vector double __c) { 4727 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4728 } 4729 #endif 4730 4731 /* vec_vmaddfp */ 4732 4733 static __inline__ vector float __attribute__((__always_inline__)) 4734 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4735 return __builtin_altivec_vmaddfp(__a, __b, __c); 4736 } 4737 4738 /* vec_madds */ 4739 4740 static __inline__ vector signed short __attribute__((__always_inline__)) 4741 vec_madds(vector signed short __a, vector signed short __b, 4742 vector signed short __c) { 4743 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4744 } 4745 4746 /* vec_vmhaddshs */ 4747 static __inline__ vector signed short __attribute__((__always_inline__)) 4748 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4749 vector signed short __c) { 4750 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4751 } 4752 4753 /* vec_msub */ 4754 4755 #ifdef __VSX__ 4756 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4757 vector float __b, 4758 vector float __c) { 4759 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4760 } 4761 4762 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4763 vector double __b, 4764 vector double __c) { 4765 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4766 } 4767 #endif 4768 4769 /* vec_max */ 4770 4771 static __inline__ vector signed char __ATTRS_o_ai 4772 vec_max(vector signed char __a, vector signed char __b) { 4773 return __builtin_altivec_vmaxsb(__a, __b); 4774 } 4775 4776 static __inline__ vector signed char __ATTRS_o_ai 4777 vec_max(vector bool char __a, vector signed char __b) { 4778 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4779 } 4780 4781 static __inline__ vector signed char __ATTRS_o_ai 4782 vec_max(vector signed char __a, vector bool char __b) { 4783 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4784 } 4785 4786 static __inline__ vector unsigned char __ATTRS_o_ai 4787 vec_max(vector unsigned char __a, vector unsigned char __b) { 4788 return __builtin_altivec_vmaxub(__a, __b); 4789 } 4790 4791 static __inline__ vector unsigned char __ATTRS_o_ai 4792 vec_max(vector bool char __a, vector unsigned char __b) { 4793 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4794 } 4795 4796 static __inline__ vector unsigned char __ATTRS_o_ai 4797 vec_max(vector unsigned char __a, vector bool char __b) { 4798 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4799 } 4800 4801 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4802 vector short __b) { 4803 return __builtin_altivec_vmaxsh(__a, __b); 4804 } 4805 4806 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4807 vector short __b) { 4808 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4809 } 4810 4811 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4812 vector bool short __b) { 4813 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4814 } 4815 4816 static __inline__ vector unsigned short __ATTRS_o_ai 4817 vec_max(vector unsigned short __a, vector unsigned short __b) { 4818 return __builtin_altivec_vmaxuh(__a, __b); 4819 } 4820 4821 static __inline__ vector unsigned short __ATTRS_o_ai 4822 vec_max(vector bool short __a, vector unsigned short __b) { 4823 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4824 } 4825 4826 static __inline__ vector unsigned short __ATTRS_o_ai 4827 vec_max(vector unsigned short __a, vector bool short __b) { 4828 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4829 } 4830 4831 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4832 vector int __b) { 4833 return __builtin_altivec_vmaxsw(__a, __b); 4834 } 4835 4836 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4837 vector int __b) { 4838 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4839 } 4840 4841 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4842 vector bool int __b) { 4843 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4844 } 4845 4846 static __inline__ vector unsigned int __ATTRS_o_ai 4847 vec_max(vector unsigned int __a, vector unsigned int __b) { 4848 return __builtin_altivec_vmaxuw(__a, __b); 4849 } 4850 4851 static __inline__ vector unsigned int __ATTRS_o_ai 4852 vec_max(vector bool int __a, vector unsigned int __b) { 4853 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4854 } 4855 4856 static __inline__ vector unsigned int __ATTRS_o_ai 4857 vec_max(vector unsigned int __a, vector bool int __b) { 4858 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4859 } 4860 4861 #ifdef __POWER8_VECTOR__ 4862 static __inline__ vector signed long long __ATTRS_o_ai 4863 vec_max(vector signed long long __a, vector signed long long __b) { 4864 return __builtin_altivec_vmaxsd(__a, __b); 4865 } 4866 4867 static __inline__ vector signed long long __ATTRS_o_ai 4868 vec_max(vector bool long long __a, vector signed long long __b) { 4869 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4870 } 4871 4872 static __inline__ vector signed long long __ATTRS_o_ai 4873 vec_max(vector signed long long __a, vector bool long long __b) { 4874 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4875 } 4876 4877 static __inline__ vector unsigned long long __ATTRS_o_ai 4878 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4879 return __builtin_altivec_vmaxud(__a, __b); 4880 } 4881 4882 static __inline__ vector unsigned long long __ATTRS_o_ai 4883 vec_max(vector bool long long __a, vector unsigned long long __b) { 4884 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4885 } 4886 4887 static __inline__ vector unsigned long long __ATTRS_o_ai 4888 vec_max(vector unsigned long long __a, vector bool long long __b) { 4889 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4890 } 4891 #endif 4892 4893 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4894 vector float __b) { 4895 #ifdef __VSX__ 4896 return __builtin_vsx_xvmaxsp(__a, __b); 4897 #else 4898 return __builtin_altivec_vmaxfp(__a, __b); 4899 #endif 4900 } 4901 4902 #ifdef __VSX__ 4903 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4904 vector double __b) { 4905 return __builtin_vsx_xvmaxdp(__a, __b); 4906 } 4907 #endif 4908 4909 /* vec_vmaxsb */ 4910 4911 static __inline__ vector signed char __ATTRS_o_ai 4912 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4913 return __builtin_altivec_vmaxsb(__a, __b); 4914 } 4915 4916 static __inline__ vector signed char __ATTRS_o_ai 4917 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4918 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4919 } 4920 4921 static __inline__ vector signed char __ATTRS_o_ai 4922 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4923 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4924 } 4925 4926 /* vec_vmaxub */ 4927 4928 static __inline__ vector unsigned char __ATTRS_o_ai 4929 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4930 return __builtin_altivec_vmaxub(__a, __b); 4931 } 4932 4933 static __inline__ vector unsigned char __ATTRS_o_ai 4934 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4935 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4936 } 4937 4938 static __inline__ vector unsigned char __ATTRS_o_ai 4939 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4940 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4941 } 4942 4943 /* vec_vmaxsh */ 4944 4945 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4946 vector short __b) { 4947 return __builtin_altivec_vmaxsh(__a, __b); 4948 } 4949 4950 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 4951 vector short __b) { 4952 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4953 } 4954 4955 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4956 vector bool short __b) { 4957 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4958 } 4959 4960 /* vec_vmaxuh */ 4961 4962 static __inline__ vector unsigned short __ATTRS_o_ai 4963 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 4964 return __builtin_altivec_vmaxuh(__a, __b); 4965 } 4966 4967 static __inline__ vector unsigned short __ATTRS_o_ai 4968 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 4969 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4970 } 4971 4972 static __inline__ vector unsigned short __ATTRS_o_ai 4973 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 4974 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4975 } 4976 4977 /* vec_vmaxsw */ 4978 4979 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4980 vector int __b) { 4981 return __builtin_altivec_vmaxsw(__a, __b); 4982 } 4983 4984 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 4985 vector int __b) { 4986 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4987 } 4988 4989 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 4990 vector bool int __b) { 4991 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4992 } 4993 4994 /* vec_vmaxuw */ 4995 4996 static __inline__ vector unsigned int __ATTRS_o_ai 4997 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 4998 return __builtin_altivec_vmaxuw(__a, __b); 4999 } 5000 5001 static __inline__ vector unsigned int __ATTRS_o_ai 5002 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 5003 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 5004 } 5005 5006 static __inline__ vector unsigned int __ATTRS_o_ai 5007 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 5008 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 5009 } 5010 5011 /* vec_vmaxfp */ 5012 5013 static __inline__ vector float __attribute__((__always_inline__)) 5014 vec_vmaxfp(vector float __a, vector float __b) { 5015 #ifdef __VSX__ 5016 return __builtin_vsx_xvmaxsp(__a, __b); 5017 #else 5018 return __builtin_altivec_vmaxfp(__a, __b); 5019 #endif 5020 } 5021 5022 /* vec_mergeh */ 5023 5024 static __inline__ vector signed char __ATTRS_o_ai 5025 vec_mergeh(vector signed char __a, vector signed char __b) { 5026 return vec_perm(__a, __b, 5027 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5028 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5029 0x06, 0x16, 0x07, 0x17)); 5030 } 5031 5032 static __inline__ vector unsigned char __ATTRS_o_ai 5033 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 5034 return vec_perm(__a, __b, 5035 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5036 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5037 0x06, 0x16, 0x07, 0x17)); 5038 } 5039 5040 static __inline__ vector bool char __ATTRS_o_ai 5041 vec_mergeh(vector bool char __a, vector bool char __b) { 5042 return vec_perm(__a, __b, 5043 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5044 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5045 0x06, 0x16, 0x07, 0x17)); 5046 } 5047 5048 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 5049 vector short __b) { 5050 return vec_perm(__a, __b, 5051 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5052 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5053 0x06, 0x07, 0x16, 0x17)); 5054 } 5055 5056 static __inline__ vector unsigned short __ATTRS_o_ai 5057 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 5058 return vec_perm(__a, __b, 5059 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5060 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5061 0x06, 0x07, 0x16, 0x17)); 5062 } 5063 5064 static __inline__ vector bool short __ATTRS_o_ai 5065 vec_mergeh(vector bool short __a, vector bool short __b) { 5066 return vec_perm(__a, __b, 5067 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5068 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5069 0x06, 0x07, 0x16, 0x17)); 5070 } 5071 5072 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 5073 vector pixel __b) { 5074 return vec_perm(__a, __b, 5075 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5076 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5077 0x06, 0x07, 0x16, 0x17)); 5078 } 5079 5080 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 5081 vector int __b) { 5082 return vec_perm(__a, __b, 5083 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5084 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5085 0x14, 0x15, 0x16, 0x17)); 5086 } 5087 5088 static __inline__ vector unsigned int __ATTRS_o_ai 5089 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 5090 return vec_perm(__a, __b, 5091 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5092 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5093 0x14, 0x15, 0x16, 0x17)); 5094 } 5095 5096 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 5097 vector bool int __b) { 5098 return vec_perm(__a, __b, 5099 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5100 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5101 0x14, 0x15, 0x16, 0x17)); 5102 } 5103 5104 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 5105 vector float __b) { 5106 return vec_perm(__a, __b, 5107 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5108 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5109 0x14, 0x15, 0x16, 0x17)); 5110 } 5111 5112 #ifdef __VSX__ 5113 static __inline__ vector signed long long __ATTRS_o_ai 5114 vec_mergeh(vector signed long long __a, vector signed long long __b) { 5115 return vec_perm(__a, __b, 5116 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5117 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5118 0x14, 0x15, 0x16, 0x17)); 5119 } 5120 5121 static __inline__ vector signed long long __ATTRS_o_ai 5122 vec_mergeh(vector signed long long __a, vector bool long long __b) { 5123 return vec_perm(__a, (vector signed long long)__b, 5124 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5125 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5126 0x14, 0x15, 0x16, 0x17)); 5127 } 5128 5129 static __inline__ vector signed long long __ATTRS_o_ai 5130 vec_mergeh(vector bool long long __a, vector signed long long __b) { 5131 return vec_perm((vector signed long long)__a, __b, 5132 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5133 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5134 0x14, 0x15, 0x16, 0x17)); 5135 } 5136 5137 static __inline__ vector unsigned long long __ATTRS_o_ai 5138 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 5139 return vec_perm(__a, __b, 5140 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5141 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5142 0x14, 0x15, 0x16, 0x17)); 5143 } 5144 5145 static __inline__ vector unsigned long long __ATTRS_o_ai 5146 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 5147 return vec_perm(__a, (vector unsigned long long)__b, 5148 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5149 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5150 0x14, 0x15, 0x16, 0x17)); 5151 } 5152 5153 static __inline__ vector unsigned long long __ATTRS_o_ai 5154 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 5155 return vec_perm((vector unsigned long long)__a, __b, 5156 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5157 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5158 0x14, 0x15, 0x16, 0x17)); 5159 } 5160 5161 static __inline__ vector bool long long __ATTRS_o_ai 5162 vec_mergeh(vector bool long long __a, vector bool long long __b) { 5163 return vec_perm(__a, __b, 5164 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5165 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5166 0x14, 0x15, 0x16, 0x17)); 5167 } 5168 5169 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 5170 vector double __b) { 5171 return vec_perm(__a, __b, 5172 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5173 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5174 0x14, 0x15, 0x16, 0x17)); 5175 } 5176 static __inline__ vector double __ATTRS_o_ai 5177 vec_mergeh(vector double __a, vector bool long long __b) { 5178 return vec_perm(__a, (vector double)__b, 5179 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5180 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5181 0x14, 0x15, 0x16, 0x17)); 5182 } 5183 static __inline__ vector double __ATTRS_o_ai 5184 vec_mergeh(vector bool long long __a, vector double __b) { 5185 return vec_perm((vector double)__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 #endif 5191 5192 /* vec_vmrghb */ 5193 5194 #define __builtin_altivec_vmrghb vec_vmrghb 5195 5196 static __inline__ vector signed char __ATTRS_o_ai 5197 vec_vmrghb(vector signed char __a, vector signed char __b) { 5198 return vec_perm(__a, __b, 5199 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5200 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5201 0x06, 0x16, 0x07, 0x17)); 5202 } 5203 5204 static __inline__ vector unsigned char __ATTRS_o_ai 5205 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 5206 return vec_perm(__a, __b, 5207 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5208 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5209 0x06, 0x16, 0x07, 0x17)); 5210 } 5211 5212 static __inline__ vector bool char __ATTRS_o_ai 5213 vec_vmrghb(vector bool char __a, vector bool char __b) { 5214 return vec_perm(__a, __b, 5215 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5216 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5217 0x06, 0x16, 0x07, 0x17)); 5218 } 5219 5220 /* vec_vmrghh */ 5221 5222 #define __builtin_altivec_vmrghh vec_vmrghh 5223 5224 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 5225 vector short __b) { 5226 return vec_perm(__a, __b, 5227 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5228 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5229 0x06, 0x07, 0x16, 0x17)); 5230 } 5231 5232 static __inline__ vector unsigned short __ATTRS_o_ai 5233 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 5234 return vec_perm(__a, __b, 5235 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5236 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5237 0x06, 0x07, 0x16, 0x17)); 5238 } 5239 5240 static __inline__ vector bool short __ATTRS_o_ai 5241 vec_vmrghh(vector bool short __a, vector bool short __b) { 5242 return vec_perm(__a, __b, 5243 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5244 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5245 0x06, 0x07, 0x16, 0x17)); 5246 } 5247 5248 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 5249 vector pixel __b) { 5250 return vec_perm(__a, __b, 5251 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5252 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5253 0x06, 0x07, 0x16, 0x17)); 5254 } 5255 5256 /* vec_vmrghw */ 5257 5258 #define __builtin_altivec_vmrghw vec_vmrghw 5259 5260 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 5261 vector int __b) { 5262 return vec_perm(__a, __b, 5263 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5264 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5265 0x14, 0x15, 0x16, 0x17)); 5266 } 5267 5268 static __inline__ vector unsigned int __ATTRS_o_ai 5269 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 5270 return vec_perm(__a, __b, 5271 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5272 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5273 0x14, 0x15, 0x16, 0x17)); 5274 } 5275 5276 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 5277 vector bool int __b) { 5278 return vec_perm(__a, __b, 5279 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5280 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5281 0x14, 0x15, 0x16, 0x17)); 5282 } 5283 5284 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 5285 vector float __b) { 5286 return vec_perm(__a, __b, 5287 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5288 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5289 0x14, 0x15, 0x16, 0x17)); 5290 } 5291 5292 /* vec_mergel */ 5293 5294 static __inline__ vector signed char __ATTRS_o_ai 5295 vec_mergel(vector signed char __a, vector signed char __b) { 5296 return vec_perm(__a, __b, 5297 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5298 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5299 0x0E, 0x1E, 0x0F, 0x1F)); 5300 } 5301 5302 static __inline__ vector unsigned char __ATTRS_o_ai 5303 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 5304 return vec_perm(__a, __b, 5305 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5306 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5307 0x0E, 0x1E, 0x0F, 0x1F)); 5308 } 5309 5310 static __inline__ vector bool char __ATTRS_o_ai 5311 vec_mergel(vector bool char __a, vector bool char __b) { 5312 return vec_perm(__a, __b, 5313 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5314 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5315 0x0E, 0x1E, 0x0F, 0x1F)); 5316 } 5317 5318 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 5319 vector short __b) { 5320 return vec_perm(__a, __b, 5321 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5322 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5323 0x0E, 0x0F, 0x1E, 0x1F)); 5324 } 5325 5326 static __inline__ vector unsigned short __ATTRS_o_ai 5327 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 5328 return vec_perm(__a, __b, 5329 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5330 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5331 0x0E, 0x0F, 0x1E, 0x1F)); 5332 } 5333 5334 static __inline__ vector bool short __ATTRS_o_ai 5335 vec_mergel(vector bool short __a, vector bool short __b) { 5336 return vec_perm(__a, __b, 5337 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5338 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5339 0x0E, 0x0F, 0x1E, 0x1F)); 5340 } 5341 5342 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 5343 vector pixel __b) { 5344 return vec_perm(__a, __b, 5345 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5346 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5347 0x0E, 0x0F, 0x1E, 0x1F)); 5348 } 5349 5350 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 5351 vector int __b) { 5352 return vec_perm(__a, __b, 5353 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5354 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5355 0x1C, 0x1D, 0x1E, 0x1F)); 5356 } 5357 5358 static __inline__ vector unsigned int __ATTRS_o_ai 5359 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 5360 return vec_perm(__a, __b, 5361 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5362 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5363 0x1C, 0x1D, 0x1E, 0x1F)); 5364 } 5365 5366 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 5367 vector bool int __b) { 5368 return vec_perm(__a, __b, 5369 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5370 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5371 0x1C, 0x1D, 0x1E, 0x1F)); 5372 } 5373 5374 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 5375 vector float __b) { 5376 return vec_perm(__a, __b, 5377 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5378 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5379 0x1C, 0x1D, 0x1E, 0x1F)); 5380 } 5381 5382 #ifdef __VSX__ 5383 static __inline__ vector signed long long __ATTRS_o_ai 5384 vec_mergel(vector signed long long __a, vector signed long long __b) { 5385 return vec_perm(__a, __b, 5386 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5387 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5388 0x1C, 0x1D, 0x1E, 0x1F)); 5389 } 5390 static __inline__ vector signed long long __ATTRS_o_ai 5391 vec_mergel(vector signed long long __a, vector bool long long __b) { 5392 return vec_perm(__a, (vector signed long long)__b, 5393 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5394 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5395 0x1C, 0x1D, 0x1E, 0x1F)); 5396 } 5397 static __inline__ vector signed long long __ATTRS_o_ai 5398 vec_mergel(vector bool long long __a, vector signed long long __b) { 5399 return vec_perm((vector signed long long)__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 unsigned long long __ATTRS_o_ai 5405 vec_mergel(vector unsigned long long __a, vector unsigned long long __b) { 5406 return vec_perm(__a, __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 unsigned long long __ATTRS_o_ai 5412 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 5413 return vec_perm(__a, (vector unsigned long long)__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 bool long long __a, vector unsigned long long __b) { 5420 return vec_perm((vector unsigned long long)__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 bool long long __ATTRS_o_ai 5426 vec_mergel(vector bool long long __a, vector bool long long __b) { 5427 return vec_perm(__a, __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 double __ATTRS_o_ai vec_mergel(vector double __a, 5433 vector double __b) { 5434 return vec_perm(__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 double __ATTRS_o_ai 5440 vec_mergel(vector double __a, vector bool long long __b) { 5441 return vec_perm(__a, (vector double)__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 5447 vec_mergel(vector bool long long __a, vector double __b) { 5448 return vec_perm((vector double)__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 #endif 5454 5455 /* vec_vmrglb */ 5456 5457 #define __builtin_altivec_vmrglb vec_vmrglb 5458 5459 static __inline__ vector signed char __ATTRS_o_ai 5460 vec_vmrglb(vector signed char __a, vector signed char __b) { 5461 return vec_perm(__a, __b, 5462 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5463 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5464 0x0E, 0x1E, 0x0F, 0x1F)); 5465 } 5466 5467 static __inline__ vector unsigned char __ATTRS_o_ai 5468 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 5469 return vec_perm(__a, __b, 5470 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5471 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5472 0x0E, 0x1E, 0x0F, 0x1F)); 5473 } 5474 5475 static __inline__ vector bool char __ATTRS_o_ai 5476 vec_vmrglb(vector bool char __a, vector bool char __b) { 5477 return vec_perm(__a, __b, 5478 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5479 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5480 0x0E, 0x1E, 0x0F, 0x1F)); 5481 } 5482 5483 /* vec_vmrglh */ 5484 5485 #define __builtin_altivec_vmrglh vec_vmrglh 5486 5487 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 5488 vector short __b) { 5489 return vec_perm(__a, __b, 5490 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5491 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5492 0x0E, 0x0F, 0x1E, 0x1F)); 5493 } 5494 5495 static __inline__ vector unsigned short __ATTRS_o_ai 5496 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5497 return vec_perm(__a, __b, 5498 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5499 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5500 0x0E, 0x0F, 0x1E, 0x1F)); 5501 } 5502 5503 static __inline__ vector bool short __ATTRS_o_ai 5504 vec_vmrglh(vector bool short __a, vector bool short __b) { 5505 return vec_perm(__a, __b, 5506 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5507 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5508 0x0E, 0x0F, 0x1E, 0x1F)); 5509 } 5510 5511 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5512 vector pixel __b) { 5513 return vec_perm(__a, __b, 5514 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5515 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5516 0x0E, 0x0F, 0x1E, 0x1F)); 5517 } 5518 5519 /* vec_vmrglw */ 5520 5521 #define __builtin_altivec_vmrglw vec_vmrglw 5522 5523 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5524 vector int __b) { 5525 return vec_perm(__a, __b, 5526 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5527 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5528 0x1C, 0x1D, 0x1E, 0x1F)); 5529 } 5530 5531 static __inline__ vector unsigned int __ATTRS_o_ai 5532 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5533 return vec_perm(__a, __b, 5534 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5535 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5536 0x1C, 0x1D, 0x1E, 0x1F)); 5537 } 5538 5539 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5540 vector bool int __b) { 5541 return vec_perm(__a, __b, 5542 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5543 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5544 0x1C, 0x1D, 0x1E, 0x1F)); 5545 } 5546 5547 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5548 vector float __b) { 5549 return vec_perm(__a, __b, 5550 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5551 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5552 0x1C, 0x1D, 0x1E, 0x1F)); 5553 } 5554 5555 #ifdef __POWER8_VECTOR__ 5556 /* vec_mergee */ 5557 5558 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5559 vector bool int __b) { 5560 return vec_perm(__a, __b, 5561 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5562 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5563 0x18, 0x19, 0x1A, 0x1B)); 5564 } 5565 5566 static __inline__ vector signed int __ATTRS_o_ai 5567 vec_mergee(vector signed int __a, vector signed int __b) { 5568 return vec_perm(__a, __b, 5569 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5570 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5571 0x18, 0x19, 0x1A, 0x1B)); 5572 } 5573 5574 static __inline__ vector unsigned int __ATTRS_o_ai 5575 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5576 return vec_perm(__a, __b, 5577 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5578 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5579 0x18, 0x19, 0x1A, 0x1B)); 5580 } 5581 5582 static __inline__ vector bool long long __ATTRS_o_ai 5583 vec_mergee(vector bool long long __a, vector bool long long __b) { 5584 return vec_mergeh(__a, __b); 5585 } 5586 5587 static __inline__ vector signed long long __ATTRS_o_ai 5588 vec_mergee(vector signed long long __a, vector signed long long __b) { 5589 return vec_mergeh(__a, __b); 5590 } 5591 5592 static __inline__ vector unsigned long long __ATTRS_o_ai 5593 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5594 return vec_mergeh(__a, __b); 5595 } 5596 5597 static __inline__ vector float __ATTRS_o_ai 5598 vec_mergee(vector float __a, vector float __b) { 5599 return vec_perm(__a, __b, 5600 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5601 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5602 0x18, 0x19, 0x1A, 0x1B)); 5603 } 5604 5605 static __inline__ vector double __ATTRS_o_ai 5606 vec_mergee(vector double __a, vector double __b) { 5607 return vec_mergeh(__a, __b); 5608 } 5609 5610 /* vec_mergeo */ 5611 5612 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5613 vector bool int __b) { 5614 return vec_perm(__a, __b, 5615 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5616 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5617 0x1C, 0x1D, 0x1E, 0x1F)); 5618 } 5619 5620 static __inline__ vector signed int __ATTRS_o_ai 5621 vec_mergeo(vector signed int __a, vector signed int __b) { 5622 return vec_perm(__a, __b, 5623 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5624 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5625 0x1C, 0x1D, 0x1E, 0x1F)); 5626 } 5627 5628 static __inline__ vector unsigned int __ATTRS_o_ai 5629 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5630 return vec_perm(__a, __b, 5631 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5632 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5633 0x1C, 0x1D, 0x1E, 0x1F)); 5634 } 5635 5636 static __inline__ vector bool long long __ATTRS_o_ai 5637 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5638 return vec_mergel(__a, __b); 5639 } 5640 5641 static __inline__ vector signed long long __ATTRS_o_ai 5642 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5643 return vec_mergel(__a, __b); 5644 } 5645 5646 static __inline__ vector unsigned long long __ATTRS_o_ai 5647 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5648 return vec_mergel(__a, __b); 5649 } 5650 5651 static __inline__ vector float __ATTRS_o_ai 5652 vec_mergeo(vector float __a, vector float __b) { 5653 return vec_perm(__a, __b, 5654 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5655 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5656 0x1C, 0x1D, 0x1E, 0x1F)); 5657 } 5658 5659 static __inline__ vector double __ATTRS_o_ai 5660 vec_mergeo(vector double __a, vector double __b) { 5661 return vec_mergel(__a, __b); 5662 } 5663 5664 #endif 5665 5666 /* vec_mfvscr */ 5667 5668 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5669 vec_mfvscr(void) { 5670 return __builtin_altivec_mfvscr(); 5671 } 5672 5673 /* vec_min */ 5674 5675 static __inline__ vector signed char __ATTRS_o_ai 5676 vec_min(vector signed char __a, vector signed char __b) { 5677 return __builtin_altivec_vminsb(__a, __b); 5678 } 5679 5680 static __inline__ vector signed char __ATTRS_o_ai 5681 vec_min(vector bool char __a, vector signed char __b) { 5682 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5683 } 5684 5685 static __inline__ vector signed char __ATTRS_o_ai 5686 vec_min(vector signed char __a, vector bool char __b) { 5687 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5688 } 5689 5690 static __inline__ vector unsigned char __ATTRS_o_ai 5691 vec_min(vector unsigned char __a, vector unsigned char __b) { 5692 return __builtin_altivec_vminub(__a, __b); 5693 } 5694 5695 static __inline__ vector unsigned char __ATTRS_o_ai 5696 vec_min(vector bool char __a, vector unsigned char __b) { 5697 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5698 } 5699 5700 static __inline__ vector unsigned char __ATTRS_o_ai 5701 vec_min(vector unsigned char __a, vector bool char __b) { 5702 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5703 } 5704 5705 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5706 vector short __b) { 5707 return __builtin_altivec_vminsh(__a, __b); 5708 } 5709 5710 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5711 vector short __b) { 5712 return __builtin_altivec_vminsh((vector short)__a, __b); 5713 } 5714 5715 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5716 vector bool short __b) { 5717 return __builtin_altivec_vminsh(__a, (vector short)__b); 5718 } 5719 5720 static __inline__ vector unsigned short __ATTRS_o_ai 5721 vec_min(vector unsigned short __a, vector unsigned short __b) { 5722 return __builtin_altivec_vminuh(__a, __b); 5723 } 5724 5725 static __inline__ vector unsigned short __ATTRS_o_ai 5726 vec_min(vector bool short __a, vector unsigned short __b) { 5727 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5728 } 5729 5730 static __inline__ vector unsigned short __ATTRS_o_ai 5731 vec_min(vector unsigned short __a, vector bool short __b) { 5732 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5733 } 5734 5735 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5736 vector int __b) { 5737 return __builtin_altivec_vminsw(__a, __b); 5738 } 5739 5740 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5741 vector int __b) { 5742 return __builtin_altivec_vminsw((vector int)__a, __b); 5743 } 5744 5745 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5746 vector bool int __b) { 5747 return __builtin_altivec_vminsw(__a, (vector int)__b); 5748 } 5749 5750 static __inline__ vector unsigned int __ATTRS_o_ai 5751 vec_min(vector unsigned int __a, vector unsigned int __b) { 5752 return __builtin_altivec_vminuw(__a, __b); 5753 } 5754 5755 static __inline__ vector unsigned int __ATTRS_o_ai 5756 vec_min(vector bool int __a, vector unsigned int __b) { 5757 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5758 } 5759 5760 static __inline__ vector unsigned int __ATTRS_o_ai 5761 vec_min(vector unsigned int __a, vector bool int __b) { 5762 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5763 } 5764 5765 #ifdef __POWER8_VECTOR__ 5766 static __inline__ vector signed long long __ATTRS_o_ai 5767 vec_min(vector signed long long __a, vector signed long long __b) { 5768 return __builtin_altivec_vminsd(__a, __b); 5769 } 5770 5771 static __inline__ vector signed long long __ATTRS_o_ai 5772 vec_min(vector bool long long __a, vector signed long long __b) { 5773 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5774 } 5775 5776 static __inline__ vector signed long long __ATTRS_o_ai 5777 vec_min(vector signed long long __a, vector bool long long __b) { 5778 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5779 } 5780 5781 static __inline__ vector unsigned long long __ATTRS_o_ai 5782 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5783 return __builtin_altivec_vminud(__a, __b); 5784 } 5785 5786 static __inline__ vector unsigned long long __ATTRS_o_ai 5787 vec_min(vector bool long long __a, vector unsigned long long __b) { 5788 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5789 } 5790 5791 static __inline__ vector unsigned long long __ATTRS_o_ai 5792 vec_min(vector unsigned long long __a, vector bool long long __b) { 5793 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5794 } 5795 #endif 5796 5797 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5798 vector float __b) { 5799 #ifdef __VSX__ 5800 return __builtin_vsx_xvminsp(__a, __b); 5801 #else 5802 return __builtin_altivec_vminfp(__a, __b); 5803 #endif 5804 } 5805 5806 #ifdef __VSX__ 5807 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5808 vector double __b) { 5809 return __builtin_vsx_xvmindp(__a, __b); 5810 } 5811 #endif 5812 5813 /* vec_vminsb */ 5814 5815 static __inline__ vector signed char __ATTRS_o_ai 5816 vec_vminsb(vector signed char __a, vector signed char __b) { 5817 return __builtin_altivec_vminsb(__a, __b); 5818 } 5819 5820 static __inline__ vector signed char __ATTRS_o_ai 5821 vec_vminsb(vector bool char __a, vector signed char __b) { 5822 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5823 } 5824 5825 static __inline__ vector signed char __ATTRS_o_ai 5826 vec_vminsb(vector signed char __a, vector bool char __b) { 5827 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5828 } 5829 5830 /* vec_vminub */ 5831 5832 static __inline__ vector unsigned char __ATTRS_o_ai 5833 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5834 return __builtin_altivec_vminub(__a, __b); 5835 } 5836 5837 static __inline__ vector unsigned char __ATTRS_o_ai 5838 vec_vminub(vector bool char __a, vector unsigned char __b) { 5839 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5840 } 5841 5842 static __inline__ vector unsigned char __ATTRS_o_ai 5843 vec_vminub(vector unsigned char __a, vector bool char __b) { 5844 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5845 } 5846 5847 /* vec_vminsh */ 5848 5849 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5850 vector short __b) { 5851 return __builtin_altivec_vminsh(__a, __b); 5852 } 5853 5854 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5855 vector short __b) { 5856 return __builtin_altivec_vminsh((vector short)__a, __b); 5857 } 5858 5859 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5860 vector bool short __b) { 5861 return __builtin_altivec_vminsh(__a, (vector short)__b); 5862 } 5863 5864 /* vec_vminuh */ 5865 5866 static __inline__ vector unsigned short __ATTRS_o_ai 5867 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5868 return __builtin_altivec_vminuh(__a, __b); 5869 } 5870 5871 static __inline__ vector unsigned short __ATTRS_o_ai 5872 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5873 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5874 } 5875 5876 static __inline__ vector unsigned short __ATTRS_o_ai 5877 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5878 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5879 } 5880 5881 /* vec_vminsw */ 5882 5883 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5884 vector int __b) { 5885 return __builtin_altivec_vminsw(__a, __b); 5886 } 5887 5888 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5889 vector int __b) { 5890 return __builtin_altivec_vminsw((vector int)__a, __b); 5891 } 5892 5893 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5894 vector bool int __b) { 5895 return __builtin_altivec_vminsw(__a, (vector int)__b); 5896 } 5897 5898 /* vec_vminuw */ 5899 5900 static __inline__ vector unsigned int __ATTRS_o_ai 5901 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5902 return __builtin_altivec_vminuw(__a, __b); 5903 } 5904 5905 static __inline__ vector unsigned int __ATTRS_o_ai 5906 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5907 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5908 } 5909 5910 static __inline__ vector unsigned int __ATTRS_o_ai 5911 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5912 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5913 } 5914 5915 /* vec_vminfp */ 5916 5917 static __inline__ vector float __attribute__((__always_inline__)) 5918 vec_vminfp(vector float __a, vector float __b) { 5919 #ifdef __VSX__ 5920 return __builtin_vsx_xvminsp(__a, __b); 5921 #else 5922 return __builtin_altivec_vminfp(__a, __b); 5923 #endif 5924 } 5925 5926 /* vec_mladd */ 5927 5928 #define __builtin_altivec_vmladduhm vec_mladd 5929 5930 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5931 vector short __b, 5932 vector short __c) { 5933 return __a * __b + __c; 5934 } 5935 5936 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5937 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5938 return __a * (vector short)__b + (vector short)__c; 5939 } 5940 5941 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5942 vector short __b, 5943 vector short __c) { 5944 return (vector short)__a * __b + __c; 5945 } 5946 5947 static __inline__ vector unsigned short __ATTRS_o_ai 5948 vec_mladd(vector unsigned short __a, vector unsigned short __b, 5949 vector unsigned short __c) { 5950 return __a * __b + __c; 5951 } 5952 5953 /* vec_vmladduhm */ 5954 5955 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 5956 vector short __b, 5957 vector short __c) { 5958 return __a * __b + __c; 5959 } 5960 5961 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 5962 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5963 return __a * (vector short)__b + (vector short)__c; 5964 } 5965 5966 static __inline__ vector short __ATTRS_o_ai 5967 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 5968 return (vector short)__a * __b + __c; 5969 } 5970 5971 static __inline__ vector unsigned short __ATTRS_o_ai 5972 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 5973 vector unsigned short __c) { 5974 return __a * __b + __c; 5975 } 5976 5977 /* vec_mradds */ 5978 5979 static __inline__ vector short __attribute__((__always_inline__)) 5980 vec_mradds(vector short __a, vector short __b, vector short __c) { 5981 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5982 } 5983 5984 /* vec_vmhraddshs */ 5985 5986 static __inline__ vector short __attribute__((__always_inline__)) 5987 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 5988 return __builtin_altivec_vmhraddshs(__a, __b, __c); 5989 } 5990 5991 /* vec_msum */ 5992 5993 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 5994 vector unsigned char __b, 5995 vector int __c) { 5996 return __builtin_altivec_vmsummbm(__a, __b, __c); 5997 } 5998 5999 static __inline__ vector unsigned int __ATTRS_o_ai 6000 vec_msum(vector unsigned char __a, vector unsigned char __b, 6001 vector unsigned int __c) { 6002 return __builtin_altivec_vmsumubm(__a, __b, __c); 6003 } 6004 6005 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 6006 vector short __b, 6007 vector int __c) { 6008 return __builtin_altivec_vmsumshm(__a, __b, __c); 6009 } 6010 6011 static __inline__ vector unsigned int __ATTRS_o_ai 6012 vec_msum(vector unsigned short __a, vector unsigned short __b, 6013 vector unsigned int __c) { 6014 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6015 } 6016 6017 /* vec_msumc */ 6018 6019 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6020 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6021 vec_msumc(vector unsigned long long __a, vector unsigned long long __b, 6022 vector unsigned __int128 __c) { 6023 return __builtin_altivec_vmsumcud(__a, __b, __c); 6024 } 6025 #endif 6026 6027 /* vec_vmsummbm */ 6028 6029 static __inline__ vector int __attribute__((__always_inline__)) 6030 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 6031 return __builtin_altivec_vmsummbm(__a, __b, __c); 6032 } 6033 6034 /* vec_vmsumubm */ 6035 6036 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6037 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 6038 vector unsigned int __c) { 6039 return __builtin_altivec_vmsumubm(__a, __b, __c); 6040 } 6041 6042 /* vec_vmsumshm */ 6043 6044 static __inline__ vector int __attribute__((__always_inline__)) 6045 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 6046 return __builtin_altivec_vmsumshm(__a, __b, __c); 6047 } 6048 6049 /* vec_vmsumuhm */ 6050 6051 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6052 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 6053 vector unsigned int __c) { 6054 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6055 } 6056 6057 /* vec_msums */ 6058 6059 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 6060 vector short __b, 6061 vector int __c) { 6062 return __builtin_altivec_vmsumshs(__a, __b, __c); 6063 } 6064 6065 static __inline__ vector unsigned int __ATTRS_o_ai 6066 vec_msums(vector unsigned short __a, vector unsigned short __b, 6067 vector unsigned int __c) { 6068 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6069 } 6070 6071 /* vec_vmsumshs */ 6072 6073 static __inline__ vector int __attribute__((__always_inline__)) 6074 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 6075 return __builtin_altivec_vmsumshs(__a, __b, __c); 6076 } 6077 6078 /* vec_vmsumuhs */ 6079 6080 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6081 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 6082 vector unsigned int __c) { 6083 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6084 } 6085 6086 /* vec_mtvscr */ 6087 6088 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 6089 __builtin_altivec_mtvscr((vector int)__a); 6090 } 6091 6092 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 6093 __builtin_altivec_mtvscr((vector int)__a); 6094 } 6095 6096 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 6097 __builtin_altivec_mtvscr((vector int)__a); 6098 } 6099 6100 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 6101 __builtin_altivec_mtvscr((vector int)__a); 6102 } 6103 6104 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 6105 __builtin_altivec_mtvscr((vector int)__a); 6106 } 6107 6108 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 6109 __builtin_altivec_mtvscr((vector int)__a); 6110 } 6111 6112 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 6113 __builtin_altivec_mtvscr((vector int)__a); 6114 } 6115 6116 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 6117 __builtin_altivec_mtvscr((vector int)__a); 6118 } 6119 6120 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 6121 __builtin_altivec_mtvscr((vector int)__a); 6122 } 6123 6124 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 6125 __builtin_altivec_mtvscr((vector int)__a); 6126 } 6127 6128 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 6129 __builtin_altivec_mtvscr((vector int)__a); 6130 } 6131 6132 /* vec_mul */ 6133 6134 /* Integer vector multiplication will involve multiplication of the odd/even 6135 elements separately, then truncating the results and moving to the 6136 result vector. 6137 */ 6138 static __inline__ vector signed char __ATTRS_o_ai 6139 vec_mul(vector signed char __a, vector signed char __b) { 6140 return __a * __b; 6141 } 6142 6143 static __inline__ vector unsigned char __ATTRS_o_ai 6144 vec_mul(vector unsigned char __a, vector unsigned char __b) { 6145 return __a * __b; 6146 } 6147 6148 static __inline__ vector signed short __ATTRS_o_ai 6149 vec_mul(vector signed short __a, vector signed short __b) { 6150 return __a * __b; 6151 } 6152 6153 static __inline__ vector unsigned short __ATTRS_o_ai 6154 vec_mul(vector unsigned short __a, vector unsigned short __b) { 6155 return __a * __b; 6156 } 6157 6158 static __inline__ vector signed int __ATTRS_o_ai 6159 vec_mul(vector signed int __a, vector signed int __b) { 6160 return __a * __b; 6161 } 6162 6163 static __inline__ vector unsigned int __ATTRS_o_ai 6164 vec_mul(vector unsigned int __a, vector unsigned int __b) { 6165 return __a * __b; 6166 } 6167 6168 #ifdef __VSX__ 6169 static __inline__ vector signed long long __ATTRS_o_ai 6170 vec_mul(vector signed long long __a, vector signed long long __b) { 6171 return __a * __b; 6172 } 6173 6174 static __inline__ vector unsigned long long __ATTRS_o_ai 6175 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 6176 return __a * __b; 6177 } 6178 #endif 6179 6180 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 6181 vector float __b) { 6182 return __a * __b; 6183 } 6184 6185 #ifdef __VSX__ 6186 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 6187 vector double __b) { 6188 return __a * __b; 6189 } 6190 #endif 6191 6192 /* The vmulos* and vmules* instructions have a big endian bias, so 6193 we must reverse the meaning of "even" and "odd" for little endian. */ 6194 6195 /* vec_mule */ 6196 6197 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 6198 vector signed char __b) { 6199 #ifdef __LITTLE_ENDIAN__ 6200 return __builtin_altivec_vmulosb(__a, __b); 6201 #else 6202 return __builtin_altivec_vmulesb(__a, __b); 6203 #endif 6204 } 6205 6206 static __inline__ vector unsigned short __ATTRS_o_ai 6207 vec_mule(vector unsigned char __a, vector unsigned char __b) { 6208 #ifdef __LITTLE_ENDIAN__ 6209 return __builtin_altivec_vmuloub(__a, __b); 6210 #else 6211 return __builtin_altivec_vmuleub(__a, __b); 6212 #endif 6213 } 6214 6215 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 6216 vector short __b) { 6217 #ifdef __LITTLE_ENDIAN__ 6218 return __builtin_altivec_vmulosh(__a, __b); 6219 #else 6220 return __builtin_altivec_vmulesh(__a, __b); 6221 #endif 6222 } 6223 6224 static __inline__ vector unsigned int __ATTRS_o_ai 6225 vec_mule(vector unsigned short __a, vector unsigned short __b) { 6226 #ifdef __LITTLE_ENDIAN__ 6227 return __builtin_altivec_vmulouh(__a, __b); 6228 #else 6229 return __builtin_altivec_vmuleuh(__a, __b); 6230 #endif 6231 } 6232 6233 #ifdef __POWER8_VECTOR__ 6234 static __inline__ vector signed long long __ATTRS_o_ai 6235 vec_mule(vector signed int __a, vector signed int __b) { 6236 #ifdef __LITTLE_ENDIAN__ 6237 return __builtin_altivec_vmulosw(__a, __b); 6238 #else 6239 return __builtin_altivec_vmulesw(__a, __b); 6240 #endif 6241 } 6242 6243 static __inline__ vector unsigned long long __ATTRS_o_ai 6244 vec_mule(vector unsigned int __a, vector unsigned int __b) { 6245 #ifdef __LITTLE_ENDIAN__ 6246 return __builtin_altivec_vmulouw(__a, __b); 6247 #else 6248 return __builtin_altivec_vmuleuw(__a, __b); 6249 #endif 6250 } 6251 #endif 6252 6253 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6254 static __inline__ vector signed __int128 __ATTRS_o_ai 6255 vec_mule(vector signed long long __a, vector signed long long __b) { 6256 #ifdef __LITTLE_ENDIAN__ 6257 return __builtin_altivec_vmulosd(__a, __b); 6258 #else 6259 return __builtin_altivec_vmulesd(__a, __b); 6260 #endif 6261 } 6262 6263 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6264 vec_mule(vector unsigned long long __a, vector unsigned long long __b) { 6265 #ifdef __LITTLE_ENDIAN__ 6266 return __builtin_altivec_vmuloud(__a, __b); 6267 #else 6268 return __builtin_altivec_vmuleud(__a, __b); 6269 #endif 6270 } 6271 #endif 6272 6273 /* vec_vmulesb */ 6274 6275 static __inline__ vector short __attribute__((__always_inline__)) 6276 vec_vmulesb(vector signed char __a, vector signed char __b) { 6277 #ifdef __LITTLE_ENDIAN__ 6278 return __builtin_altivec_vmulosb(__a, __b); 6279 #else 6280 return __builtin_altivec_vmulesb(__a, __b); 6281 #endif 6282 } 6283 6284 /* vec_vmuleub */ 6285 6286 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6287 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 6288 #ifdef __LITTLE_ENDIAN__ 6289 return __builtin_altivec_vmuloub(__a, __b); 6290 #else 6291 return __builtin_altivec_vmuleub(__a, __b); 6292 #endif 6293 } 6294 6295 /* vec_vmulesh */ 6296 6297 static __inline__ vector int __attribute__((__always_inline__)) 6298 vec_vmulesh(vector short __a, vector short __b) { 6299 #ifdef __LITTLE_ENDIAN__ 6300 return __builtin_altivec_vmulosh(__a, __b); 6301 #else 6302 return __builtin_altivec_vmulesh(__a, __b); 6303 #endif 6304 } 6305 6306 /* vec_vmuleuh */ 6307 6308 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6309 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 6310 #ifdef __LITTLE_ENDIAN__ 6311 return __builtin_altivec_vmulouh(__a, __b); 6312 #else 6313 return __builtin_altivec_vmuleuh(__a, __b); 6314 #endif 6315 } 6316 6317 /* vec_mulh */ 6318 6319 #ifdef __POWER10_VECTOR__ 6320 static __inline__ vector signed int __ATTRS_o_ai 6321 vec_mulh(vector signed int __a, vector signed int __b) { 6322 return __builtin_altivec_vmulhsw(__a, __b); 6323 } 6324 6325 static __inline__ vector unsigned int __ATTRS_o_ai 6326 vec_mulh(vector unsigned int __a, vector unsigned int __b) { 6327 return __builtin_altivec_vmulhuw(__a, __b); 6328 } 6329 6330 static __inline__ vector signed long long __ATTRS_o_ai 6331 vec_mulh(vector signed long long __a, vector signed long long __b) { 6332 return __builtin_altivec_vmulhsd(__a, __b); 6333 } 6334 6335 static __inline__ vector unsigned long long __ATTRS_o_ai 6336 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { 6337 return __builtin_altivec_vmulhud(__a, __b); 6338 } 6339 #endif 6340 6341 /* vec_mulo */ 6342 6343 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 6344 vector signed char __b) { 6345 #ifdef __LITTLE_ENDIAN__ 6346 return __builtin_altivec_vmulesb(__a, __b); 6347 #else 6348 return __builtin_altivec_vmulosb(__a, __b); 6349 #endif 6350 } 6351 6352 static __inline__ vector unsigned short __ATTRS_o_ai 6353 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 6354 #ifdef __LITTLE_ENDIAN__ 6355 return __builtin_altivec_vmuleub(__a, __b); 6356 #else 6357 return __builtin_altivec_vmuloub(__a, __b); 6358 #endif 6359 } 6360 6361 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 6362 vector short __b) { 6363 #ifdef __LITTLE_ENDIAN__ 6364 return __builtin_altivec_vmulesh(__a, __b); 6365 #else 6366 return __builtin_altivec_vmulosh(__a, __b); 6367 #endif 6368 } 6369 6370 static __inline__ vector unsigned int __ATTRS_o_ai 6371 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 6372 #ifdef __LITTLE_ENDIAN__ 6373 return __builtin_altivec_vmuleuh(__a, __b); 6374 #else 6375 return __builtin_altivec_vmulouh(__a, __b); 6376 #endif 6377 } 6378 6379 #ifdef __POWER8_VECTOR__ 6380 static __inline__ vector signed long long __ATTRS_o_ai 6381 vec_mulo(vector signed int __a, vector signed int __b) { 6382 #ifdef __LITTLE_ENDIAN__ 6383 return __builtin_altivec_vmulesw(__a, __b); 6384 #else 6385 return __builtin_altivec_vmulosw(__a, __b); 6386 #endif 6387 } 6388 6389 static __inline__ vector unsigned long long __ATTRS_o_ai 6390 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 6391 #ifdef __LITTLE_ENDIAN__ 6392 return __builtin_altivec_vmuleuw(__a, __b); 6393 #else 6394 return __builtin_altivec_vmulouw(__a, __b); 6395 #endif 6396 } 6397 #endif 6398 6399 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6400 static __inline__ vector signed __int128 __ATTRS_o_ai 6401 vec_mulo(vector signed long long __a, vector signed long long __b) { 6402 #ifdef __LITTLE_ENDIAN__ 6403 return __builtin_altivec_vmulesd(__a, __b); 6404 #else 6405 return __builtin_altivec_vmulosd(__a, __b); 6406 #endif 6407 } 6408 6409 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6410 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { 6411 #ifdef __LITTLE_ENDIAN__ 6412 return __builtin_altivec_vmuleud(__a, __b); 6413 #else 6414 return __builtin_altivec_vmuloud(__a, __b); 6415 #endif 6416 } 6417 #endif 6418 6419 /* vec_vmulosb */ 6420 6421 static __inline__ vector short __attribute__((__always_inline__)) 6422 vec_vmulosb(vector signed char __a, vector signed char __b) { 6423 #ifdef __LITTLE_ENDIAN__ 6424 return __builtin_altivec_vmulesb(__a, __b); 6425 #else 6426 return __builtin_altivec_vmulosb(__a, __b); 6427 #endif 6428 } 6429 6430 /* vec_vmuloub */ 6431 6432 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6433 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 6434 #ifdef __LITTLE_ENDIAN__ 6435 return __builtin_altivec_vmuleub(__a, __b); 6436 #else 6437 return __builtin_altivec_vmuloub(__a, __b); 6438 #endif 6439 } 6440 6441 /* vec_vmulosh */ 6442 6443 static __inline__ vector int __attribute__((__always_inline__)) 6444 vec_vmulosh(vector short __a, vector short __b) { 6445 #ifdef __LITTLE_ENDIAN__ 6446 return __builtin_altivec_vmulesh(__a, __b); 6447 #else 6448 return __builtin_altivec_vmulosh(__a, __b); 6449 #endif 6450 } 6451 6452 /* vec_vmulouh */ 6453 6454 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6455 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 6456 #ifdef __LITTLE_ENDIAN__ 6457 return __builtin_altivec_vmuleuh(__a, __b); 6458 #else 6459 return __builtin_altivec_vmulouh(__a, __b); 6460 #endif 6461 } 6462 6463 /* vec_nand */ 6464 6465 #ifdef __POWER8_VECTOR__ 6466 static __inline__ vector signed char __ATTRS_o_ai 6467 vec_nand(vector signed char __a, vector signed char __b) { 6468 return ~(__a & __b); 6469 } 6470 6471 static __inline__ vector signed char __ATTRS_o_ai 6472 vec_nand(vector signed char __a, vector bool char __b) { 6473 return ~(__a & __b); 6474 } 6475 6476 static __inline__ vector signed char __ATTRS_o_ai 6477 vec_nand(vector bool char __a, vector signed char __b) { 6478 return ~(__a & __b); 6479 } 6480 6481 static __inline__ vector unsigned char __ATTRS_o_ai 6482 vec_nand(vector unsigned char __a, vector unsigned char __b) { 6483 return ~(__a & __b); 6484 } 6485 6486 static __inline__ vector unsigned char __ATTRS_o_ai 6487 vec_nand(vector unsigned char __a, vector bool char __b) { 6488 return ~(__a & __b); 6489 } 6490 6491 static __inline__ vector unsigned char __ATTRS_o_ai 6492 vec_nand(vector bool char __a, vector unsigned char __b) { 6493 return ~(__a & __b); 6494 } 6495 6496 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 6497 vector bool char __b) { 6498 return ~(__a & __b); 6499 } 6500 6501 static __inline__ vector signed short __ATTRS_o_ai 6502 vec_nand(vector signed short __a, vector signed short __b) { 6503 return ~(__a & __b); 6504 } 6505 6506 static __inline__ vector signed short __ATTRS_o_ai 6507 vec_nand(vector signed short __a, vector bool short __b) { 6508 return ~(__a & __b); 6509 } 6510 6511 static __inline__ vector signed short __ATTRS_o_ai 6512 vec_nand(vector bool short __a, vector signed short __b) { 6513 return ~(__a & __b); 6514 } 6515 6516 static __inline__ vector unsigned short __ATTRS_o_ai 6517 vec_nand(vector unsigned short __a, vector unsigned short __b) { 6518 return ~(__a & __b); 6519 } 6520 6521 static __inline__ vector unsigned short __ATTRS_o_ai 6522 vec_nand(vector unsigned short __a, vector bool short __b) { 6523 return ~(__a & __b); 6524 } 6525 6526 static __inline__ vector bool short __ATTRS_o_ai 6527 vec_nand(vector bool short __a, vector bool short __b) { 6528 return ~(__a & __b); 6529 } 6530 6531 static __inline__ vector signed int __ATTRS_o_ai 6532 vec_nand(vector signed int __a, vector signed int __b) { 6533 return ~(__a & __b); 6534 } 6535 6536 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 6537 vector bool int __b) { 6538 return ~(__a & __b); 6539 } 6540 6541 static __inline__ vector signed int __ATTRS_o_ai 6542 vec_nand(vector bool int __a, vector signed int __b) { 6543 return ~(__a & __b); 6544 } 6545 6546 static __inline__ vector unsigned int __ATTRS_o_ai 6547 vec_nand(vector unsigned int __a, vector unsigned int __b) { 6548 return ~(__a & __b); 6549 } 6550 6551 static __inline__ vector unsigned int __ATTRS_o_ai 6552 vec_nand(vector unsigned int __a, vector bool int __b) { 6553 return ~(__a & __b); 6554 } 6555 6556 static __inline__ vector unsigned int __ATTRS_o_ai 6557 vec_nand(vector bool int __a, vector unsigned int __b) { 6558 return ~(__a & __b); 6559 } 6560 6561 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 6562 vector bool int __b) { 6563 return ~(__a & __b); 6564 } 6565 6566 static __inline__ vector float __ATTRS_o_ai 6567 vec_nand(vector float __a, vector float __b) { 6568 return (vector float)(~((vector unsigned int)__a & 6569 (vector unsigned int)__b)); 6570 } 6571 6572 static __inline__ vector signed long long __ATTRS_o_ai 6573 vec_nand(vector signed long long __a, vector signed long long __b) { 6574 return ~(__a & __b); 6575 } 6576 6577 static __inline__ vector signed long long __ATTRS_o_ai 6578 vec_nand(vector signed long long __a, vector bool long long __b) { 6579 return ~(__a & __b); 6580 } 6581 6582 static __inline__ vector signed long long __ATTRS_o_ai 6583 vec_nand(vector bool long long __a, vector signed long long __b) { 6584 return ~(__a & __b); 6585 } 6586 6587 static __inline__ vector unsigned long long __ATTRS_o_ai 6588 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6589 return ~(__a & __b); 6590 } 6591 6592 static __inline__ vector unsigned long long __ATTRS_o_ai 6593 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6594 return ~(__a & __b); 6595 } 6596 6597 static __inline__ vector unsigned long long __ATTRS_o_ai 6598 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6599 return ~(__a & __b); 6600 } 6601 6602 static __inline__ vector bool long long __ATTRS_o_ai 6603 vec_nand(vector bool long long __a, vector bool long long __b) { 6604 return ~(__a & __b); 6605 } 6606 6607 static __inline__ vector double __ATTRS_o_ai 6608 vec_nand(vector double __a, vector double __b) { 6609 return (vector double)(~((vector unsigned long long)__a & 6610 (vector unsigned long long)__b)); 6611 } 6612 6613 #endif 6614 6615 /* vec_nmadd */ 6616 6617 #ifdef __VSX__ 6618 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6619 vector float __b, 6620 vector float __c) { 6621 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6622 } 6623 6624 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6625 vector double __b, 6626 vector double __c) { 6627 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6628 } 6629 #endif 6630 6631 /* vec_nmsub */ 6632 6633 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6634 vector float __b, 6635 vector float __c) { 6636 #ifdef __VSX__ 6637 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6638 #else 6639 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6640 #endif 6641 } 6642 6643 #ifdef __VSX__ 6644 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6645 vector double __b, 6646 vector double __c) { 6647 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6648 } 6649 #endif 6650 6651 /* vec_vnmsubfp */ 6652 6653 static __inline__ vector float __attribute__((__always_inline__)) 6654 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6655 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6656 } 6657 6658 /* vec_nor */ 6659 6660 #define __builtin_altivec_vnor vec_nor 6661 6662 static __inline__ vector signed char __ATTRS_o_ai 6663 vec_nor(vector signed char __a, vector signed char __b) { 6664 return ~(__a | __b); 6665 } 6666 6667 static __inline__ vector unsigned char __ATTRS_o_ai 6668 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6669 return ~(__a | __b); 6670 } 6671 6672 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6673 vector bool char __b) { 6674 return ~(__a | __b); 6675 } 6676 6677 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6678 vector short __b) { 6679 return ~(__a | __b); 6680 } 6681 6682 static __inline__ vector unsigned short __ATTRS_o_ai 6683 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6684 return ~(__a | __b); 6685 } 6686 6687 static __inline__ vector bool short __ATTRS_o_ai 6688 vec_nor(vector bool short __a, vector bool short __b) { 6689 return ~(__a | __b); 6690 } 6691 6692 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6693 vector int __b) { 6694 return ~(__a | __b); 6695 } 6696 6697 static __inline__ vector unsigned int __ATTRS_o_ai 6698 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6699 return ~(__a | __b); 6700 } 6701 6702 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6703 vector bool int __b) { 6704 return ~(__a | __b); 6705 } 6706 6707 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6708 vector float __b) { 6709 vector unsigned int __res = 6710 ~((vector unsigned int)__a | (vector unsigned int)__b); 6711 return (vector float)__res; 6712 } 6713 6714 #ifdef __VSX__ 6715 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6716 vector double __b) { 6717 vector unsigned long long __res = 6718 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6719 return (vector double)__res; 6720 } 6721 #endif 6722 6723 /* vec_vnor */ 6724 6725 static __inline__ vector signed char __ATTRS_o_ai 6726 vec_vnor(vector signed char __a, vector signed char __b) { 6727 return ~(__a | __b); 6728 } 6729 6730 static __inline__ vector unsigned char __ATTRS_o_ai 6731 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6732 return ~(__a | __b); 6733 } 6734 6735 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6736 vector bool char __b) { 6737 return ~(__a | __b); 6738 } 6739 6740 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6741 vector short __b) { 6742 return ~(__a | __b); 6743 } 6744 6745 static __inline__ vector unsigned short __ATTRS_o_ai 6746 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6747 return ~(__a | __b); 6748 } 6749 6750 static __inline__ vector bool short __ATTRS_o_ai 6751 vec_vnor(vector bool short __a, vector bool short __b) { 6752 return ~(__a | __b); 6753 } 6754 6755 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6756 vector int __b) { 6757 return ~(__a | __b); 6758 } 6759 6760 static __inline__ vector unsigned int __ATTRS_o_ai 6761 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6762 return ~(__a | __b); 6763 } 6764 6765 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6766 vector bool int __b) { 6767 return ~(__a | __b); 6768 } 6769 6770 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6771 vector float __b) { 6772 vector unsigned int __res = 6773 ~((vector unsigned int)__a | (vector unsigned int)__b); 6774 return (vector float)__res; 6775 } 6776 6777 #ifdef __VSX__ 6778 static __inline__ vector signed long long __ATTRS_o_ai 6779 vec_nor(vector signed long long __a, vector signed long long __b) { 6780 return ~(__a | __b); 6781 } 6782 6783 static __inline__ vector unsigned long long __ATTRS_o_ai 6784 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6785 return ~(__a | __b); 6786 } 6787 6788 static __inline__ vector bool long long __ATTRS_o_ai 6789 vec_nor(vector bool long long __a, vector bool long long __b) { 6790 return ~(__a | __b); 6791 } 6792 #endif 6793 6794 /* vec_or */ 6795 6796 #define __builtin_altivec_vor vec_or 6797 6798 static __inline__ vector signed char __ATTRS_o_ai 6799 vec_or(vector signed char __a, vector signed char __b) { 6800 return __a | __b; 6801 } 6802 6803 static __inline__ vector signed char __ATTRS_o_ai 6804 vec_or(vector bool char __a, vector signed char __b) { 6805 return (vector signed char)__a | __b; 6806 } 6807 6808 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6809 vector bool char __b) { 6810 return __a | (vector signed char)__b; 6811 } 6812 6813 static __inline__ vector unsigned char __ATTRS_o_ai 6814 vec_or(vector unsigned char __a, vector unsigned char __b) { 6815 return __a | __b; 6816 } 6817 6818 static __inline__ vector unsigned char __ATTRS_o_ai 6819 vec_or(vector bool char __a, vector unsigned char __b) { 6820 return (vector unsigned char)__a | __b; 6821 } 6822 6823 static __inline__ vector unsigned char __ATTRS_o_ai 6824 vec_or(vector unsigned char __a, vector bool char __b) { 6825 return __a | (vector unsigned char)__b; 6826 } 6827 6828 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6829 vector bool char __b) { 6830 return __a | __b; 6831 } 6832 6833 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6834 vector short __b) { 6835 return __a | __b; 6836 } 6837 6838 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6839 vector short __b) { 6840 return (vector short)__a | __b; 6841 } 6842 6843 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6844 vector bool short __b) { 6845 return __a | (vector short)__b; 6846 } 6847 6848 static __inline__ vector unsigned short __ATTRS_o_ai 6849 vec_or(vector unsigned short __a, vector unsigned short __b) { 6850 return __a | __b; 6851 } 6852 6853 static __inline__ vector unsigned short __ATTRS_o_ai 6854 vec_or(vector bool short __a, vector unsigned short __b) { 6855 return (vector unsigned short)__a | __b; 6856 } 6857 6858 static __inline__ vector unsigned short __ATTRS_o_ai 6859 vec_or(vector unsigned short __a, vector bool short __b) { 6860 return __a | (vector unsigned short)__b; 6861 } 6862 6863 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6864 vector bool short __b) { 6865 return __a | __b; 6866 } 6867 6868 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6869 vector int __b) { 6870 return __a | __b; 6871 } 6872 6873 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6874 vector int __b) { 6875 return (vector int)__a | __b; 6876 } 6877 6878 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6879 vector bool int __b) { 6880 return __a | (vector int)__b; 6881 } 6882 6883 static __inline__ vector unsigned int __ATTRS_o_ai 6884 vec_or(vector unsigned int __a, vector unsigned int __b) { 6885 return __a | __b; 6886 } 6887 6888 static __inline__ vector unsigned int __ATTRS_o_ai 6889 vec_or(vector bool int __a, vector unsigned int __b) { 6890 return (vector unsigned int)__a | __b; 6891 } 6892 6893 static __inline__ vector unsigned int __ATTRS_o_ai 6894 vec_or(vector unsigned int __a, vector bool int __b) { 6895 return __a | (vector unsigned int)__b; 6896 } 6897 6898 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6899 vector bool int __b) { 6900 return __a | __b; 6901 } 6902 6903 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6904 vector float __b) { 6905 vector unsigned int __res = 6906 (vector unsigned int)__a | (vector unsigned int)__b; 6907 return (vector float)__res; 6908 } 6909 6910 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6911 vector float __b) { 6912 vector unsigned int __res = 6913 (vector unsigned int)__a | (vector unsigned int)__b; 6914 return (vector float)__res; 6915 } 6916 6917 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6918 vector bool int __b) { 6919 vector unsigned int __res = 6920 (vector unsigned int)__a | (vector unsigned int)__b; 6921 return (vector float)__res; 6922 } 6923 6924 #ifdef __VSX__ 6925 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6926 vector double __b) { 6927 return (vector double)((vector unsigned long long)__a | 6928 (vector unsigned long long)__b); 6929 } 6930 6931 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6932 vector bool long long __b) { 6933 return (vector double)((vector unsigned long long)__a | 6934 (vector unsigned long long)__b); 6935 } 6936 6937 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6938 vector double __b) { 6939 return (vector double)((vector unsigned long long)__a | 6940 (vector unsigned long long)__b); 6941 } 6942 6943 static __inline__ vector signed long long __ATTRS_o_ai 6944 vec_or(vector signed long long __a, vector signed long long __b) { 6945 return __a | __b; 6946 } 6947 6948 static __inline__ vector signed long long __ATTRS_o_ai 6949 vec_or(vector bool long long __a, vector signed long long __b) { 6950 return (vector signed long long)__a | __b; 6951 } 6952 6953 static __inline__ vector signed long long __ATTRS_o_ai 6954 vec_or(vector signed long long __a, vector bool long long __b) { 6955 return __a | (vector signed long long)__b; 6956 } 6957 6958 static __inline__ vector unsigned long long __ATTRS_o_ai 6959 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 6960 return __a | __b; 6961 } 6962 6963 static __inline__ vector unsigned long long __ATTRS_o_ai 6964 vec_or(vector bool long long __a, vector unsigned long long __b) { 6965 return (vector unsigned long long)__a | __b; 6966 } 6967 6968 static __inline__ vector unsigned long long __ATTRS_o_ai 6969 vec_or(vector unsigned long long __a, vector bool long long __b) { 6970 return __a | (vector unsigned long long)__b; 6971 } 6972 6973 static __inline__ vector bool long long __ATTRS_o_ai 6974 vec_or(vector bool long long __a, vector bool long long __b) { 6975 return __a | __b; 6976 } 6977 #endif 6978 6979 #ifdef __POWER8_VECTOR__ 6980 static __inline__ vector signed char __ATTRS_o_ai 6981 vec_orc(vector signed char __a, vector signed char __b) { 6982 return __a | ~__b; 6983 } 6984 6985 static __inline__ vector signed char __ATTRS_o_ai 6986 vec_orc(vector signed char __a, vector bool char __b) { 6987 return __a | ~__b; 6988 } 6989 6990 static __inline__ vector signed char __ATTRS_o_ai 6991 vec_orc(vector bool char __a, vector signed char __b) { 6992 return __a | ~__b; 6993 } 6994 6995 static __inline__ vector unsigned char __ATTRS_o_ai 6996 vec_orc(vector unsigned char __a, vector unsigned char __b) { 6997 return __a | ~__b; 6998 } 6999 7000 static __inline__ vector unsigned char __ATTRS_o_ai 7001 vec_orc(vector unsigned char __a, vector bool char __b) { 7002 return __a | ~__b; 7003 } 7004 7005 static __inline__ vector unsigned char __ATTRS_o_ai 7006 vec_orc(vector bool char __a, vector unsigned char __b) { 7007 return __a | ~__b; 7008 } 7009 7010 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 7011 vector bool char __b) { 7012 return __a | ~__b; 7013 } 7014 7015 static __inline__ vector signed short __ATTRS_o_ai 7016 vec_orc(vector signed short __a, vector signed short __b) { 7017 return __a | ~__b; 7018 } 7019 7020 static __inline__ vector signed short __ATTRS_o_ai 7021 vec_orc(vector signed short __a, vector bool short __b) { 7022 return __a | ~__b; 7023 } 7024 7025 static __inline__ vector signed short __ATTRS_o_ai 7026 vec_orc(vector bool short __a, vector signed short __b) { 7027 return __a | ~__b; 7028 } 7029 7030 static __inline__ vector unsigned short __ATTRS_o_ai 7031 vec_orc(vector unsigned short __a, vector unsigned short __b) { 7032 return __a | ~__b; 7033 } 7034 7035 static __inline__ vector unsigned short __ATTRS_o_ai 7036 vec_orc(vector unsigned short __a, vector bool short __b) { 7037 return __a | ~__b; 7038 } 7039 7040 static __inline__ vector unsigned short __ATTRS_o_ai 7041 vec_orc(vector bool short __a, vector unsigned short __b) { 7042 return __a | ~__b; 7043 } 7044 7045 static __inline__ vector bool short __ATTRS_o_ai 7046 vec_orc(vector bool short __a, vector bool short __b) { 7047 return __a | ~__b; 7048 } 7049 7050 static __inline__ vector signed int __ATTRS_o_ai 7051 vec_orc(vector signed int __a, vector signed int __b) { 7052 return __a | ~__b; 7053 } 7054 7055 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 7056 vector bool int __b) { 7057 return __a | ~__b; 7058 } 7059 7060 static __inline__ vector signed int __ATTRS_o_ai 7061 vec_orc(vector bool int __a, vector signed int __b) { 7062 return __a | ~__b; 7063 } 7064 7065 static __inline__ vector unsigned int __ATTRS_o_ai 7066 vec_orc(vector unsigned int __a, vector unsigned int __b) { 7067 return __a | ~__b; 7068 } 7069 7070 static __inline__ vector unsigned int __ATTRS_o_ai 7071 vec_orc(vector unsigned int __a, vector bool int __b) { 7072 return __a | ~__b; 7073 } 7074 7075 static __inline__ vector unsigned int __ATTRS_o_ai 7076 vec_orc(vector bool int __a, vector unsigned int __b) { 7077 return __a | ~__b; 7078 } 7079 7080 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 7081 vector bool int __b) { 7082 return __a | ~__b; 7083 } 7084 7085 static __inline__ vector float __ATTRS_o_ai 7086 vec_orc(vector bool int __a, vector float __b) { 7087 return (vector float)(__a | ~(vector unsigned int)__b); 7088 } 7089 7090 static __inline__ vector float __ATTRS_o_ai 7091 vec_orc(vector float __a, vector bool int __b) { 7092 return (vector float)((vector unsigned int)__a | ~__b); 7093 } 7094 7095 static __inline__ vector signed long long __ATTRS_o_ai 7096 vec_orc(vector signed long long __a, vector signed long long __b) { 7097 return __a | ~__b; 7098 } 7099 7100 static __inline__ vector signed long long __ATTRS_o_ai 7101 vec_orc(vector signed long long __a, vector bool long long __b) { 7102 return __a | ~__b; 7103 } 7104 7105 static __inline__ vector signed long long __ATTRS_o_ai 7106 vec_orc(vector bool long long __a, vector signed long long __b) { 7107 return __a | ~__b; 7108 } 7109 7110 static __inline__ vector unsigned long long __ATTRS_o_ai 7111 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 7112 return __a | ~__b; 7113 } 7114 7115 static __inline__ vector unsigned long long __ATTRS_o_ai 7116 vec_orc(vector unsigned long long __a, vector bool long long __b) { 7117 return __a | ~__b; 7118 } 7119 7120 static __inline__ vector unsigned long long __ATTRS_o_ai 7121 vec_orc(vector bool long long __a, vector unsigned long long __b) { 7122 return __a | ~__b; 7123 } 7124 7125 static __inline__ vector bool long long __ATTRS_o_ai 7126 vec_orc(vector bool long long __a, vector bool long long __b) { 7127 return __a | ~__b; 7128 } 7129 7130 static __inline__ vector double __ATTRS_o_ai 7131 vec_orc(vector double __a, vector bool long long __b) { 7132 return (vector double)((vector unsigned long long)__a | ~__b); 7133 } 7134 7135 static __inline__ vector double __ATTRS_o_ai 7136 vec_orc(vector bool long long __a, vector double __b) { 7137 return (vector double)(__a | ~(vector unsigned long long)__b); 7138 } 7139 #endif 7140 7141 /* vec_vor */ 7142 7143 static __inline__ vector signed char __ATTRS_o_ai 7144 vec_vor(vector signed char __a, vector signed char __b) { 7145 return __a | __b; 7146 } 7147 7148 static __inline__ vector signed char __ATTRS_o_ai 7149 vec_vor(vector bool char __a, vector signed char __b) { 7150 return (vector signed char)__a | __b; 7151 } 7152 7153 static __inline__ vector signed char __ATTRS_o_ai 7154 vec_vor(vector signed char __a, vector bool char __b) { 7155 return __a | (vector signed char)__b; 7156 } 7157 7158 static __inline__ vector unsigned char __ATTRS_o_ai 7159 vec_vor(vector unsigned char __a, vector unsigned char __b) { 7160 return __a | __b; 7161 } 7162 7163 static __inline__ vector unsigned char __ATTRS_o_ai 7164 vec_vor(vector bool char __a, vector unsigned char __b) { 7165 return (vector unsigned char)__a | __b; 7166 } 7167 7168 static __inline__ vector unsigned char __ATTRS_o_ai 7169 vec_vor(vector unsigned char __a, vector bool char __b) { 7170 return __a | (vector unsigned char)__b; 7171 } 7172 7173 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 7174 vector bool char __b) { 7175 return __a | __b; 7176 } 7177 7178 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7179 vector short __b) { 7180 return __a | __b; 7181 } 7182 7183 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 7184 vector short __b) { 7185 return (vector short)__a | __b; 7186 } 7187 7188 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7189 vector bool short __b) { 7190 return __a | (vector short)__b; 7191 } 7192 7193 static __inline__ vector unsigned short __ATTRS_o_ai 7194 vec_vor(vector unsigned short __a, vector unsigned short __b) { 7195 return __a | __b; 7196 } 7197 7198 static __inline__ vector unsigned short __ATTRS_o_ai 7199 vec_vor(vector bool short __a, vector unsigned short __b) { 7200 return (vector unsigned short)__a | __b; 7201 } 7202 7203 static __inline__ vector unsigned short __ATTRS_o_ai 7204 vec_vor(vector unsigned short __a, vector bool short __b) { 7205 return __a | (vector unsigned short)__b; 7206 } 7207 7208 static __inline__ vector bool short __ATTRS_o_ai 7209 vec_vor(vector bool short __a, vector bool short __b) { 7210 return __a | __b; 7211 } 7212 7213 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7214 vector int __b) { 7215 return __a | __b; 7216 } 7217 7218 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 7219 vector int __b) { 7220 return (vector int)__a | __b; 7221 } 7222 7223 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7224 vector bool int __b) { 7225 return __a | (vector int)__b; 7226 } 7227 7228 static __inline__ vector unsigned int __ATTRS_o_ai 7229 vec_vor(vector unsigned int __a, vector unsigned int __b) { 7230 return __a | __b; 7231 } 7232 7233 static __inline__ vector unsigned int __ATTRS_o_ai 7234 vec_vor(vector bool int __a, vector unsigned int __b) { 7235 return (vector unsigned int)__a | __b; 7236 } 7237 7238 static __inline__ vector unsigned int __ATTRS_o_ai 7239 vec_vor(vector unsigned int __a, vector bool int __b) { 7240 return __a | (vector unsigned int)__b; 7241 } 7242 7243 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 7244 vector bool int __b) { 7245 return __a | __b; 7246 } 7247 7248 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7249 vector float __b) { 7250 vector unsigned int __res = 7251 (vector unsigned int)__a | (vector unsigned int)__b; 7252 return (vector float)__res; 7253 } 7254 7255 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 7256 vector float __b) { 7257 vector unsigned int __res = 7258 (vector unsigned int)__a | (vector unsigned int)__b; 7259 return (vector float)__res; 7260 } 7261 7262 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7263 vector bool int __b) { 7264 vector unsigned int __res = 7265 (vector unsigned int)__a | (vector unsigned int)__b; 7266 return (vector float)__res; 7267 } 7268 7269 #ifdef __VSX__ 7270 static __inline__ vector signed long long __ATTRS_o_ai 7271 vec_vor(vector signed long long __a, vector signed long long __b) { 7272 return __a | __b; 7273 } 7274 7275 static __inline__ vector signed long long __ATTRS_o_ai 7276 vec_vor(vector bool long long __a, vector signed long long __b) { 7277 return (vector signed long long)__a | __b; 7278 } 7279 7280 static __inline__ vector signed long long __ATTRS_o_ai 7281 vec_vor(vector signed long long __a, vector bool long long __b) { 7282 return __a | (vector signed long long)__b; 7283 } 7284 7285 static __inline__ vector unsigned long long __ATTRS_o_ai 7286 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 7287 return __a | __b; 7288 } 7289 7290 static __inline__ vector unsigned long long __ATTRS_o_ai 7291 vec_vor(vector bool long long __a, vector unsigned long long __b) { 7292 return (vector unsigned long long)__a | __b; 7293 } 7294 7295 static __inline__ vector unsigned long long __ATTRS_o_ai 7296 vec_vor(vector unsigned long long __a, vector bool long long __b) { 7297 return __a | (vector unsigned long long)__b; 7298 } 7299 7300 static __inline__ vector bool long long __ATTRS_o_ai 7301 vec_vor(vector bool long long __a, vector bool long long __b) { 7302 return __a | __b; 7303 } 7304 #endif 7305 7306 /* vec_pack */ 7307 7308 /* The various vector pack instructions have a big-endian bias, so for 7309 little endian we must handle reversed element numbering. */ 7310 7311 static __inline__ vector signed char __ATTRS_o_ai 7312 vec_pack(vector signed short __a, vector signed short __b) { 7313 #ifdef __LITTLE_ENDIAN__ 7314 return (vector signed char)vec_perm( 7315 __a, __b, 7316 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7317 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7318 #else 7319 return (vector signed char)vec_perm( 7320 __a, __b, 7321 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7322 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7323 #endif 7324 } 7325 7326 static __inline__ vector unsigned char __ATTRS_o_ai 7327 vec_pack(vector unsigned short __a, vector unsigned short __b) { 7328 #ifdef __LITTLE_ENDIAN__ 7329 return (vector unsigned char)vec_perm( 7330 __a, __b, 7331 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7332 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7333 #else 7334 return (vector unsigned char)vec_perm( 7335 __a, __b, 7336 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7337 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7338 #endif 7339 } 7340 7341 static __inline__ vector bool char __ATTRS_o_ai 7342 vec_pack(vector bool short __a, vector bool short __b) { 7343 #ifdef __LITTLE_ENDIAN__ 7344 return (vector bool char)vec_perm( 7345 __a, __b, 7346 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7347 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7348 #else 7349 return (vector bool char)vec_perm( 7350 __a, __b, 7351 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7352 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7353 #endif 7354 } 7355 7356 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 7357 vector int __b) { 7358 #ifdef __LITTLE_ENDIAN__ 7359 return (vector short)vec_perm( 7360 __a, __b, 7361 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7362 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7363 #else 7364 return (vector short)vec_perm( 7365 __a, __b, 7366 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7367 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7368 #endif 7369 } 7370 7371 static __inline__ vector unsigned short __ATTRS_o_ai 7372 vec_pack(vector unsigned int __a, vector unsigned int __b) { 7373 #ifdef __LITTLE_ENDIAN__ 7374 return (vector unsigned short)vec_perm( 7375 __a, __b, 7376 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7377 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7378 #else 7379 return (vector unsigned short)vec_perm( 7380 __a, __b, 7381 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7382 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7383 #endif 7384 } 7385 7386 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 7387 vector bool int __b) { 7388 #ifdef __LITTLE_ENDIAN__ 7389 return (vector bool short)vec_perm( 7390 __a, __b, 7391 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7392 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7393 #else 7394 return (vector bool short)vec_perm( 7395 __a, __b, 7396 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7397 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7398 #endif 7399 } 7400 7401 #ifdef __VSX__ 7402 static __inline__ vector signed int __ATTRS_o_ai 7403 vec_pack(vector signed long long __a, vector signed long long __b) { 7404 #ifdef __LITTLE_ENDIAN__ 7405 return (vector signed int)vec_perm( 7406 __a, __b, 7407 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7408 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7409 #else 7410 return (vector signed int)vec_perm( 7411 __a, __b, 7412 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7413 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7414 #endif 7415 } 7416 static __inline__ vector unsigned int __ATTRS_o_ai 7417 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 7418 #ifdef __LITTLE_ENDIAN__ 7419 return (vector unsigned 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 unsigned 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 7431 static __inline__ vector bool int __ATTRS_o_ai 7432 vec_pack(vector bool long long __a, vector bool long long __b) { 7433 #ifdef __LITTLE_ENDIAN__ 7434 return (vector bool int)vec_perm( 7435 __a, __b, 7436 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7437 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7438 #else 7439 return (vector bool int)vec_perm( 7440 __a, __b, 7441 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7442 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7443 #endif 7444 } 7445 7446 static __inline__ vector float __ATTRS_o_ai 7447 vec_pack(vector double __a, vector double __b) { 7448 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 7449 } 7450 #endif 7451 7452 #ifdef __POWER9_VECTOR__ 7453 static __inline__ vector unsigned short __ATTRS_o_ai 7454 vec_pack_to_short_fp32(vector float __a, vector float __b) { 7455 vector float __resa = __builtin_vsx_xvcvsphp(__a); 7456 vector float __resb = __builtin_vsx_xvcvsphp(__b); 7457 #ifdef __LITTLE_ENDIAN__ 7458 return (vector unsigned short)vec_mergee(__resa, __resb); 7459 #else 7460 return (vector unsigned short)vec_mergeo(__resa, __resb); 7461 #endif 7462 } 7463 7464 #endif 7465 /* vec_vpkuhum */ 7466 7467 #define __builtin_altivec_vpkuhum vec_vpkuhum 7468 7469 static __inline__ vector signed char __ATTRS_o_ai 7470 vec_vpkuhum(vector signed short __a, vector signed short __b) { 7471 #ifdef __LITTLE_ENDIAN__ 7472 return (vector signed char)vec_perm( 7473 __a, __b, 7474 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7475 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7476 #else 7477 return (vector signed char)vec_perm( 7478 __a, __b, 7479 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7480 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7481 #endif 7482 } 7483 7484 static __inline__ vector unsigned char __ATTRS_o_ai 7485 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 7486 #ifdef __LITTLE_ENDIAN__ 7487 return (vector unsigned char)vec_perm( 7488 __a, __b, 7489 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7490 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7491 #else 7492 return (vector unsigned char)vec_perm( 7493 __a, __b, 7494 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7495 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7496 #endif 7497 } 7498 7499 static __inline__ vector bool char __ATTRS_o_ai 7500 vec_vpkuhum(vector bool short __a, vector bool short __b) { 7501 #ifdef __LITTLE_ENDIAN__ 7502 return (vector bool char)vec_perm( 7503 __a, __b, 7504 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7505 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7506 #else 7507 return (vector bool char)vec_perm( 7508 __a, __b, 7509 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7510 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7511 #endif 7512 } 7513 7514 /* vec_vpkuwum */ 7515 7516 #define __builtin_altivec_vpkuwum vec_vpkuwum 7517 7518 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 7519 vector int __b) { 7520 #ifdef __LITTLE_ENDIAN__ 7521 return (vector short)vec_perm( 7522 __a, __b, 7523 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7524 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7525 #else 7526 return (vector short)vec_perm( 7527 __a, __b, 7528 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7529 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7530 #endif 7531 } 7532 7533 static __inline__ vector unsigned short __ATTRS_o_ai 7534 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 7535 #ifdef __LITTLE_ENDIAN__ 7536 return (vector unsigned short)vec_perm( 7537 __a, __b, 7538 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7539 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7540 #else 7541 return (vector unsigned short)vec_perm( 7542 __a, __b, 7543 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7544 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7545 #endif 7546 } 7547 7548 static __inline__ vector bool short __ATTRS_o_ai 7549 vec_vpkuwum(vector bool int __a, vector bool int __b) { 7550 #ifdef __LITTLE_ENDIAN__ 7551 return (vector bool short)vec_perm( 7552 __a, __b, 7553 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7554 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7555 #else 7556 return (vector bool short)vec_perm( 7557 __a, __b, 7558 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7559 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7560 #endif 7561 } 7562 7563 /* vec_vpkudum */ 7564 7565 #ifdef __POWER8_VECTOR__ 7566 #define __builtin_altivec_vpkudum vec_vpkudum 7567 7568 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7569 vector long long __b) { 7570 #ifdef __LITTLE_ENDIAN__ 7571 return (vector int)vec_perm( 7572 __a, __b, 7573 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7574 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7575 #else 7576 return (vector int)vec_perm( 7577 __a, __b, 7578 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7579 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7580 #endif 7581 } 7582 7583 static __inline__ vector unsigned int __ATTRS_o_ai 7584 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7585 #ifdef __LITTLE_ENDIAN__ 7586 return (vector unsigned int)vec_perm( 7587 __a, __b, 7588 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7589 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7590 #else 7591 return (vector unsigned int)vec_perm( 7592 __a, __b, 7593 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7594 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7595 #endif 7596 } 7597 7598 static __inline__ vector bool int __ATTRS_o_ai 7599 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7600 #ifdef __LITTLE_ENDIAN__ 7601 return (vector bool int)vec_perm( 7602 (vector long long)__a, (vector long long)__b, 7603 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7604 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7605 #else 7606 return (vector bool int)vec_perm( 7607 (vector long long)__a, (vector long long)__b, 7608 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7609 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7610 #endif 7611 } 7612 #endif 7613 7614 /* vec_packpx */ 7615 7616 static __inline__ vector pixel __attribute__((__always_inline__)) 7617 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7618 #ifdef __LITTLE_ENDIAN__ 7619 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7620 #else 7621 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7622 #endif 7623 } 7624 7625 /* vec_vpkpx */ 7626 7627 static __inline__ vector pixel __attribute__((__always_inline__)) 7628 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7629 #ifdef __LITTLE_ENDIAN__ 7630 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7631 #else 7632 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7633 #endif 7634 } 7635 7636 /* vec_packs */ 7637 7638 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7639 vector short __b) { 7640 #ifdef __LITTLE_ENDIAN__ 7641 return __builtin_altivec_vpkshss(__b, __a); 7642 #else 7643 return __builtin_altivec_vpkshss(__a, __b); 7644 #endif 7645 } 7646 7647 static __inline__ vector unsigned char __ATTRS_o_ai 7648 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7649 #ifdef __LITTLE_ENDIAN__ 7650 return __builtin_altivec_vpkuhus(__b, __a); 7651 #else 7652 return __builtin_altivec_vpkuhus(__a, __b); 7653 #endif 7654 } 7655 7656 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7657 vector int __b) { 7658 #ifdef __LITTLE_ENDIAN__ 7659 return __builtin_altivec_vpkswss(__b, __a); 7660 #else 7661 return __builtin_altivec_vpkswss(__a, __b); 7662 #endif 7663 } 7664 7665 static __inline__ vector unsigned short __ATTRS_o_ai 7666 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7667 #ifdef __LITTLE_ENDIAN__ 7668 return __builtin_altivec_vpkuwus(__b, __a); 7669 #else 7670 return __builtin_altivec_vpkuwus(__a, __b); 7671 #endif 7672 } 7673 7674 #ifdef __POWER8_VECTOR__ 7675 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7676 vector long long __b) { 7677 #ifdef __LITTLE_ENDIAN__ 7678 return __builtin_altivec_vpksdss(__b, __a); 7679 #else 7680 return __builtin_altivec_vpksdss(__a, __b); 7681 #endif 7682 } 7683 7684 static __inline__ vector unsigned int __ATTRS_o_ai 7685 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7686 #ifdef __LITTLE_ENDIAN__ 7687 return __builtin_altivec_vpkudus(__b, __a); 7688 #else 7689 return __builtin_altivec_vpkudus(__a, __b); 7690 #endif 7691 } 7692 #endif 7693 7694 /* vec_vpkshss */ 7695 7696 static __inline__ vector signed char __attribute__((__always_inline__)) 7697 vec_vpkshss(vector short __a, vector short __b) { 7698 #ifdef __LITTLE_ENDIAN__ 7699 return __builtin_altivec_vpkshss(__b, __a); 7700 #else 7701 return __builtin_altivec_vpkshss(__a, __b); 7702 #endif 7703 } 7704 7705 /* vec_vpksdss */ 7706 7707 #ifdef __POWER8_VECTOR__ 7708 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7709 vector long long __b) { 7710 #ifdef __LITTLE_ENDIAN__ 7711 return __builtin_altivec_vpksdss(__b, __a); 7712 #else 7713 return __builtin_altivec_vpksdss(__a, __b); 7714 #endif 7715 } 7716 #endif 7717 7718 /* vec_vpkuhus */ 7719 7720 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7721 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7722 #ifdef __LITTLE_ENDIAN__ 7723 return __builtin_altivec_vpkuhus(__b, __a); 7724 #else 7725 return __builtin_altivec_vpkuhus(__a, __b); 7726 #endif 7727 } 7728 7729 /* vec_vpkudus */ 7730 7731 #ifdef __POWER8_VECTOR__ 7732 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7733 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7734 #ifdef __LITTLE_ENDIAN__ 7735 return __builtin_altivec_vpkudus(__b, __a); 7736 #else 7737 return __builtin_altivec_vpkudus(__a, __b); 7738 #endif 7739 } 7740 #endif 7741 7742 /* vec_vpkswss */ 7743 7744 static __inline__ vector signed short __attribute__((__always_inline__)) 7745 vec_vpkswss(vector int __a, vector int __b) { 7746 #ifdef __LITTLE_ENDIAN__ 7747 return __builtin_altivec_vpkswss(__b, __a); 7748 #else 7749 return __builtin_altivec_vpkswss(__a, __b); 7750 #endif 7751 } 7752 7753 /* vec_vpkuwus */ 7754 7755 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7756 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7757 #ifdef __LITTLE_ENDIAN__ 7758 return __builtin_altivec_vpkuwus(__b, __a); 7759 #else 7760 return __builtin_altivec_vpkuwus(__a, __b); 7761 #endif 7762 } 7763 7764 /* vec_packsu */ 7765 7766 static __inline__ vector unsigned char __ATTRS_o_ai 7767 vec_packsu(vector short __a, vector short __b) { 7768 #ifdef __LITTLE_ENDIAN__ 7769 return __builtin_altivec_vpkshus(__b, __a); 7770 #else 7771 return __builtin_altivec_vpkshus(__a, __b); 7772 #endif 7773 } 7774 7775 static __inline__ vector unsigned char __ATTRS_o_ai 7776 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7777 #ifdef __LITTLE_ENDIAN__ 7778 return __builtin_altivec_vpkuhus(__b, __a); 7779 #else 7780 return __builtin_altivec_vpkuhus(__a, __b); 7781 #endif 7782 } 7783 7784 static __inline__ vector unsigned short __ATTRS_o_ai 7785 vec_packsu(vector int __a, vector int __b) { 7786 #ifdef __LITTLE_ENDIAN__ 7787 return __builtin_altivec_vpkswus(__b, __a); 7788 #else 7789 return __builtin_altivec_vpkswus(__a, __b); 7790 #endif 7791 } 7792 7793 static __inline__ vector unsigned short __ATTRS_o_ai 7794 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7795 #ifdef __LITTLE_ENDIAN__ 7796 return __builtin_altivec_vpkuwus(__b, __a); 7797 #else 7798 return __builtin_altivec_vpkuwus(__a, __b); 7799 #endif 7800 } 7801 7802 #ifdef __POWER8_VECTOR__ 7803 static __inline__ vector unsigned int __ATTRS_o_ai 7804 vec_packsu(vector long long __a, vector long long __b) { 7805 #ifdef __LITTLE_ENDIAN__ 7806 return __builtin_altivec_vpksdus(__b, __a); 7807 #else 7808 return __builtin_altivec_vpksdus(__a, __b); 7809 #endif 7810 } 7811 7812 static __inline__ vector unsigned int __ATTRS_o_ai 7813 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7814 #ifdef __LITTLE_ENDIAN__ 7815 return __builtin_altivec_vpkudus(__b, __a); 7816 #else 7817 return __builtin_altivec_vpkudus(__a, __b); 7818 #endif 7819 } 7820 #endif 7821 7822 /* vec_vpkshus */ 7823 7824 static __inline__ vector unsigned char __ATTRS_o_ai 7825 vec_vpkshus(vector short __a, vector short __b) { 7826 #ifdef __LITTLE_ENDIAN__ 7827 return __builtin_altivec_vpkshus(__b, __a); 7828 #else 7829 return __builtin_altivec_vpkshus(__a, __b); 7830 #endif 7831 } 7832 7833 static __inline__ vector unsigned char __ATTRS_o_ai 7834 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7835 #ifdef __LITTLE_ENDIAN__ 7836 return __builtin_altivec_vpkuhus(__b, __a); 7837 #else 7838 return __builtin_altivec_vpkuhus(__a, __b); 7839 #endif 7840 } 7841 7842 /* vec_vpkswus */ 7843 7844 static __inline__ vector unsigned short __ATTRS_o_ai 7845 vec_vpkswus(vector int __a, vector int __b) { 7846 #ifdef __LITTLE_ENDIAN__ 7847 return __builtin_altivec_vpkswus(__b, __a); 7848 #else 7849 return __builtin_altivec_vpkswus(__a, __b); 7850 #endif 7851 } 7852 7853 static __inline__ vector unsigned short __ATTRS_o_ai 7854 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7855 #ifdef __LITTLE_ENDIAN__ 7856 return __builtin_altivec_vpkuwus(__b, __a); 7857 #else 7858 return __builtin_altivec_vpkuwus(__a, __b); 7859 #endif 7860 } 7861 7862 /* vec_vpksdus */ 7863 7864 #ifdef __POWER8_VECTOR__ 7865 static __inline__ vector unsigned int __ATTRS_o_ai 7866 vec_vpksdus(vector long long __a, vector long long __b) { 7867 #ifdef __LITTLE_ENDIAN__ 7868 return __builtin_altivec_vpksdus(__b, __a); 7869 #else 7870 return __builtin_altivec_vpksdus(__a, __b); 7871 #endif 7872 } 7873 #endif 7874 7875 /* vec_perm */ 7876 7877 // The vperm instruction is defined architecturally with a big-endian bias. 7878 // For little endian, we swap the input operands and invert the permute 7879 // control vector. Only the rightmost 5 bits matter, so we could use 7880 // a vector of all 31s instead of all 255s to perform the inversion. 7881 // However, when the PCV is not a constant, using 255 has an advantage 7882 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7883 // later, possibly a vec_nand). 7884 7885 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7886 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7887 #ifdef __LITTLE_ENDIAN__ 7888 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7889 255, 255, 255, 255, 255, 255, 255, 255}; 7890 __d = vec_xor(__c, __d); 7891 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7892 (vector int)__a, __d); 7893 #else 7894 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7895 (vector int)__b, __c); 7896 #endif 7897 } 7898 7899 static __inline__ vector unsigned char __ATTRS_o_ai 7900 vec_perm(vector unsigned char __a, vector unsigned char __b, 7901 vector unsigned char __c) { 7902 #ifdef __LITTLE_ENDIAN__ 7903 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7904 255, 255, 255, 255, 255, 255, 255, 255}; 7905 __d = vec_xor(__c, __d); 7906 return (vector unsigned char)__builtin_altivec_vperm_4si( 7907 (vector int)__b, (vector int)__a, __d); 7908 #else 7909 return (vector unsigned char)__builtin_altivec_vperm_4si( 7910 (vector int)__a, (vector int)__b, __c); 7911 #endif 7912 } 7913 7914 static __inline__ vector bool char __ATTRS_o_ai 7915 vec_perm(vector bool char __a, vector bool char __b, 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 bool char)__builtin_altivec_vperm_4si((vector int)__b, 7921 (vector int)__a, __d); 7922 #else 7923 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7924 (vector int)__b, __c); 7925 #endif 7926 } 7927 7928 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7929 vector signed short __b, 7930 vector unsigned char __c) { 7931 #ifdef __LITTLE_ENDIAN__ 7932 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7933 255, 255, 255, 255, 255, 255, 255, 255}; 7934 __d = vec_xor(__c, __d); 7935 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 7936 (vector int)__a, __d); 7937 #else 7938 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 7939 (vector int)__b, __c); 7940 #endif 7941 } 7942 7943 static __inline__ vector unsigned short __ATTRS_o_ai 7944 vec_perm(vector unsigned short __a, vector unsigned short __b, 7945 vector unsigned char __c) { 7946 #ifdef __LITTLE_ENDIAN__ 7947 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7948 255, 255, 255, 255, 255, 255, 255, 255}; 7949 __d = vec_xor(__c, __d); 7950 return (vector unsigned short)__builtin_altivec_vperm_4si( 7951 (vector int)__b, (vector int)__a, __d); 7952 #else 7953 return (vector unsigned short)__builtin_altivec_vperm_4si( 7954 (vector int)__a, (vector int)__b, __c); 7955 #endif 7956 } 7957 7958 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 7959 vector bool short __a, vector bool short __b, 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 bool short)__builtin_altivec_vperm_4si((vector int)__b, 7965 (vector int)__a, __d); 7966 #else 7967 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 7968 (vector int)__b, __c); 7969 #endif 7970 } 7971 7972 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 7973 vector pixel __b, 7974 vector unsigned char __c) { 7975 #ifdef __LITTLE_ENDIAN__ 7976 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7977 255, 255, 255, 255, 255, 255, 255, 255}; 7978 __d = vec_xor(__c, __d); 7979 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 7980 (vector int)__a, __d); 7981 #else 7982 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 7983 (vector int)__b, __c); 7984 #endif 7985 } 7986 7987 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 7988 vector signed int __b, 7989 vector unsigned char __c) { 7990 #ifdef __LITTLE_ENDIAN__ 7991 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7992 255, 255, 255, 255, 255, 255, 255, 255}; 7993 __d = vec_xor(__c, __d); 7994 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 7995 #else 7996 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 7997 #endif 7998 } 7999 8000 static __inline__ vector unsigned int __ATTRS_o_ai 8001 vec_perm(vector unsigned int __a, vector unsigned int __b, 8002 vector unsigned char __c) { 8003 #ifdef __LITTLE_ENDIAN__ 8004 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8005 255, 255, 255, 255, 255, 255, 255, 255}; 8006 __d = vec_xor(__c, __d); 8007 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 8008 (vector int)__a, __d); 8009 #else 8010 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 8011 (vector int)__b, __c); 8012 #endif 8013 } 8014 8015 static __inline__ vector bool int __ATTRS_o_ai 8016 vec_perm(vector bool int __a, vector bool int __b, 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 bool int)__builtin_altivec_vperm_4si((vector int)__b, 8022 (vector int)__a, __d); 8023 #else 8024 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 8025 (vector int)__b, __c); 8026 #endif 8027 } 8028 8029 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 8030 vector float __b, 8031 vector unsigned char __c) { 8032 #ifdef __LITTLE_ENDIAN__ 8033 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8034 255, 255, 255, 255, 255, 255, 255, 255}; 8035 __d = vec_xor(__c, __d); 8036 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 8037 (vector int)__a, __d); 8038 #else 8039 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 8040 (vector int)__b, __c); 8041 #endif 8042 } 8043 8044 #ifdef __VSX__ 8045 static __inline__ vector long long __ATTRS_o_ai 8046 vec_perm(vector signed long long __a, vector signed long long __b, 8047 vector unsigned char __c) { 8048 #ifdef __LITTLE_ENDIAN__ 8049 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8050 255, 255, 255, 255, 255, 255, 255, 255}; 8051 __d = vec_xor(__c, __d); 8052 return (vector signed long long)__builtin_altivec_vperm_4si( 8053 (vector int)__b, (vector int)__a, __d); 8054 #else 8055 return (vector signed long long)__builtin_altivec_vperm_4si( 8056 (vector int)__a, (vector int)__b, __c); 8057 #endif 8058 } 8059 8060 static __inline__ vector unsigned long long __ATTRS_o_ai 8061 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 8062 vector unsigned char __c) { 8063 #ifdef __LITTLE_ENDIAN__ 8064 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8065 255, 255, 255, 255, 255, 255, 255, 255}; 8066 __d = vec_xor(__c, __d); 8067 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8068 (vector int)__b, (vector int)__a, __d); 8069 #else 8070 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8071 (vector int)__a, (vector int)__b, __c); 8072 #endif 8073 } 8074 8075 static __inline__ vector bool long long __ATTRS_o_ai 8076 vec_perm(vector bool long long __a, vector bool long long __b, 8077 vector unsigned char __c) { 8078 #ifdef __LITTLE_ENDIAN__ 8079 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8080 255, 255, 255, 255, 255, 255, 255, 255}; 8081 __d = vec_xor(__c, __d); 8082 return (vector bool long long)__builtin_altivec_vperm_4si( 8083 (vector int)__b, (vector int)__a, __d); 8084 #else 8085 return (vector bool long long)__builtin_altivec_vperm_4si( 8086 (vector int)__a, (vector int)__b, __c); 8087 #endif 8088 } 8089 8090 static __inline__ vector double __ATTRS_o_ai 8091 vec_perm(vector double __a, vector double __b, 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 double)__builtin_altivec_vperm_4si((vector int)__b, 8097 (vector int)__a, __d); 8098 #else 8099 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 8100 (vector int)__b, __c); 8101 #endif 8102 } 8103 #endif 8104 8105 /* vec_vperm */ 8106 8107 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 8108 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8109 return vec_perm(__a, __b, __c); 8110 } 8111 8112 static __inline__ vector unsigned char __ATTRS_o_ai 8113 vec_vperm(vector unsigned char __a, vector unsigned char __b, 8114 vector unsigned char __c) { 8115 return vec_perm(__a, __b, __c); 8116 } 8117 8118 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 8119 vector bool char __a, vector bool char __b, vector unsigned char __c) { 8120 return vec_perm(__a, __b, __c); 8121 } 8122 8123 static __inline__ vector short __ATTRS_o_ai 8124 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 8125 return vec_perm(__a, __b, __c); 8126 } 8127 8128 static __inline__ vector unsigned short __ATTRS_o_ai 8129 vec_vperm(vector unsigned short __a, vector unsigned short __b, 8130 vector unsigned char __c) { 8131 return vec_perm(__a, __b, __c); 8132 } 8133 8134 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 8135 vector bool short __a, vector bool short __b, vector unsigned char __c) { 8136 return vec_perm(__a, __b, __c); 8137 } 8138 8139 static __inline__ vector pixel __ATTRS_o_ai 8140 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 8141 return vec_perm(__a, __b, __c); 8142 } 8143 8144 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 8145 vector int __b, 8146 vector unsigned char __c) { 8147 return vec_perm(__a, __b, __c); 8148 } 8149 8150 static __inline__ vector unsigned int __ATTRS_o_ai 8151 vec_vperm(vector unsigned int __a, vector unsigned int __b, 8152 vector unsigned char __c) { 8153 return vec_perm(__a, __b, __c); 8154 } 8155 8156 static __inline__ vector bool int __ATTRS_o_ai 8157 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8158 return vec_perm(__a, __b, __c); 8159 } 8160 8161 static __inline__ vector float __ATTRS_o_ai 8162 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 8163 return vec_perm(__a, __b, __c); 8164 } 8165 8166 #ifdef __VSX__ 8167 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 8168 vector long long __a, vector long long __b, vector unsigned char __c) { 8169 return vec_perm(__a, __b, __c); 8170 } 8171 8172 static __inline__ vector unsigned long long __ATTRS_o_ai 8173 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 8174 vector unsigned char __c) { 8175 return vec_perm(__a, __b, __c); 8176 } 8177 8178 static __inline__ vector double __ATTRS_o_ai 8179 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 8180 return vec_perm(__a, __b, __c); 8181 } 8182 #endif 8183 8184 /* vec_re */ 8185 8186 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 8187 #ifdef __VSX__ 8188 return __builtin_vsx_xvresp(__a); 8189 #else 8190 return __builtin_altivec_vrefp(__a); 8191 #endif 8192 } 8193 8194 #ifdef __VSX__ 8195 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 8196 return __builtin_vsx_xvredp(__a); 8197 } 8198 #endif 8199 8200 /* vec_vrefp */ 8201 8202 static __inline__ vector float __attribute__((__always_inline__)) 8203 vec_vrefp(vector float __a) { 8204 return __builtin_altivec_vrefp(__a); 8205 } 8206 8207 /* vec_rl */ 8208 8209 static __inline__ vector signed char __ATTRS_o_ai 8210 vec_rl(vector signed char __a, vector unsigned char __b) { 8211 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8212 } 8213 8214 static __inline__ vector unsigned char __ATTRS_o_ai 8215 vec_rl(vector unsigned char __a, vector unsigned char __b) { 8216 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8217 } 8218 8219 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 8220 vector unsigned short __b) { 8221 return __builtin_altivec_vrlh(__a, __b); 8222 } 8223 8224 static __inline__ vector unsigned short __ATTRS_o_ai 8225 vec_rl(vector unsigned short __a, vector unsigned short __b) { 8226 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8227 } 8228 8229 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 8230 vector unsigned int __b) { 8231 return __builtin_altivec_vrlw(__a, __b); 8232 } 8233 8234 static __inline__ vector unsigned int __ATTRS_o_ai 8235 vec_rl(vector unsigned int __a, vector unsigned int __b) { 8236 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8237 } 8238 8239 #ifdef __POWER8_VECTOR__ 8240 static __inline__ vector signed long long __ATTRS_o_ai 8241 vec_rl(vector signed long long __a, vector unsigned long long __b) { 8242 return __builtin_altivec_vrld(__a, __b); 8243 } 8244 8245 static __inline__ vector unsigned long long __ATTRS_o_ai 8246 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 8247 return __builtin_altivec_vrld(__a, __b); 8248 } 8249 #endif 8250 8251 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8252 static __inline__ vector signed __int128 __ATTRS_o_ai 8253 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { 8254 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a)); 8255 } 8256 8257 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8258 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 8259 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); 8260 } 8261 #endif 8262 8263 /* vec_rlmi */ 8264 #ifdef __POWER9_VECTOR__ 8265 static __inline__ vector unsigned int __ATTRS_o_ai 8266 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 8267 vector unsigned int __c) { 8268 return __builtin_altivec_vrlwmi(__a, __c, __b); 8269 } 8270 8271 static __inline__ vector unsigned long long __ATTRS_o_ai 8272 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 8273 vector unsigned long long __c) { 8274 return __builtin_altivec_vrldmi(__a, __c, __b); 8275 } 8276 #endif 8277 8278 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8279 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8280 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, 8281 vector unsigned __int128 __c) { 8282 return __builtin_altivec_vrlqmi(__a, __c, __b); 8283 } 8284 8285 static __inline__ vector signed __int128 __ATTRS_o_ai 8286 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, 8287 vector signed __int128 __c) { 8288 return __builtin_altivec_vrlqmi(__a, __c, __b); 8289 } 8290 #endif 8291 8292 /* vec_rlnm */ 8293 #ifdef __POWER9_VECTOR__ 8294 static __inline__ vector unsigned int __ATTRS_o_ai 8295 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 8296 vector unsigned int __c) { 8297 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 8298 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 8299 } 8300 8301 static __inline__ vector unsigned long long __ATTRS_o_ai 8302 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 8303 vector unsigned long long __c) { 8304 vector unsigned long long OneByte = { 0x8, 0x8 }; 8305 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 8306 } 8307 #endif 8308 8309 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8310 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8311 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, 8312 vector unsigned __int128 __c) { 8313 // Merge __b and __c using an appropriate shuffle. 8314 vector unsigned char TmpB = (vector unsigned char)__b; 8315 vector unsigned char TmpC = (vector unsigned char)__c; 8316 vector unsigned char MaskAndShift = 8317 #ifdef __LITTLE_ENDIAN__ 8318 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8319 1, -1, -1, -1, -1, -1); 8320 #else 8321 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8322 -1, -1, -1, -1, -1, -1, -1); 8323 #endif 8324 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8325 } 8326 8327 static __inline__ vector signed __int128 __ATTRS_o_ai 8328 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, 8329 vector signed __int128 __c) { 8330 // Merge __b and __c using an appropriate shuffle. 8331 vector unsigned char TmpB = (vector unsigned char)__b; 8332 vector unsigned char TmpC = (vector unsigned char)__c; 8333 vector unsigned char MaskAndShift = 8334 #ifdef __LITTLE_ENDIAN__ 8335 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8336 1, -1, -1, -1, -1, -1); 8337 #else 8338 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8339 -1, -1, -1, -1, -1, -1, -1); 8340 #endif 8341 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8342 } 8343 #endif 8344 8345 /* vec_vrlb */ 8346 8347 static __inline__ vector signed char __ATTRS_o_ai 8348 vec_vrlb(vector signed char __a, vector unsigned char __b) { 8349 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8350 } 8351 8352 static __inline__ vector unsigned char __ATTRS_o_ai 8353 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 8354 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8355 } 8356 8357 /* vec_vrlh */ 8358 8359 static __inline__ vector short __ATTRS_o_ai 8360 vec_vrlh(vector short __a, vector unsigned short __b) { 8361 return __builtin_altivec_vrlh(__a, __b); 8362 } 8363 8364 static __inline__ vector unsigned short __ATTRS_o_ai 8365 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 8366 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8367 } 8368 8369 /* vec_vrlw */ 8370 8371 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 8372 vector unsigned int __b) { 8373 return __builtin_altivec_vrlw(__a, __b); 8374 } 8375 8376 static __inline__ vector unsigned int __ATTRS_o_ai 8377 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 8378 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8379 } 8380 8381 /* vec_round */ 8382 8383 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 8384 #ifdef __VSX__ 8385 return __builtin_vsx_xvrspi(__a); 8386 #else 8387 return __builtin_altivec_vrfin(__a); 8388 #endif 8389 } 8390 8391 #ifdef __VSX__ 8392 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8393 return __builtin_vsx_xvrdpi(__a); 8394 } 8395 8396 /* vec_rint */ 8397 8398 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 8399 return __builtin_vsx_xvrspic(__a); 8400 } 8401 8402 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 8403 return __builtin_vsx_xvrdpic(__a); 8404 } 8405 8406 /* vec_roundc */ 8407 8408 static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { 8409 return __builtin_vsx_xvrspic(__a); 8410 } 8411 8412 static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { 8413 return __builtin_vsx_xvrdpic(__a); 8414 } 8415 8416 /* vec_nearbyint */ 8417 8418 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 8419 return __builtin_vsx_xvrspi(__a); 8420 } 8421 8422 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 8423 return __builtin_vsx_xvrdpi(__a); 8424 } 8425 #endif 8426 8427 /* vec_vrfin */ 8428 8429 static __inline__ vector float __attribute__((__always_inline__)) 8430 vec_vrfin(vector float __a) { 8431 return __builtin_altivec_vrfin(__a); 8432 } 8433 8434 /* vec_sqrt */ 8435 8436 #ifdef __VSX__ 8437 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 8438 return __builtin_vsx_xvsqrtsp(__a); 8439 } 8440 8441 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 8442 return __builtin_vsx_xvsqrtdp(__a); 8443 } 8444 #endif 8445 8446 /* vec_rsqrte */ 8447 8448 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 8449 #ifdef __VSX__ 8450 return __builtin_vsx_xvrsqrtesp(__a); 8451 #else 8452 return __builtin_altivec_vrsqrtefp(__a); 8453 #endif 8454 } 8455 8456 #ifdef __VSX__ 8457 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 8458 return __builtin_vsx_xvrsqrtedp(__a); 8459 } 8460 #endif 8461 8462 static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { 8463 return __builtin_ppc_rsqrtf(__a); 8464 } 8465 8466 #ifdef __VSX__ 8467 static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { 8468 return __builtin_ppc_rsqrtd(__a); 8469 } 8470 #endif 8471 8472 /* vec_vrsqrtefp */ 8473 8474 static __inline__ __vector float __attribute__((__always_inline__)) 8475 vec_vrsqrtefp(vector float __a) { 8476 return __builtin_altivec_vrsqrtefp(__a); 8477 } 8478 8479 /* vec_xvtsqrt */ 8480 8481 #ifdef __VSX__ 8482 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { 8483 return __builtin_vsx_xvtsqrtdp(__a); 8484 } 8485 8486 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { 8487 return __builtin_vsx_xvtsqrtsp(__a); 8488 } 8489 #endif 8490 8491 /* vec_sel */ 8492 8493 #define __builtin_altivec_vsel_4si vec_sel 8494 8495 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 8496 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8497 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8498 } 8499 8500 static __inline__ vector signed char __ATTRS_o_ai 8501 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 8502 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8503 } 8504 8505 static __inline__ vector unsigned char __ATTRS_o_ai 8506 vec_sel(vector unsigned char __a, vector unsigned char __b, 8507 vector unsigned char __c) { 8508 return (__a & ~__c) | (__b & __c); 8509 } 8510 8511 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 8512 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8513 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8514 } 8515 8516 static __inline__ vector bool char __ATTRS_o_ai 8517 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8518 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8519 } 8520 8521 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 8522 vector bool char __b, 8523 vector bool char __c) { 8524 return (__a & ~__c) | (__b & __c); 8525 } 8526 8527 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8528 vector short __b, 8529 vector unsigned short __c) { 8530 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8531 } 8532 8533 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8534 vector short __b, 8535 vector bool short __c) { 8536 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8537 } 8538 8539 static __inline__ vector unsigned short __ATTRS_o_ai 8540 vec_sel(vector unsigned short __a, vector unsigned short __b, 8541 vector unsigned short __c) { 8542 return (__a & ~__c) | (__b & __c); 8543 } 8544 8545 static __inline__ vector unsigned short __ATTRS_o_ai 8546 vec_sel(vector unsigned short __a, vector unsigned short __b, 8547 vector bool short __c) { 8548 return (__a & ~(vector unsigned short)__c) | 8549 (__b & (vector unsigned short)__c); 8550 } 8551 8552 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 8553 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8554 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8555 } 8556 8557 static __inline__ vector bool short __ATTRS_o_ai 8558 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 8559 return (__a & ~__c) | (__b & __c); 8560 } 8561 8562 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8563 vector int __b, 8564 vector unsigned int __c) { 8565 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8566 } 8567 8568 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8569 vector int __b, 8570 vector bool int __c) { 8571 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8572 } 8573 8574 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 8575 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8576 return (__a & ~__c) | (__b & __c); 8577 } 8578 8579 static __inline__ vector unsigned int __ATTRS_o_ai 8580 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8581 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8582 } 8583 8584 static __inline__ vector bool int __ATTRS_o_ai 8585 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8586 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8587 } 8588 8589 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 8590 vector bool int __b, 8591 vector bool int __c) { 8592 return (__a & ~__c) | (__b & __c); 8593 } 8594 8595 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8596 vector float __b, 8597 vector unsigned int __c) { 8598 vector int __res = ((vector int)__a & ~(vector int)__c) | 8599 ((vector int)__b & (vector int)__c); 8600 return (vector float)__res; 8601 } 8602 8603 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8604 vector float __b, 8605 vector bool int __c) { 8606 vector int __res = ((vector int)__a & ~(vector int)__c) | 8607 ((vector int)__b & (vector int)__c); 8608 return (vector float)__res; 8609 } 8610 8611 #ifdef __VSX__ 8612 static __inline__ vector double __ATTRS_o_ai 8613 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 8614 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8615 ((vector long long)__b & (vector long long)__c); 8616 return (vector double)__res; 8617 } 8618 8619 static __inline__ vector double __ATTRS_o_ai 8620 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 8621 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8622 ((vector long long)__b & (vector long long)__c); 8623 return (vector double)__res; 8624 } 8625 8626 static __inline__ vector bool long long __ATTRS_o_ai 8627 vec_sel(vector bool long long __a, vector bool long long __b, 8628 vector bool long long __c) { 8629 return (__a & ~__c) | (__b & __c); 8630 } 8631 8632 static __inline__ vector bool long long __ATTRS_o_ai 8633 vec_sel(vector bool long long __a, vector bool long long __b, 8634 vector unsigned long long __c) { 8635 return (__a & ~(vector bool long long)__c) | 8636 (__b & (vector bool long long)__c); 8637 } 8638 8639 static __inline__ vector signed long long __ATTRS_o_ai 8640 vec_sel(vector signed long long __a, vector signed long long __b, 8641 vector bool long long __c) { 8642 return (__a & ~(vector signed long long)__c) | 8643 (__b & (vector signed long long)__c); 8644 } 8645 8646 static __inline__ vector signed long long __ATTRS_o_ai 8647 vec_sel(vector signed long long __a, vector signed long long __b, 8648 vector unsigned long long __c) { 8649 return (__a & ~(vector signed long long)__c) | 8650 (__b & (vector signed long long)__c); 8651 } 8652 8653 static __inline__ vector unsigned long long __ATTRS_o_ai 8654 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8655 vector bool long long __c) { 8656 return (__a & ~(vector unsigned long long)__c) | 8657 (__b & (vector unsigned long long)__c); 8658 } 8659 8660 static __inline__ vector unsigned long long __ATTRS_o_ai 8661 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8662 vector unsigned long long __c) { 8663 return (__a & ~__c) | (__b & __c); 8664 } 8665 #endif 8666 8667 /* vec_vsel */ 8668 8669 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 8670 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8671 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8672 } 8673 8674 static __inline__ vector signed char __ATTRS_o_ai 8675 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 8676 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8677 } 8678 8679 static __inline__ vector unsigned char __ATTRS_o_ai 8680 vec_vsel(vector unsigned char __a, vector unsigned char __b, 8681 vector unsigned char __c) { 8682 return (__a & ~__c) | (__b & __c); 8683 } 8684 8685 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 8686 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8687 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8688 } 8689 8690 static __inline__ vector bool char __ATTRS_o_ai 8691 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8692 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8693 } 8694 8695 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 8696 vector bool char __b, 8697 vector bool char __c) { 8698 return (__a & ~__c) | (__b & __c); 8699 } 8700 8701 static __inline__ vector short __ATTRS_o_ai 8702 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8703 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8704 } 8705 8706 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8707 vector short __b, 8708 vector bool short __c) { 8709 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8710 } 8711 8712 static __inline__ vector unsigned short __ATTRS_o_ai 8713 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8714 vector unsigned short __c) { 8715 return (__a & ~__c) | (__b & __c); 8716 } 8717 8718 static __inline__ vector unsigned short __ATTRS_o_ai 8719 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8720 vector bool short __c) { 8721 return (__a & ~(vector unsigned short)__c) | 8722 (__b & (vector unsigned short)__c); 8723 } 8724 8725 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8726 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8727 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8728 } 8729 8730 static __inline__ vector bool short __ATTRS_o_ai 8731 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8732 return (__a & ~__c) | (__b & __c); 8733 } 8734 8735 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8736 vector int __b, 8737 vector unsigned int __c) { 8738 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8739 } 8740 8741 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8742 vector int __b, 8743 vector bool int __c) { 8744 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8745 } 8746 8747 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8748 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8749 return (__a & ~__c) | (__b & __c); 8750 } 8751 8752 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8753 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8754 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8755 } 8756 8757 static __inline__ vector bool int __ATTRS_o_ai 8758 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8759 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8760 } 8761 8762 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8763 vector bool int __b, 8764 vector bool int __c) { 8765 return (__a & ~__c) | (__b & __c); 8766 } 8767 8768 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8769 vector float __b, 8770 vector unsigned int __c) { 8771 vector int __res = ((vector int)__a & ~(vector int)__c) | 8772 ((vector int)__b & (vector int)__c); 8773 return (vector float)__res; 8774 } 8775 8776 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8777 vector float __b, 8778 vector bool int __c) { 8779 vector int __res = ((vector int)__a & ~(vector int)__c) | 8780 ((vector int)__b & (vector int)__c); 8781 return (vector float)__res; 8782 } 8783 8784 /* vec_sl */ 8785 8786 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8787 // than the length of __a. 8788 static __inline__ vector unsigned char __ATTRS_o_ai 8789 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8790 return __a << (__b % 8791 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8792 } 8793 8794 static __inline__ vector signed char __ATTRS_o_ai 8795 vec_sl(vector signed char __a, vector unsigned char __b) { 8796 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8797 } 8798 8799 static __inline__ vector unsigned short __ATTRS_o_ai 8800 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8801 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8802 __CHAR_BIT__)); 8803 } 8804 8805 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8806 vector unsigned short __b) { 8807 return (vector short)vec_sl((vector unsigned short)__a, __b); 8808 } 8809 8810 static __inline__ vector unsigned int __ATTRS_o_ai 8811 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8812 return __a << (__b % 8813 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8814 } 8815 8816 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8817 vector unsigned int __b) { 8818 return (vector int)vec_sl((vector unsigned int)__a, __b); 8819 } 8820 8821 #ifdef __POWER8_VECTOR__ 8822 static __inline__ vector unsigned long long __ATTRS_o_ai 8823 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8824 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8825 __CHAR_BIT__)); 8826 } 8827 8828 static __inline__ vector long long __ATTRS_o_ai 8829 vec_sl(vector long long __a, vector unsigned long long __b) { 8830 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8831 } 8832 #else 8833 static __inline__ vector unsigned char __ATTRS_o_ai 8834 vec_vspltb(vector unsigned char __a, unsigned char __b); 8835 static __inline__ vector unsigned long long __ATTRS_o_ai 8836 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8837 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 8838 8839 // Big endian element one (the right doubleword) can be left shifted as-is. 8840 // The other element needs to be swapped into the right doubleword and 8841 // shifted. Then the right doublewords of the two result vectors are merged. 8842 vector signed long long __rightelt = 8843 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8844 (vector signed int)__b); 8845 #ifdef __LITTLE_ENDIAN__ 8846 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8847 (vector signed int)__rightelt, 8848 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8849 #else 8850 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8851 (vector signed int)__rightelt, 8852 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8853 #endif 8854 __a = __builtin_shufflevector(__a, __a, 1, 0); 8855 __b = __builtin_shufflevector(__b, __b, 1, 0); 8856 vector signed long long __leftelt = 8857 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8858 (vector signed int)__b); 8859 #ifdef __LITTLE_ENDIAN__ 8860 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8861 (vector signed int)__leftelt, 8862 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8863 return (vector unsigned long long)__builtin_shufflevector(__rightelt, 8864 __leftelt, 0, 2); 8865 #else 8866 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8867 (vector signed int)__leftelt, 8868 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8869 return (vector unsigned long long)__builtin_shufflevector(__leftelt, 8870 __rightelt, 1, 3); 8871 #endif 8872 } 8873 8874 static __inline__ vector long long __ATTRS_o_ai 8875 vec_sl(vector long long __a, vector unsigned long long __b) { 8876 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8877 } 8878 #endif 8879 8880 /* vec_vslb */ 8881 8882 #define __builtin_altivec_vslb vec_vslb 8883 8884 static __inline__ vector signed char __ATTRS_o_ai 8885 vec_vslb(vector signed char __a, vector unsigned char __b) { 8886 return vec_sl(__a, __b); 8887 } 8888 8889 static __inline__ vector unsigned char __ATTRS_o_ai 8890 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8891 return vec_sl(__a, __b); 8892 } 8893 8894 /* vec_vslh */ 8895 8896 #define __builtin_altivec_vslh vec_vslh 8897 8898 static __inline__ vector short __ATTRS_o_ai 8899 vec_vslh(vector short __a, vector unsigned short __b) { 8900 return vec_sl(__a, __b); 8901 } 8902 8903 static __inline__ vector unsigned short __ATTRS_o_ai 8904 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8905 return vec_sl(__a, __b); 8906 } 8907 8908 /* vec_vslw */ 8909 8910 #define __builtin_altivec_vslw vec_vslw 8911 8912 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8913 vector unsigned int __b) { 8914 return vec_sl(__a, __b); 8915 } 8916 8917 static __inline__ vector unsigned int __ATTRS_o_ai 8918 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 8919 return vec_sl(__a, __b); 8920 } 8921 8922 /* vec_sld */ 8923 8924 #define __builtin_altivec_vsldoi_4si vec_sld 8925 8926 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 8927 vector signed char __a, vector signed char __b, unsigned const int __c) { 8928 unsigned char __d = __c & 0x0F; 8929 #ifdef __LITTLE_ENDIAN__ 8930 return vec_perm( 8931 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8932 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8933 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8934 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8935 #else 8936 return vec_perm( 8937 __a, __b, 8938 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8939 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8940 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8941 #endif 8942 } 8943 8944 static __inline__ vector unsigned char __ATTRS_o_ai 8945 vec_sld(vector unsigned char __a, vector unsigned char __b, 8946 unsigned const int __c) { 8947 unsigned char __d = __c & 0x0F; 8948 #ifdef __LITTLE_ENDIAN__ 8949 return vec_perm( 8950 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8951 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8952 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8953 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8954 #else 8955 return vec_perm( 8956 __a, __b, 8957 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8958 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8959 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8960 #endif 8961 } 8962 8963 static __inline__ vector bool char __ATTRS_o_ai 8964 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 8965 unsigned char __d = __c & 0x0F; 8966 #ifdef __LITTLE_ENDIAN__ 8967 return vec_perm( 8968 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8969 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8970 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8971 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8972 #else 8973 return vec_perm( 8974 __a, __b, 8975 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8976 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8977 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8978 #endif 8979 } 8980 8981 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 8982 vector signed short __a, vector signed short __b, unsigned const int __c) { 8983 unsigned char __d = __c & 0x0F; 8984 #ifdef __LITTLE_ENDIAN__ 8985 return vec_perm( 8986 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8987 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8988 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8989 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8990 #else 8991 return vec_perm( 8992 __a, __b, 8993 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8994 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8995 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8996 #endif 8997 } 8998 8999 static __inline__ vector unsigned short __ATTRS_o_ai 9000 vec_sld(vector unsigned short __a, vector unsigned short __b, 9001 unsigned const int __c) { 9002 unsigned char __d = __c & 0x0F; 9003 #ifdef __LITTLE_ENDIAN__ 9004 return vec_perm( 9005 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9006 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9007 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9008 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9009 #else 9010 return vec_perm( 9011 __a, __b, 9012 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9013 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9014 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9015 #endif 9016 } 9017 9018 static __inline__ vector bool short __ATTRS_o_ai 9019 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 9020 unsigned char __d = __c & 0x0F; 9021 #ifdef __LITTLE_ENDIAN__ 9022 return vec_perm( 9023 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9024 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9025 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9026 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9027 #else 9028 return vec_perm( 9029 __a, __b, 9030 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9031 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9032 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9033 #endif 9034 } 9035 9036 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 9037 vector pixel __b, 9038 unsigned const int __c) { 9039 unsigned char __d = __c & 0x0F; 9040 #ifdef __LITTLE_ENDIAN__ 9041 return vec_perm( 9042 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9043 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9044 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9045 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9046 #else 9047 return vec_perm( 9048 __a, __b, 9049 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9050 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9051 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9052 #endif 9053 } 9054 9055 static __inline__ vector signed int __ATTRS_o_ai 9056 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 9057 unsigned char __d = __c & 0x0F; 9058 #ifdef __LITTLE_ENDIAN__ 9059 return vec_perm( 9060 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9061 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9062 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9063 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9064 #else 9065 return vec_perm( 9066 __a, __b, 9067 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9068 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9069 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9070 #endif 9071 } 9072 9073 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 9074 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9075 unsigned char __d = __c & 0x0F; 9076 #ifdef __LITTLE_ENDIAN__ 9077 return vec_perm( 9078 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9079 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9080 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9081 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9082 #else 9083 return vec_perm( 9084 __a, __b, 9085 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9086 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9087 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9088 #endif 9089 } 9090 9091 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 9092 vector bool int __b, 9093 unsigned const int __c) { 9094 unsigned char __d = __c & 0x0F; 9095 #ifdef __LITTLE_ENDIAN__ 9096 return vec_perm( 9097 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9098 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9099 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9100 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9101 #else 9102 return vec_perm( 9103 __a, __b, 9104 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9105 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9106 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9107 #endif 9108 } 9109 9110 static __inline__ vector float __ATTRS_o_ai vec_sld(vector float __a, 9111 vector float __b, 9112 unsigned const int __c) { 9113 unsigned char __d = __c & 0x0F; 9114 #ifdef __LITTLE_ENDIAN__ 9115 return vec_perm( 9116 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9117 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9118 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9119 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9120 #else 9121 return vec_perm( 9122 __a, __b, 9123 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9124 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9125 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9126 #endif 9127 } 9128 9129 #ifdef __VSX__ 9130 static __inline__ vector bool long long __ATTRS_o_ai 9131 vec_sld(vector bool long long __a, vector bool long long __b, 9132 unsigned const int __c) { 9133 unsigned char __d = __c & 0x0F; 9134 #ifdef __LITTLE_ENDIAN__ 9135 return vec_perm( 9136 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9137 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9138 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9139 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9140 #else 9141 return vec_perm( 9142 __a, __b, 9143 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9144 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9145 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9146 #endif 9147 } 9148 9149 static __inline__ vector signed long long __ATTRS_o_ai 9150 vec_sld(vector signed long long __a, vector signed long long __b, 9151 unsigned const int __c) { 9152 unsigned char __d = __c & 0x0F; 9153 #ifdef __LITTLE_ENDIAN__ 9154 return vec_perm( 9155 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9156 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9157 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9158 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9159 #else 9160 return vec_perm( 9161 __a, __b, 9162 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9163 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9164 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9165 #endif 9166 } 9167 9168 static __inline__ vector unsigned long long __ATTRS_o_ai 9169 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 9170 unsigned const int __c) { 9171 unsigned char __d = __c & 0x0F; 9172 #ifdef __LITTLE_ENDIAN__ 9173 return vec_perm( 9174 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9175 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9176 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9177 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9178 #else 9179 return vec_perm( 9180 __a, __b, 9181 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9182 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9183 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9184 #endif 9185 } 9186 9187 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 9188 vector double __b, 9189 unsigned const int __c) { 9190 unsigned char __d = __c & 0x0F; 9191 #ifdef __LITTLE_ENDIAN__ 9192 return vec_perm( 9193 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9194 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9195 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9196 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9197 #else 9198 return vec_perm( 9199 __a, __b, 9200 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9201 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9202 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9203 #endif 9204 } 9205 #endif 9206 9207 /* vec_sldw */ 9208 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 9209 vector signed char __a, vector signed char __b, unsigned const int __c) { 9210 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9211 } 9212 9213 static __inline__ vector unsigned char __ATTRS_o_ai 9214 vec_sldw(vector unsigned char __a, vector unsigned char __b, 9215 unsigned const int __c) { 9216 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9217 } 9218 9219 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 9220 vector signed short __a, vector signed short __b, unsigned const int __c) { 9221 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9222 } 9223 9224 static __inline__ vector unsigned short __ATTRS_o_ai 9225 vec_sldw(vector unsigned short __a, vector unsigned short __b, 9226 unsigned const int __c) { 9227 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9228 } 9229 9230 static __inline__ vector signed int __ATTRS_o_ai 9231 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 9232 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9233 } 9234 9235 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 9236 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9237 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9238 } 9239 9240 static __inline__ vector float __ATTRS_o_ai vec_sldw( 9241 vector float __a, vector float __b, unsigned const int __c) { 9242 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9243 } 9244 9245 #ifdef __VSX__ 9246 static __inline__ vector signed long long __ATTRS_o_ai 9247 vec_sldw(vector signed long long __a, vector signed long long __b, 9248 unsigned const int __c) { 9249 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9250 } 9251 9252 static __inline__ vector unsigned long long __ATTRS_o_ai 9253 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 9254 unsigned const int __c) { 9255 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9256 } 9257 9258 static __inline__ vector double __ATTRS_o_ai vec_sldw( 9259 vector double __a, vector double __b, unsigned const int __c) { 9260 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9261 } 9262 #endif 9263 9264 #ifdef __POWER9_VECTOR__ 9265 /* vec_slv */ 9266 static __inline__ vector unsigned char __ATTRS_o_ai 9267 vec_slv(vector unsigned char __a, vector unsigned char __b) { 9268 return __builtin_altivec_vslv(__a, __b); 9269 } 9270 9271 /* vec_srv */ 9272 static __inline__ vector unsigned char __ATTRS_o_ai 9273 vec_srv(vector unsigned char __a, vector unsigned char __b) { 9274 return __builtin_altivec_vsrv(__a, __b); 9275 } 9276 #endif 9277 9278 /* vec_vsldoi */ 9279 9280 static __inline__ vector signed char __ATTRS_o_ai 9281 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 9282 unsigned char __d = __c & 0x0F; 9283 #ifdef __LITTLE_ENDIAN__ 9284 return vec_perm( 9285 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9286 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9287 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9288 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9289 #else 9290 return vec_perm( 9291 __a, __b, 9292 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9293 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9294 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9295 #endif 9296 } 9297 9298 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 9299 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 9300 unsigned char __d = __c & 0x0F; 9301 #ifdef __LITTLE_ENDIAN__ 9302 return vec_perm( 9303 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9304 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9305 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9306 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9307 #else 9308 return vec_perm( 9309 __a, __b, 9310 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9311 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9312 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9313 #endif 9314 } 9315 9316 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 9317 vector short __b, 9318 unsigned char __c) { 9319 unsigned char __d = __c & 0x0F; 9320 #ifdef __LITTLE_ENDIAN__ 9321 return vec_perm( 9322 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9323 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9324 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9325 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9326 #else 9327 return vec_perm( 9328 __a, __b, 9329 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9330 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9331 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9332 #endif 9333 } 9334 9335 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 9336 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 9337 unsigned char __d = __c & 0x0F; 9338 #ifdef __LITTLE_ENDIAN__ 9339 return vec_perm( 9340 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9341 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9342 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9343 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9344 #else 9345 return vec_perm( 9346 __a, __b, 9347 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9348 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9349 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9350 #endif 9351 } 9352 9353 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 9354 vector pixel __b, 9355 unsigned char __c) { 9356 unsigned char __d = __c & 0x0F; 9357 #ifdef __LITTLE_ENDIAN__ 9358 return vec_perm( 9359 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9360 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9361 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9362 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9363 #else 9364 return vec_perm( 9365 __a, __b, 9366 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9367 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9368 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9369 #endif 9370 } 9371 9372 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 9373 vector int __b, 9374 unsigned char __c) { 9375 unsigned char __d = __c & 0x0F; 9376 #ifdef __LITTLE_ENDIAN__ 9377 return vec_perm( 9378 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9379 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9380 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9381 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9382 #else 9383 return vec_perm( 9384 __a, __b, 9385 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9386 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9387 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9388 #endif 9389 } 9390 9391 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 9392 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 9393 unsigned char __d = __c & 0x0F; 9394 #ifdef __LITTLE_ENDIAN__ 9395 return vec_perm( 9396 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9397 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9398 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9399 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9400 #else 9401 return vec_perm( 9402 __a, __b, 9403 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9404 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9405 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9406 #endif 9407 } 9408 9409 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 9410 vector float __b, 9411 unsigned char __c) { 9412 unsigned char __d = __c & 0x0F; 9413 #ifdef __LITTLE_ENDIAN__ 9414 return vec_perm( 9415 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9416 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9417 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9418 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9419 #else 9420 return vec_perm( 9421 __a, __b, 9422 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9423 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9424 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9425 #endif 9426 } 9427 9428 /* vec_sll */ 9429 9430 static __inline__ vector signed char __ATTRS_o_ai 9431 vec_sll(vector signed char __a, vector unsigned char __b) { 9432 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9433 (vector int)__b); 9434 } 9435 9436 static __inline__ vector signed char __ATTRS_o_ai 9437 vec_sll(vector signed char __a, vector unsigned short __b) { 9438 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9439 (vector int)__b); 9440 } 9441 9442 static __inline__ vector signed char __ATTRS_o_ai 9443 vec_sll(vector signed char __a, vector unsigned int __b) { 9444 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9445 (vector int)__b); 9446 } 9447 9448 static __inline__ vector unsigned char __ATTRS_o_ai 9449 vec_sll(vector unsigned char __a, vector unsigned char __b) { 9450 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9451 (vector int)__b); 9452 } 9453 9454 static __inline__ vector unsigned char __ATTRS_o_ai 9455 vec_sll(vector unsigned char __a, vector unsigned short __b) { 9456 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9457 (vector int)__b); 9458 } 9459 9460 static __inline__ vector unsigned char __ATTRS_o_ai 9461 vec_sll(vector unsigned char __a, vector unsigned int __b) { 9462 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9463 (vector int)__b); 9464 } 9465 9466 static __inline__ vector bool char __ATTRS_o_ai 9467 vec_sll(vector bool char __a, vector unsigned char __b) { 9468 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9469 (vector int)__b); 9470 } 9471 9472 static __inline__ vector bool char __ATTRS_o_ai 9473 vec_sll(vector bool char __a, vector unsigned short __b) { 9474 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9475 (vector int)__b); 9476 } 9477 9478 static __inline__ vector bool char __ATTRS_o_ai 9479 vec_sll(vector bool char __a, vector unsigned int __b) { 9480 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9481 (vector int)__b); 9482 } 9483 9484 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9485 vector unsigned char __b) { 9486 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9487 } 9488 9489 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9490 vector unsigned short __b) { 9491 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9492 } 9493 9494 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9495 vector unsigned int __b) { 9496 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9497 } 9498 9499 static __inline__ vector unsigned short __ATTRS_o_ai 9500 vec_sll(vector unsigned short __a, vector unsigned char __b) { 9501 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9502 (vector int)__b); 9503 } 9504 9505 static __inline__ vector unsigned short __ATTRS_o_ai 9506 vec_sll(vector unsigned short __a, vector unsigned short __b) { 9507 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9508 (vector int)__b); 9509 } 9510 9511 static __inline__ vector unsigned short __ATTRS_o_ai 9512 vec_sll(vector unsigned short __a, vector unsigned int __b) { 9513 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9514 (vector int)__b); 9515 } 9516 9517 static __inline__ vector bool short __ATTRS_o_ai 9518 vec_sll(vector bool short __a, vector unsigned char __b) { 9519 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9520 (vector int)__b); 9521 } 9522 9523 static __inline__ vector bool short __ATTRS_o_ai 9524 vec_sll(vector bool short __a, vector unsigned short __b) { 9525 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9526 (vector int)__b); 9527 } 9528 9529 static __inline__ vector bool short __ATTRS_o_ai 9530 vec_sll(vector bool short __a, vector unsigned int __b) { 9531 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9532 (vector int)__b); 9533 } 9534 9535 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9536 vector unsigned char __b) { 9537 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9538 } 9539 9540 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9541 vector unsigned short __b) { 9542 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9543 } 9544 9545 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9546 vector unsigned int __b) { 9547 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9548 } 9549 9550 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9551 vector unsigned char __b) { 9552 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9553 } 9554 9555 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9556 vector unsigned short __b) { 9557 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9558 } 9559 9560 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9561 vector unsigned int __b) { 9562 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9563 } 9564 9565 static __inline__ vector unsigned int __ATTRS_o_ai 9566 vec_sll(vector unsigned int __a, vector unsigned char __b) { 9567 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9568 (vector int)__b); 9569 } 9570 9571 static __inline__ vector unsigned int __ATTRS_o_ai 9572 vec_sll(vector unsigned int __a, vector unsigned short __b) { 9573 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9574 (vector int)__b); 9575 } 9576 9577 static __inline__ vector unsigned int __ATTRS_o_ai 9578 vec_sll(vector unsigned int __a, vector unsigned int __b) { 9579 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9580 (vector int)__b); 9581 } 9582 9583 static __inline__ vector bool int __ATTRS_o_ai 9584 vec_sll(vector bool int __a, vector unsigned char __b) { 9585 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9586 (vector int)__b); 9587 } 9588 9589 static __inline__ vector bool int __ATTRS_o_ai 9590 vec_sll(vector bool int __a, vector unsigned short __b) { 9591 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9592 (vector int)__b); 9593 } 9594 9595 static __inline__ vector bool int __ATTRS_o_ai 9596 vec_sll(vector bool int __a, vector unsigned int __b) { 9597 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9598 (vector int)__b); 9599 } 9600 9601 #ifdef __VSX__ 9602 static __inline__ vector signed long long __ATTRS_o_ai 9603 vec_sll(vector signed long long __a, vector unsigned char __b) { 9604 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 9605 (vector int)__b); 9606 } 9607 9608 static __inline__ vector unsigned long long __ATTRS_o_ai 9609 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 9610 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 9611 (vector int)__b); 9612 } 9613 #endif 9614 9615 /* vec_vsl */ 9616 9617 static __inline__ vector signed char __ATTRS_o_ai 9618 vec_vsl(vector signed char __a, vector unsigned char __b) { 9619 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9620 (vector int)__b); 9621 } 9622 9623 static __inline__ vector signed char __ATTRS_o_ai 9624 vec_vsl(vector signed char __a, vector unsigned short __b) { 9625 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9626 (vector int)__b); 9627 } 9628 9629 static __inline__ vector signed char __ATTRS_o_ai 9630 vec_vsl(vector signed char __a, vector unsigned int __b) { 9631 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9632 (vector int)__b); 9633 } 9634 9635 static __inline__ vector unsigned char __ATTRS_o_ai 9636 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 9637 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9638 (vector int)__b); 9639 } 9640 9641 static __inline__ vector unsigned char __ATTRS_o_ai 9642 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 9643 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9644 (vector int)__b); 9645 } 9646 9647 static __inline__ vector unsigned char __ATTRS_o_ai 9648 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 9649 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9650 (vector int)__b); 9651 } 9652 9653 static __inline__ vector bool char __ATTRS_o_ai 9654 vec_vsl(vector bool char __a, vector unsigned char __b) { 9655 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9656 (vector int)__b); 9657 } 9658 9659 static __inline__ vector bool char __ATTRS_o_ai 9660 vec_vsl(vector bool char __a, vector unsigned short __b) { 9661 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9662 (vector int)__b); 9663 } 9664 9665 static __inline__ vector bool char __ATTRS_o_ai 9666 vec_vsl(vector bool char __a, vector unsigned int __b) { 9667 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9668 (vector int)__b); 9669 } 9670 9671 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9672 vector unsigned char __b) { 9673 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9674 } 9675 9676 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9677 vector unsigned short __b) { 9678 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9679 } 9680 9681 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9682 vector unsigned int __b) { 9683 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9684 } 9685 9686 static __inline__ vector unsigned short __ATTRS_o_ai 9687 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 9688 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9689 (vector int)__b); 9690 } 9691 9692 static __inline__ vector unsigned short __ATTRS_o_ai 9693 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 9694 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9695 (vector int)__b); 9696 } 9697 9698 static __inline__ vector unsigned short __ATTRS_o_ai 9699 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 9700 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9701 (vector int)__b); 9702 } 9703 9704 static __inline__ vector bool short __ATTRS_o_ai 9705 vec_vsl(vector bool short __a, vector unsigned char __b) { 9706 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9707 (vector int)__b); 9708 } 9709 9710 static __inline__ vector bool short __ATTRS_o_ai 9711 vec_vsl(vector bool short __a, vector unsigned short __b) { 9712 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9713 (vector int)__b); 9714 } 9715 9716 static __inline__ vector bool short __ATTRS_o_ai 9717 vec_vsl(vector bool short __a, vector unsigned int __b) { 9718 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9719 (vector int)__b); 9720 } 9721 9722 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9723 vector unsigned char __b) { 9724 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9725 } 9726 9727 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9728 vector unsigned short __b) { 9729 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9730 } 9731 9732 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9733 vector unsigned int __b) { 9734 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9735 } 9736 9737 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9738 vector unsigned char __b) { 9739 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9740 } 9741 9742 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9743 vector unsigned short __b) { 9744 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9745 } 9746 9747 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9748 vector unsigned int __b) { 9749 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9750 } 9751 9752 static __inline__ vector unsigned int __ATTRS_o_ai 9753 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 9754 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9755 (vector int)__b); 9756 } 9757 9758 static __inline__ vector unsigned int __ATTRS_o_ai 9759 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9760 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9761 (vector int)__b); 9762 } 9763 9764 static __inline__ vector unsigned int __ATTRS_o_ai 9765 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9766 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9767 (vector int)__b); 9768 } 9769 9770 static __inline__ vector bool int __ATTRS_o_ai 9771 vec_vsl(vector bool int __a, vector unsigned char __b) { 9772 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9773 (vector int)__b); 9774 } 9775 9776 static __inline__ vector bool int __ATTRS_o_ai 9777 vec_vsl(vector bool int __a, vector unsigned short __b) { 9778 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9779 (vector int)__b); 9780 } 9781 9782 static __inline__ vector bool int __ATTRS_o_ai 9783 vec_vsl(vector bool int __a, vector unsigned int __b) { 9784 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9785 (vector int)__b); 9786 } 9787 9788 /* vec_slo */ 9789 9790 static __inline__ vector signed char __ATTRS_o_ai 9791 vec_slo(vector signed char __a, vector signed char __b) { 9792 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9793 (vector int)__b); 9794 } 9795 9796 static __inline__ vector signed char __ATTRS_o_ai 9797 vec_slo(vector signed char __a, vector unsigned char __b) { 9798 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9799 (vector int)__b); 9800 } 9801 9802 static __inline__ vector unsigned char __ATTRS_o_ai 9803 vec_slo(vector unsigned char __a, vector signed char __b) { 9804 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9805 (vector int)__b); 9806 } 9807 9808 static __inline__ vector unsigned char __ATTRS_o_ai 9809 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9810 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9811 (vector int)__b); 9812 } 9813 9814 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9815 vector signed char __b) { 9816 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9817 } 9818 9819 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9820 vector unsigned char __b) { 9821 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9822 } 9823 9824 static __inline__ vector unsigned short __ATTRS_o_ai 9825 vec_slo(vector unsigned short __a, vector signed char __b) { 9826 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9827 (vector int)__b); 9828 } 9829 9830 static __inline__ vector unsigned short __ATTRS_o_ai 9831 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9832 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9833 (vector int)__b); 9834 } 9835 9836 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9837 vector signed char __b) { 9838 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9839 } 9840 9841 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9842 vector unsigned char __b) { 9843 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9844 } 9845 9846 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9847 vector signed char __b) { 9848 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9849 } 9850 9851 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9852 vector unsigned char __b) { 9853 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9854 } 9855 9856 static __inline__ vector unsigned int __ATTRS_o_ai 9857 vec_slo(vector unsigned int __a, vector signed char __b) { 9858 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9859 (vector int)__b); 9860 } 9861 9862 static __inline__ vector unsigned int __ATTRS_o_ai 9863 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9864 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9865 (vector int)__b); 9866 } 9867 9868 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9869 vector signed char __b) { 9870 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9871 } 9872 9873 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9874 vector unsigned char __b) { 9875 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9876 } 9877 9878 #ifdef __VSX__ 9879 static __inline__ vector signed long long __ATTRS_o_ai 9880 vec_slo(vector signed long long __a, vector signed char __b) { 9881 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9882 (vector int)__b); 9883 } 9884 9885 static __inline__ vector signed long long __ATTRS_o_ai 9886 vec_slo(vector signed long long __a, vector unsigned char __b) { 9887 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9888 (vector int)__b); 9889 } 9890 9891 static __inline__ vector unsigned long long __ATTRS_o_ai 9892 vec_slo(vector unsigned long long __a, vector signed char __b) { 9893 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9894 (vector int)__b); 9895 } 9896 9897 static __inline__ vector unsigned long long __ATTRS_o_ai 9898 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9899 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9900 (vector int)__b); 9901 } 9902 #endif 9903 9904 /* vec_vslo */ 9905 9906 static __inline__ vector signed char __ATTRS_o_ai 9907 vec_vslo(vector signed char __a, vector signed char __b) { 9908 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9909 (vector int)__b); 9910 } 9911 9912 static __inline__ vector signed char __ATTRS_o_ai 9913 vec_vslo(vector signed char __a, vector unsigned char __b) { 9914 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9915 (vector int)__b); 9916 } 9917 9918 static __inline__ vector unsigned char __ATTRS_o_ai 9919 vec_vslo(vector unsigned char __a, vector signed char __b) { 9920 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9921 (vector int)__b); 9922 } 9923 9924 static __inline__ vector unsigned char __ATTRS_o_ai 9925 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 9926 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9927 (vector int)__b); 9928 } 9929 9930 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9931 vector signed char __b) { 9932 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9933 } 9934 9935 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9936 vector unsigned char __b) { 9937 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9938 } 9939 9940 static __inline__ vector unsigned short __ATTRS_o_ai 9941 vec_vslo(vector unsigned short __a, vector signed char __b) { 9942 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9943 (vector int)__b); 9944 } 9945 9946 static __inline__ vector unsigned short __ATTRS_o_ai 9947 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 9948 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9949 (vector int)__b); 9950 } 9951 9952 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9953 vector signed char __b) { 9954 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9955 } 9956 9957 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9958 vector unsigned char __b) { 9959 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9960 } 9961 9962 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9963 vector signed char __b) { 9964 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9965 } 9966 9967 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 9968 vector unsigned char __b) { 9969 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9970 } 9971 9972 static __inline__ vector unsigned int __ATTRS_o_ai 9973 vec_vslo(vector unsigned int __a, vector signed char __b) { 9974 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9975 (vector int)__b); 9976 } 9977 9978 static __inline__ vector unsigned int __ATTRS_o_ai 9979 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 9980 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9981 (vector int)__b); 9982 } 9983 9984 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9985 vector signed char __b) { 9986 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9987 } 9988 9989 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 9990 vector unsigned char __b) { 9991 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9992 } 9993 9994 /* vec_splat */ 9995 9996 static __inline__ vector signed char __ATTRS_o_ai 9997 vec_splat(vector signed char __a, unsigned const int __b) { 9998 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 9999 } 10000 10001 static __inline__ vector unsigned char __ATTRS_o_ai 10002 vec_splat(vector unsigned char __a, unsigned const int __b) { 10003 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10004 } 10005 10006 static __inline__ vector bool char __ATTRS_o_ai 10007 vec_splat(vector bool char __a, unsigned const int __b) { 10008 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10009 } 10010 10011 static __inline__ vector signed short __ATTRS_o_ai 10012 vec_splat(vector signed short __a, unsigned const int __b) { 10013 unsigned char b0 = (__b & 0x07) * 2; 10014 unsigned char b1 = b0 + 1; 10015 return vec_perm(__a, __a, 10016 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10017 b0, b1, b0, b1, b0, b1)); 10018 } 10019 10020 static __inline__ vector unsigned short __ATTRS_o_ai 10021 vec_splat(vector unsigned short __a, unsigned const int __b) { 10022 unsigned char b0 = (__b & 0x07) * 2; 10023 unsigned char b1 = b0 + 1; 10024 return vec_perm(__a, __a, 10025 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10026 b0, b1, b0, b1, b0, b1)); 10027 } 10028 10029 static __inline__ vector bool short __ATTRS_o_ai 10030 vec_splat(vector bool short __a, unsigned const int __b) { 10031 unsigned char b0 = (__b & 0x07) * 2; 10032 unsigned char b1 = b0 + 1; 10033 return vec_perm(__a, __a, 10034 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10035 b0, b1, b0, b1, b0, b1)); 10036 } 10037 10038 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 10039 unsigned const int __b) { 10040 unsigned char b0 = (__b & 0x07) * 2; 10041 unsigned char b1 = b0 + 1; 10042 return vec_perm(__a, __a, 10043 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10044 b0, b1, b0, b1, b0, b1)); 10045 } 10046 10047 static __inline__ vector signed int __ATTRS_o_ai 10048 vec_splat(vector signed int __a, unsigned const int __b) { 10049 unsigned char b0 = (__b & 0x03) * 4; 10050 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10051 return vec_perm(__a, __a, 10052 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10053 b2, b3, b0, b1, b2, b3)); 10054 } 10055 10056 static __inline__ vector unsigned int __ATTRS_o_ai 10057 vec_splat(vector unsigned int __a, unsigned const int __b) { 10058 unsigned char b0 = (__b & 0x03) * 4; 10059 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10060 return vec_perm(__a, __a, 10061 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10062 b2, b3, b0, b1, b2, b3)); 10063 } 10064 10065 static __inline__ vector bool int __ATTRS_o_ai 10066 vec_splat(vector bool int __a, unsigned const int __b) { 10067 unsigned char b0 = (__b & 0x03) * 4; 10068 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10069 return vec_perm(__a, __a, 10070 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10071 b2, b3, b0, b1, b2, b3)); 10072 } 10073 10074 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 10075 unsigned const int __b) { 10076 unsigned char b0 = (__b & 0x03) * 4; 10077 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10078 return vec_perm(__a, __a, 10079 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10080 b2, b3, b0, b1, b2, b3)); 10081 } 10082 10083 #ifdef __VSX__ 10084 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 10085 unsigned const int __b) { 10086 unsigned char b0 = (__b & 0x01) * 8; 10087 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10088 b6 = b0 + 6, b7 = b0 + 7; 10089 return vec_perm(__a, __a, 10090 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10091 b2, b3, b4, b5, b6, b7)); 10092 } 10093 static __inline__ vector bool long long __ATTRS_o_ai 10094 vec_splat(vector bool long long __a, unsigned const int __b) { 10095 unsigned char b0 = (__b & 0x01) * 8; 10096 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10097 b6 = b0 + 6, b7 = b0 + 7; 10098 return vec_perm(__a, __a, 10099 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10100 b2, b3, b4, b5, b6, b7)); 10101 } 10102 static __inline__ vector signed long long __ATTRS_o_ai 10103 vec_splat(vector signed long long __a, unsigned const int __b) { 10104 unsigned char b0 = (__b & 0x01) * 8; 10105 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10106 b6 = b0 + 6, b7 = b0 + 7; 10107 return vec_perm(__a, __a, 10108 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10109 b2, b3, b4, b5, b6, b7)); 10110 } 10111 static __inline__ vector unsigned long long __ATTRS_o_ai 10112 vec_splat(vector unsigned long long __a, unsigned const int __b) { 10113 unsigned char b0 = (__b & 0x01) * 8; 10114 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10115 b6 = b0 + 6, b7 = b0 + 7; 10116 return vec_perm(__a, __a, 10117 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10118 b2, b3, b4, b5, b6, b7)); 10119 } 10120 #endif 10121 10122 /* vec_vspltb */ 10123 10124 #define __builtin_altivec_vspltb vec_vspltb 10125 10126 static __inline__ vector signed char __ATTRS_o_ai 10127 vec_vspltb(vector signed char __a, unsigned char __b) { 10128 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10129 } 10130 10131 static __inline__ vector unsigned char __ATTRS_o_ai 10132 vec_vspltb(vector unsigned char __a, unsigned char __b) { 10133 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10134 } 10135 10136 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 10137 unsigned char __b) { 10138 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10139 } 10140 10141 /* vec_vsplth */ 10142 10143 #define __builtin_altivec_vsplth vec_vsplth 10144 10145 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 10146 unsigned char __b) { 10147 __b *= 2; 10148 unsigned char b1 = __b + 1; 10149 return vec_perm(__a, __a, 10150 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10151 __b, b1, __b, b1, __b, b1, __b, b1)); 10152 } 10153 10154 static __inline__ vector unsigned short __ATTRS_o_ai 10155 vec_vsplth(vector unsigned short __a, unsigned char __b) { 10156 __b *= 2; 10157 unsigned char b1 = __b + 1; 10158 return vec_perm(__a, __a, 10159 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10160 __b, b1, __b, b1, __b, b1, __b, b1)); 10161 } 10162 10163 static __inline__ vector bool short __ATTRS_o_ai 10164 vec_vsplth(vector bool short __a, unsigned char __b) { 10165 __b *= 2; 10166 unsigned char b1 = __b + 1; 10167 return vec_perm(__a, __a, 10168 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10169 __b, b1, __b, b1, __b, b1, __b, b1)); 10170 } 10171 10172 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 10173 unsigned char __b) { 10174 __b *= 2; 10175 unsigned char b1 = __b + 1; 10176 return vec_perm(__a, __a, 10177 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10178 __b, b1, __b, b1, __b, b1, __b, b1)); 10179 } 10180 10181 /* vec_vspltw */ 10182 10183 #define __builtin_altivec_vspltw vec_vspltw 10184 10185 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 10186 unsigned char __b) { 10187 __b *= 4; 10188 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10189 return vec_perm(__a, __a, 10190 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10191 b1, b2, b3, __b, b1, b2, b3)); 10192 } 10193 10194 static __inline__ vector unsigned int __ATTRS_o_ai 10195 vec_vspltw(vector unsigned int __a, unsigned char __b) { 10196 __b *= 4; 10197 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10198 return vec_perm(__a, __a, 10199 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10200 b1, b2, b3, __b, b1, b2, b3)); 10201 } 10202 10203 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 10204 unsigned char __b) { 10205 __b *= 4; 10206 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10207 return vec_perm(__a, __a, 10208 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10209 b1, b2, b3, __b, b1, b2, b3)); 10210 } 10211 10212 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 10213 unsigned char __b) { 10214 __b *= 4; 10215 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10216 return vec_perm(__a, __a, 10217 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10218 b1, b2, b3, __b, b1, b2, b3)); 10219 } 10220 10221 /* vec_splat_s8 */ 10222 10223 #define __builtin_altivec_vspltisb vec_splat_s8 10224 10225 // FIXME: parameter should be treated as 5-bit signed literal 10226 static __inline__ vector signed char __ATTRS_o_ai 10227 vec_splat_s8(signed char __a) { 10228 return (vector signed char)(__a); 10229 } 10230 10231 /* vec_vspltisb */ 10232 10233 // FIXME: parameter should be treated as 5-bit signed literal 10234 static __inline__ vector signed char __ATTRS_o_ai 10235 vec_vspltisb(signed char __a) { 10236 return (vector signed char)(__a); 10237 } 10238 10239 /* vec_splat_s16 */ 10240 10241 #define __builtin_altivec_vspltish vec_splat_s16 10242 10243 // FIXME: parameter should be treated as 5-bit signed literal 10244 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 10245 return (vector short)(__a); 10246 } 10247 10248 /* vec_vspltish */ 10249 10250 // FIXME: parameter should be treated as 5-bit signed literal 10251 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 10252 return (vector short)(__a); 10253 } 10254 10255 /* vec_splat_s32 */ 10256 10257 #define __builtin_altivec_vspltisw vec_splat_s32 10258 10259 // FIXME: parameter should be treated as 5-bit signed literal 10260 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 10261 return (vector int)(__a); 10262 } 10263 10264 /* vec_vspltisw */ 10265 10266 // FIXME: parameter should be treated as 5-bit signed literal 10267 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 10268 return (vector int)(__a); 10269 } 10270 10271 /* vec_splat_u8 */ 10272 10273 // FIXME: parameter should be treated as 5-bit signed literal 10274 static __inline__ vector unsigned char __ATTRS_o_ai 10275 vec_splat_u8(unsigned char __a) { 10276 return (vector unsigned char)(__a); 10277 } 10278 10279 /* vec_splat_u16 */ 10280 10281 // FIXME: parameter should be treated as 5-bit signed literal 10282 static __inline__ vector unsigned short __ATTRS_o_ai 10283 vec_splat_u16(signed char __a) { 10284 return (vector unsigned short)(__a); 10285 } 10286 10287 /* vec_splat_u32 */ 10288 10289 // FIXME: parameter should be treated as 5-bit signed literal 10290 static __inline__ vector unsigned int __ATTRS_o_ai 10291 vec_splat_u32(signed char __a) { 10292 return (vector unsigned int)(__a); 10293 } 10294 10295 /* vec_sr */ 10296 10297 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 10298 // than the length of __a. 10299 static __inline__ vector unsigned char __ATTRS_o_ai 10300 vec_sr(vector unsigned char __a, vector unsigned char __b) { 10301 return __a >> 10302 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 10303 } 10304 10305 static __inline__ vector signed char __ATTRS_o_ai 10306 vec_sr(vector signed char __a, vector unsigned char __b) { 10307 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 10308 } 10309 10310 static __inline__ vector unsigned short __ATTRS_o_ai 10311 vec_sr(vector unsigned short __a, vector unsigned short __b) { 10312 return __a >> 10313 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 10314 } 10315 10316 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 10317 vector unsigned short __b) { 10318 return (vector short)vec_sr((vector unsigned short)__a, __b); 10319 } 10320 10321 static __inline__ vector unsigned int __ATTRS_o_ai 10322 vec_sr(vector unsigned int __a, vector unsigned int __b) { 10323 return __a >> 10324 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 10325 } 10326 10327 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 10328 vector unsigned int __b) { 10329 return (vector int)vec_sr((vector unsigned int)__a, __b); 10330 } 10331 10332 #ifdef __POWER8_VECTOR__ 10333 static __inline__ vector unsigned long long __ATTRS_o_ai 10334 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10335 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 10336 __CHAR_BIT__)); 10337 } 10338 10339 static __inline__ vector long long __ATTRS_o_ai 10340 vec_sr(vector long long __a, vector unsigned long long __b) { 10341 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10342 } 10343 #else 10344 static __inline__ vector unsigned long long __ATTRS_o_ai 10345 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10346 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10347 10348 // Big endian element zero (the left doubleword) can be right shifted as-is. 10349 // However the shift amount must be in the right doubleword. 10350 // The other element needs to be swapped into the left doubleword and 10351 // shifted. Then the left doublewords of the two result vectors are merged. 10352 vector unsigned long long __swapshift = 10353 __builtin_shufflevector(__b, __b, 1, 0); 10354 vector unsigned long long __leftelt = 10355 (vector unsigned long long)__builtin_altivec_vsro( 10356 (vector signed int)__a, (vector signed int)__swapshift); 10357 #ifdef __LITTLE_ENDIAN__ 10358 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10359 (vector signed int)__leftelt, 10360 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0)); 10361 #else 10362 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10363 (vector signed int)__leftelt, 10364 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15)); 10365 #endif 10366 __a = __builtin_shufflevector(__a, __a, 1, 0); 10367 vector unsigned long long __rightelt = 10368 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a, 10369 (vector signed int)__b); 10370 #ifdef __LITTLE_ENDIAN__ 10371 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10372 (vector signed int)__rightelt, 10373 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 10374 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3); 10375 #else 10376 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10377 (vector signed int)__rightelt, 10378 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 10379 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2); 10380 #endif 10381 } 10382 10383 static __inline__ vector long long __ATTRS_o_ai 10384 vec_sr(vector long long __a, vector unsigned long long __b) { 10385 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10386 } 10387 #endif 10388 10389 /* vec_vsrb */ 10390 10391 #define __builtin_altivec_vsrb vec_vsrb 10392 10393 static __inline__ vector signed char __ATTRS_o_ai 10394 vec_vsrb(vector signed char __a, vector unsigned char __b) { 10395 return vec_sr(__a, __b); 10396 } 10397 10398 static __inline__ vector unsigned char __ATTRS_o_ai 10399 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 10400 return vec_sr(__a, __b); 10401 } 10402 10403 /* vec_vsrh */ 10404 10405 #define __builtin_altivec_vsrh vec_vsrh 10406 10407 static __inline__ vector short __ATTRS_o_ai 10408 vec_vsrh(vector short __a, vector unsigned short __b) { 10409 return vec_sr(__a, __b); 10410 } 10411 10412 static __inline__ vector unsigned short __ATTRS_o_ai 10413 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 10414 return vec_sr(__a, __b); 10415 } 10416 10417 /* vec_vsrw */ 10418 10419 #define __builtin_altivec_vsrw vec_vsrw 10420 10421 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 10422 vector unsigned int __b) { 10423 return vec_sr(__a, __b); 10424 } 10425 10426 static __inline__ vector unsigned int __ATTRS_o_ai 10427 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 10428 return vec_sr(__a, __b); 10429 } 10430 10431 /* vec_sra */ 10432 10433 static __inline__ vector signed char __ATTRS_o_ai 10434 vec_sra(vector signed char __a, vector unsigned char __b) { 10435 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10436 } 10437 10438 static __inline__ vector unsigned char __ATTRS_o_ai 10439 vec_sra(vector unsigned char __a, vector unsigned char __b) { 10440 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10441 } 10442 10443 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 10444 vector unsigned short __b) { 10445 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10446 } 10447 10448 static __inline__ vector unsigned short __ATTRS_o_ai 10449 vec_sra(vector unsigned short __a, vector unsigned short __b) { 10450 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10451 } 10452 10453 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 10454 vector unsigned int __b) { 10455 return __builtin_altivec_vsraw(__a, __b); 10456 } 10457 10458 static __inline__ vector unsigned int __ATTRS_o_ai 10459 vec_sra(vector unsigned int __a, vector unsigned int __b) { 10460 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10461 } 10462 10463 #ifdef __POWER8_VECTOR__ 10464 static __inline__ vector signed long long __ATTRS_o_ai 10465 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10466 return __a >> __b; 10467 } 10468 10469 static __inline__ vector unsigned long long __ATTRS_o_ai 10470 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10471 return (vector unsigned long long)((vector signed long long)__a >> __b); 10472 } 10473 #else 10474 static __inline__ vector signed long long __ATTRS_o_ai 10475 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10476 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10477 return __a >> __b; 10478 } 10479 10480 static __inline__ vector unsigned long long __ATTRS_o_ai 10481 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10482 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10483 return (vector unsigned long long)((vector signed long long)__a >> __b); 10484 } 10485 #endif 10486 10487 /* vec_vsrab */ 10488 10489 static __inline__ vector signed char __ATTRS_o_ai 10490 vec_vsrab(vector signed char __a, vector unsigned char __b) { 10491 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10492 } 10493 10494 static __inline__ vector unsigned char __ATTRS_o_ai 10495 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 10496 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10497 } 10498 10499 /* vec_vsrah */ 10500 10501 static __inline__ vector short __ATTRS_o_ai 10502 vec_vsrah(vector short __a, vector unsigned short __b) { 10503 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10504 } 10505 10506 static __inline__ vector unsigned short __ATTRS_o_ai 10507 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 10508 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10509 } 10510 10511 /* vec_vsraw */ 10512 10513 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 10514 vector unsigned int __b) { 10515 return __builtin_altivec_vsraw(__a, __b); 10516 } 10517 10518 static __inline__ vector unsigned int __ATTRS_o_ai 10519 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 10520 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10521 } 10522 10523 /* vec_srl */ 10524 10525 static __inline__ vector signed char __ATTRS_o_ai 10526 vec_srl(vector signed char __a, vector unsigned char __b) { 10527 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10528 (vector int)__b); 10529 } 10530 10531 static __inline__ vector signed char __ATTRS_o_ai 10532 vec_srl(vector signed char __a, vector unsigned short __b) { 10533 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10534 (vector int)__b); 10535 } 10536 10537 static __inline__ vector signed char __ATTRS_o_ai 10538 vec_srl(vector signed char __a, vector unsigned int __b) { 10539 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10540 (vector int)__b); 10541 } 10542 10543 static __inline__ vector unsigned char __ATTRS_o_ai 10544 vec_srl(vector unsigned char __a, vector unsigned char __b) { 10545 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10546 (vector int)__b); 10547 } 10548 10549 static __inline__ vector unsigned char __ATTRS_o_ai 10550 vec_srl(vector unsigned char __a, vector unsigned short __b) { 10551 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10552 (vector int)__b); 10553 } 10554 10555 static __inline__ vector unsigned char __ATTRS_o_ai 10556 vec_srl(vector unsigned char __a, vector unsigned int __b) { 10557 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10558 (vector int)__b); 10559 } 10560 10561 static __inline__ vector bool char __ATTRS_o_ai 10562 vec_srl(vector bool char __a, vector unsigned char __b) { 10563 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10564 (vector int)__b); 10565 } 10566 10567 static __inline__ vector bool char __ATTRS_o_ai 10568 vec_srl(vector bool char __a, vector unsigned short __b) { 10569 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10570 (vector int)__b); 10571 } 10572 10573 static __inline__ vector bool char __ATTRS_o_ai 10574 vec_srl(vector bool char __a, vector unsigned int __b) { 10575 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10576 (vector int)__b); 10577 } 10578 10579 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10580 vector unsigned char __b) { 10581 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10582 } 10583 10584 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10585 vector unsigned short __b) { 10586 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10587 } 10588 10589 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10590 vector unsigned int __b) { 10591 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10592 } 10593 10594 static __inline__ vector unsigned short __ATTRS_o_ai 10595 vec_srl(vector unsigned short __a, vector unsigned char __b) { 10596 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10597 (vector int)__b); 10598 } 10599 10600 static __inline__ vector unsigned short __ATTRS_o_ai 10601 vec_srl(vector unsigned short __a, vector unsigned short __b) { 10602 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10603 (vector int)__b); 10604 } 10605 10606 static __inline__ vector unsigned short __ATTRS_o_ai 10607 vec_srl(vector unsigned short __a, vector unsigned int __b) { 10608 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10609 (vector int)__b); 10610 } 10611 10612 static __inline__ vector bool short __ATTRS_o_ai 10613 vec_srl(vector bool short __a, vector unsigned char __b) { 10614 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10615 (vector int)__b); 10616 } 10617 10618 static __inline__ vector bool short __ATTRS_o_ai 10619 vec_srl(vector bool short __a, vector unsigned short __b) { 10620 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10621 (vector int)__b); 10622 } 10623 10624 static __inline__ vector bool short __ATTRS_o_ai 10625 vec_srl(vector bool short __a, vector unsigned int __b) { 10626 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10627 (vector int)__b); 10628 } 10629 10630 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10631 vector unsigned char __b) { 10632 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10633 } 10634 10635 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10636 vector unsigned short __b) { 10637 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10638 } 10639 10640 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10641 vector unsigned int __b) { 10642 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10643 } 10644 10645 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10646 vector unsigned char __b) { 10647 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10648 } 10649 10650 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10651 vector unsigned short __b) { 10652 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10653 } 10654 10655 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10656 vector unsigned int __b) { 10657 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10658 } 10659 10660 static __inline__ vector unsigned int __ATTRS_o_ai 10661 vec_srl(vector unsigned int __a, vector unsigned char __b) { 10662 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10663 (vector int)__b); 10664 } 10665 10666 static __inline__ vector unsigned int __ATTRS_o_ai 10667 vec_srl(vector unsigned int __a, vector unsigned short __b) { 10668 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10669 (vector int)__b); 10670 } 10671 10672 static __inline__ vector unsigned int __ATTRS_o_ai 10673 vec_srl(vector unsigned int __a, vector unsigned int __b) { 10674 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10675 (vector int)__b); 10676 } 10677 10678 static __inline__ vector bool int __ATTRS_o_ai 10679 vec_srl(vector bool int __a, vector unsigned char __b) { 10680 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10681 (vector int)__b); 10682 } 10683 10684 static __inline__ vector bool int __ATTRS_o_ai 10685 vec_srl(vector bool int __a, vector unsigned short __b) { 10686 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10687 (vector int)__b); 10688 } 10689 10690 static __inline__ vector bool int __ATTRS_o_ai 10691 vec_srl(vector bool int __a, vector unsigned int __b) { 10692 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10693 (vector int)__b); 10694 } 10695 10696 #ifdef __VSX__ 10697 static __inline__ vector signed long long __ATTRS_o_ai 10698 vec_srl(vector signed long long __a, vector unsigned char __b) { 10699 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 10700 (vector int)__b); 10701 } 10702 10703 static __inline__ vector unsigned long long __ATTRS_o_ai 10704 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 10705 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 10706 (vector int)__b); 10707 } 10708 #endif 10709 10710 /* vec_vsr */ 10711 10712 static __inline__ vector signed char __ATTRS_o_ai 10713 vec_vsr(vector signed char __a, vector unsigned char __b) { 10714 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10715 (vector int)__b); 10716 } 10717 10718 static __inline__ vector signed char __ATTRS_o_ai 10719 vec_vsr(vector signed char __a, vector unsigned short __b) { 10720 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10721 (vector int)__b); 10722 } 10723 10724 static __inline__ vector signed char __ATTRS_o_ai 10725 vec_vsr(vector signed char __a, vector unsigned int __b) { 10726 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10727 (vector int)__b); 10728 } 10729 10730 static __inline__ vector unsigned char __ATTRS_o_ai 10731 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 10732 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10733 (vector int)__b); 10734 } 10735 10736 static __inline__ vector unsigned char __ATTRS_o_ai 10737 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 10738 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10739 (vector int)__b); 10740 } 10741 10742 static __inline__ vector unsigned char __ATTRS_o_ai 10743 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 10744 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10745 (vector int)__b); 10746 } 10747 10748 static __inline__ vector bool char __ATTRS_o_ai 10749 vec_vsr(vector bool char __a, vector unsigned char __b) { 10750 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10751 (vector int)__b); 10752 } 10753 10754 static __inline__ vector bool char __ATTRS_o_ai 10755 vec_vsr(vector bool char __a, vector unsigned short __b) { 10756 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10757 (vector int)__b); 10758 } 10759 10760 static __inline__ vector bool char __ATTRS_o_ai 10761 vec_vsr(vector bool char __a, vector unsigned int __b) { 10762 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10763 (vector int)__b); 10764 } 10765 10766 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10767 vector unsigned char __b) { 10768 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10769 } 10770 10771 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10772 vector unsigned short __b) { 10773 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10774 } 10775 10776 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10777 vector unsigned int __b) { 10778 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10779 } 10780 10781 static __inline__ vector unsigned short __ATTRS_o_ai 10782 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 10783 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10784 (vector int)__b); 10785 } 10786 10787 static __inline__ vector unsigned short __ATTRS_o_ai 10788 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 10789 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10790 (vector int)__b); 10791 } 10792 10793 static __inline__ vector unsigned short __ATTRS_o_ai 10794 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 10795 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10796 (vector int)__b); 10797 } 10798 10799 static __inline__ vector bool short __ATTRS_o_ai 10800 vec_vsr(vector bool short __a, vector unsigned char __b) { 10801 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10802 (vector int)__b); 10803 } 10804 10805 static __inline__ vector bool short __ATTRS_o_ai 10806 vec_vsr(vector bool short __a, vector unsigned short __b) { 10807 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10808 (vector int)__b); 10809 } 10810 10811 static __inline__ vector bool short __ATTRS_o_ai 10812 vec_vsr(vector bool short __a, vector unsigned int __b) { 10813 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10814 (vector int)__b); 10815 } 10816 10817 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10818 vector unsigned char __b) { 10819 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10820 } 10821 10822 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10823 vector unsigned short __b) { 10824 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10825 } 10826 10827 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10828 vector unsigned int __b) { 10829 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10830 } 10831 10832 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10833 vector unsigned char __b) { 10834 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10835 } 10836 10837 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10838 vector unsigned short __b) { 10839 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10840 } 10841 10842 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10843 vector unsigned int __b) { 10844 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10845 } 10846 10847 static __inline__ vector unsigned int __ATTRS_o_ai 10848 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10849 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10850 (vector int)__b); 10851 } 10852 10853 static __inline__ vector unsigned int __ATTRS_o_ai 10854 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10855 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10856 (vector int)__b); 10857 } 10858 10859 static __inline__ vector unsigned int __ATTRS_o_ai 10860 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10861 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10862 (vector int)__b); 10863 } 10864 10865 static __inline__ vector bool int __ATTRS_o_ai 10866 vec_vsr(vector bool int __a, vector unsigned char __b) { 10867 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10868 (vector int)__b); 10869 } 10870 10871 static __inline__ vector bool int __ATTRS_o_ai 10872 vec_vsr(vector bool int __a, vector unsigned short __b) { 10873 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10874 (vector int)__b); 10875 } 10876 10877 static __inline__ vector bool int __ATTRS_o_ai 10878 vec_vsr(vector bool int __a, vector unsigned int __b) { 10879 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10880 (vector int)__b); 10881 } 10882 10883 /* vec_sro */ 10884 10885 static __inline__ vector signed char __ATTRS_o_ai 10886 vec_sro(vector signed char __a, vector signed char __b) { 10887 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10888 (vector int)__b); 10889 } 10890 10891 static __inline__ vector signed char __ATTRS_o_ai 10892 vec_sro(vector signed char __a, vector unsigned char __b) { 10893 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10894 (vector int)__b); 10895 } 10896 10897 static __inline__ vector unsigned char __ATTRS_o_ai 10898 vec_sro(vector unsigned char __a, vector signed char __b) { 10899 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10900 (vector int)__b); 10901 } 10902 10903 static __inline__ vector unsigned char __ATTRS_o_ai 10904 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10905 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10906 (vector int)__b); 10907 } 10908 10909 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10910 vector signed char __b) { 10911 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10912 } 10913 10914 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10915 vector unsigned char __b) { 10916 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10917 } 10918 10919 static __inline__ vector unsigned short __ATTRS_o_ai 10920 vec_sro(vector unsigned short __a, vector signed char __b) { 10921 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10922 (vector int)__b); 10923 } 10924 10925 static __inline__ vector unsigned short __ATTRS_o_ai 10926 vec_sro(vector unsigned short __a, vector unsigned char __b) { 10927 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10928 (vector int)__b); 10929 } 10930 10931 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10932 vector signed char __b) { 10933 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10934 } 10935 10936 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10937 vector unsigned char __b) { 10938 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10939 } 10940 10941 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10942 vector signed char __b) { 10943 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10944 } 10945 10946 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10947 vector unsigned char __b) { 10948 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10949 } 10950 10951 static __inline__ vector unsigned int __ATTRS_o_ai 10952 vec_sro(vector unsigned int __a, vector signed char __b) { 10953 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10954 (vector int)__b); 10955 } 10956 10957 static __inline__ vector unsigned int __ATTRS_o_ai 10958 vec_sro(vector unsigned int __a, vector unsigned char __b) { 10959 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10960 (vector int)__b); 10961 } 10962 10963 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10964 vector signed char __b) { 10965 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10966 } 10967 10968 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 10969 vector unsigned char __b) { 10970 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10971 } 10972 10973 #ifdef __VSX__ 10974 static __inline__ vector signed long long __ATTRS_o_ai 10975 vec_sro(vector signed long long __a, vector signed char __b) { 10976 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10977 (vector int)__b); 10978 } 10979 10980 static __inline__ vector signed long long __ATTRS_o_ai 10981 vec_sro(vector signed long long __a, vector unsigned char __b) { 10982 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 10983 (vector int)__b); 10984 } 10985 10986 static __inline__ vector unsigned long long __ATTRS_o_ai 10987 vec_sro(vector unsigned long long __a, vector signed char __b) { 10988 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10989 (vector int)__b); 10990 } 10991 10992 static __inline__ vector unsigned long long __ATTRS_o_ai 10993 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 10994 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 10995 (vector int)__b); 10996 } 10997 #endif 10998 10999 /* vec_vsro */ 11000 11001 static __inline__ vector signed char __ATTRS_o_ai 11002 vec_vsro(vector signed char __a, vector signed char __b) { 11003 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11004 (vector int)__b); 11005 } 11006 11007 static __inline__ vector signed char __ATTRS_o_ai 11008 vec_vsro(vector signed char __a, vector unsigned char __b) { 11009 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11010 (vector int)__b); 11011 } 11012 11013 static __inline__ vector unsigned char __ATTRS_o_ai 11014 vec_vsro(vector unsigned char __a, vector signed char __b) { 11015 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11016 (vector int)__b); 11017 } 11018 11019 static __inline__ vector unsigned char __ATTRS_o_ai 11020 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 11021 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11022 (vector int)__b); 11023 } 11024 11025 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11026 vector signed char __b) { 11027 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11028 } 11029 11030 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11031 vector unsigned char __b) { 11032 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11033 } 11034 11035 static __inline__ vector unsigned short __ATTRS_o_ai 11036 vec_vsro(vector unsigned short __a, vector signed char __b) { 11037 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11038 (vector int)__b); 11039 } 11040 11041 static __inline__ vector unsigned short __ATTRS_o_ai 11042 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 11043 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11044 (vector int)__b); 11045 } 11046 11047 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11048 vector signed char __b) { 11049 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11050 } 11051 11052 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11053 vector unsigned char __b) { 11054 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11055 } 11056 11057 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11058 vector signed char __b) { 11059 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11060 } 11061 11062 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11063 vector unsigned char __b) { 11064 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11065 } 11066 11067 static __inline__ vector unsigned int __ATTRS_o_ai 11068 vec_vsro(vector unsigned int __a, vector signed char __b) { 11069 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11070 (vector int)__b); 11071 } 11072 11073 static __inline__ vector unsigned int __ATTRS_o_ai 11074 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 11075 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11076 (vector int)__b); 11077 } 11078 11079 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11080 vector signed char __b) { 11081 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11082 } 11083 11084 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11085 vector unsigned char __b) { 11086 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11087 } 11088 11089 /* vec_st */ 11090 11091 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 11092 vector signed char *__c) { 11093 __builtin_altivec_stvx((vector int)__a, __b, __c); 11094 } 11095 11096 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, int __b, 11097 signed char *__c) { 11098 __builtin_altivec_stvx((vector int)__a, __b, __c); 11099 } 11100 11101 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 11102 vector unsigned char *__c) { 11103 __builtin_altivec_stvx((vector int)__a, __b, __c); 11104 } 11105 11106 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, int __b, 11107 unsigned char *__c) { 11108 __builtin_altivec_stvx((vector int)__a, __b, __c); 11109 } 11110 11111 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __b, 11112 signed char *__c) { 11113 __builtin_altivec_stvx((vector int)__a, __b, __c); 11114 } 11115 11116 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, int __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, int __b, 11122 vector bool char *__c) { 11123 __builtin_altivec_stvx((vector int)__a, __b, __c); 11124 } 11125 11126 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 11127 vector short *__c) { 11128 __builtin_altivec_stvx((vector int)__a, __b, __c); 11129 } 11130 11131 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, int __b, 11132 short *__c) { 11133 __builtin_altivec_stvx((vector int)__a, __b, __c); 11134 } 11135 11136 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 11137 vector unsigned short *__c) { 11138 __builtin_altivec_stvx((vector int)__a, __b, __c); 11139 } 11140 11141 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, int __b, 11142 unsigned short *__c) { 11143 __builtin_altivec_stvx((vector int)__a, __b, __c); 11144 } 11145 11146 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __b, 11147 short *__c) { 11148 __builtin_altivec_stvx((vector int)__a, __b, __c); 11149 } 11150 11151 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, int __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, int __b, 11157 vector bool short *__c) { 11158 __builtin_altivec_stvx((vector int)__a, __b, __c); 11159 } 11160 11161 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 11162 short *__c) { 11163 __builtin_altivec_stvx((vector int)__a, __b, __c); 11164 } 11165 11166 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, int __b, 11167 unsigned 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, int __b, 11172 vector pixel *__c) { 11173 __builtin_altivec_stvx((vector int)__a, __b, __c); 11174 } 11175 11176 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, 11177 vector int *__c) { 11178 __builtin_altivec_stvx(__a, __b, __c); 11179 } 11180 11181 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, int __b, int *__c) { 11182 __builtin_altivec_stvx(__a, __b, __c); 11183 } 11184 11185 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 11186 vector unsigned int *__c) { 11187 __builtin_altivec_stvx((vector int)__a, __b, __c); 11188 } 11189 11190 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, int __b, 11191 unsigned int *__c) { 11192 __builtin_altivec_stvx((vector int)__a, __b, __c); 11193 } 11194 11195 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __b, 11196 int *__c) { 11197 __builtin_altivec_stvx((vector int)__a, __b, __c); 11198 } 11199 11200 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, int __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, int __b, 11206 vector bool int *__c) { 11207 __builtin_altivec_stvx((vector int)__a, __b, __c); 11208 } 11209 11210 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 11211 vector float *__c) { 11212 __builtin_altivec_stvx((vector int)__a, __b, __c); 11213 } 11214 11215 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, int __b, 11216 float *__c) { 11217 __builtin_altivec_stvx((vector int)__a, __b, __c); 11218 } 11219 11220 /* vec_stvx */ 11221 11222 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 11223 vector signed char *__c) { 11224 __builtin_altivec_stvx((vector int)__a, __b, __c); 11225 } 11226 11227 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, int __b, 11228 signed char *__c) { 11229 __builtin_altivec_stvx((vector int)__a, __b, __c); 11230 } 11231 11232 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 11233 vector unsigned char *__c) { 11234 __builtin_altivec_stvx((vector int)__a, __b, __c); 11235 } 11236 11237 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, int __b, 11238 unsigned char *__c) { 11239 __builtin_altivec_stvx((vector int)__a, __b, __c); 11240 } 11241 11242 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __b, 11243 signed char *__c) { 11244 __builtin_altivec_stvx((vector int)__a, __b, __c); 11245 } 11246 11247 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, int __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, int __b, 11253 vector bool char *__c) { 11254 __builtin_altivec_stvx((vector int)__a, __b, __c); 11255 } 11256 11257 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 11258 vector short *__c) { 11259 __builtin_altivec_stvx((vector int)__a, __b, __c); 11260 } 11261 11262 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, int __b, 11263 short *__c) { 11264 __builtin_altivec_stvx((vector int)__a, __b, __c); 11265 } 11266 11267 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 11268 vector unsigned short *__c) { 11269 __builtin_altivec_stvx((vector int)__a, __b, __c); 11270 } 11271 11272 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, int __b, 11273 unsigned short *__c) { 11274 __builtin_altivec_stvx((vector int)__a, __b, __c); 11275 } 11276 11277 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __b, 11278 short *__c) { 11279 __builtin_altivec_stvx((vector int)__a, __b, __c); 11280 } 11281 11282 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, int __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, int __b, 11288 vector bool short *__c) { 11289 __builtin_altivec_stvx((vector int)__a, __b, __c); 11290 } 11291 11292 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 11293 short *__c) { 11294 __builtin_altivec_stvx((vector int)__a, __b, __c); 11295 } 11296 11297 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, int __b, 11298 unsigned 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, int __b, 11303 vector pixel *__c) { 11304 __builtin_altivec_stvx((vector int)__a, __b, __c); 11305 } 11306 11307 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 11308 vector int *__c) { 11309 __builtin_altivec_stvx(__a, __b, __c); 11310 } 11311 11312 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, int __b, 11313 int *__c) { 11314 __builtin_altivec_stvx(__a, __b, __c); 11315 } 11316 11317 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 11318 vector unsigned int *__c) { 11319 __builtin_altivec_stvx((vector int)__a, __b, __c); 11320 } 11321 11322 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, int __b, 11323 unsigned int *__c) { 11324 __builtin_altivec_stvx((vector int)__a, __b, __c); 11325 } 11326 11327 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __b, 11328 int *__c) { 11329 __builtin_altivec_stvx((vector int)__a, __b, __c); 11330 } 11331 11332 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, int __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, int __b, 11338 vector bool int *__c) { 11339 __builtin_altivec_stvx((vector int)__a, __b, __c); 11340 } 11341 11342 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 11343 vector float *__c) { 11344 __builtin_altivec_stvx((vector int)__a, __b, __c); 11345 } 11346 11347 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, int __b, 11348 float *__c) { 11349 __builtin_altivec_stvx((vector int)__a, __b, __c); 11350 } 11351 11352 /* vec_ste */ 11353 11354 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, int __b, 11355 signed char *__c) { 11356 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11357 } 11358 11359 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, int __b, 11360 unsigned char *__c) { 11361 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11362 } 11363 11364 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, int __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 bool char __a, int __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 short __a, int __b, 11375 short *__c) { 11376 __builtin_altivec_stvehx(__a, __b, __c); 11377 } 11378 11379 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, int __b, 11380 unsigned short *__c) { 11381 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11382 } 11383 11384 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __b, 11385 short *__c) { 11386 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11387 } 11388 11389 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, int __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 pixel __a, int __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 pixel __a, int __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 int __a, int __b, int *__c) { 11405 __builtin_altivec_stvewx(__a, __b, __c); 11406 } 11407 11408 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, int __b, 11409 unsigned int *__c) { 11410 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11411 } 11412 11413 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __b, 11414 int *__c) { 11415 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11416 } 11417 11418 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, int __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 float __a, int __b, 11424 float *__c) { 11425 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11426 } 11427 11428 /* vec_stvebx */ 11429 11430 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, int __b, 11431 signed char *__c) { 11432 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11433 } 11434 11435 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 11436 int __b, unsigned char *__c) { 11437 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11438 } 11439 11440 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, int __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 bool char __a, int __b, 11446 unsigned char *__c) { 11447 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11448 } 11449 11450 /* vec_stvehx */ 11451 11452 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, int __b, 11453 short *__c) { 11454 __builtin_altivec_stvehx(__a, __b, __c); 11455 } 11456 11457 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 11458 int __b, unsigned short *__c) { 11459 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11460 } 11461 11462 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 11463 short *__c) { 11464 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11465 } 11466 11467 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, int __b, 11468 unsigned short *__c) { 11469 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11470 } 11471 11472 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, int __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 pixel __a, int __b, 11478 unsigned short *__c) { 11479 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11480 } 11481 11482 /* vec_stvewx */ 11483 11484 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, int __b, 11485 int *__c) { 11486 __builtin_altivec_stvewx(__a, __b, __c); 11487 } 11488 11489 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, int __b, 11490 unsigned int *__c) { 11491 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11492 } 11493 11494 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __b, 11495 int *__c) { 11496 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11497 } 11498 11499 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, int __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 float __a, int __b, 11505 float *__c) { 11506 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11507 } 11508 11509 /* vec_stl */ 11510 11511 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11512 vector signed char *__c) { 11513 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11514 } 11515 11516 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11517 signed char *__c) { 11518 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11519 } 11520 11521 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11522 vector unsigned char *__c) { 11523 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11524 } 11525 11526 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11527 unsigned char *__c) { 11528 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11529 } 11530 11531 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11532 signed char *__c) { 11533 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11534 } 11535 11536 static __inline__ void __ATTRS_o_ai vec_stl(vector bool 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 vector bool char *__c) { 11543 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11544 } 11545 11546 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11547 vector short *__c) { 11548 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11549 } 11550 11551 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11552 short *__c) { 11553 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11554 } 11555 11556 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11557 vector unsigned short *__c) { 11558 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11559 } 11560 11561 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11562 unsigned short *__c) { 11563 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11564 } 11565 11566 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11567 short *__c) { 11568 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11569 } 11570 11571 static __inline__ void __ATTRS_o_ai vec_stl(vector bool 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 vector bool short *__c) { 11578 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11579 } 11580 11581 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11582 short *__c) { 11583 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11584 } 11585 11586 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11587 unsigned 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 vector pixel *__c) { 11593 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11594 } 11595 11596 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 11597 vector int *__c) { 11598 __builtin_altivec_stvxl(__a, __b, __c); 11599 } 11600 11601 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 11602 __builtin_altivec_stvxl(__a, __b, __c); 11603 } 11604 11605 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11606 vector unsigned int *__c) { 11607 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11608 } 11609 11610 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11611 unsigned int *__c) { 11612 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11613 } 11614 11615 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11616 int *__c) { 11617 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11618 } 11619 11620 static __inline__ void __ATTRS_o_ai vec_stl(vector bool 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 vector bool int *__c) { 11627 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11628 } 11629 11630 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11631 vector float *__c) { 11632 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11633 } 11634 11635 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11636 float *__c) { 11637 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11638 } 11639 11640 /* vec_stvxl */ 11641 11642 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11643 vector signed char *__c) { 11644 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11645 } 11646 11647 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11648 signed char *__c) { 11649 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11650 } 11651 11652 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11653 vector unsigned char *__c) { 11654 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11655 } 11656 11657 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11658 unsigned char *__c) { 11659 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11660 } 11661 11662 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11663 signed char *__c) { 11664 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11665 } 11666 11667 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool 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 vector bool char *__c) { 11674 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11675 } 11676 11677 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11678 vector short *__c) { 11679 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11680 } 11681 11682 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11683 short *__c) { 11684 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11685 } 11686 11687 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11688 int __b, 11689 vector unsigned short *__c) { 11690 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11691 } 11692 11693 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11694 int __b, unsigned short *__c) { 11695 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11696 } 11697 11698 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11699 short *__c) { 11700 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11701 } 11702 11703 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11704 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 vector bool short *__c) { 11710 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11711 } 11712 11713 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11714 short *__c) { 11715 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11716 } 11717 11718 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11719 unsigned 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 vector pixel *__c) { 11725 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11726 } 11727 11728 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11729 vector int *__c) { 11730 __builtin_altivec_stvxl(__a, __b, __c); 11731 } 11732 11733 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11734 int *__c) { 11735 __builtin_altivec_stvxl(__a, __b, __c); 11736 } 11737 11738 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11739 vector unsigned int *__c) { 11740 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11741 } 11742 11743 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11744 unsigned int *__c) { 11745 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11746 } 11747 11748 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11749 int *__c) { 11750 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11751 } 11752 11753 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool 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 vector bool int *__c) { 11760 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11761 } 11762 11763 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11764 vector float *__c) { 11765 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11766 } 11767 11768 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11769 float *__c) { 11770 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11771 } 11772 11773 /* vec_sub */ 11774 11775 static __inline__ vector signed char __ATTRS_o_ai 11776 vec_sub(vector signed char __a, vector signed char __b) { 11777 return __a - __b; 11778 } 11779 11780 static __inline__ vector signed char __ATTRS_o_ai 11781 vec_sub(vector bool char __a, vector signed char __b) { 11782 return (vector signed char)__a - __b; 11783 } 11784 11785 static __inline__ vector signed char __ATTRS_o_ai 11786 vec_sub(vector signed char __a, vector bool char __b) { 11787 return __a - (vector signed char)__b; 11788 } 11789 11790 static __inline__ vector unsigned char __ATTRS_o_ai 11791 vec_sub(vector unsigned char __a, vector unsigned char __b) { 11792 return __a - __b; 11793 } 11794 11795 static __inline__ vector unsigned char __ATTRS_o_ai 11796 vec_sub(vector bool char __a, vector unsigned char __b) { 11797 return (vector unsigned char)__a - __b; 11798 } 11799 11800 static __inline__ vector unsigned char __ATTRS_o_ai 11801 vec_sub(vector unsigned char __a, vector bool char __b) { 11802 return __a - (vector unsigned char)__b; 11803 } 11804 11805 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11806 vector short __b) { 11807 return __a - __b; 11808 } 11809 11810 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 11811 vector short __b) { 11812 return (vector short)__a - __b; 11813 } 11814 11815 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11816 vector bool short __b) { 11817 return __a - (vector short)__b; 11818 } 11819 11820 static __inline__ vector unsigned short __ATTRS_o_ai 11821 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11822 return __a - __b; 11823 } 11824 11825 static __inline__ vector unsigned short __ATTRS_o_ai 11826 vec_sub(vector bool short __a, vector unsigned short __b) { 11827 return (vector unsigned short)__a - __b; 11828 } 11829 11830 static __inline__ vector unsigned short __ATTRS_o_ai 11831 vec_sub(vector unsigned short __a, vector bool short __b) { 11832 return __a - (vector unsigned short)__b; 11833 } 11834 11835 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11836 vector int __b) { 11837 return __a - __b; 11838 } 11839 11840 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11841 vector int __b) { 11842 return (vector int)__a - __b; 11843 } 11844 11845 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11846 vector bool int __b) { 11847 return __a - (vector int)__b; 11848 } 11849 11850 static __inline__ vector unsigned int __ATTRS_o_ai 11851 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11852 return __a - __b; 11853 } 11854 11855 static __inline__ vector unsigned int __ATTRS_o_ai 11856 vec_sub(vector bool int __a, vector unsigned int __b) { 11857 return (vector unsigned int)__a - __b; 11858 } 11859 11860 static __inline__ vector unsigned int __ATTRS_o_ai 11861 vec_sub(vector unsigned int __a, vector bool int __b) { 11862 return __a - (vector unsigned int)__b; 11863 } 11864 11865 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 11866 defined(__SIZEOF_INT128__) 11867 static __inline__ vector signed __int128 __ATTRS_o_ai 11868 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11869 return __a - __b; 11870 } 11871 11872 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11873 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11874 return __a - __b; 11875 } 11876 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) && 11877 // defined(__SIZEOF_INT128__) 11878 11879 #ifdef __VSX__ 11880 static __inline__ vector signed long long __ATTRS_o_ai 11881 vec_sub(vector signed long long __a, vector signed long long __b) { 11882 return __a - __b; 11883 } 11884 11885 static __inline__ vector unsigned long long __ATTRS_o_ai 11886 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11887 return __a - __b; 11888 } 11889 11890 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11891 vector double __b) { 11892 return __a - __b; 11893 } 11894 #endif 11895 11896 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11897 vector float __b) { 11898 return __a - __b; 11899 } 11900 11901 /* vec_vsububm */ 11902 11903 #define __builtin_altivec_vsububm vec_vsububm 11904 11905 static __inline__ vector signed char __ATTRS_o_ai 11906 vec_vsububm(vector signed char __a, vector signed char __b) { 11907 return __a - __b; 11908 } 11909 11910 static __inline__ vector signed char __ATTRS_o_ai 11911 vec_vsububm(vector bool char __a, vector signed char __b) { 11912 return (vector signed char)__a - __b; 11913 } 11914 11915 static __inline__ vector signed char __ATTRS_o_ai 11916 vec_vsububm(vector signed char __a, vector bool char __b) { 11917 return __a - (vector signed char)__b; 11918 } 11919 11920 static __inline__ vector unsigned char __ATTRS_o_ai 11921 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 11922 return __a - __b; 11923 } 11924 11925 static __inline__ vector unsigned char __ATTRS_o_ai 11926 vec_vsububm(vector bool char __a, vector unsigned char __b) { 11927 return (vector unsigned char)__a - __b; 11928 } 11929 11930 static __inline__ vector unsigned char __ATTRS_o_ai 11931 vec_vsububm(vector unsigned char __a, vector bool char __b) { 11932 return __a - (vector unsigned char)__b; 11933 } 11934 11935 /* vec_vsubuhm */ 11936 11937 #define __builtin_altivec_vsubuhm vec_vsubuhm 11938 11939 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11940 vector short __b) { 11941 return __a - __b; 11942 } 11943 11944 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 11945 vector short __b) { 11946 return (vector short)__a - __b; 11947 } 11948 11949 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11950 vector bool short __b) { 11951 return __a - (vector short)__b; 11952 } 11953 11954 static __inline__ vector unsigned short __ATTRS_o_ai 11955 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 11956 return __a - __b; 11957 } 11958 11959 static __inline__ vector unsigned short __ATTRS_o_ai 11960 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 11961 return (vector unsigned short)__a - __b; 11962 } 11963 11964 static __inline__ vector unsigned short __ATTRS_o_ai 11965 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 11966 return __a - (vector unsigned short)__b; 11967 } 11968 11969 /* vec_vsubuwm */ 11970 11971 #define __builtin_altivec_vsubuwm vec_vsubuwm 11972 11973 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11974 vector int __b) { 11975 return __a - __b; 11976 } 11977 11978 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 11979 vector int __b) { 11980 return (vector int)__a - __b; 11981 } 11982 11983 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 11984 vector bool int __b) { 11985 return __a - (vector int)__b; 11986 } 11987 11988 static __inline__ vector unsigned int __ATTRS_o_ai 11989 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 11990 return __a - __b; 11991 } 11992 11993 static __inline__ vector unsigned int __ATTRS_o_ai 11994 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 11995 return (vector unsigned int)__a - __b; 11996 } 11997 11998 static __inline__ vector unsigned int __ATTRS_o_ai 11999 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 12000 return __a - (vector unsigned int)__b; 12001 } 12002 12003 /* vec_vsubfp */ 12004 12005 #define __builtin_altivec_vsubfp vec_vsubfp 12006 12007 static __inline__ vector float __attribute__((__always_inline__)) 12008 vec_vsubfp(vector float __a, vector float __b) { 12009 return __a - __b; 12010 } 12011 12012 /* vec_subc */ 12013 12014 static __inline__ vector signed int __ATTRS_o_ai 12015 vec_subc(vector signed int __a, vector signed int __b) { 12016 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 12017 (vector unsigned int) __b); 12018 } 12019 12020 static __inline__ vector unsigned int __ATTRS_o_ai 12021 vec_subc(vector unsigned int __a, vector unsigned int __b) { 12022 return __builtin_altivec_vsubcuw(__a, __b); 12023 } 12024 12025 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 12026 #ifdef __SIZEOF_INT128__ 12027 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12028 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12029 return __builtin_altivec_vsubcuq(__a, __b); 12030 } 12031 12032 static __inline__ vector signed __int128 __ATTRS_o_ai 12033 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 12034 return __builtin_altivec_vsubcuq(__a, __b); 12035 } 12036 #endif 12037 12038 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12039 vec_subc_u128(vector unsigned char __a, vector unsigned char __b) { 12040 return (vector unsigned char)__builtin_altivec_vsubcuq(__a, __b); 12041 } 12042 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 12043 12044 /* vec_vsubcuw */ 12045 12046 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12047 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 12048 return __builtin_altivec_vsubcuw(__a, __b); 12049 } 12050 12051 /* vec_subs */ 12052 12053 static __inline__ vector signed char __ATTRS_o_ai 12054 vec_subs(vector signed char __a, vector signed char __b) { 12055 return __builtin_altivec_vsubsbs(__a, __b); 12056 } 12057 12058 static __inline__ vector signed char __ATTRS_o_ai 12059 vec_subs(vector bool char __a, vector signed char __b) { 12060 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12061 } 12062 12063 static __inline__ vector signed char __ATTRS_o_ai 12064 vec_subs(vector signed char __a, vector bool char __b) { 12065 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12066 } 12067 12068 static __inline__ vector unsigned char __ATTRS_o_ai 12069 vec_subs(vector unsigned char __a, vector unsigned char __b) { 12070 return __builtin_altivec_vsububs(__a, __b); 12071 } 12072 12073 static __inline__ vector unsigned char __ATTRS_o_ai 12074 vec_subs(vector bool char __a, vector unsigned char __b) { 12075 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12076 } 12077 12078 static __inline__ vector unsigned char __ATTRS_o_ai 12079 vec_subs(vector unsigned char __a, vector bool char __b) { 12080 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12081 } 12082 12083 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12084 vector short __b) { 12085 return __builtin_altivec_vsubshs(__a, __b); 12086 } 12087 12088 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 12089 vector short __b) { 12090 return __builtin_altivec_vsubshs((vector short)__a, __b); 12091 } 12092 12093 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12094 vector bool short __b) { 12095 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12096 } 12097 12098 static __inline__ vector unsigned short __ATTRS_o_ai 12099 vec_subs(vector unsigned short __a, vector unsigned short __b) { 12100 return __builtin_altivec_vsubuhs(__a, __b); 12101 } 12102 12103 static __inline__ vector unsigned short __ATTRS_o_ai 12104 vec_subs(vector bool short __a, vector unsigned short __b) { 12105 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12106 } 12107 12108 static __inline__ vector unsigned short __ATTRS_o_ai 12109 vec_subs(vector unsigned short __a, vector bool short __b) { 12110 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12111 } 12112 12113 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12114 vector int __b) { 12115 return __builtin_altivec_vsubsws(__a, __b); 12116 } 12117 12118 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 12119 vector int __b) { 12120 return __builtin_altivec_vsubsws((vector int)__a, __b); 12121 } 12122 12123 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12124 vector bool int __b) { 12125 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12126 } 12127 12128 static __inline__ vector unsigned int __ATTRS_o_ai 12129 vec_subs(vector unsigned int __a, vector unsigned int __b) { 12130 return __builtin_altivec_vsubuws(__a, __b); 12131 } 12132 12133 static __inline__ vector unsigned int __ATTRS_o_ai 12134 vec_subs(vector bool int __a, vector unsigned int __b) { 12135 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12136 } 12137 12138 static __inline__ vector unsigned int __ATTRS_o_ai 12139 vec_subs(vector unsigned int __a, vector bool int __b) { 12140 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12141 } 12142 12143 /* vec_vsubsbs */ 12144 12145 static __inline__ vector signed char __ATTRS_o_ai 12146 vec_vsubsbs(vector signed char __a, vector signed char __b) { 12147 return __builtin_altivec_vsubsbs(__a, __b); 12148 } 12149 12150 static __inline__ vector signed char __ATTRS_o_ai 12151 vec_vsubsbs(vector bool char __a, vector signed char __b) { 12152 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12153 } 12154 12155 static __inline__ vector signed char __ATTRS_o_ai 12156 vec_vsubsbs(vector signed char __a, vector bool char __b) { 12157 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12158 } 12159 12160 /* vec_vsububs */ 12161 12162 static __inline__ vector unsigned char __ATTRS_o_ai 12163 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 12164 return __builtin_altivec_vsububs(__a, __b); 12165 } 12166 12167 static __inline__ vector unsigned char __ATTRS_o_ai 12168 vec_vsububs(vector bool char __a, vector unsigned char __b) { 12169 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12170 } 12171 12172 static __inline__ vector unsigned char __ATTRS_o_ai 12173 vec_vsububs(vector unsigned char __a, vector bool char __b) { 12174 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12175 } 12176 12177 /* vec_vsubshs */ 12178 12179 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12180 vector short __b) { 12181 return __builtin_altivec_vsubshs(__a, __b); 12182 } 12183 12184 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 12185 vector short __b) { 12186 return __builtin_altivec_vsubshs((vector short)__a, __b); 12187 } 12188 12189 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12190 vector bool short __b) { 12191 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12192 } 12193 12194 /* vec_vsubuhs */ 12195 12196 static __inline__ vector unsigned short __ATTRS_o_ai 12197 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 12198 return __builtin_altivec_vsubuhs(__a, __b); 12199 } 12200 12201 static __inline__ vector unsigned short __ATTRS_o_ai 12202 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 12203 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12204 } 12205 12206 static __inline__ vector unsigned short __ATTRS_o_ai 12207 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 12208 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12209 } 12210 12211 /* vec_vsubsws */ 12212 12213 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12214 vector int __b) { 12215 return __builtin_altivec_vsubsws(__a, __b); 12216 } 12217 12218 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 12219 vector int __b) { 12220 return __builtin_altivec_vsubsws((vector int)__a, __b); 12221 } 12222 12223 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12224 vector bool int __b) { 12225 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12226 } 12227 12228 /* vec_vsubuws */ 12229 12230 static __inline__ vector unsigned int __ATTRS_o_ai 12231 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 12232 return __builtin_altivec_vsubuws(__a, __b); 12233 } 12234 12235 static __inline__ vector unsigned int __ATTRS_o_ai 12236 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 12237 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12238 } 12239 12240 static __inline__ vector unsigned int __ATTRS_o_ai 12241 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 12242 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12243 } 12244 12245 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 12246 /* vec_vsubuqm */ 12247 12248 #ifdef __SIZEOF_INT128__ 12249 static __inline__ vector signed __int128 __ATTRS_o_ai 12250 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 12251 return __a - __b; 12252 } 12253 12254 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12255 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12256 return __a - __b; 12257 } 12258 #endif 12259 12260 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12261 vec_sub_u128(vector unsigned char __a, vector unsigned char __b) { 12262 return __builtin_altivec_vsubuqm(__a, __b); 12263 } 12264 12265 /* vec_vsubeuqm */ 12266 12267 #ifdef __SIZEOF_INT128__ 12268 static __inline__ vector signed __int128 __ATTRS_o_ai 12269 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 12270 vector signed __int128 __c) { 12271 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12272 } 12273 12274 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12275 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 12276 vector unsigned __int128 __c) { 12277 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12278 } 12279 12280 static __inline__ vector signed __int128 __ATTRS_o_ai 12281 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 12282 vector signed __int128 __c) { 12283 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12284 } 12285 12286 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12287 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 12288 vector unsigned __int128 __c) { 12289 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12290 } 12291 #endif 12292 12293 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12294 vec_sube_u128(vector unsigned char __a, vector unsigned char __b, 12295 vector unsigned char __c) { 12296 return (vector unsigned char)__builtin_altivec_vsubeuqm(__a, __b, __c); 12297 } 12298 12299 /* vec_vsubcuq */ 12300 12301 #ifdef __SIZEOF_INT128__ 12302 static __inline__ vector signed __int128 __ATTRS_o_ai 12303 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 12304 return __builtin_altivec_vsubcuq(__a, __b); 12305 } 12306 12307 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12308 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12309 return __builtin_altivec_vsubcuq(__a, __b); 12310 } 12311 12312 /* vec_vsubecuq */ 12313 12314 static __inline__ vector signed __int128 __ATTRS_o_ai 12315 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 12316 vector signed __int128 __c) { 12317 return __builtin_altivec_vsubecuq(__a, __b, __c); 12318 } 12319 12320 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12321 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 12322 vector unsigned __int128 __c) { 12323 return __builtin_altivec_vsubecuq(__a, __b, __c); 12324 } 12325 #endif 12326 12327 static __inline__ vector signed int __ATTRS_o_ai 12328 vec_subec(vector signed int __a, vector signed int __b, 12329 vector signed int __c) { 12330 return vec_addec(__a, ~__b, __c); 12331 } 12332 12333 static __inline__ vector unsigned int __ATTRS_o_ai 12334 vec_subec(vector unsigned int __a, vector unsigned int __b, 12335 vector unsigned int __c) { 12336 return vec_addec(__a, ~__b, __c); 12337 } 12338 12339 #ifdef __SIZEOF_INT128__ 12340 static __inline__ vector signed __int128 __ATTRS_o_ai 12341 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 12342 vector signed __int128 __c) { 12343 return __builtin_altivec_vsubecuq(__a, __b, __c); 12344 } 12345 12346 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12347 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 12348 vector unsigned __int128 __c) { 12349 return __builtin_altivec_vsubecuq(__a, __b, __c); 12350 } 12351 #endif 12352 12353 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12354 vec_subec_u128(vector unsigned char __a, vector unsigned char __b, 12355 vector unsigned char __c) { 12356 return (vector unsigned char)__builtin_altivec_vsubecuq(__a, __b, __c); 12357 } 12358 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 12359 12360 static __inline__ vector signed int __ATTRS_o_ai 12361 vec_sube(vector signed int __a, vector signed int __b, 12362 vector signed int __c) { 12363 vector signed int __mask = {1, 1, 1, 1}; 12364 vector signed int __carry = __c & __mask; 12365 return vec_adde(__a, ~__b, __carry); 12366 } 12367 12368 static __inline__ vector unsigned int __ATTRS_o_ai 12369 vec_sube(vector unsigned int __a, vector unsigned int __b, 12370 vector unsigned int __c) { 12371 vector unsigned int __mask = {1, 1, 1, 1}; 12372 vector unsigned int __carry = __c & __mask; 12373 return vec_adde(__a, ~__b, __carry); 12374 } 12375 /* vec_sum4s */ 12376 12377 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 12378 vector int __b) { 12379 return __builtin_altivec_vsum4sbs(__a, __b); 12380 } 12381 12382 static __inline__ vector unsigned int __ATTRS_o_ai 12383 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 12384 return __builtin_altivec_vsum4ubs(__a, __b); 12385 } 12386 12387 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 12388 vector int __b) { 12389 return __builtin_altivec_vsum4shs(__a, __b); 12390 } 12391 12392 /* vec_vsum4sbs */ 12393 12394 static __inline__ vector int __attribute__((__always_inline__)) 12395 vec_vsum4sbs(vector signed char __a, vector int __b) { 12396 return __builtin_altivec_vsum4sbs(__a, __b); 12397 } 12398 12399 /* vec_vsum4ubs */ 12400 12401 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12402 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 12403 return __builtin_altivec_vsum4ubs(__a, __b); 12404 } 12405 12406 /* vec_vsum4shs */ 12407 12408 static __inline__ vector int __attribute__((__always_inline__)) 12409 vec_vsum4shs(vector signed short __a, vector int __b) { 12410 return __builtin_altivec_vsum4shs(__a, __b); 12411 } 12412 12413 /* vec_sum2s */ 12414 12415 /* The vsum2sws instruction has a big-endian bias, so that the second 12416 input vector and the result always reference big-endian elements 12417 1 and 3 (little-endian element 0 and 2). For ease of porting the 12418 programmer wants elements 1 and 3 in both cases, so for little 12419 endian we must perform some permutes. */ 12420 12421 static __inline__ vector signed int __attribute__((__always_inline__)) 12422 vec_sum2s(vector int __a, vector int __b) { 12423 #ifdef __LITTLE_ENDIAN__ 12424 vector int __c = (vector signed int)vec_perm( 12425 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12426 8, 9, 10, 11)); 12427 __c = __builtin_altivec_vsum2sws(__a, __c); 12428 return (vector signed int)vec_perm( 12429 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12430 8, 9, 10, 11)); 12431 #else 12432 return __builtin_altivec_vsum2sws(__a, __b); 12433 #endif 12434 } 12435 12436 /* vec_vsum2sws */ 12437 12438 static __inline__ vector signed int __attribute__((__always_inline__)) 12439 vec_vsum2sws(vector int __a, vector int __b) { 12440 #ifdef __LITTLE_ENDIAN__ 12441 vector int __c = (vector signed int)vec_perm( 12442 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12443 8, 9, 10, 11)); 12444 __c = __builtin_altivec_vsum2sws(__a, __c); 12445 return (vector signed int)vec_perm( 12446 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12447 8, 9, 10, 11)); 12448 #else 12449 return __builtin_altivec_vsum2sws(__a, __b); 12450 #endif 12451 } 12452 12453 /* vec_sums */ 12454 12455 /* The vsumsws instruction has a big-endian bias, so that the second 12456 input vector and the result always reference big-endian element 3 12457 (little-endian element 0). For ease of porting the programmer 12458 wants element 3 in both cases, so for little endian we must perform 12459 some permutes. */ 12460 12461 static __inline__ vector signed int __attribute__((__always_inline__)) 12462 vec_sums(vector signed int __a, vector signed int __b) { 12463 #ifdef __LITTLE_ENDIAN__ 12464 __b = (vector signed int)vec_splat(__b, 3); 12465 __b = __builtin_altivec_vsumsws(__a, __b); 12466 return (vector signed int)(0, 0, 0, __b[0]); 12467 #else 12468 return __builtin_altivec_vsumsws(__a, __b); 12469 #endif 12470 } 12471 12472 /* vec_vsumsws */ 12473 12474 static __inline__ vector signed int __attribute__((__always_inline__)) 12475 vec_vsumsws(vector signed int __a, vector signed int __b) { 12476 #ifdef __LITTLE_ENDIAN__ 12477 __b = (vector signed int)vec_splat(__b, 3); 12478 __b = __builtin_altivec_vsumsws(__a, __b); 12479 return (vector signed int)(0, 0, 0, __b[0]); 12480 #else 12481 return __builtin_altivec_vsumsws(__a, __b); 12482 #endif 12483 } 12484 12485 /* vec_trunc */ 12486 12487 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 12488 #ifdef __VSX__ 12489 return __builtin_vsx_xvrspiz(__a); 12490 #else 12491 return __builtin_altivec_vrfiz(__a); 12492 #endif 12493 } 12494 12495 #ifdef __VSX__ 12496 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 12497 return __builtin_vsx_xvrdpiz(__a); 12498 } 12499 #endif 12500 12501 /* vec_roundz */ 12502 static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) { 12503 return vec_trunc(__a); 12504 } 12505 12506 #ifdef __VSX__ 12507 static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) { 12508 return vec_trunc(__a); 12509 } 12510 #endif 12511 12512 /* vec_vrfiz */ 12513 12514 static __inline__ vector float __attribute__((__always_inline__)) 12515 vec_vrfiz(vector float __a) { 12516 return __builtin_altivec_vrfiz(__a); 12517 } 12518 12519 /* vec_unpackh */ 12520 12521 /* The vector unpack instructions all have a big-endian bias, so for 12522 little endian we must reverse the meanings of "high" and "low." */ 12523 #ifdef __LITTLE_ENDIAN__ 12524 #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12525 #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12526 #else 12527 #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12528 #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12529 #endif 12530 12531 static __inline__ vector short __ATTRS_o_ai 12532 vec_unpackh(vector signed char __a) { 12533 #ifdef __LITTLE_ENDIAN__ 12534 return __builtin_altivec_vupklsb((vector char)__a); 12535 #else 12536 return __builtin_altivec_vupkhsb((vector char)__a); 12537 #endif 12538 } 12539 12540 static __inline__ vector bool short __ATTRS_o_ai 12541 vec_unpackh(vector bool char __a) { 12542 #ifdef __LITTLE_ENDIAN__ 12543 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12544 #else 12545 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12546 #endif 12547 } 12548 12549 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 12550 #ifdef __LITTLE_ENDIAN__ 12551 return __builtin_altivec_vupklsh(__a); 12552 #else 12553 return __builtin_altivec_vupkhsh(__a); 12554 #endif 12555 } 12556 12557 static __inline__ vector bool int __ATTRS_o_ai 12558 vec_unpackh(vector bool short __a) { 12559 #ifdef __LITTLE_ENDIAN__ 12560 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12561 #else 12562 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12563 #endif 12564 } 12565 12566 static __inline__ vector unsigned int __ATTRS_o_ai 12567 vec_unpackh(vector pixel __a) { 12568 #ifdef __LITTLE_ENDIAN__ 12569 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12570 #else 12571 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12572 #endif 12573 } 12574 12575 #ifdef __POWER8_VECTOR__ 12576 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 12577 #ifdef __LITTLE_ENDIAN__ 12578 return __builtin_altivec_vupklsw(__a); 12579 #else 12580 return __builtin_altivec_vupkhsw(__a); 12581 #endif 12582 } 12583 12584 static __inline__ vector bool long long __ATTRS_o_ai 12585 vec_unpackh(vector bool int __a) { 12586 #ifdef __LITTLE_ENDIAN__ 12587 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12588 #else 12589 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12590 #endif 12591 } 12592 12593 static __inline__ vector double __ATTRS_o_ai 12594 vec_unpackh(vector float __a) { 12595 return (vector double)(__a[0], __a[1]); 12596 } 12597 #endif 12598 12599 /* vec_vupkhsb */ 12600 12601 static __inline__ vector short __ATTRS_o_ai 12602 vec_vupkhsb(vector signed char __a) { 12603 #ifdef __LITTLE_ENDIAN__ 12604 return __builtin_altivec_vupklsb((vector char)__a); 12605 #else 12606 return __builtin_altivec_vupkhsb((vector char)__a); 12607 #endif 12608 } 12609 12610 static __inline__ vector bool short __ATTRS_o_ai 12611 vec_vupkhsb(vector bool char __a) { 12612 #ifdef __LITTLE_ENDIAN__ 12613 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12614 #else 12615 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12616 #endif 12617 } 12618 12619 /* vec_vupkhsh */ 12620 12621 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 12622 #ifdef __LITTLE_ENDIAN__ 12623 return __builtin_altivec_vupklsh(__a); 12624 #else 12625 return __builtin_altivec_vupkhsh(__a); 12626 #endif 12627 } 12628 12629 static __inline__ vector bool int __ATTRS_o_ai 12630 vec_vupkhsh(vector bool short __a) { 12631 #ifdef __LITTLE_ENDIAN__ 12632 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12633 #else 12634 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12635 #endif 12636 } 12637 12638 static __inline__ vector unsigned int __ATTRS_o_ai 12639 vec_vupkhsh(vector pixel __a) { 12640 #ifdef __LITTLE_ENDIAN__ 12641 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12642 #else 12643 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12644 #endif 12645 } 12646 12647 /* vec_vupkhsw */ 12648 12649 #ifdef __POWER8_VECTOR__ 12650 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 12651 #ifdef __LITTLE_ENDIAN__ 12652 return __builtin_altivec_vupklsw(__a); 12653 #else 12654 return __builtin_altivec_vupkhsw(__a); 12655 #endif 12656 } 12657 12658 static __inline__ vector bool long long __ATTRS_o_ai 12659 vec_vupkhsw(vector bool int __a) { 12660 #ifdef __LITTLE_ENDIAN__ 12661 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12662 #else 12663 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12664 #endif 12665 } 12666 #endif 12667 12668 /* vec_unpackl */ 12669 12670 static __inline__ vector short __ATTRS_o_ai 12671 vec_unpackl(vector signed char __a) { 12672 #ifdef __LITTLE_ENDIAN__ 12673 return __builtin_altivec_vupkhsb((vector char)__a); 12674 #else 12675 return __builtin_altivec_vupklsb((vector char)__a); 12676 #endif 12677 } 12678 12679 static __inline__ vector bool short __ATTRS_o_ai 12680 vec_unpackl(vector bool char __a) { 12681 #ifdef __LITTLE_ENDIAN__ 12682 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12683 #else 12684 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12685 #endif 12686 } 12687 12688 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 12689 #ifdef __LITTLE_ENDIAN__ 12690 return __builtin_altivec_vupkhsh(__a); 12691 #else 12692 return __builtin_altivec_vupklsh(__a); 12693 #endif 12694 } 12695 12696 static __inline__ vector bool int __ATTRS_o_ai 12697 vec_unpackl(vector bool short __a) { 12698 #ifdef __LITTLE_ENDIAN__ 12699 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12700 #else 12701 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12702 #endif 12703 } 12704 12705 static __inline__ vector unsigned int __ATTRS_o_ai 12706 vec_unpackl(vector pixel __a) { 12707 #ifdef __LITTLE_ENDIAN__ 12708 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12709 #else 12710 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12711 #endif 12712 } 12713 12714 #ifdef __POWER8_VECTOR__ 12715 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 12716 #ifdef __LITTLE_ENDIAN__ 12717 return __builtin_altivec_vupkhsw(__a); 12718 #else 12719 return __builtin_altivec_vupklsw(__a); 12720 #endif 12721 } 12722 12723 static __inline__ vector bool long long __ATTRS_o_ai 12724 vec_unpackl(vector bool int __a) { 12725 #ifdef __LITTLE_ENDIAN__ 12726 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12727 #else 12728 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12729 #endif 12730 } 12731 12732 static __inline__ vector double __ATTRS_o_ai 12733 vec_unpackl(vector float __a) { 12734 return (vector double)(__a[2], __a[3]); 12735 } 12736 #endif 12737 12738 /* vec_vupklsb */ 12739 12740 static __inline__ vector short __ATTRS_o_ai 12741 vec_vupklsb(vector signed char __a) { 12742 #ifdef __LITTLE_ENDIAN__ 12743 return __builtin_altivec_vupkhsb((vector char)__a); 12744 #else 12745 return __builtin_altivec_vupklsb((vector char)__a); 12746 #endif 12747 } 12748 12749 static __inline__ vector bool short __ATTRS_o_ai 12750 vec_vupklsb(vector bool char __a) { 12751 #ifdef __LITTLE_ENDIAN__ 12752 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12753 #else 12754 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12755 #endif 12756 } 12757 12758 /* vec_vupklsh */ 12759 12760 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 12761 #ifdef __LITTLE_ENDIAN__ 12762 return __builtin_altivec_vupkhsh(__a); 12763 #else 12764 return __builtin_altivec_vupklsh(__a); 12765 #endif 12766 } 12767 12768 static __inline__ vector bool int __ATTRS_o_ai 12769 vec_vupklsh(vector bool short __a) { 12770 #ifdef __LITTLE_ENDIAN__ 12771 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12772 #else 12773 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12774 #endif 12775 } 12776 12777 static __inline__ vector unsigned int __ATTRS_o_ai 12778 vec_vupklsh(vector pixel __a) { 12779 #ifdef __LITTLE_ENDIAN__ 12780 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12781 #else 12782 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12783 #endif 12784 } 12785 12786 /* vec_vupklsw */ 12787 12788 #ifdef __POWER8_VECTOR__ 12789 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 12790 #ifdef __LITTLE_ENDIAN__ 12791 return __builtin_altivec_vupkhsw(__a); 12792 #else 12793 return __builtin_altivec_vupklsw(__a); 12794 #endif 12795 } 12796 12797 static __inline__ vector bool long long __ATTRS_o_ai 12798 vec_vupklsw(vector bool int __a) { 12799 #ifdef __LITTLE_ENDIAN__ 12800 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12801 #else 12802 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12803 #endif 12804 } 12805 #endif 12806 12807 /* vec_vsx_ld */ 12808 12809 #ifdef __VSX__ 12810 12811 static __inline__ vector bool int __ATTRS_o_ai 12812 vec_vsx_ld(int __a, const vector bool int *__b) { 12813 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 12814 } 12815 12816 static __inline__ vector signed int __ATTRS_o_ai 12817 vec_vsx_ld(int __a, const vector signed int *__b) { 12818 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12819 } 12820 12821 static __inline__ vector signed int __ATTRS_o_ai 12822 vec_vsx_ld(int __a, const signed int *__b) { 12823 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12824 } 12825 12826 static __inline__ vector unsigned int __ATTRS_o_ai 12827 vec_vsx_ld(int __a, const vector unsigned int *__b) { 12828 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12829 } 12830 12831 static __inline__ vector unsigned int __ATTRS_o_ai 12832 vec_vsx_ld(int __a, const unsigned int *__b) { 12833 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12834 } 12835 12836 static __inline__ vector float __ATTRS_o_ai 12837 vec_vsx_ld(int __a, const vector float *__b) { 12838 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12839 } 12840 12841 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 12842 const float *__b) { 12843 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12844 } 12845 12846 static __inline__ vector signed long long __ATTRS_o_ai 12847 vec_vsx_ld(int __a, const vector signed long long *__b) { 12848 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 12849 } 12850 12851 static __inline__ vector unsigned long long __ATTRS_o_ai 12852 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 12853 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 12854 } 12855 12856 static __inline__ vector double __ATTRS_o_ai 12857 vec_vsx_ld(int __a, const vector double *__b) { 12858 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12859 } 12860 12861 static __inline__ vector double __ATTRS_o_ai 12862 vec_vsx_ld(int __a, const double *__b) { 12863 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12864 } 12865 12866 static __inline__ vector bool short __ATTRS_o_ai 12867 vec_vsx_ld(int __a, const vector bool short *__b) { 12868 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12869 } 12870 12871 static __inline__ vector signed short __ATTRS_o_ai 12872 vec_vsx_ld(int __a, const vector signed short *__b) { 12873 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12874 } 12875 12876 static __inline__ vector signed short __ATTRS_o_ai 12877 vec_vsx_ld(int __a, const signed short *__b) { 12878 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12879 } 12880 12881 static __inline__ vector unsigned short __ATTRS_o_ai 12882 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12883 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12884 } 12885 12886 static __inline__ vector unsigned short __ATTRS_o_ai 12887 vec_vsx_ld(int __a, const unsigned short *__b) { 12888 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12889 } 12890 12891 static __inline__ vector bool char __ATTRS_o_ai 12892 vec_vsx_ld(int __a, const vector bool char *__b) { 12893 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12894 } 12895 12896 static __inline__ vector signed char __ATTRS_o_ai 12897 vec_vsx_ld(int __a, const vector signed char *__b) { 12898 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12899 } 12900 12901 static __inline__ vector signed char __ATTRS_o_ai 12902 vec_vsx_ld(int __a, const signed char *__b) { 12903 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12904 } 12905 12906 static __inline__ vector unsigned char __ATTRS_o_ai 12907 vec_vsx_ld(int __a, const vector unsigned char *__b) { 12908 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12909 } 12910 12911 static __inline__ vector unsigned char __ATTRS_o_ai 12912 vec_vsx_ld(int __a, const unsigned char *__b) { 12913 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12914 } 12915 12916 #endif 12917 12918 /* vec_vsx_st */ 12919 12920 #ifdef __VSX__ 12921 12922 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12923 vector bool int *__c) { 12924 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12925 } 12926 12927 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12928 signed int *__c) { 12929 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12930 } 12931 12932 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12933 unsigned int *__c) { 12934 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12935 } 12936 12937 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12938 vector signed int *__c) { 12939 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12940 } 12941 12942 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12943 signed int *__c) { 12944 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12945 } 12946 12947 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12948 vector unsigned int *__c) { 12949 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12950 } 12951 12952 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12953 unsigned int *__c) { 12954 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12955 } 12956 12957 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12958 vector float *__c) { 12959 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12960 } 12961 12962 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12963 float *__c) { 12964 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12965 } 12966 12967 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 12968 int __b, 12969 vector signed long long *__c) { 12970 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12971 } 12972 12973 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 12974 int __b, 12975 vector unsigned long long *__c) { 12976 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12977 } 12978 12979 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12980 vector double *__c) { 12981 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12982 } 12983 12984 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 12985 double *__c) { 12986 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 12987 } 12988 12989 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12990 vector bool short *__c) { 12991 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12992 } 12993 12994 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 12995 signed short *__c) { 12996 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12997 } 12998 12999 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13000 unsigned short *__c) { 13001 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13002 } 13003 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13004 vector signed short *__c) { 13005 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13006 } 13007 13008 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13009 signed short *__c) { 13010 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13011 } 13012 13013 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13014 int __b, 13015 vector unsigned short *__c) { 13016 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13017 } 13018 13019 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13020 int __b, unsigned short *__c) { 13021 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13022 } 13023 13024 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13025 vector bool char *__c) { 13026 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13027 } 13028 13029 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13030 signed char *__c) { 13031 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13032 } 13033 13034 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13035 unsigned char *__c) { 13036 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13037 } 13038 13039 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13040 vector signed char *__c) { 13041 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13042 } 13043 13044 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13045 signed char *__c) { 13046 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13047 } 13048 13049 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13050 int __b, 13051 vector unsigned char *__c) { 13052 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13053 } 13054 13055 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13056 int __b, unsigned char *__c) { 13057 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13058 } 13059 13060 #endif 13061 13062 #ifdef __VSX__ 13063 #define vec_xxpermdi __builtin_vsx_xxpermdi 13064 #define vec_xxsldwi __builtin_vsx_xxsldwi 13065 #define vec_permi(__a, __b, __c) \ 13066 _Generic((__a), vector signed long long \ 13067 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13068 (((__c)&0x1) + 2)), \ 13069 vector unsigned long long \ 13070 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13071 (((__c)&0x1) + 2)), \ 13072 vector double \ 13073 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13074 (((__c)&0x1) + 2))) 13075 #endif 13076 13077 /* vec_xor */ 13078 13079 #define __builtin_altivec_vxor vec_xor 13080 13081 static __inline__ vector signed char __ATTRS_o_ai 13082 vec_xor(vector signed char __a, vector signed char __b) { 13083 return __a ^ __b; 13084 } 13085 13086 static __inline__ vector signed char __ATTRS_o_ai 13087 vec_xor(vector bool char __a, vector signed char __b) { 13088 return (vector signed char)__a ^ __b; 13089 } 13090 13091 static __inline__ vector signed char __ATTRS_o_ai 13092 vec_xor(vector signed char __a, vector bool char __b) { 13093 return __a ^ (vector signed char)__b; 13094 } 13095 13096 static __inline__ vector unsigned char __ATTRS_o_ai 13097 vec_xor(vector unsigned char __a, vector unsigned char __b) { 13098 return __a ^ __b; 13099 } 13100 13101 static __inline__ vector unsigned char __ATTRS_o_ai 13102 vec_xor(vector bool char __a, vector unsigned char __b) { 13103 return (vector unsigned char)__a ^ __b; 13104 } 13105 13106 static __inline__ vector unsigned char __ATTRS_o_ai 13107 vec_xor(vector unsigned char __a, vector bool char __b) { 13108 return __a ^ (vector unsigned char)__b; 13109 } 13110 13111 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 13112 vector bool char __b) { 13113 return __a ^ __b; 13114 } 13115 13116 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13117 vector short __b) { 13118 return __a ^ __b; 13119 } 13120 13121 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 13122 vector short __b) { 13123 return (vector short)__a ^ __b; 13124 } 13125 13126 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13127 vector bool short __b) { 13128 return __a ^ (vector short)__b; 13129 } 13130 13131 static __inline__ vector unsigned short __ATTRS_o_ai 13132 vec_xor(vector unsigned short __a, vector unsigned short __b) { 13133 return __a ^ __b; 13134 } 13135 13136 static __inline__ vector unsigned short __ATTRS_o_ai 13137 vec_xor(vector bool short __a, vector unsigned short __b) { 13138 return (vector unsigned short)__a ^ __b; 13139 } 13140 13141 static __inline__ vector unsigned short __ATTRS_o_ai 13142 vec_xor(vector unsigned short __a, vector bool short __b) { 13143 return __a ^ (vector unsigned short)__b; 13144 } 13145 13146 static __inline__ vector bool short __ATTRS_o_ai 13147 vec_xor(vector bool short __a, vector bool short __b) { 13148 return __a ^ __b; 13149 } 13150 13151 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13152 vector int __b) { 13153 return __a ^ __b; 13154 } 13155 13156 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 13157 vector int __b) { 13158 return (vector int)__a ^ __b; 13159 } 13160 13161 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13162 vector bool int __b) { 13163 return __a ^ (vector int)__b; 13164 } 13165 13166 static __inline__ vector unsigned int __ATTRS_o_ai 13167 vec_xor(vector unsigned int __a, vector unsigned int __b) { 13168 return __a ^ __b; 13169 } 13170 13171 static __inline__ vector unsigned int __ATTRS_o_ai 13172 vec_xor(vector bool int __a, vector unsigned int __b) { 13173 return (vector unsigned int)__a ^ __b; 13174 } 13175 13176 static __inline__ vector unsigned int __ATTRS_o_ai 13177 vec_xor(vector unsigned int __a, vector bool int __b) { 13178 return __a ^ (vector unsigned int)__b; 13179 } 13180 13181 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 13182 vector bool int __b) { 13183 return __a ^ __b; 13184 } 13185 13186 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13187 vector float __b) { 13188 vector unsigned int __res = 13189 (vector unsigned int)__a ^ (vector unsigned int)__b; 13190 return (vector float)__res; 13191 } 13192 13193 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 13194 vector float __b) { 13195 vector unsigned int __res = 13196 (vector unsigned int)__a ^ (vector unsigned int)__b; 13197 return (vector float)__res; 13198 } 13199 13200 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13201 vector bool int __b) { 13202 vector unsigned int __res = 13203 (vector unsigned int)__a ^ (vector unsigned int)__b; 13204 return (vector float)__res; 13205 } 13206 13207 #ifdef __VSX__ 13208 static __inline__ vector signed long long __ATTRS_o_ai 13209 vec_xor(vector signed long long __a, vector signed long long __b) { 13210 return __a ^ __b; 13211 } 13212 13213 static __inline__ vector signed long long __ATTRS_o_ai 13214 vec_xor(vector bool long long __a, vector signed long long __b) { 13215 return (vector signed long long)__a ^ __b; 13216 } 13217 13218 static __inline__ vector signed long long __ATTRS_o_ai 13219 vec_xor(vector signed long long __a, vector bool long long __b) { 13220 return __a ^ (vector signed long long)__b; 13221 } 13222 13223 static __inline__ vector unsigned long long __ATTRS_o_ai 13224 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 13225 return __a ^ __b; 13226 } 13227 13228 static __inline__ vector unsigned long long __ATTRS_o_ai 13229 vec_xor(vector bool long long __a, vector unsigned long long __b) { 13230 return (vector unsigned long long)__a ^ __b; 13231 } 13232 13233 static __inline__ vector unsigned long long __ATTRS_o_ai 13234 vec_xor(vector unsigned long long __a, vector bool long long __b) { 13235 return __a ^ (vector unsigned long long)__b; 13236 } 13237 13238 static __inline__ vector bool long long __ATTRS_o_ai 13239 vec_xor(vector bool long long __a, vector bool long long __b) { 13240 return __a ^ __b; 13241 } 13242 13243 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 13244 vector double __b) { 13245 return (vector double)((vector unsigned long long)__a ^ 13246 (vector unsigned long long)__b); 13247 } 13248 13249 static __inline__ vector double __ATTRS_o_ai 13250 vec_xor(vector double __a, vector bool long long __b) { 13251 return (vector double)((vector unsigned long long)__a ^ 13252 (vector unsigned long long)__b); 13253 } 13254 13255 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 13256 vector double __b) { 13257 return (vector double)((vector unsigned long long)__a ^ 13258 (vector unsigned long long)__b); 13259 } 13260 #endif 13261 13262 /* vec_vxor */ 13263 13264 static __inline__ vector signed char __ATTRS_o_ai 13265 vec_vxor(vector signed char __a, vector signed char __b) { 13266 return __a ^ __b; 13267 } 13268 13269 static __inline__ vector signed char __ATTRS_o_ai 13270 vec_vxor(vector bool char __a, vector signed char __b) { 13271 return (vector signed char)__a ^ __b; 13272 } 13273 13274 static __inline__ vector signed char __ATTRS_o_ai 13275 vec_vxor(vector signed char __a, vector bool char __b) { 13276 return __a ^ (vector signed char)__b; 13277 } 13278 13279 static __inline__ vector unsigned char __ATTRS_o_ai 13280 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 13281 return __a ^ __b; 13282 } 13283 13284 static __inline__ vector unsigned char __ATTRS_o_ai 13285 vec_vxor(vector bool char __a, vector unsigned char __b) { 13286 return (vector unsigned char)__a ^ __b; 13287 } 13288 13289 static __inline__ vector unsigned char __ATTRS_o_ai 13290 vec_vxor(vector unsigned char __a, vector bool char __b) { 13291 return __a ^ (vector unsigned char)__b; 13292 } 13293 13294 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 13295 vector bool char __b) { 13296 return __a ^ __b; 13297 } 13298 13299 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13300 vector short __b) { 13301 return __a ^ __b; 13302 } 13303 13304 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 13305 vector short __b) { 13306 return (vector short)__a ^ __b; 13307 } 13308 13309 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13310 vector bool short __b) { 13311 return __a ^ (vector short)__b; 13312 } 13313 13314 static __inline__ vector unsigned short __ATTRS_o_ai 13315 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 13316 return __a ^ __b; 13317 } 13318 13319 static __inline__ vector unsigned short __ATTRS_o_ai 13320 vec_vxor(vector bool short __a, vector unsigned short __b) { 13321 return (vector unsigned short)__a ^ __b; 13322 } 13323 13324 static __inline__ vector unsigned short __ATTRS_o_ai 13325 vec_vxor(vector unsigned short __a, vector bool short __b) { 13326 return __a ^ (vector unsigned short)__b; 13327 } 13328 13329 static __inline__ vector bool short __ATTRS_o_ai 13330 vec_vxor(vector bool short __a, vector bool short __b) { 13331 return __a ^ __b; 13332 } 13333 13334 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13335 vector int __b) { 13336 return __a ^ __b; 13337 } 13338 13339 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 13340 vector int __b) { 13341 return (vector int)__a ^ __b; 13342 } 13343 13344 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13345 vector bool int __b) { 13346 return __a ^ (vector int)__b; 13347 } 13348 13349 static __inline__ vector unsigned int __ATTRS_o_ai 13350 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 13351 return __a ^ __b; 13352 } 13353 13354 static __inline__ vector unsigned int __ATTRS_o_ai 13355 vec_vxor(vector bool int __a, vector unsigned int __b) { 13356 return (vector unsigned int)__a ^ __b; 13357 } 13358 13359 static __inline__ vector unsigned int __ATTRS_o_ai 13360 vec_vxor(vector unsigned int __a, vector bool int __b) { 13361 return __a ^ (vector unsigned int)__b; 13362 } 13363 13364 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 13365 vector bool int __b) { 13366 return __a ^ __b; 13367 } 13368 13369 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13370 vector float __b) { 13371 vector unsigned int __res = 13372 (vector unsigned int)__a ^ (vector unsigned int)__b; 13373 return (vector float)__res; 13374 } 13375 13376 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 13377 vector float __b) { 13378 vector unsigned int __res = 13379 (vector unsigned int)__a ^ (vector unsigned int)__b; 13380 return (vector float)__res; 13381 } 13382 13383 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13384 vector bool int __b) { 13385 vector unsigned int __res = 13386 (vector unsigned int)__a ^ (vector unsigned int)__b; 13387 return (vector float)__res; 13388 } 13389 13390 #ifdef __VSX__ 13391 static __inline__ vector signed long long __ATTRS_o_ai 13392 vec_vxor(vector signed long long __a, vector signed long long __b) { 13393 return __a ^ __b; 13394 } 13395 13396 static __inline__ vector signed long long __ATTRS_o_ai 13397 vec_vxor(vector bool long long __a, vector signed long long __b) { 13398 return (vector signed long long)__a ^ __b; 13399 } 13400 13401 static __inline__ vector signed long long __ATTRS_o_ai 13402 vec_vxor(vector signed long long __a, vector bool long long __b) { 13403 return __a ^ (vector signed long long)__b; 13404 } 13405 13406 static __inline__ vector unsigned long long __ATTRS_o_ai 13407 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 13408 return __a ^ __b; 13409 } 13410 13411 static __inline__ vector unsigned long long __ATTRS_o_ai 13412 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 13413 return (vector unsigned long long)__a ^ __b; 13414 } 13415 13416 static __inline__ vector unsigned long long __ATTRS_o_ai 13417 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 13418 return __a ^ (vector unsigned long long)__b; 13419 } 13420 13421 static __inline__ vector bool long long __ATTRS_o_ai 13422 vec_vxor(vector bool long long __a, vector bool long long __b) { 13423 return __a ^ __b; 13424 } 13425 #endif 13426 13427 /* ------------------------ extensions for CBEA ----------------------------- */ 13428 13429 /* vec_extract */ 13430 13431 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 13432 unsigned int __b) { 13433 return __a[__b & 0xf]; 13434 } 13435 13436 static __inline__ unsigned char __ATTRS_o_ai 13437 vec_extract(vector unsigned char __a, unsigned int __b) { 13438 return __a[__b & 0xf]; 13439 } 13440 13441 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 13442 unsigned int __b) { 13443 return __a[__b & 0xf]; 13444 } 13445 13446 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 13447 unsigned int __b) { 13448 return __a[__b & 0x7]; 13449 } 13450 13451 static __inline__ unsigned short __ATTRS_o_ai 13452 vec_extract(vector unsigned short __a, unsigned int __b) { 13453 return __a[__b & 0x7]; 13454 } 13455 13456 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 13457 unsigned int __b) { 13458 return __a[__b & 0x7]; 13459 } 13460 13461 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 13462 unsigned int __b) { 13463 return __a[__b & 0x3]; 13464 } 13465 13466 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 13467 unsigned int __b) { 13468 return __a[__b & 0x3]; 13469 } 13470 13471 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 13472 unsigned int __b) { 13473 return __a[__b & 0x3]; 13474 } 13475 13476 #ifdef __VSX__ 13477 static __inline__ signed long long __ATTRS_o_ai 13478 vec_extract(vector signed long long __a, unsigned int __b) { 13479 return __a[__b & 0x1]; 13480 } 13481 13482 static __inline__ unsigned long long __ATTRS_o_ai 13483 vec_extract(vector unsigned long long __a, unsigned int __b) { 13484 return __a[__b & 0x1]; 13485 } 13486 13487 static __inline__ unsigned long long __ATTRS_o_ai 13488 vec_extract(vector bool long long __a, unsigned int __b) { 13489 return __a[__b & 0x1]; 13490 } 13491 13492 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, 13493 unsigned int __b) { 13494 return __a[__b & 0x1]; 13495 } 13496 #endif 13497 13498 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, 13499 unsigned int __b) { 13500 return __a[__b & 0x3]; 13501 } 13502 13503 #ifdef __POWER9_VECTOR__ 13504 13505 #define vec_insert4b __builtin_vsx_insertword 13506 #define vec_extract4b __builtin_vsx_extractuword 13507 13508 /* vec_extract_exp */ 13509 13510 static __inline__ vector unsigned int __ATTRS_o_ai 13511 vec_extract_exp(vector float __a) { 13512 return __builtin_vsx_xvxexpsp(__a); 13513 } 13514 13515 static __inline__ vector unsigned long long __ATTRS_o_ai 13516 vec_extract_exp(vector double __a) { 13517 return __builtin_vsx_xvxexpdp(__a); 13518 } 13519 13520 /* vec_extract_sig */ 13521 13522 static __inline__ vector unsigned int __ATTRS_o_ai 13523 vec_extract_sig(vector float __a) { 13524 return __builtin_vsx_xvxsigsp(__a); 13525 } 13526 13527 static __inline__ vector unsigned long long __ATTRS_o_ai 13528 vec_extract_sig (vector double __a) { 13529 return __builtin_vsx_xvxsigdp(__a); 13530 } 13531 13532 static __inline__ vector float __ATTRS_o_ai 13533 vec_extract_fp32_from_shorth(vector unsigned short __a) { 13534 vector unsigned short __b = 13535 #ifdef __LITTLE_ENDIAN__ 13536 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 13537 #else 13538 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 13539 #endif 13540 return __builtin_vsx_xvcvhpsp(__b); 13541 } 13542 13543 static __inline__ vector float __ATTRS_o_ai 13544 vec_extract_fp32_from_shortl(vector unsigned short __a) { 13545 vector unsigned short __b = 13546 #ifdef __LITTLE_ENDIAN__ 13547 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 13548 #else 13549 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 13550 #endif 13551 return __builtin_vsx_xvcvhpsp(__b); 13552 } 13553 #endif /* __POWER9_VECTOR__ */ 13554 13555 /* vec_insert */ 13556 13557 static __inline__ vector signed char __ATTRS_o_ai 13558 vec_insert(signed char __a, vector signed char __b, int __c) { 13559 __b[__c] = __a; 13560 return __b; 13561 } 13562 13563 static __inline__ vector unsigned char __ATTRS_o_ai 13564 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 13565 __b[__c] = __a; 13566 return __b; 13567 } 13568 13569 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 13570 vector bool char __b, 13571 int __c) { 13572 __b[__c] = __a; 13573 return __b; 13574 } 13575 13576 static __inline__ vector signed short __ATTRS_o_ai 13577 vec_insert(signed short __a, vector signed short __b, int __c) { 13578 __b[__c] = __a; 13579 return __b; 13580 } 13581 13582 static __inline__ vector unsigned short __ATTRS_o_ai 13583 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 13584 __b[__c] = __a; 13585 return __b; 13586 } 13587 13588 static __inline__ vector bool short __ATTRS_o_ai 13589 vec_insert(unsigned short __a, vector bool short __b, int __c) { 13590 __b[__c] = __a; 13591 return __b; 13592 } 13593 13594 static __inline__ vector signed int __ATTRS_o_ai 13595 vec_insert(signed int __a, vector signed int __b, int __c) { 13596 __b[__c] = __a; 13597 return __b; 13598 } 13599 13600 static __inline__ vector unsigned int __ATTRS_o_ai 13601 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 13602 __b[__c] = __a; 13603 return __b; 13604 } 13605 13606 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 13607 vector bool int __b, 13608 int __c) { 13609 __b[__c] = __a; 13610 return __b; 13611 } 13612 13613 #ifdef __VSX__ 13614 static __inline__ vector signed long long __ATTRS_o_ai 13615 vec_insert(signed long long __a, vector signed long long __b, int __c) { 13616 __b[__c] = __a; 13617 return __b; 13618 } 13619 13620 static __inline__ vector unsigned long long __ATTRS_o_ai 13621 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 13622 __b[__c] = __a; 13623 return __b; 13624 } 13625 13626 static __inline__ vector bool long long __ATTRS_o_ai 13627 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 13628 __b[__c] = __a; 13629 return __b; 13630 } 13631 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 13632 vector double __b, 13633 int __c) { 13634 __b[__c] = __a; 13635 return __b; 13636 } 13637 #endif 13638 13639 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 13640 vector float __b, 13641 int __c) { 13642 __b[__c] = __a; 13643 return __b; 13644 } 13645 13646 /* vec_lvlx */ 13647 13648 static __inline__ vector signed char __ATTRS_o_ai 13649 vec_lvlx(int __a, const signed char *__b) { 13650 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13651 vec_lvsl(__a, __b)); 13652 } 13653 13654 static __inline__ vector signed char __ATTRS_o_ai 13655 vec_lvlx(int __a, const vector signed char *__b) { 13656 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13657 vec_lvsl(__a, (unsigned char *)__b)); 13658 } 13659 13660 static __inline__ vector unsigned char __ATTRS_o_ai 13661 vec_lvlx(int __a, const unsigned char *__b) { 13662 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13663 vec_lvsl(__a, __b)); 13664 } 13665 13666 static __inline__ vector unsigned char __ATTRS_o_ai 13667 vec_lvlx(int __a, const vector unsigned char *__b) { 13668 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13669 vec_lvsl(__a, (unsigned char *)__b)); 13670 } 13671 13672 static __inline__ vector bool char __ATTRS_o_ai 13673 vec_lvlx(int __a, const vector bool char *__b) { 13674 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 13675 vec_lvsl(__a, (unsigned char *)__b)); 13676 } 13677 13678 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13679 const short *__b) { 13680 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13681 } 13682 13683 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13684 const vector short *__b) { 13685 return vec_perm(vec_ld(__a, __b), (vector short)(0), 13686 vec_lvsl(__a, (unsigned char *)__b)); 13687 } 13688 13689 static __inline__ vector unsigned short __ATTRS_o_ai 13690 vec_lvlx(int __a, const unsigned short *__b) { 13691 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13692 vec_lvsl(__a, __b)); 13693 } 13694 13695 static __inline__ vector unsigned short __ATTRS_o_ai 13696 vec_lvlx(int __a, const vector unsigned short *__b) { 13697 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13698 vec_lvsl(__a, (unsigned char *)__b)); 13699 } 13700 13701 static __inline__ vector bool short __ATTRS_o_ai 13702 vec_lvlx(int __a, const vector bool short *__b) { 13703 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 13704 vec_lvsl(__a, (unsigned char *)__b)); 13705 } 13706 13707 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 13708 const vector pixel *__b) { 13709 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 13710 vec_lvsl(__a, (unsigned char *)__b)); 13711 } 13712 13713 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 13714 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13715 } 13716 13717 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 13718 const vector int *__b) { 13719 return vec_perm(vec_ld(__a, __b), (vector int)(0), 13720 vec_lvsl(__a, (unsigned char *)__b)); 13721 } 13722 13723 static __inline__ vector unsigned int __ATTRS_o_ai 13724 vec_lvlx(int __a, const unsigned int *__b) { 13725 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13726 vec_lvsl(__a, __b)); 13727 } 13728 13729 static __inline__ vector unsigned int __ATTRS_o_ai 13730 vec_lvlx(int __a, const vector unsigned int *__b) { 13731 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13732 vec_lvsl(__a, (unsigned char *)__b)); 13733 } 13734 13735 static __inline__ vector bool int __ATTRS_o_ai 13736 vec_lvlx(int __a, const vector bool int *__b) { 13737 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 13738 vec_lvsl(__a, (unsigned char *)__b)); 13739 } 13740 13741 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13742 const float *__b) { 13743 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13744 } 13745 13746 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13747 const vector float *__b) { 13748 return vec_perm(vec_ld(__a, __b), (vector float)(0), 13749 vec_lvsl(__a, (unsigned char *)__b)); 13750 } 13751 13752 /* vec_lvlxl */ 13753 13754 static __inline__ vector signed char __ATTRS_o_ai 13755 vec_lvlxl(int __a, const signed char *__b) { 13756 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13757 vec_lvsl(__a, __b)); 13758 } 13759 13760 static __inline__ vector signed char __ATTRS_o_ai 13761 vec_lvlxl(int __a, const vector signed char *__b) { 13762 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13763 vec_lvsl(__a, (unsigned char *)__b)); 13764 } 13765 13766 static __inline__ vector unsigned char __ATTRS_o_ai 13767 vec_lvlxl(int __a, const unsigned char *__b) { 13768 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13769 vec_lvsl(__a, __b)); 13770 } 13771 13772 static __inline__ vector unsigned char __ATTRS_o_ai 13773 vec_lvlxl(int __a, const vector unsigned char *__b) { 13774 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13775 vec_lvsl(__a, (unsigned char *)__b)); 13776 } 13777 13778 static __inline__ vector bool char __ATTRS_o_ai 13779 vec_lvlxl(int __a, const vector bool char *__b) { 13780 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 13781 vec_lvsl(__a, (unsigned char *)__b)); 13782 } 13783 13784 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13785 const short *__b) { 13786 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13787 } 13788 13789 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13790 const vector short *__b) { 13791 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 13792 vec_lvsl(__a, (unsigned char *)__b)); 13793 } 13794 13795 static __inline__ vector unsigned short __ATTRS_o_ai 13796 vec_lvlxl(int __a, const unsigned short *__b) { 13797 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13798 vec_lvsl(__a, __b)); 13799 } 13800 13801 static __inline__ vector unsigned short __ATTRS_o_ai 13802 vec_lvlxl(int __a, const vector unsigned short *__b) { 13803 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13804 vec_lvsl(__a, (unsigned char *)__b)); 13805 } 13806 13807 static __inline__ vector bool short __ATTRS_o_ai 13808 vec_lvlxl(int __a, const vector bool short *__b) { 13809 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 13810 vec_lvsl(__a, (unsigned char *)__b)); 13811 } 13812 13813 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 13814 const vector pixel *__b) { 13815 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 13816 vec_lvsl(__a, (unsigned char *)__b)); 13817 } 13818 13819 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 13820 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13821 } 13822 13823 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 13824 const vector int *__b) { 13825 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 13826 vec_lvsl(__a, (unsigned char *)__b)); 13827 } 13828 13829 static __inline__ vector unsigned int __ATTRS_o_ai 13830 vec_lvlxl(int __a, const unsigned int *__b) { 13831 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13832 vec_lvsl(__a, __b)); 13833 } 13834 13835 static __inline__ vector unsigned int __ATTRS_o_ai 13836 vec_lvlxl(int __a, const vector unsigned int *__b) { 13837 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13838 vec_lvsl(__a, (unsigned char *)__b)); 13839 } 13840 13841 static __inline__ vector bool int __ATTRS_o_ai 13842 vec_lvlxl(int __a, const vector bool int *__b) { 13843 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 13844 vec_lvsl(__a, (unsigned char *)__b)); 13845 } 13846 13847 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13848 const float *__b) { 13849 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13850 } 13851 13852 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13853 vector float *__b) { 13854 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 13855 vec_lvsl(__a, (unsigned char *)__b)); 13856 } 13857 13858 /* vec_lvrx */ 13859 13860 static __inline__ vector signed char __ATTRS_o_ai 13861 vec_lvrx(int __a, const signed char *__b) { 13862 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13863 vec_lvsl(__a, __b)); 13864 } 13865 13866 static __inline__ vector signed char __ATTRS_o_ai 13867 vec_lvrx(int __a, const vector signed char *__b) { 13868 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13869 vec_lvsl(__a, (unsigned char *)__b)); 13870 } 13871 13872 static __inline__ vector unsigned char __ATTRS_o_ai 13873 vec_lvrx(int __a, const unsigned char *__b) { 13874 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13875 vec_lvsl(__a, __b)); 13876 } 13877 13878 static __inline__ vector unsigned char __ATTRS_o_ai 13879 vec_lvrx(int __a, const vector unsigned char *__b) { 13880 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13881 vec_lvsl(__a, (unsigned char *)__b)); 13882 } 13883 13884 static __inline__ vector bool char __ATTRS_o_ai 13885 vec_lvrx(int __a, const vector bool char *__b) { 13886 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13887 vec_lvsl(__a, (unsigned char *)__b)); 13888 } 13889 13890 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13891 const short *__b) { 13892 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13893 } 13894 13895 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13896 const vector short *__b) { 13897 return vec_perm((vector short)(0), vec_ld(__a, __b), 13898 vec_lvsl(__a, (unsigned char *)__b)); 13899 } 13900 13901 static __inline__ vector unsigned short __ATTRS_o_ai 13902 vec_lvrx(int __a, const unsigned short *__b) { 13903 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13904 vec_lvsl(__a, __b)); 13905 } 13906 13907 static __inline__ vector unsigned short __ATTRS_o_ai 13908 vec_lvrx(int __a, const vector unsigned short *__b) { 13909 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13910 vec_lvsl(__a, (unsigned char *)__b)); 13911 } 13912 13913 static __inline__ vector bool short __ATTRS_o_ai 13914 vec_lvrx(int __a, const vector bool short *__b) { 13915 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 13916 vec_lvsl(__a, (unsigned char *)__b)); 13917 } 13918 13919 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 13920 const vector pixel *__b) { 13921 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 13922 vec_lvsl(__a, (unsigned char *)__b)); 13923 } 13924 13925 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 13926 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13927 } 13928 13929 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 13930 const vector int *__b) { 13931 return vec_perm((vector int)(0), vec_ld(__a, __b), 13932 vec_lvsl(__a, (unsigned char *)__b)); 13933 } 13934 13935 static __inline__ vector unsigned int __ATTRS_o_ai 13936 vec_lvrx(int __a, const unsigned int *__b) { 13937 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13938 vec_lvsl(__a, __b)); 13939 } 13940 13941 static __inline__ vector unsigned int __ATTRS_o_ai 13942 vec_lvrx(int __a, const vector unsigned int *__b) { 13943 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13944 vec_lvsl(__a, (unsigned char *)__b)); 13945 } 13946 13947 static __inline__ vector bool int __ATTRS_o_ai 13948 vec_lvrx(int __a, const vector bool int *__b) { 13949 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 13950 vec_lvsl(__a, (unsigned char *)__b)); 13951 } 13952 13953 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13954 const float *__b) { 13955 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13956 } 13957 13958 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13959 const vector float *__b) { 13960 return vec_perm((vector float)(0), vec_ld(__a, __b), 13961 vec_lvsl(__a, (unsigned char *)__b)); 13962 } 13963 13964 /* vec_lvrxl */ 13965 13966 static __inline__ vector signed char __ATTRS_o_ai 13967 vec_lvrxl(int __a, const signed char *__b) { 13968 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13969 vec_lvsl(__a, __b)); 13970 } 13971 13972 static __inline__ vector signed char __ATTRS_o_ai 13973 vec_lvrxl(int __a, const vector signed char *__b) { 13974 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 13975 vec_lvsl(__a, (unsigned char *)__b)); 13976 } 13977 13978 static __inline__ vector unsigned char __ATTRS_o_ai 13979 vec_lvrxl(int __a, const unsigned char *__b) { 13980 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13981 vec_lvsl(__a, __b)); 13982 } 13983 13984 static __inline__ vector unsigned char __ATTRS_o_ai 13985 vec_lvrxl(int __a, const vector unsigned char *__b) { 13986 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 13987 vec_lvsl(__a, (unsigned char *)__b)); 13988 } 13989 13990 static __inline__ vector bool char __ATTRS_o_ai 13991 vec_lvrxl(int __a, const vector bool char *__b) { 13992 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 13993 vec_lvsl(__a, (unsigned char *)__b)); 13994 } 13995 13996 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 13997 const short *__b) { 13998 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 13999 } 14000 14001 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14002 const vector short *__b) { 14003 return vec_perm((vector short)(0), vec_ldl(__a, __b), 14004 vec_lvsl(__a, (unsigned char *)__b)); 14005 } 14006 14007 static __inline__ vector unsigned short __ATTRS_o_ai 14008 vec_lvrxl(int __a, const unsigned short *__b) { 14009 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14010 vec_lvsl(__a, __b)); 14011 } 14012 14013 static __inline__ vector unsigned short __ATTRS_o_ai 14014 vec_lvrxl(int __a, const vector unsigned short *__b) { 14015 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14016 vec_lvsl(__a, (unsigned char *)__b)); 14017 } 14018 14019 static __inline__ vector bool short __ATTRS_o_ai 14020 vec_lvrxl(int __a, const vector bool short *__b) { 14021 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 14022 vec_lvsl(__a, (unsigned char *)__b)); 14023 } 14024 14025 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 14026 const vector pixel *__b) { 14027 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 14028 vec_lvsl(__a, (unsigned char *)__b)); 14029 } 14030 14031 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 14032 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14033 } 14034 14035 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 14036 const vector int *__b) { 14037 return vec_perm((vector int)(0), vec_ldl(__a, __b), 14038 vec_lvsl(__a, (unsigned char *)__b)); 14039 } 14040 14041 static __inline__ vector unsigned int __ATTRS_o_ai 14042 vec_lvrxl(int __a, const unsigned int *__b) { 14043 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14044 vec_lvsl(__a, __b)); 14045 } 14046 14047 static __inline__ vector unsigned int __ATTRS_o_ai 14048 vec_lvrxl(int __a, const vector unsigned int *__b) { 14049 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14050 vec_lvsl(__a, (unsigned char *)__b)); 14051 } 14052 14053 static __inline__ vector bool int __ATTRS_o_ai 14054 vec_lvrxl(int __a, const vector bool int *__b) { 14055 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 14056 vec_lvsl(__a, (unsigned char *)__b)); 14057 } 14058 14059 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14060 const float *__b) { 14061 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14062 } 14063 14064 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14065 const vector float *__b) { 14066 return vec_perm((vector float)(0), vec_ldl(__a, __b), 14067 vec_lvsl(__a, (unsigned char *)__b)); 14068 } 14069 14070 /* vec_stvlx */ 14071 14072 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14073 signed char *__c) { 14074 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14075 __c); 14076 } 14077 14078 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14079 vector signed char *__c) { 14080 return vec_st( 14081 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14082 __b, __c); 14083 } 14084 14085 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14086 unsigned char *__c) { 14087 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14088 __c); 14089 } 14090 14091 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14092 vector unsigned char *__c) { 14093 return vec_st( 14094 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14095 __b, __c); 14096 } 14097 14098 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool char __a, int __b, 14099 vector bool char *__c) { 14100 return vec_st( 14101 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14102 __b, __c); 14103 } 14104 14105 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14106 short *__c) { 14107 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14108 __c); 14109 } 14110 14111 static __inline__ void __ATTRS_o_ai vec_stvlx(vector short __a, int __b, 14112 vector short *__c) { 14113 return vec_st( 14114 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14115 __b, __c); 14116 } 14117 14118 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14119 int __b, unsigned short *__c) { 14120 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14121 __c); 14122 } 14123 14124 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned short __a, 14125 int __b, 14126 vector unsigned short *__c) { 14127 return vec_st( 14128 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14129 __b, __c); 14130 } 14131 14132 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 14133 vector bool short *__c) { 14134 return vec_st( 14135 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14136 __b, __c); 14137 } 14138 14139 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 14140 vector pixel *__c) { 14141 return vec_st( 14142 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14143 __b, __c); 14144 } 14145 14146 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14147 int *__c) { 14148 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14149 __c); 14150 } 14151 14152 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14153 vector int *__c) { 14154 return vec_st( 14155 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14156 __b, __c); 14157 } 14158 14159 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14160 unsigned int *__c) { 14161 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14162 __c); 14163 } 14164 14165 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14166 vector unsigned int *__c) { 14167 return vec_st( 14168 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14169 __b, __c); 14170 } 14171 14172 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 14173 vector bool int *__c) { 14174 return vec_st( 14175 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14176 __b, __c); 14177 } 14178 14179 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 14180 vector float *__c) { 14181 return vec_st( 14182 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14183 __b, __c); 14184 } 14185 14186 /* vec_stvlxl */ 14187 14188 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14189 signed char *__c) { 14190 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14191 __c); 14192 } 14193 14194 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14195 vector signed char *__c) { 14196 return vec_stl( 14197 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14198 __b, __c); 14199 } 14200 14201 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14202 int __b, unsigned char *__c) { 14203 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14204 __c); 14205 } 14206 14207 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14208 int __b, 14209 vector unsigned char *__c) { 14210 return vec_stl( 14211 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14212 __b, __c); 14213 } 14214 14215 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool char __a, int __b, 14216 vector bool char *__c) { 14217 return vec_stl( 14218 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14219 __b, __c); 14220 } 14221 14222 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14223 short *__c) { 14224 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14225 __c); 14226 } 14227 14228 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector short __a, int __b, 14229 vector short *__c) { 14230 return vec_stl( 14231 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14232 __b, __c); 14233 } 14234 14235 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14236 int __b, unsigned short *__c) { 14237 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14238 __c); 14239 } 14240 14241 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned short __a, 14242 int __b, 14243 vector unsigned short *__c) { 14244 return vec_stl( 14245 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14246 __b, __c); 14247 } 14248 14249 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 14250 vector bool short *__c) { 14251 return vec_stl( 14252 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14253 __b, __c); 14254 } 14255 14256 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 14257 vector pixel *__c) { 14258 return vec_stl( 14259 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14260 __b, __c); 14261 } 14262 14263 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14264 int *__c) { 14265 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14266 __c); 14267 } 14268 14269 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14270 vector int *__c) { 14271 return vec_stl( 14272 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14273 __b, __c); 14274 } 14275 14276 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14277 unsigned int *__c) { 14278 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14279 __c); 14280 } 14281 14282 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14283 vector unsigned int *__c) { 14284 return vec_stl( 14285 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14286 __b, __c); 14287 } 14288 14289 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 14290 vector bool int *__c) { 14291 return vec_stl( 14292 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14293 __b, __c); 14294 } 14295 14296 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 14297 vector float *__c) { 14298 return vec_stl( 14299 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14300 __b, __c); 14301 } 14302 14303 /* vec_stvrx */ 14304 14305 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14306 signed char *__c) { 14307 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14308 __c); 14309 } 14310 14311 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14312 vector signed char *__c) { 14313 return vec_st( 14314 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14315 __b, __c); 14316 } 14317 14318 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14319 unsigned char *__c) { 14320 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14321 __c); 14322 } 14323 14324 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14325 vector unsigned char *__c) { 14326 return vec_st( 14327 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14328 __b, __c); 14329 } 14330 14331 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool char __a, int __b, 14332 vector bool char *__c) { 14333 return vec_st( 14334 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14335 __b, __c); 14336 } 14337 14338 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14339 short *__c) { 14340 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14341 __c); 14342 } 14343 14344 static __inline__ void __ATTRS_o_ai vec_stvrx(vector short __a, int __b, 14345 vector short *__c) { 14346 return vec_st( 14347 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14348 __b, __c); 14349 } 14350 14351 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14352 int __b, unsigned short *__c) { 14353 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14354 __c); 14355 } 14356 14357 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned short __a, 14358 int __b, 14359 vector unsigned short *__c) { 14360 return vec_st( 14361 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14362 __b, __c); 14363 } 14364 14365 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 14366 vector bool short *__c) { 14367 return vec_st( 14368 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14369 __b, __c); 14370 } 14371 14372 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 14373 vector pixel *__c) { 14374 return vec_st( 14375 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14376 __b, __c); 14377 } 14378 14379 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14380 int *__c) { 14381 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14382 __c); 14383 } 14384 14385 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14386 vector int *__c) { 14387 return vec_st( 14388 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14389 __b, __c); 14390 } 14391 14392 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14393 unsigned int *__c) { 14394 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14395 __c); 14396 } 14397 14398 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14399 vector unsigned int *__c) { 14400 return vec_st( 14401 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14402 __b, __c); 14403 } 14404 14405 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 14406 vector bool int *__c) { 14407 return vec_st( 14408 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14409 __b, __c); 14410 } 14411 14412 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 14413 vector float *__c) { 14414 return vec_st( 14415 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14416 __b, __c); 14417 } 14418 14419 /* vec_stvrxl */ 14420 14421 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14422 signed char *__c) { 14423 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14424 __c); 14425 } 14426 14427 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14428 vector signed char *__c) { 14429 return vec_stl( 14430 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14431 __b, __c); 14432 } 14433 14434 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14435 int __b, unsigned char *__c) { 14436 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14437 __c); 14438 } 14439 14440 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14441 int __b, 14442 vector unsigned char *__c) { 14443 return vec_stl( 14444 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14445 __b, __c); 14446 } 14447 14448 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool char __a, int __b, 14449 vector bool char *__c) { 14450 return vec_stl( 14451 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14452 __b, __c); 14453 } 14454 14455 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14456 short *__c) { 14457 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14458 __c); 14459 } 14460 14461 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector short __a, int __b, 14462 vector short *__c) { 14463 return vec_stl( 14464 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14465 __b, __c); 14466 } 14467 14468 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14469 int __b, unsigned short *__c) { 14470 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14471 __c); 14472 } 14473 14474 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned short __a, 14475 int __b, 14476 vector unsigned short *__c) { 14477 return vec_stl( 14478 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14479 __b, __c); 14480 } 14481 14482 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 14483 vector bool short *__c) { 14484 return vec_stl( 14485 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14486 __b, __c); 14487 } 14488 14489 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 14490 vector pixel *__c) { 14491 return vec_stl( 14492 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14493 __b, __c); 14494 } 14495 14496 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14497 int *__c) { 14498 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14499 __c); 14500 } 14501 14502 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14503 vector int *__c) { 14504 return vec_stl( 14505 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14506 __b, __c); 14507 } 14508 14509 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14510 unsigned int *__c) { 14511 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14512 __c); 14513 } 14514 14515 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14516 vector unsigned int *__c) { 14517 return vec_stl( 14518 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14519 __b, __c); 14520 } 14521 14522 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 14523 vector bool int *__c) { 14524 return vec_stl( 14525 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14526 __b, __c); 14527 } 14528 14529 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 14530 vector float *__c) { 14531 return vec_stl( 14532 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14533 __b, __c); 14534 } 14535 14536 /* vec_promote */ 14537 14538 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 14539 int __b) { 14540 vector signed char __res = (vector signed char)(0); 14541 __res[__b & 0x7] = __a; 14542 return __res; 14543 } 14544 14545 static __inline__ vector unsigned char __ATTRS_o_ai 14546 vec_promote(unsigned char __a, int __b) { 14547 vector unsigned char __res = (vector unsigned char)(0); 14548 __res[__b & 0x7] = __a; 14549 return __res; 14550 } 14551 14552 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 14553 vector short __res = (vector short)(0); 14554 __res[__b & 0x7] = __a; 14555 return __res; 14556 } 14557 14558 static __inline__ vector unsigned short __ATTRS_o_ai 14559 vec_promote(unsigned short __a, int __b) { 14560 vector unsigned short __res = (vector unsigned short)(0); 14561 __res[__b & 0x7] = __a; 14562 return __res; 14563 } 14564 14565 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 14566 vector int __res = (vector int)(0); 14567 __res[__b & 0x3] = __a; 14568 return __res; 14569 } 14570 14571 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 14572 int __b) { 14573 vector unsigned int __res = (vector unsigned int)(0); 14574 __res[__b & 0x3] = __a; 14575 return __res; 14576 } 14577 14578 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 14579 vector float __res = (vector float)(0); 14580 __res[__b & 0x3] = __a; 14581 return __res; 14582 } 14583 14584 #ifdef __VSX__ 14585 static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) { 14586 vector double __res = (vector double)(0); 14587 __res[__b & 0x1] = __a; 14588 return __res; 14589 } 14590 14591 static __inline__ vector signed long long __ATTRS_o_ai 14592 vec_promote(signed long long __a, int __b) { 14593 vector signed long long __res = (vector signed long long)(0); 14594 __res[__b & 0x1] = __a; 14595 return __res; 14596 } 14597 14598 static __inline__ vector unsigned long long __ATTRS_o_ai 14599 vec_promote(unsigned long long __a, int __b) { 14600 vector unsigned long long __res = (vector unsigned long long)(0); 14601 __res[__b & 0x1] = __a; 14602 return __res; 14603 } 14604 #endif 14605 14606 /* vec_splats */ 14607 14608 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 14609 return (vector signed char)(__a); 14610 } 14611 14612 static __inline__ vector unsigned char __ATTRS_o_ai 14613 vec_splats(unsigned char __a) { 14614 return (vector unsigned char)(__a); 14615 } 14616 14617 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 14618 return (vector short)(__a); 14619 } 14620 14621 static __inline__ vector unsigned short __ATTRS_o_ai 14622 vec_splats(unsigned short __a) { 14623 return (vector unsigned short)(__a); 14624 } 14625 14626 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 14627 return (vector int)(__a); 14628 } 14629 14630 static __inline__ vector unsigned int __ATTRS_o_ai 14631 vec_splats(unsigned int __a) { 14632 return (vector unsigned int)(__a); 14633 } 14634 14635 #ifdef __VSX__ 14636 static __inline__ vector signed long long __ATTRS_o_ai 14637 vec_splats(signed long long __a) { 14638 return (vector signed long long)(__a); 14639 } 14640 14641 static __inline__ vector unsigned long long __ATTRS_o_ai 14642 vec_splats(unsigned long long __a) { 14643 return (vector unsigned long long)(__a); 14644 } 14645 14646 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 14647 defined(__SIZEOF_INT128__) 14648 static __inline__ vector signed __int128 __ATTRS_o_ai 14649 vec_splats(signed __int128 __a) { 14650 return (vector signed __int128)(__a); 14651 } 14652 14653 static __inline__ vector unsigned __int128 __ATTRS_o_ai 14654 vec_splats(unsigned __int128 __a) { 14655 return (vector unsigned __int128)(__a); 14656 } 14657 14658 #endif 14659 14660 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 14661 return (vector double)(__a); 14662 } 14663 #endif 14664 14665 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 14666 return (vector float)(__a); 14667 } 14668 14669 /* ----------------------------- predicates --------------------------------- */ 14670 14671 /* vec_all_eq */ 14672 14673 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14674 vector signed char __b) { 14675 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14676 (vector char)__b); 14677 } 14678 14679 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14680 vector bool char __b) { 14681 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14682 (vector char)__b); 14683 } 14684 14685 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14686 vector unsigned 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 unsigned 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 bool char __a, 14698 vector signed 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 bool char __a, 14704 vector unsigned 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 bool 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 short __a, 14716 vector short __b) { 14717 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 14718 } 14719 14720 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14721 vector bool short __b) { 14722 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 14723 } 14724 14725 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14726 vector unsigned short __b) { 14727 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14728 (vector short)__b); 14729 } 14730 14731 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14732 vector bool short __b) { 14733 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14734 (vector short)__b); 14735 } 14736 14737 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14738 vector 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 bool short __a, 14744 vector unsigned 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 bool 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 pixel __a, 14756 vector pixel __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 int __a, vector int __b) { 14762 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 14763 } 14764 14765 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 14766 vector bool int __b) { 14767 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 14768 } 14769 14770 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14771 vector unsigned int __b) { 14772 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14773 (vector int)__b); 14774 } 14775 14776 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14777 vector bool int __b) { 14778 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14779 (vector int)__b); 14780 } 14781 14782 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14783 vector 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 bool int __a, 14789 vector unsigned 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 bool int __b) { 14796 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14797 (vector int)__b); 14798 } 14799 14800 #ifdef __VSX__ 14801 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 14802 vector signed long long __b) { 14803 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 14804 } 14805 14806 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 14807 vector bool long long __b) { 14808 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, (vector long long)__b); 14809 } 14810 14811 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14812 vector unsigned long long __b) { 14813 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14814 (vector long long)__b); 14815 } 14816 14817 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14818 vector bool long long __b) { 14819 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14820 (vector long long)__b); 14821 } 14822 14823 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14824 vector 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 bool long long __a, 14830 vector unsigned 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 bool long long __b) { 14837 return __builtin_altivec_vcmpequd_p(__CR6_LT, (vector long long)__a, 14838 (vector long long)__b); 14839 } 14840 #endif 14841 14842 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 14843 vector float __b) { 14844 #ifdef __VSX__ 14845 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 14846 #else 14847 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 14848 #endif 14849 } 14850 14851 #ifdef __VSX__ 14852 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 14853 vector double __b) { 14854 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 14855 } 14856 #endif 14857 14858 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 14859 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, 14860 vector signed __int128 __b) { 14861 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14862 } 14863 14864 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, 14865 vector unsigned __int128 __b) { 14866 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14867 } 14868 #endif 14869 14870 /* vec_all_ge */ 14871 14872 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14873 vector signed char __b) { 14874 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 14875 } 14876 14877 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14878 vector bool char __b) { 14879 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 14880 } 14881 14882 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14883 vector unsigned char __b) { 14884 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 14885 } 14886 14887 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14888 vector bool char __b) { 14889 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 14890 } 14891 14892 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14893 vector signed char __b) { 14894 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14895 (vector unsigned char)__a); 14896 } 14897 14898 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14899 vector unsigned char __b) { 14900 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 14901 } 14902 14903 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14904 vector bool char __b) { 14905 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14906 (vector unsigned char)__a); 14907 } 14908 14909 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14910 vector short __b) { 14911 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 14912 } 14913 14914 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14915 vector bool short __b) { 14916 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 14917 } 14918 14919 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14920 vector unsigned short __b) { 14921 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 14922 } 14923 14924 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14925 vector bool short __b) { 14926 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14927 __a); 14928 } 14929 14930 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14931 vector short __b) { 14932 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14933 (vector unsigned short)__a); 14934 } 14935 14936 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14937 vector unsigned short __b) { 14938 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 14939 (vector unsigned short)__a); 14940 } 14941 14942 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14943 vector bool short __b) { 14944 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14945 (vector unsigned short)__a); 14946 } 14947 14948 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 14949 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 14950 } 14951 14952 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 14953 vector bool int __b) { 14954 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 14955 } 14956 14957 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14958 vector unsigned int __b) { 14959 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 14960 } 14961 14962 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 14963 vector bool int __b) { 14964 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 14965 } 14966 14967 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14968 vector int __b) { 14969 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14970 (vector unsigned int)__a); 14971 } 14972 14973 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14974 vector unsigned int __b) { 14975 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 14976 } 14977 14978 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 14979 vector bool int __b) { 14980 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 14981 (vector unsigned int)__a); 14982 } 14983 14984 #ifdef __VSX__ 14985 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14986 vector signed long long __b) { 14987 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 14988 } 14989 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 14990 vector bool long long __b) { 14991 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 14992 __a); 14993 } 14994 14995 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 14996 vector unsigned long long __b) { 14997 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 14998 } 14999 15000 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15001 vector bool long long __b) { 15002 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15003 __a); 15004 } 15005 15006 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15007 vector signed long long __b) { 15008 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15009 (vector unsigned long long)__a); 15010 } 15011 15012 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15013 vector unsigned long long __b) { 15014 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 15015 (vector unsigned long long)__a); 15016 } 15017 15018 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15019 vector bool long long __b) { 15020 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15021 (vector unsigned long long)__a); 15022 } 15023 #endif 15024 15025 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 15026 vector float __b) { 15027 #ifdef __VSX__ 15028 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 15029 #else 15030 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 15031 #endif 15032 } 15033 15034 #ifdef __VSX__ 15035 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 15036 vector double __b) { 15037 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 15038 } 15039 #endif 15040 15041 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15042 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, 15043 vector signed __int128 __b) { 15044 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); 15045 } 15046 15047 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, 15048 vector unsigned __int128 __b) { 15049 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); 15050 } 15051 #endif 15052 15053 /* vec_all_gt */ 15054 15055 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15056 vector signed char __b) { 15057 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 15058 } 15059 15060 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15061 vector bool char __b) { 15062 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 15063 } 15064 15065 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15066 vector unsigned char __b) { 15067 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 15068 } 15069 15070 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15071 vector bool char __b) { 15072 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 15073 } 15074 15075 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15076 vector signed char __b) { 15077 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 15078 (vector unsigned char)__b); 15079 } 15080 15081 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15082 vector unsigned char __b) { 15083 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 15084 } 15085 15086 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15087 vector bool char __b) { 15088 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 15089 (vector unsigned char)__b); 15090 } 15091 15092 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15093 vector short __b) { 15094 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 15095 } 15096 15097 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15098 vector bool short __b) { 15099 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 15100 } 15101 15102 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15103 vector unsigned short __b) { 15104 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 15105 } 15106 15107 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15108 vector bool short __b) { 15109 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 15110 (vector unsigned short)__b); 15111 } 15112 15113 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15114 vector short __b) { 15115 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15116 (vector unsigned short)__b); 15117 } 15118 15119 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15120 vector unsigned short __b) { 15121 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15122 __b); 15123 } 15124 15125 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15126 vector bool short __b) { 15127 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15128 (vector unsigned short)__b); 15129 } 15130 15131 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 15132 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 15133 } 15134 15135 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 15136 vector bool int __b) { 15137 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 15138 } 15139 15140 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15141 vector unsigned int __b) { 15142 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 15143 } 15144 15145 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15146 vector bool int __b) { 15147 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 15148 } 15149 15150 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15151 vector int __b) { 15152 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 15153 (vector unsigned int)__b); 15154 } 15155 15156 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15157 vector unsigned int __b) { 15158 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 15159 } 15160 15161 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15162 vector bool int __b) { 15163 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 15164 (vector unsigned int)__b); 15165 } 15166 15167 #ifdef __VSX__ 15168 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15169 vector signed long long __b) { 15170 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 15171 } 15172 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15173 vector bool long long __b) { 15174 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 15175 (vector signed long long)__b); 15176 } 15177 15178 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15179 vector unsigned long long __b) { 15180 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 15181 } 15182 15183 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15184 vector bool long long __b) { 15185 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 15186 (vector unsigned long long)__b); 15187 } 15188 15189 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15190 vector signed long long __b) { 15191 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__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 unsigned long long __b) { 15197 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15198 __b); 15199 } 15200 15201 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15202 vector bool long long __b) { 15203 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15204 (vector unsigned long long)__b); 15205 } 15206 #endif 15207 15208 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 15209 vector float __b) { 15210 #ifdef __VSX__ 15211 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 15212 #else 15213 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 15214 #endif 15215 } 15216 15217 #ifdef __VSX__ 15218 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 15219 vector double __b) { 15220 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 15221 } 15222 #endif 15223 15224 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15225 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, 15226 vector signed __int128 __b) { 15227 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); 15228 } 15229 15230 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, 15231 vector unsigned __int128 __b) { 15232 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); 15233 } 15234 #endif 15235 15236 /* vec_all_in */ 15237 15238 static __inline__ int __attribute__((__always_inline__)) 15239 vec_all_in(vector float __a, vector float __b) { 15240 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 15241 } 15242 15243 /* vec_all_le */ 15244 15245 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15246 vector signed char __b) { 15247 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 15248 } 15249 15250 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15251 vector bool char __b) { 15252 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 15253 } 15254 15255 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15256 vector unsigned char __b) { 15257 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 15258 } 15259 15260 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15261 vector bool char __b) { 15262 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 15263 } 15264 15265 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15266 vector signed char __b) { 15267 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 15268 (vector unsigned char)__b); 15269 } 15270 15271 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15272 vector unsigned char __b) { 15273 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 15274 } 15275 15276 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15277 vector bool char __b) { 15278 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 15279 (vector unsigned char)__b); 15280 } 15281 15282 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15283 vector short __b) { 15284 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 15285 } 15286 15287 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15288 vector bool short __b) { 15289 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 15290 } 15291 15292 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15293 vector unsigned short __b) { 15294 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 15295 } 15296 15297 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15298 vector bool short __b) { 15299 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 15300 (vector unsigned short)__b); 15301 } 15302 15303 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15304 vector short __b) { 15305 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15306 (vector unsigned short)__b); 15307 } 15308 15309 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15310 vector unsigned short __b) { 15311 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15312 __b); 15313 } 15314 15315 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15316 vector bool short __b) { 15317 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15318 (vector unsigned short)__b); 15319 } 15320 15321 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 15322 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 15323 } 15324 15325 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 15326 vector bool int __b) { 15327 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 15328 } 15329 15330 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15331 vector unsigned int __b) { 15332 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 15333 } 15334 15335 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15336 vector bool int __b) { 15337 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 15338 } 15339 15340 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15341 vector int __b) { 15342 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 15343 (vector unsigned int)__b); 15344 } 15345 15346 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15347 vector unsigned int __b) { 15348 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 15349 } 15350 15351 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15352 vector bool int __b) { 15353 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 15354 (vector unsigned int)__b); 15355 } 15356 15357 #ifdef __VSX__ 15358 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15359 vector signed long long __b) { 15360 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 15361 } 15362 15363 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15364 vector unsigned long long __b) { 15365 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 15366 } 15367 15368 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15369 vector bool long long __b) { 15370 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 15371 (vector signed long long)__b); 15372 } 15373 15374 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15375 vector bool long long __b) { 15376 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 15377 (vector unsigned long long)__b); 15378 } 15379 15380 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15381 vector signed long long __b) { 15382 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15383 (vector unsigned long long)__b); 15384 } 15385 15386 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15387 vector unsigned long long __b) { 15388 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15389 __b); 15390 } 15391 15392 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15393 vector bool long long __b) { 15394 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15395 (vector unsigned long long)__b); 15396 } 15397 #endif 15398 15399 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 15400 vector float __b) { 15401 #ifdef __VSX__ 15402 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 15403 #else 15404 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 15405 #endif 15406 } 15407 15408 #ifdef __VSX__ 15409 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 15410 vector double __b) { 15411 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 15412 } 15413 #endif 15414 15415 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15416 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, 15417 vector signed __int128 __b) { 15418 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); 15419 } 15420 15421 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, 15422 vector unsigned __int128 __b) { 15423 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); 15424 } 15425 #endif 15426 15427 /* vec_all_lt */ 15428 15429 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15430 vector signed char __b) { 15431 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 15432 } 15433 15434 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15435 vector bool char __b) { 15436 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 15437 } 15438 15439 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15440 vector unsigned char __b) { 15441 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 15442 } 15443 15444 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15445 vector bool char __b) { 15446 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 15447 } 15448 15449 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15450 vector signed char __b) { 15451 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 15452 (vector unsigned char)__a); 15453 } 15454 15455 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15456 vector unsigned char __b) { 15457 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 15458 } 15459 15460 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15461 vector bool char __b) { 15462 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 15463 (vector unsigned char)__a); 15464 } 15465 15466 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15467 vector short __b) { 15468 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 15469 } 15470 15471 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15472 vector bool short __b) { 15473 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 15474 } 15475 15476 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15477 vector unsigned short __b) { 15478 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 15479 } 15480 15481 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15482 vector bool short __b) { 15483 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15484 __a); 15485 } 15486 15487 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15488 vector short __b) { 15489 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15490 (vector unsigned short)__a); 15491 } 15492 15493 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15494 vector unsigned short __b) { 15495 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 15496 (vector unsigned short)__a); 15497 } 15498 15499 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15500 vector bool short __b) { 15501 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15502 (vector unsigned short)__a); 15503 } 15504 15505 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 15506 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 15507 } 15508 15509 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 15510 vector bool int __b) { 15511 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 15512 } 15513 15514 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15515 vector unsigned int __b) { 15516 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 15517 } 15518 15519 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15520 vector bool int __b) { 15521 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 15522 } 15523 15524 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15525 vector int __b) { 15526 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 15527 (vector unsigned 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_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15567 (vector unsigned 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_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16143 (vector unsigned 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_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16182 (vector unsigned 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_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16220 (vector unsigned 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_vcmpgtud_p(__CR6_LT_REV, 16261 (vector unsigned long long)__b, 16262 (vector unsigned long long)__a); 16263 } 16264 16265 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16266 vector unsigned long long __b) { 16267 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 16268 (vector unsigned long long)__a); 16269 } 16270 16271 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16272 vector bool long long __b) { 16273 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16274 (vector unsigned long long)__b, 16275 (vector unsigned long long)__a); 16276 } 16277 #endif 16278 16279 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 16280 vector float __b) { 16281 #ifdef __VSX__ 16282 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 16283 #else 16284 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 16285 #endif 16286 } 16287 16288 #ifdef __VSX__ 16289 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 16290 vector double __b) { 16291 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 16292 } 16293 #endif 16294 16295 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16296 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, 16297 vector signed __int128 __b) { 16298 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); 16299 } 16300 16301 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, 16302 vector unsigned __int128 __b) { 16303 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); 16304 } 16305 #endif 16306 16307 /* vec_any_gt */ 16308 16309 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16310 vector signed char __b) { 16311 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 16312 } 16313 16314 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16315 vector bool char __b) { 16316 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 16317 (vector signed char)__b); 16318 } 16319 16320 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16321 vector unsigned char __b) { 16322 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 16323 } 16324 16325 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16326 vector bool char __b) { 16327 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 16328 (vector unsigned char)__b); 16329 } 16330 16331 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16332 vector signed char __b) { 16333 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16334 (vector unsigned char)__b); 16335 } 16336 16337 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16338 vector unsigned char __b) { 16339 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16340 __b); 16341 } 16342 16343 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16344 vector bool char __b) { 16345 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16346 (vector unsigned char)__b); 16347 } 16348 16349 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16350 vector short __b) { 16351 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 16352 } 16353 16354 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16355 vector bool short __b) { 16356 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 16357 } 16358 16359 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16360 vector unsigned short __b) { 16361 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 16362 } 16363 16364 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16365 vector bool short __b) { 16366 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 16367 (vector unsigned short)__b); 16368 } 16369 16370 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16371 vector short __b) { 16372 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16373 (vector unsigned short)__b); 16374 } 16375 16376 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16377 vector unsigned short __b) { 16378 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16379 __b); 16380 } 16381 16382 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16383 vector bool short __b) { 16384 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16385 (vector unsigned short)__b); 16386 } 16387 16388 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 16389 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 16390 } 16391 16392 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 16393 vector bool int __b) { 16394 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 16395 } 16396 16397 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16398 vector unsigned int __b) { 16399 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 16400 } 16401 16402 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16403 vector bool int __b) { 16404 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 16405 (vector unsigned int)__b); 16406 } 16407 16408 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16409 vector int __b) { 16410 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16411 (vector unsigned int)__b); 16412 } 16413 16414 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16415 vector unsigned int __b) { 16416 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16417 __b); 16418 } 16419 16420 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16421 vector bool int __b) { 16422 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16423 (vector unsigned int)__b); 16424 } 16425 16426 #ifdef __VSX__ 16427 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16428 vector signed long long __b) { 16429 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 16430 } 16431 16432 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16433 vector unsigned long long __b) { 16434 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 16435 } 16436 16437 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16438 vector bool long long __b) { 16439 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 16440 (vector signed long long)__b); 16441 } 16442 16443 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16444 vector bool long long __b) { 16445 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 16446 (vector unsigned long long)__b); 16447 } 16448 16449 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16450 vector signed long long __b) { 16451 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16452 (vector unsigned long long)__a, 16453 (vector unsigned long long)__b); 16454 } 16455 16456 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16457 vector unsigned long long __b) { 16458 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16459 (vector unsigned long long)__a, __b); 16460 } 16461 16462 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16463 vector bool long long __b) { 16464 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16465 (vector unsigned long long)__a, 16466 (vector unsigned long long)__b); 16467 } 16468 #endif 16469 16470 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 16471 vector float __b) { 16472 #ifdef __VSX__ 16473 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 16474 #else 16475 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 16476 #endif 16477 } 16478 16479 #ifdef __VSX__ 16480 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 16481 vector double __b) { 16482 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 16483 } 16484 #endif 16485 16486 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16487 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, 16488 vector signed __int128 __b) { 16489 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); 16490 } 16491 16492 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, 16493 vector unsigned __int128 __b) { 16494 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); 16495 } 16496 #endif 16497 16498 /* vec_any_le */ 16499 16500 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16501 vector signed char __b) { 16502 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 16503 } 16504 16505 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16506 vector bool char __b) { 16507 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 16508 (vector signed char)__b); 16509 } 16510 16511 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16512 vector unsigned char __b) { 16513 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 16514 } 16515 16516 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16517 vector bool char __b) { 16518 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 16519 (vector unsigned char)__b); 16520 } 16521 16522 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16523 vector signed char __b) { 16524 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16525 (vector unsigned char)__b); 16526 } 16527 16528 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16529 vector unsigned char __b) { 16530 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16531 __b); 16532 } 16533 16534 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16535 vector bool char __b) { 16536 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16537 (vector unsigned char)__b); 16538 } 16539 16540 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16541 vector short __b) { 16542 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 16543 } 16544 16545 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16546 vector bool short __b) { 16547 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 16548 } 16549 16550 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16551 vector unsigned short __b) { 16552 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 16553 } 16554 16555 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16556 vector bool short __b) { 16557 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 16558 (vector unsigned short)__b); 16559 } 16560 16561 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16562 vector short __b) { 16563 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16564 (vector unsigned short)__b); 16565 } 16566 16567 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16568 vector unsigned short __b) { 16569 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16570 __b); 16571 } 16572 16573 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16574 vector bool short __b) { 16575 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16576 (vector unsigned short)__b); 16577 } 16578 16579 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 16580 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 16581 } 16582 16583 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 16584 vector bool int __b) { 16585 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 16586 } 16587 16588 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16589 vector unsigned int __b) { 16590 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 16591 } 16592 16593 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16594 vector bool int __b) { 16595 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 16596 (vector unsigned int)__b); 16597 } 16598 16599 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16600 vector int __b) { 16601 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16602 (vector unsigned int)__b); 16603 } 16604 16605 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16606 vector unsigned int __b) { 16607 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16608 __b); 16609 } 16610 16611 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16612 vector bool int __b) { 16613 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16614 (vector unsigned int)__b); 16615 } 16616 16617 #ifdef __VSX__ 16618 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16619 vector signed long long __b) { 16620 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 16621 } 16622 16623 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16624 vector unsigned long long __b) { 16625 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 16626 } 16627 16628 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16629 vector bool long long __b) { 16630 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 16631 (vector signed long long)__b); 16632 } 16633 16634 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16635 vector bool long long __b) { 16636 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 16637 (vector unsigned long long)__b); 16638 } 16639 16640 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16641 vector signed long long __b) { 16642 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16643 (vector unsigned long long)__a, 16644 (vector unsigned long long)__b); 16645 } 16646 16647 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16648 vector unsigned long long __b) { 16649 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16650 (vector unsigned long long)__a, __b); 16651 } 16652 16653 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16654 vector bool long long __b) { 16655 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16656 (vector unsigned long long)__a, 16657 (vector unsigned long long)__b); 16658 } 16659 #endif 16660 16661 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 16662 vector float __b) { 16663 #ifdef __VSX__ 16664 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 16665 #else 16666 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 16667 #endif 16668 } 16669 16670 #ifdef __VSX__ 16671 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 16672 vector double __b) { 16673 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 16674 } 16675 #endif 16676 16677 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16678 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, 16679 vector signed __int128 __b) { 16680 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); 16681 } 16682 16683 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, 16684 vector unsigned __int128 __b) { 16685 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); 16686 } 16687 #endif 16688 16689 /* vec_any_lt */ 16690 16691 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16692 vector signed char __b) { 16693 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 16694 } 16695 16696 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16697 vector bool char __b) { 16698 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 16699 __a); 16700 } 16701 16702 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16703 vector unsigned char __b) { 16704 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 16705 } 16706 16707 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16708 vector bool char __b) { 16709 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16710 __a); 16711 } 16712 16713 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16714 vector signed char __b) { 16715 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16716 (vector unsigned char)__a); 16717 } 16718 16719 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16720 vector unsigned char __b) { 16721 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 16722 (vector unsigned char)__a); 16723 } 16724 16725 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16726 vector bool char __b) { 16727 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16728 (vector unsigned char)__a); 16729 } 16730 16731 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16732 vector short __b) { 16733 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 16734 } 16735 16736 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16737 vector bool short __b) { 16738 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 16739 } 16740 16741 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16742 vector unsigned short __b) { 16743 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 16744 } 16745 16746 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16747 vector bool short __b) { 16748 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16749 __a); 16750 } 16751 16752 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16753 vector short __b) { 16754 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16755 (vector unsigned short)__a); 16756 } 16757 16758 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16759 vector unsigned short __b) { 16760 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 16761 (vector unsigned short)__a); 16762 } 16763 16764 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16765 vector bool short __b) { 16766 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16767 (vector unsigned short)__a); 16768 } 16769 16770 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 16771 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 16772 } 16773 16774 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 16775 vector bool int __b) { 16776 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 16777 } 16778 16779 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16780 vector unsigned int __b) { 16781 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 16782 } 16783 16784 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16785 vector bool int __b) { 16786 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16787 __a); 16788 } 16789 16790 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16791 vector int __b) { 16792 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16793 (vector unsigned int)__a); 16794 } 16795 16796 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16797 vector unsigned int __b) { 16798 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 16799 (vector unsigned int)__a); 16800 } 16801 16802 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16803 vector bool int __b) { 16804 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16805 (vector unsigned int)__a); 16806 } 16807 16808 #ifdef __VSX__ 16809 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16810 vector signed long long __b) { 16811 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 16812 } 16813 16814 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16815 vector unsigned long long __b) { 16816 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 16817 } 16818 16819 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16820 vector bool long long __b) { 16821 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16822 (vector signed long long)__b, __a); 16823 } 16824 16825 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16826 vector bool long long __b) { 16827 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16828 (vector unsigned long long)__b, __a); 16829 } 16830 16831 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16832 vector signed long long __b) { 16833 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16834 (vector unsigned long long)__b, 16835 (vector unsigned long long)__a); 16836 } 16837 16838 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16839 vector unsigned long long __b) { 16840 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 16841 (vector unsigned long long)__a); 16842 } 16843 16844 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16845 vector bool long long __b) { 16846 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16847 (vector unsigned long long)__b, 16848 (vector unsigned long long)__a); 16849 } 16850 #endif 16851 16852 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 16853 vector float __b) { 16854 #ifdef __VSX__ 16855 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 16856 #else 16857 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 16858 #endif 16859 } 16860 16861 #ifdef __VSX__ 16862 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 16863 vector double __b) { 16864 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 16865 } 16866 #endif 16867 16868 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16869 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, 16870 vector signed __int128 __b) { 16871 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); 16872 } 16873 16874 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, 16875 vector unsigned __int128 __b) { 16876 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); 16877 } 16878 #endif 16879 16880 /* vec_any_nan */ 16881 16882 static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) { 16883 #ifdef __VSX__ 16884 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a); 16885 #else 16886 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 16887 #endif 16888 } 16889 #ifdef __VSX__ 16890 static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) { 16891 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a); 16892 } 16893 #endif 16894 16895 /* vec_any_ne */ 16896 16897 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16898 vector signed char __b) { 16899 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16900 (vector char)__b); 16901 } 16902 16903 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16904 vector bool char __b) { 16905 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16906 (vector char)__b); 16907 } 16908 16909 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16910 vector unsigned char __b) { 16911 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16912 (vector char)__b); 16913 } 16914 16915 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16916 vector bool char __b) { 16917 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16918 (vector char)__b); 16919 } 16920 16921 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16922 vector signed char __b) { 16923 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16924 (vector char)__b); 16925 } 16926 16927 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16928 vector unsigned char __b) { 16929 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16930 (vector char)__b); 16931 } 16932 16933 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16934 vector bool char __b) { 16935 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16936 (vector char)__b); 16937 } 16938 16939 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16940 vector short __b) { 16941 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 16942 } 16943 16944 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16945 vector bool short __b) { 16946 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 16947 } 16948 16949 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16950 vector unsigned short __b) { 16951 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16952 (vector short)__b); 16953 } 16954 16955 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16956 vector bool short __b) { 16957 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16958 (vector short)__b); 16959 } 16960 16961 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16962 vector short __b) { 16963 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16964 (vector short)__b); 16965 } 16966 16967 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16968 vector unsigned short __b) { 16969 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16970 (vector short)__b); 16971 } 16972 16973 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 16974 vector bool short __b) { 16975 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16976 (vector short)__b); 16977 } 16978 16979 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 16980 vector pixel __b) { 16981 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16982 (vector short)__b); 16983 } 16984 16985 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 16986 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 16987 } 16988 16989 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 16990 vector bool int __b) { 16991 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 16992 } 16993 16994 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 16995 vector unsigned int __b) { 16996 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 16997 (vector int)__b); 16998 } 16999 17000 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17001 vector bool int __b) { 17002 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17003 (vector int)__b); 17004 } 17005 17006 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17007 vector int __b) { 17008 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17009 (vector int)__b); 17010 } 17011 17012 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17013 vector unsigned int __b) { 17014 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17015 (vector int)__b); 17016 } 17017 17018 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17019 vector bool int __b) { 17020 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17021 (vector int)__b); 17022 } 17023 17024 #ifdef __VSX__ 17025 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17026 vector signed long long __b) { 17027 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 17028 } 17029 17030 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17031 vector unsigned long long __b) { 17032 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, (vector long long)__a, 17033 (vector long long)__b); 17034 } 17035 17036 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17037 vector bool long long __b) { 17038 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, 17039 (vector signed long long)__b); 17040 } 17041 17042 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17043 vector bool long long __b) { 17044 return __builtin_altivec_vcmpequd_p( 17045 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17046 } 17047 17048 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17049 vector signed long long __b) { 17050 return __builtin_altivec_vcmpequd_p( 17051 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17052 } 17053 17054 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17055 vector unsigned long long __b) { 17056 return __builtin_altivec_vcmpequd_p( 17057 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17058 } 17059 17060 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17061 vector bool long long __b) { 17062 return __builtin_altivec_vcmpequd_p( 17063 __CR6_LT_REV, (vector signed long long)__a, (vector signed long long)__b); 17064 } 17065 #endif 17066 17067 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 17068 vector float __b) { 17069 #ifdef __VSX__ 17070 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 17071 #else 17072 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 17073 #endif 17074 } 17075 17076 #ifdef __VSX__ 17077 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 17078 vector double __b) { 17079 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 17080 } 17081 #endif 17082 17083 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 17084 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, 17085 vector signed __int128 __b) { 17086 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17087 } 17088 17089 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, 17090 vector unsigned __int128 __b) { 17091 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17092 } 17093 #endif 17094 17095 /* vec_any_nge */ 17096 17097 static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, 17098 vector float __b) { 17099 #ifdef __VSX__ 17100 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b); 17101 #else 17102 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 17103 #endif 17104 } 17105 17106 #ifdef __VSX__ 17107 static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a, 17108 vector double __b) { 17109 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b); 17110 } 17111 #endif 17112 17113 /* vec_any_ngt */ 17114 17115 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, 17116 vector float __b) { 17117 #ifdef __VSX__ 17118 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b); 17119 #else 17120 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 17121 #endif 17122 } 17123 17124 #ifdef __VSX__ 17125 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a, 17126 vector double __b) { 17127 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b); 17128 } 17129 #endif 17130 17131 /* vec_any_nle */ 17132 17133 static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, 17134 vector float __b) { 17135 #ifdef __VSX__ 17136 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a); 17137 #else 17138 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 17139 #endif 17140 } 17141 17142 #ifdef __VSX__ 17143 static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a, 17144 vector double __b) { 17145 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a); 17146 } 17147 #endif 17148 17149 /* vec_any_nlt */ 17150 17151 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, 17152 vector float __b) { 17153 #ifdef __VSX__ 17154 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a); 17155 #else 17156 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 17157 #endif 17158 } 17159 17160 #ifdef __VSX__ 17161 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a, 17162 vector double __b) { 17163 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a); 17164 } 17165 #endif 17166 17167 /* vec_any_numeric */ 17168 17169 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) { 17170 #ifdef __VSX__ 17171 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a); 17172 #else 17173 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 17174 #endif 17175 } 17176 17177 #ifdef __VSX__ 17178 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) { 17179 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a); 17180 } 17181 #endif 17182 17183 /* vec_any_out */ 17184 17185 static __inline__ int __attribute__((__always_inline__)) 17186 vec_any_out(vector float __a, vector float __b) { 17187 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 17188 } 17189 17190 /* Power 8 Crypto functions 17191 Note: We diverge from the current GCC implementation with regard 17192 to cryptography and related functions as follows: 17193 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 17194 - The remaining ones are only available on Power8 and up so 17195 require -mpower8-vector 17196 The justification for this is that export requirements require that 17197 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 17198 support). As a result, we need to be able to turn off support for those. 17199 The remaining ones (currently controlled by -mcrypto for GCC) still 17200 need to be provided on compliant hardware even if Vector.Crypto is not 17201 provided. 17202 */ 17203 #ifdef __CRYPTO__ 17204 #define vec_sbox_be __builtin_altivec_crypto_vsbox 17205 #define vec_cipher_be __builtin_altivec_crypto_vcipher 17206 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 17207 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 17208 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 17209 17210 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17211 __builtin_crypto_vsbox(vector unsigned long long __a) { 17212 return __builtin_altivec_crypto_vsbox(__a); 17213 } 17214 17215 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17216 __builtin_crypto_vcipher(vector unsigned long long __a, 17217 vector unsigned long long __b) { 17218 return __builtin_altivec_crypto_vcipher(__a, __b); 17219 } 17220 17221 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17222 __builtin_crypto_vcipherlast(vector unsigned long long __a, 17223 vector unsigned long long __b) { 17224 return __builtin_altivec_crypto_vcipherlast(__a, __b); 17225 } 17226 17227 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17228 __builtin_crypto_vncipher(vector unsigned long long __a, 17229 vector unsigned long long __b) { 17230 return __builtin_altivec_crypto_vncipher(__a, __b); 17231 } 17232 17233 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17234 __builtin_crypto_vncipherlast(vector unsigned long long __a, 17235 vector unsigned long long __b) { 17236 return __builtin_altivec_crypto_vncipherlast(__a, __b); 17237 } 17238 17239 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 17240 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 17241 17242 #define vec_shasigma_be(X, Y, Z) \ 17243 _Generic((X), vector unsigned int \ 17244 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 17245 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 17246 #endif 17247 17248 #ifdef __POWER8_VECTOR__ 17249 static __inline__ vector bool char __ATTRS_o_ai 17250 vec_permxor(vector bool char __a, vector bool char __b, 17251 vector bool char __c) { 17252 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17253 } 17254 17255 static __inline__ vector signed char __ATTRS_o_ai 17256 vec_permxor(vector signed char __a, vector signed char __b, 17257 vector signed char __c) { 17258 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17259 } 17260 17261 static __inline__ vector unsigned char __ATTRS_o_ai 17262 vec_permxor(vector unsigned char __a, vector unsigned char __b, 17263 vector unsigned char __c) { 17264 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17265 } 17266 17267 static __inline__ vector unsigned char __ATTRS_o_ai 17268 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 17269 vector unsigned char __c) { 17270 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17271 } 17272 17273 static __inline__ vector unsigned short __ATTRS_o_ai 17274 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 17275 vector unsigned short __c) { 17276 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 17277 (vector unsigned char)__a, (vector unsigned char)__b, 17278 (vector unsigned char)__c); 17279 } 17280 17281 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 17282 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 17283 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 17284 (vector unsigned char)__a, (vector unsigned char)__b, 17285 (vector unsigned char)__c); 17286 } 17287 17288 static __inline__ vector unsigned long long __ATTRS_o_ai 17289 __builtin_crypto_vpermxor(vector unsigned long long __a, 17290 vector unsigned long long __b, 17291 vector unsigned long long __c) { 17292 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 17293 (vector unsigned char)__a, (vector unsigned char)__b, 17294 (vector unsigned char)__c); 17295 } 17296 17297 static __inline__ vector unsigned char __ATTRS_o_ai 17298 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 17299 return __builtin_altivec_crypto_vpmsumb(__a, __b); 17300 } 17301 17302 static __inline__ vector unsigned short __ATTRS_o_ai 17303 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 17304 return __builtin_altivec_crypto_vpmsumh(__a, __b); 17305 } 17306 17307 static __inline__ vector unsigned int __ATTRS_o_ai 17308 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 17309 return __builtin_altivec_crypto_vpmsumw(__a, __b); 17310 } 17311 17312 static __inline__ vector unsigned long long __ATTRS_o_ai 17313 __builtin_crypto_vpmsumb(vector unsigned long long __a, 17314 vector unsigned long long __b) { 17315 return __builtin_altivec_crypto_vpmsumd(__a, __b); 17316 } 17317 17318 static __inline__ vector signed char __ATTRS_o_ai 17319 vec_vgbbd(vector signed char __a) { 17320 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17321 } 17322 17323 #define vec_pmsum_be __builtin_crypto_vpmsumb 17324 #define vec_gb __builtin_altivec_vgbbd 17325 17326 static __inline__ vector unsigned char __ATTRS_o_ai 17327 vec_vgbbd(vector unsigned char __a) { 17328 return __builtin_altivec_vgbbd(__a); 17329 } 17330 17331 static __inline__ vector signed long long __ATTRS_o_ai 17332 vec_gbb(vector signed long long __a) { 17333 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17334 } 17335 17336 static __inline__ vector unsigned long long __ATTRS_o_ai 17337 vec_gbb(vector unsigned long long __a) { 17338 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17339 } 17340 17341 static __inline__ vector long long __ATTRS_o_ai 17342 vec_vbpermq(vector signed char __a, vector signed char __b) { 17343 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17344 (vector unsigned char)__b); 17345 } 17346 17347 static __inline__ vector long long __ATTRS_o_ai 17348 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 17349 return __builtin_altivec_vbpermq(__a, __b); 17350 } 17351 17352 #if defined(__powerpc64__) && defined(__SIZEOF_INT128__) 17353 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17354 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 17355 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17356 (vector unsigned char)__b); 17357 } 17358 #endif 17359 #endif 17360 17361 17362 /* vec_reve */ 17363 17364 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 17365 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17366 5, 4, 3, 2, 1, 0); 17367 } 17368 17369 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 17370 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17371 5, 4, 3, 2, 1, 0); 17372 } 17373 17374 static inline __ATTRS_o_ai vector unsigned char 17375 vec_reve(vector unsigned char __a) { 17376 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17377 5, 4, 3, 2, 1, 0); 17378 } 17379 17380 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 17381 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17382 } 17383 17384 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 17385 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17386 } 17387 17388 static inline __ATTRS_o_ai vector unsigned int 17389 vec_reve(vector unsigned int __a) { 17390 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17391 } 17392 17393 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 17394 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17395 } 17396 17397 static inline __ATTRS_o_ai vector signed short 17398 vec_reve(vector signed short __a) { 17399 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17400 } 17401 17402 static inline __ATTRS_o_ai vector unsigned short 17403 vec_reve(vector unsigned short __a) { 17404 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17405 } 17406 17407 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 17408 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17409 } 17410 17411 #ifdef __VSX__ 17412 static inline __ATTRS_o_ai vector bool long long 17413 vec_reve(vector bool long long __a) { 17414 return __builtin_shufflevector(__a, __a, 1, 0); 17415 } 17416 17417 static inline __ATTRS_o_ai vector signed long long 17418 vec_reve(vector signed long long __a) { 17419 return __builtin_shufflevector(__a, __a, 1, 0); 17420 } 17421 17422 static inline __ATTRS_o_ai vector unsigned long long 17423 vec_reve(vector unsigned long long __a) { 17424 return __builtin_shufflevector(__a, __a, 1, 0); 17425 } 17426 17427 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 17428 return __builtin_shufflevector(__a, __a, 1, 0); 17429 } 17430 #endif 17431 17432 /* vec_revb */ 17433 static __inline__ vector bool char __ATTRS_o_ai 17434 vec_revb(vector bool char __a) { 17435 return __a; 17436 } 17437 17438 static __inline__ vector signed char __ATTRS_o_ai 17439 vec_revb(vector signed char __a) { 17440 return __a; 17441 } 17442 17443 static __inline__ vector unsigned char __ATTRS_o_ai 17444 vec_revb(vector unsigned char __a) { 17445 return __a; 17446 } 17447 17448 static __inline__ vector bool short __ATTRS_o_ai 17449 vec_revb(vector bool short __a) { 17450 vector unsigned char __indices = 17451 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17452 return vec_perm(__a, __a, __indices); 17453 } 17454 17455 static __inline__ vector signed short __ATTRS_o_ai 17456 vec_revb(vector signed short __a) { 17457 vector unsigned char __indices = 17458 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17459 return vec_perm(__a, __a, __indices); 17460 } 17461 17462 static __inline__ vector unsigned short __ATTRS_o_ai 17463 vec_revb(vector unsigned short __a) { 17464 vector unsigned char __indices = 17465 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17466 return vec_perm(__a, __a, __indices); 17467 } 17468 17469 static __inline__ vector bool int __ATTRS_o_ai 17470 vec_revb(vector bool int __a) { 17471 vector unsigned char __indices = 17472 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17473 return vec_perm(__a, __a, __indices); 17474 } 17475 17476 static __inline__ vector signed int __ATTRS_o_ai 17477 vec_revb(vector signed int __a) { 17478 vector unsigned char __indices = 17479 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17480 return vec_perm(__a, __a, __indices); 17481 } 17482 17483 static __inline__ vector unsigned int __ATTRS_o_ai 17484 vec_revb(vector unsigned int __a) { 17485 vector unsigned char __indices = 17486 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17487 return vec_perm(__a, __a, __indices); 17488 } 17489 17490 static __inline__ vector float __ATTRS_o_ai 17491 vec_revb(vector float __a) { 17492 vector unsigned char __indices = 17493 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17494 return vec_perm(__a, __a, __indices); 17495 } 17496 17497 #ifdef __VSX__ 17498 static __inline__ vector bool long long __ATTRS_o_ai 17499 vec_revb(vector bool long long __a) { 17500 vector unsigned char __indices = 17501 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17502 return vec_perm(__a, __a, __indices); 17503 } 17504 17505 static __inline__ vector signed long long __ATTRS_o_ai 17506 vec_revb(vector signed long long __a) { 17507 vector unsigned char __indices = 17508 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17509 return vec_perm(__a, __a, __indices); 17510 } 17511 17512 static __inline__ vector unsigned long long __ATTRS_o_ai 17513 vec_revb(vector unsigned long long __a) { 17514 vector unsigned char __indices = 17515 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17516 return vec_perm(__a, __a, __indices); 17517 } 17518 17519 static __inline__ vector double __ATTRS_o_ai 17520 vec_revb(vector double __a) { 17521 vector unsigned char __indices = 17522 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17523 return vec_perm(__a, __a, __indices); 17524 } 17525 #endif /* End __VSX__ */ 17526 17527 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17528 defined(__SIZEOF_INT128__) 17529 static __inline__ vector signed __int128 __ATTRS_o_ai 17530 vec_revb(vector signed __int128 __a) { 17531 vector unsigned char __indices = 17532 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17533 return (vector signed __int128)vec_perm((vector signed int)__a, 17534 (vector signed int)__a, 17535 __indices); 17536 } 17537 17538 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17539 vec_revb(vector unsigned __int128 __a) { 17540 vector unsigned char __indices = 17541 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17542 return (vector unsigned __int128)vec_perm((vector signed int)__a, 17543 (vector signed int)__a, 17544 __indices); 17545 } 17546 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 17547 17548 /* vec_xl */ 17549 17550 #define vec_xld2 vec_xl 17551 #define vec_xlw4 vec_xl 17552 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 17553 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 17554 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 17555 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 17556 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 17557 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 17558 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 17559 17560 static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, 17561 const signed char *__ptr) { 17562 return *(unaligned_vec_schar *)(__ptr + __offset); 17563 } 17564 17565 static inline __ATTRS_o_ai vector unsigned char 17566 vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) { 17567 return *(unaligned_vec_uchar*)(__ptr + __offset); 17568 } 17569 17570 static inline __ATTRS_o_ai vector signed short 17571 vec_xl(ptrdiff_t __offset, const signed short *__ptr) { 17572 signed char *__addr = (signed char *)__ptr + __offset; 17573 return *(unaligned_vec_sshort *)__addr; 17574 } 17575 17576 static inline __ATTRS_o_ai vector unsigned short 17577 vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) { 17578 signed char *__addr = (signed char *)__ptr + __offset; 17579 return *(unaligned_vec_ushort *)__addr; 17580 } 17581 17582 static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset, 17583 const signed int *__ptr) { 17584 signed char *__addr = (signed char *)__ptr + __offset; 17585 return *(unaligned_vec_sint *)__addr; 17586 } 17587 17588 static inline __ATTRS_o_ai vector unsigned int 17589 vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) { 17590 signed char *__addr = (signed char *)__ptr + __offset; 17591 return *(unaligned_vec_uint *)__addr; 17592 } 17593 17594 static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset, 17595 const float *__ptr) { 17596 signed char *__addr = (signed char *)__ptr + __offset; 17597 return *(unaligned_vec_float *)__addr; 17598 } 17599 17600 #ifdef __VSX__ 17601 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 17602 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 17603 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 17604 17605 static inline __ATTRS_o_ai vector signed long long 17606 vec_xl(ptrdiff_t __offset, const signed long long *__ptr) { 17607 signed char *__addr = (signed char *)__ptr + __offset; 17608 return *(unaligned_vec_sll *)__addr; 17609 } 17610 17611 static inline __ATTRS_o_ai vector unsigned long long 17612 vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) { 17613 signed char *__addr = (signed char *)__ptr + __offset; 17614 return *(unaligned_vec_ull *)__addr; 17615 } 17616 17617 static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset, 17618 const double *__ptr) { 17619 signed char *__addr = (signed char *)__ptr + __offset; 17620 return *(unaligned_vec_double *)__addr; 17621 } 17622 #endif 17623 17624 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17625 defined(__SIZEOF_INT128__) 17626 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 17627 typedef vector unsigned __int128 unaligned_vec_ui128 17628 __attribute__((aligned(1))); 17629 static inline __ATTRS_o_ai vector signed __int128 17630 vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) { 17631 signed char *__addr = (signed char *)__ptr + __offset; 17632 return *(unaligned_vec_si128 *)__addr; 17633 } 17634 17635 static inline __ATTRS_o_ai vector unsigned __int128 17636 vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) { 17637 signed char *__addr = (signed char *)__ptr + __offset; 17638 return *(unaligned_vec_ui128 *)__addr; 17639 } 17640 #endif 17641 17642 /* vec_xl_be */ 17643 17644 #ifdef __LITTLE_ENDIAN__ 17645 static __inline__ vector signed char __ATTRS_o_ai 17646 vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) { 17647 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17648 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17649 13, 12, 11, 10, 9, 8); 17650 } 17651 17652 static __inline__ vector unsigned char __ATTRS_o_ai 17653 vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) { 17654 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17655 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17656 13, 12, 11, 10, 9, 8); 17657 } 17658 17659 static __inline__ vector signed short __ATTRS_o_ai 17660 vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) { 17661 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17662 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17663 } 17664 17665 static __inline__ vector unsigned short __ATTRS_o_ai 17666 vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) { 17667 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17668 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17669 } 17670 17671 static __inline__ vector signed int __ATTRS_o_ai 17672 vec_xl_be(signed long long __offset, const signed int *__ptr) { 17673 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17674 } 17675 17676 static __inline__ vector unsigned int __ATTRS_o_ai 17677 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 17678 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17679 } 17680 17681 static __inline__ vector float __ATTRS_o_ai 17682 vec_xl_be(signed long long __offset, const float *__ptr) { 17683 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17684 } 17685 17686 #ifdef __VSX__ 17687 static __inline__ vector signed long long __ATTRS_o_ai 17688 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 17689 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17690 } 17691 17692 static __inline__ vector unsigned long long __ATTRS_o_ai 17693 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 17694 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17695 } 17696 17697 static __inline__ vector double __ATTRS_o_ai 17698 vec_xl_be(signed long long __offset, const double *__ptr) { 17699 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17700 } 17701 #endif 17702 17703 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17704 defined(__SIZEOF_INT128__) 17705 static __inline__ vector signed __int128 __ATTRS_o_ai 17706 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 17707 return vec_xl(__offset, __ptr); 17708 } 17709 17710 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17711 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 17712 return vec_xl(__offset, __ptr); 17713 } 17714 #endif 17715 #else 17716 #define vec_xl_be vec_xl 17717 #endif 17718 17719 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17720 defined(__SIZEOF_INT128__) 17721 17722 /* vect_xl_sext */ 17723 17724 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17725 vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) { 17726 return (vector unsigned __int128)*(__pointer + __offset); 17727 } 17728 17729 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17730 vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) { 17731 return (vector unsigned __int128)*(__pointer + __offset); 17732 } 17733 17734 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17735 vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) { 17736 return (vector unsigned __int128)*(__pointer + __offset); 17737 } 17738 17739 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17740 vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) { 17741 return (vector unsigned __int128)*(__pointer + __offset); 17742 } 17743 17744 /* vec_xl_zext */ 17745 17746 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17747 vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) { 17748 return (vector unsigned __int128)*(__pointer + __offset); 17749 } 17750 17751 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17752 vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) { 17753 return (vector unsigned __int128)*(__pointer + __offset); 17754 } 17755 17756 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17757 vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) { 17758 return (vector unsigned __int128)*(__pointer + __offset); 17759 } 17760 17761 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17762 vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) { 17763 return (vector unsigned __int128)*(__pointer + __offset); 17764 } 17765 17766 #endif 17767 17768 /* vec_xlds */ 17769 #ifdef __VSX__ 17770 static __inline__ vector signed long long __ATTRS_o_ai 17771 vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) { 17772 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset); 17773 return (vector signed long long) *__addr; 17774 } 17775 17776 static __inline__ vector unsigned long long __ATTRS_o_ai 17777 vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) { 17778 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset); 17779 return (unaligned_vec_ull) *__addr; 17780 } 17781 17782 static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset, 17783 const double *__ptr) { 17784 double *__addr = (double*)((signed char *)__ptr + __offset); 17785 return (unaligned_vec_double) *__addr; 17786 } 17787 17788 /* vec_load_splats */ 17789 static __inline__ vector signed int __ATTRS_o_ai 17790 vec_load_splats(signed long long __offset, const signed int *__ptr) { 17791 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17792 return (vector signed int)*__addr; 17793 } 17794 17795 static __inline__ vector signed int __ATTRS_o_ai 17796 vec_load_splats(unsigned long long __offset, const signed int *__ptr) { 17797 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17798 return (vector signed int)*__addr; 17799 } 17800 17801 static __inline__ vector unsigned int __ATTRS_o_ai 17802 vec_load_splats(signed long long __offset, const unsigned int *__ptr) { 17803 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17804 return (vector unsigned int)*__addr; 17805 } 17806 17807 static __inline__ vector unsigned int __ATTRS_o_ai 17808 vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) { 17809 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17810 return (vector unsigned int)*__addr; 17811 } 17812 17813 static __inline__ vector float __ATTRS_o_ai 17814 vec_load_splats(signed long long __offset, const float *__ptr) { 17815 float *__addr = (float*)((signed char *)__ptr + __offset); 17816 return (vector float)*__addr; 17817 } 17818 17819 static __inline__ vector float __ATTRS_o_ai 17820 vec_load_splats(unsigned long long __offset, const float *__ptr) { 17821 float *__addr = (float*)((signed char *)__ptr + __offset); 17822 return (vector float)*__addr; 17823 } 17824 #endif 17825 17826 /* vec_xst */ 17827 17828 #define vec_xstd2 vec_xst 17829 #define vec_xstw4 vec_xst 17830 static inline __ATTRS_o_ai void 17831 vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) { 17832 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 17833 } 17834 17835 static inline __ATTRS_o_ai void 17836 vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) { 17837 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 17838 } 17839 17840 static inline __ATTRS_o_ai void 17841 vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) { 17842 signed char *__addr = (signed char *)__ptr + __offset; 17843 *(unaligned_vec_sshort *)__addr = __vec; 17844 } 17845 17846 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 17847 ptrdiff_t __offset, 17848 unsigned short *__ptr) { 17849 signed char *__addr = (signed char *)__ptr + __offset; 17850 *(unaligned_vec_ushort *)__addr = __vec; 17851 } 17852 17853 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 17854 ptrdiff_t __offset, signed int *__ptr) { 17855 signed char *__addr = (signed char *)__ptr + __offset; 17856 *(unaligned_vec_sint *)__addr = __vec; 17857 } 17858 17859 static inline __ATTRS_o_ai void 17860 vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) { 17861 signed char *__addr = (signed char *)__ptr + __offset; 17862 *(unaligned_vec_uint *)__addr = __vec; 17863 } 17864 17865 static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset, 17866 float *__ptr) { 17867 signed char *__addr = (signed char *)__ptr + __offset; 17868 *(unaligned_vec_float *)__addr = __vec; 17869 } 17870 17871 #ifdef __VSX__ 17872 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 17873 ptrdiff_t __offset, 17874 signed long long *__ptr) { 17875 signed char *__addr = (signed char *)__ptr + __offset; 17876 *(unaligned_vec_sll *)__addr = __vec; 17877 } 17878 17879 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 17880 ptrdiff_t __offset, 17881 unsigned long long *__ptr) { 17882 signed char *__addr = (signed char *)__ptr + __offset; 17883 *(unaligned_vec_ull *)__addr = __vec; 17884 } 17885 17886 static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset, 17887 double *__ptr) { 17888 signed char *__addr = (signed char *)__ptr + __offset; 17889 *(unaligned_vec_double *)__addr = __vec; 17890 } 17891 #endif 17892 17893 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17894 defined(__SIZEOF_INT128__) 17895 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 17896 ptrdiff_t __offset, 17897 signed __int128 *__ptr) { 17898 signed char *__addr = (signed char *)__ptr + __offset; 17899 *(unaligned_vec_si128 *)__addr = __vec; 17900 } 17901 17902 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 17903 ptrdiff_t __offset, 17904 unsigned __int128 *__ptr) { 17905 signed char *__addr = (signed char *)__ptr + __offset; 17906 *(unaligned_vec_ui128 *)__addr = __vec; 17907 } 17908 #endif 17909 17910 /* vec_xst_trunc */ 17911 17912 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17913 defined(__SIZEOF_INT128__) 17914 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17915 ptrdiff_t __offset, 17916 signed char *__ptr) { 17917 *(__ptr + __offset) = (signed char)__vec[0]; 17918 } 17919 17920 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17921 ptrdiff_t __offset, 17922 unsigned char *__ptr) { 17923 *(__ptr + __offset) = (unsigned char)__vec[0]; 17924 } 17925 17926 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17927 ptrdiff_t __offset, 17928 signed short *__ptr) { 17929 *(__ptr + __offset) = (signed short)__vec[0]; 17930 } 17931 17932 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17933 ptrdiff_t __offset, 17934 unsigned short *__ptr) { 17935 *(__ptr + __offset) = (unsigned short)__vec[0]; 17936 } 17937 17938 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17939 ptrdiff_t __offset, 17940 signed int *__ptr) { 17941 *(__ptr + __offset) = (signed int)__vec[0]; 17942 } 17943 17944 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17945 ptrdiff_t __offset, 17946 unsigned int *__ptr) { 17947 *(__ptr + __offset) = (unsigned int)__vec[0]; 17948 } 17949 17950 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17951 ptrdiff_t __offset, 17952 signed long long *__ptr) { 17953 *(__ptr + __offset) = (signed long long)__vec[0]; 17954 } 17955 17956 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17957 ptrdiff_t __offset, 17958 unsigned long long *__ptr) { 17959 *(__ptr + __offset) = (unsigned long long)__vec[0]; 17960 } 17961 #endif 17962 17963 /* vec_xst_be */ 17964 17965 #ifdef __LITTLE_ENDIAN__ 17966 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 17967 signed long long __offset, 17968 signed char *__ptr) { 17969 vector signed char __tmp = 17970 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17971 13, 12, 11, 10, 9, 8); 17972 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17973 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17974 } 17975 17976 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 17977 signed long long __offset, 17978 unsigned char *__ptr) { 17979 vector unsigned char __tmp = 17980 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17981 13, 12, 11, 10, 9, 8); 17982 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17983 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17984 } 17985 17986 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 17987 signed long long __offset, 17988 signed short *__ptr) { 17989 vector signed short __tmp = 17990 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17991 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 17992 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 17993 } 17994 17995 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 17996 signed long long __offset, 17997 unsigned short *__ptr) { 17998 vector unsigned short __tmp = 17999 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18000 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18001 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18002 } 18003 18004 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 18005 signed long long __offset, 18006 signed int *__ptr) { 18007 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 18008 } 18009 18010 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 18011 signed long long __offset, 18012 unsigned int *__ptr) { 18013 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18014 } 18015 18016 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 18017 signed long long __offset, 18018 float *__ptr) { 18019 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18020 } 18021 18022 #ifdef __VSX__ 18023 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 18024 signed long long __offset, 18025 signed long long *__ptr) { 18026 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18027 } 18028 18029 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 18030 signed long long __offset, 18031 unsigned long long *__ptr) { 18032 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18033 } 18034 18035 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 18036 signed long long __offset, 18037 double *__ptr) { 18038 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18039 } 18040 #endif 18041 18042 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 18043 defined(__SIZEOF_INT128__) 18044 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 18045 signed long long __offset, 18046 signed __int128 *__ptr) { 18047 vec_xst(__vec, __offset, __ptr); 18048 } 18049 18050 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 18051 signed long long __offset, 18052 unsigned __int128 *__ptr) { 18053 vec_xst(__vec, __offset, __ptr); 18054 } 18055 #endif 18056 #else 18057 #define vec_xst_be vec_xst 18058 #endif 18059 18060 #ifdef __POWER9_VECTOR__ 18061 #define vec_test_data_class(__a, __b) \ 18062 _Generic( \ 18063 (__a), vector float \ 18064 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 18065 vector double \ 18066 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 18067 (__b))) 18068 18069 #endif /* #ifdef __POWER9_VECTOR__ */ 18070 18071 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 18072 return -__a; 18073 } 18074 18075 #ifdef __VSX__ 18076 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 18077 return -__a; 18078 } 18079 18080 #endif 18081 18082 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 18083 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 18084 return -__a; 18085 } 18086 #endif 18087 18088 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 18089 return -__a; 18090 } 18091 18092 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 18093 return -__a; 18094 } 18095 18096 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 18097 return -__a; 18098 } 18099 18100 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 18101 return - vec_abs(__a); 18102 } 18103 18104 #ifdef __VSX__ 18105 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 18106 return - vec_abs(__a); 18107 } 18108 18109 #endif 18110 18111 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) 18112 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 18113 return __builtin_altivec_vminsd(__a, -__a); 18114 } 18115 #endif 18116 18117 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 18118 return __builtin_altivec_vminsw(__a, -__a); 18119 } 18120 18121 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 18122 return __builtin_altivec_vminsh(__a, -__a); 18123 } 18124 18125 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 18126 return __builtin_altivec_vminsb(__a, -__a); 18127 } 18128 18129 static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, 18130 vector float __b) { 18131 return __builtin_ppc_recipdivf(__a, __b); 18132 } 18133 18134 #ifdef __VSX__ 18135 static vector double __ATTRS_o_ai vec_recipdiv(vector double __a, 18136 vector double __b) { 18137 return __builtin_ppc_recipdivd(__a, __b); 18138 } 18139 #endif 18140 18141 #ifdef __POWER10_VECTOR__ 18142 18143 /* vec_extractm */ 18144 18145 static __inline__ unsigned int __ATTRS_o_ai 18146 vec_extractm(vector unsigned char __a) { 18147 return __builtin_altivec_vextractbm(__a); 18148 } 18149 18150 static __inline__ unsigned int __ATTRS_o_ai 18151 vec_extractm(vector unsigned short __a) { 18152 return __builtin_altivec_vextracthm(__a); 18153 } 18154 18155 static __inline__ unsigned int __ATTRS_o_ai 18156 vec_extractm(vector unsigned int __a) { 18157 return __builtin_altivec_vextractwm(__a); 18158 } 18159 18160 static __inline__ unsigned int __ATTRS_o_ai 18161 vec_extractm(vector unsigned long long __a) { 18162 return __builtin_altivec_vextractdm(__a); 18163 } 18164 18165 #ifdef __SIZEOF_INT128__ 18166 static __inline__ unsigned int __ATTRS_o_ai 18167 vec_extractm(vector unsigned __int128 __a) { 18168 return __builtin_altivec_vextractqm(__a); 18169 } 18170 #endif 18171 18172 /* vec_expandm */ 18173 18174 static __inline__ vector unsigned char __ATTRS_o_ai 18175 vec_expandm(vector unsigned char __a) { 18176 return __builtin_altivec_vexpandbm(__a); 18177 } 18178 18179 static __inline__ vector unsigned short __ATTRS_o_ai 18180 vec_expandm(vector unsigned short __a) { 18181 return __builtin_altivec_vexpandhm(__a); 18182 } 18183 18184 static __inline__ vector unsigned int __ATTRS_o_ai 18185 vec_expandm(vector unsigned int __a) { 18186 return __builtin_altivec_vexpandwm(__a); 18187 } 18188 18189 static __inline__ vector unsigned long long __ATTRS_o_ai 18190 vec_expandm(vector unsigned long long __a) { 18191 return __builtin_altivec_vexpanddm(__a); 18192 } 18193 18194 #ifdef __SIZEOF_INT128__ 18195 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18196 vec_expandm(vector unsigned __int128 __a) { 18197 return __builtin_altivec_vexpandqm(__a); 18198 } 18199 #endif 18200 18201 /* vec_cntm */ 18202 18203 #define vec_cntm(__a, __mp) \ 18204 _Generic((__a), vector unsigned char \ 18205 : __builtin_altivec_vcntmbb((__a), (unsigned int)(__mp)), \ 18206 vector unsigned short \ 18207 : __builtin_altivec_vcntmbh((__a), (unsigned int)(__mp)), \ 18208 vector unsigned int \ 18209 : __builtin_altivec_vcntmbw((__a), (unsigned int)(__mp)), \ 18210 vector unsigned long long \ 18211 : __builtin_altivec_vcntmbd((__a), (unsigned int)(__mp))) 18212 18213 /* vec_gen[b|h|w|d|q]m */ 18214 18215 static __inline__ vector unsigned char __ATTRS_o_ai 18216 vec_genbm(unsigned long long __bm) { 18217 return __builtin_altivec_mtvsrbm(__bm); 18218 } 18219 18220 static __inline__ vector unsigned short __ATTRS_o_ai 18221 vec_genhm(unsigned long long __bm) { 18222 return __builtin_altivec_mtvsrhm(__bm); 18223 } 18224 18225 static __inline__ vector unsigned int __ATTRS_o_ai 18226 vec_genwm(unsigned long long __bm) { 18227 return __builtin_altivec_mtvsrwm(__bm); 18228 } 18229 18230 static __inline__ vector unsigned long long __ATTRS_o_ai 18231 vec_gendm(unsigned long long __bm) { 18232 return __builtin_altivec_mtvsrdm(__bm); 18233 } 18234 18235 #ifdef __SIZEOF_INT128__ 18236 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18237 vec_genqm(unsigned long long __bm) { 18238 return __builtin_altivec_mtvsrqm(__bm); 18239 } 18240 #endif 18241 18242 /* vec_pdep */ 18243 18244 static __inline__ vector unsigned long long __ATTRS_o_ai 18245 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 18246 return __builtin_altivec_vpdepd(__a, __b); 18247 } 18248 18249 /* vec_pext */ 18250 18251 static __inline__ vector unsigned long long __ATTRS_o_ai 18252 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 18253 return __builtin_altivec_vpextd(__a, __b); 18254 } 18255 18256 /* vec_cfuge */ 18257 18258 static __inline__ vector unsigned long long __ATTRS_o_ai 18259 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 18260 return __builtin_altivec_vcfuged(__a, __b); 18261 } 18262 18263 /* vec_gnb */ 18264 18265 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 18266 18267 /* vec_ternarylogic */ 18268 #ifdef __VSX__ 18269 #ifdef __SIZEOF_INT128__ 18270 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18271 _Generic((__a), vector unsigned char \ 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 short \ 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 int \ 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 long long \ 18284 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18285 (vector unsigned long long)(__b), \ 18286 (vector unsigned long long)(__c), (__imm)), \ 18287 vector unsigned __int128 \ 18288 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18289 (vector unsigned long long)(__b), \ 18290 (vector unsigned long long)(__c), (__imm))) 18291 #else 18292 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18293 _Generic((__a), vector unsigned char \ 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 short \ 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 int \ 18302 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18303 (vector unsigned long long)(__b), \ 18304 (vector unsigned long long)(__c), (__imm)), \ 18305 vector unsigned long long \ 18306 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18307 (vector unsigned long long)(__b), \ 18308 (vector unsigned long long)(__c), (__imm))) 18309 #endif /* __SIZEOF_INT128__ */ 18310 #endif /* __VSX__ */ 18311 18312 /* vec_genpcvm */ 18313 18314 #ifdef __VSX__ 18315 #define vec_genpcvm(__a, __imm) \ 18316 _Generic((__a), vector unsigned char \ 18317 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ 18318 vector unsigned short \ 18319 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ 18320 vector unsigned int \ 18321 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ 18322 vector unsigned long long \ 18323 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) 18324 #endif /* __VSX__ */ 18325 18326 /* vec_clrl */ 18327 18328 static __inline__ vector signed char __ATTRS_o_ai 18329 vec_clrl(vector signed char __a, unsigned int __n) { 18330 #ifdef __LITTLE_ENDIAN__ 18331 return __builtin_altivec_vclrrb(__a, __n); 18332 #else 18333 return __builtin_altivec_vclrlb( __a, __n); 18334 #endif 18335 } 18336 18337 static __inline__ vector unsigned char __ATTRS_o_ai 18338 vec_clrl(vector unsigned char __a, unsigned int __n) { 18339 #ifdef __LITTLE_ENDIAN__ 18340 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18341 #else 18342 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18343 #endif 18344 } 18345 18346 /* vec_clrr */ 18347 18348 static __inline__ vector signed char __ATTRS_o_ai 18349 vec_clrr(vector signed char __a, unsigned int __n) { 18350 #ifdef __LITTLE_ENDIAN__ 18351 return __builtin_altivec_vclrlb(__a, __n); 18352 #else 18353 return __builtin_altivec_vclrrb( __a, __n); 18354 #endif 18355 } 18356 18357 static __inline__ vector unsigned char __ATTRS_o_ai 18358 vec_clrr(vector unsigned char __a, unsigned int __n) { 18359 #ifdef __LITTLE_ENDIAN__ 18360 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18361 #else 18362 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18363 #endif 18364 } 18365 18366 /* vec_cntlzm */ 18367 18368 static __inline__ vector unsigned long long __ATTRS_o_ai 18369 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 18370 return __builtin_altivec_vclzdm(__a, __b); 18371 } 18372 18373 /* vec_cnttzm */ 18374 18375 static __inline__ vector unsigned long long __ATTRS_o_ai 18376 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 18377 return __builtin_altivec_vctzdm(__a, __b); 18378 } 18379 18380 /* vec_mod */ 18381 18382 static __inline__ vector signed int __ATTRS_o_ai 18383 vec_mod(vector signed int __a, vector signed int __b) { 18384 return __a % __b; 18385 } 18386 18387 static __inline__ vector unsigned int __ATTRS_o_ai 18388 vec_mod(vector unsigned int __a, vector unsigned int __b) { 18389 return __a % __b; 18390 } 18391 18392 static __inline__ vector signed long long __ATTRS_o_ai 18393 vec_mod(vector signed long long __a, vector signed long long __b) { 18394 return __a % __b; 18395 } 18396 18397 static __inline__ vector unsigned long long __ATTRS_o_ai 18398 vec_mod(vector unsigned long long __a, vector unsigned long long __b) { 18399 return __a % __b; 18400 } 18401 18402 #ifdef __SIZEOF_INT128__ 18403 static __inline__ vector signed __int128 __ATTRS_o_ai 18404 vec_mod(vector signed __int128 __a, vector signed __int128 __b) { 18405 return __a % __b; 18406 } 18407 18408 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18409 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18410 return __a % __b; 18411 } 18412 #endif 18413 18414 /* vec_sldbi */ 18415 18416 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) 18417 18418 /* vec_srdbi */ 18419 18420 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) 18421 18422 /* vec_insertl */ 18423 18424 static __inline__ vector unsigned char __ATTRS_o_ai 18425 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18426 #ifdef __LITTLE_ENDIAN__ 18427 return __builtin_altivec_vinsbrx(__b, __c, __a); 18428 #else 18429 return __builtin_altivec_vinsblx(__b, __c, __a); 18430 #endif 18431 } 18432 18433 static __inline__ vector unsigned short __ATTRS_o_ai 18434 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18435 #ifdef __LITTLE_ENDIAN__ 18436 return __builtin_altivec_vinshrx(__b, __c, __a); 18437 #else 18438 return __builtin_altivec_vinshlx(__b, __c, __a); 18439 #endif 18440 } 18441 18442 static __inline__ vector unsigned int __ATTRS_o_ai 18443 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18444 #ifdef __LITTLE_ENDIAN__ 18445 return __builtin_altivec_vinswrx(__b, __c, __a); 18446 #else 18447 return __builtin_altivec_vinswlx(__b, __c, __a); 18448 #endif 18449 } 18450 18451 static __inline__ vector unsigned long long __ATTRS_o_ai 18452 vec_insertl(unsigned long long __a, vector unsigned long long __b, 18453 unsigned int __c) { 18454 #ifdef __LITTLE_ENDIAN__ 18455 return __builtin_altivec_vinsdrx(__b, __c, __a); 18456 #else 18457 return __builtin_altivec_vinsdlx(__b, __c, __a); 18458 #endif 18459 } 18460 18461 static __inline__ vector unsigned char __ATTRS_o_ai 18462 vec_insertl(vector unsigned char __a, vector unsigned char __b, 18463 unsigned int __c) { 18464 #ifdef __LITTLE_ENDIAN__ 18465 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18466 #else 18467 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18468 #endif 18469 } 18470 18471 static __inline__ vector unsigned short __ATTRS_o_ai 18472 vec_insertl(vector unsigned short __a, vector unsigned short __b, 18473 unsigned int __c) { 18474 #ifdef __LITTLE_ENDIAN__ 18475 return __builtin_altivec_vinshvrx(__b, __c, __a); 18476 #else 18477 return __builtin_altivec_vinshvlx(__b, __c, __a); 18478 #endif 18479 } 18480 18481 static __inline__ vector unsigned int __ATTRS_o_ai 18482 vec_insertl(vector unsigned int __a, vector unsigned int __b, 18483 unsigned int __c) { 18484 #ifdef __LITTLE_ENDIAN__ 18485 return __builtin_altivec_vinswvrx(__b, __c, __a); 18486 #else 18487 return __builtin_altivec_vinswvlx(__b, __c, __a); 18488 #endif 18489 } 18490 18491 /* vec_inserth */ 18492 18493 static __inline__ vector unsigned char __ATTRS_o_ai 18494 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18495 #ifdef __LITTLE_ENDIAN__ 18496 return __builtin_altivec_vinsblx(__b, __c, __a); 18497 #else 18498 return __builtin_altivec_vinsbrx(__b, __c, __a); 18499 #endif 18500 } 18501 18502 static __inline__ vector unsigned short __ATTRS_o_ai 18503 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18504 #ifdef __LITTLE_ENDIAN__ 18505 return __builtin_altivec_vinshlx(__b, __c, __a); 18506 #else 18507 return __builtin_altivec_vinshrx(__b, __c, __a); 18508 #endif 18509 } 18510 18511 static __inline__ vector unsigned int __ATTRS_o_ai 18512 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18513 #ifdef __LITTLE_ENDIAN__ 18514 return __builtin_altivec_vinswlx(__b, __c, __a); 18515 #else 18516 return __builtin_altivec_vinswrx(__b, __c, __a); 18517 #endif 18518 } 18519 18520 static __inline__ vector unsigned long long __ATTRS_o_ai 18521 vec_inserth(unsigned long long __a, vector unsigned long long __b, 18522 unsigned int __c) { 18523 #ifdef __LITTLE_ENDIAN__ 18524 return __builtin_altivec_vinsdlx(__b, __c, __a); 18525 #else 18526 return __builtin_altivec_vinsdrx(__b, __c, __a); 18527 #endif 18528 } 18529 18530 static __inline__ vector unsigned char __ATTRS_o_ai 18531 vec_inserth(vector unsigned char __a, vector unsigned char __b, 18532 unsigned int __c) { 18533 #ifdef __LITTLE_ENDIAN__ 18534 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18535 #else 18536 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18537 #endif 18538 } 18539 18540 static __inline__ vector unsigned short __ATTRS_o_ai 18541 vec_inserth(vector unsigned short __a, vector unsigned short __b, 18542 unsigned int __c) { 18543 #ifdef __LITTLE_ENDIAN__ 18544 return __builtin_altivec_vinshvlx(__b, __c, __a); 18545 #else 18546 return __builtin_altivec_vinshvrx(__b, __c, __a); 18547 #endif 18548 } 18549 18550 static __inline__ vector unsigned int __ATTRS_o_ai 18551 vec_inserth(vector unsigned int __a, vector unsigned int __b, 18552 unsigned int __c) { 18553 #ifdef __LITTLE_ENDIAN__ 18554 return __builtin_altivec_vinswvlx(__b, __c, __a); 18555 #else 18556 return __builtin_altivec_vinswvrx(__b, __c, __a); 18557 #endif 18558 } 18559 18560 /* vec_extractl */ 18561 18562 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18563 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18564 #ifdef __LITTLE_ENDIAN__ 18565 return __builtin_altivec_vextdubvrx(__a, __b, __c); 18566 #else 18567 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); 18568 return vec_sld(__ret, __ret, 8); 18569 #endif 18570 } 18571 18572 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18573 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18574 #ifdef __LITTLE_ENDIAN__ 18575 return __builtin_altivec_vextduhvrx(__a, __b, __c); 18576 #else 18577 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); 18578 return vec_sld(__ret, __ret, 8); 18579 #endif 18580 } 18581 18582 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18583 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18584 #ifdef __LITTLE_ENDIAN__ 18585 return __builtin_altivec_vextduwvrx(__a, __b, __c); 18586 #else 18587 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); 18588 return vec_sld(__ret, __ret, 8); 18589 #endif 18590 } 18591 18592 static __inline__ vector unsigned long long __ATTRS_o_ai 18593 vec_extractl(vector unsigned long long __a, vector unsigned long long __b, 18594 unsigned int __c) { 18595 #ifdef __LITTLE_ENDIAN__ 18596 return __builtin_altivec_vextddvrx(__a, __b, __c); 18597 #else 18598 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); 18599 return vec_sld(__ret, __ret, 8); 18600 #endif 18601 } 18602 18603 /* vec_extracth */ 18604 18605 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18606 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18607 #ifdef __LITTLE_ENDIAN__ 18608 return __builtin_altivec_vextdubvlx(__a, __b, __c); 18609 #else 18610 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); 18611 return vec_sld(__ret, __ret, 8); 18612 #endif 18613 } 18614 18615 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18616 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18617 #ifdef __LITTLE_ENDIAN__ 18618 return __builtin_altivec_vextduhvlx(__a, __b, __c); 18619 #else 18620 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); 18621 return vec_sld(__ret, __ret, 8); 18622 #endif 18623 } 18624 18625 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18626 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18627 #ifdef __LITTLE_ENDIAN__ 18628 return __builtin_altivec_vextduwvlx(__a, __b, __c); 18629 #else 18630 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); 18631 return vec_sld(__ret, __ret, 8); 18632 #endif 18633 } 18634 18635 static __inline__ vector unsigned long long __ATTRS_o_ai 18636 vec_extracth(vector unsigned long long __a, vector unsigned long long __b, 18637 unsigned int __c) { 18638 #ifdef __LITTLE_ENDIAN__ 18639 return __builtin_altivec_vextddvlx(__a, __b, __c); 18640 #else 18641 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); 18642 return vec_sld(__ret, __ret, 8); 18643 #endif 18644 } 18645 18646 #ifdef __VSX__ 18647 18648 /* vec_permx */ 18649 18650 #define vec_permx(__a, __b, __c, __d) \ 18651 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) 18652 18653 /* vec_blendv */ 18654 18655 static __inline__ vector signed char __ATTRS_o_ai 18656 vec_blendv(vector signed char __a, vector signed char __b, 18657 vector unsigned char __c) { 18658 return __builtin_vsx_xxblendvb(__a, __b, __c); 18659 } 18660 18661 static __inline__ vector unsigned char __ATTRS_o_ai 18662 vec_blendv(vector unsigned char __a, vector unsigned char __b, 18663 vector unsigned char __c) { 18664 return __builtin_vsx_xxblendvb(__a, __b, __c); 18665 } 18666 18667 static __inline__ vector signed short __ATTRS_o_ai 18668 vec_blendv(vector signed short __a, vector signed short __b, 18669 vector unsigned short __c) { 18670 return __builtin_vsx_xxblendvh(__a, __b, __c); 18671 } 18672 18673 static __inline__ vector unsigned short __ATTRS_o_ai 18674 vec_blendv(vector unsigned short __a, vector unsigned short __b, 18675 vector unsigned short __c) { 18676 return __builtin_vsx_xxblendvh(__a, __b, __c); 18677 } 18678 18679 static __inline__ vector signed int __ATTRS_o_ai 18680 vec_blendv(vector signed int __a, vector signed int __b, 18681 vector unsigned int __c) { 18682 return __builtin_vsx_xxblendvw(__a, __b, __c); 18683 } 18684 18685 static __inline__ vector unsigned int __ATTRS_o_ai 18686 vec_blendv(vector unsigned int __a, vector unsigned int __b, 18687 vector unsigned int __c) { 18688 return __builtin_vsx_xxblendvw(__a, __b, __c); 18689 } 18690 18691 static __inline__ vector signed long long __ATTRS_o_ai 18692 vec_blendv(vector signed long long __a, vector signed long long __b, 18693 vector unsigned long long __c) { 18694 return __builtin_vsx_xxblendvd(__a, __b, __c); 18695 } 18696 18697 static __inline__ vector unsigned long long __ATTRS_o_ai 18698 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 18699 vector unsigned long long __c) { 18700 return __builtin_vsx_xxblendvd(__a, __b, __c); 18701 } 18702 18703 static __inline__ vector float __ATTRS_o_ai 18704 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 18705 return __builtin_vsx_xxblendvw(__a, __b, __c); 18706 } 18707 18708 static __inline__ vector double __ATTRS_o_ai 18709 vec_blendv(vector double __a, vector double __b, 18710 vector unsigned long long __c) { 18711 return __builtin_vsx_xxblendvd(__a, __b, __c); 18712 } 18713 18714 /* vec_replace_elt */ 18715 18716 #define vec_replace_elt __builtin_altivec_vec_replace_elt 18717 18718 /* vec_replace_unaligned */ 18719 18720 #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned 18721 18722 /* vec_splati */ 18723 18724 #define vec_splati(__a) \ 18725 _Generic((__a), signed int \ 18726 : ((vector signed int)__a), unsigned int \ 18727 : ((vector unsigned int)__a), float \ 18728 : ((vector float)__a)) 18729 18730 /* vec_spatid */ 18731 18732 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 18733 return ((vector double)((double)__a)); 18734 } 18735 18736 /* vec_splati_ins */ 18737 18738 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 18739 vector signed int __a, const unsigned int __b, const signed int __c) { 18740 #ifdef __LITTLE_ENDIAN__ 18741 __a[1 - __b] = __c; 18742 __a[3 - __b] = __c; 18743 #else 18744 __a[__b] = __c; 18745 __a[2 + __b] = __c; 18746 #endif 18747 return __a; 18748 } 18749 18750 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 18751 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 18752 #ifdef __LITTLE_ENDIAN__ 18753 __a[1 - __b] = __c; 18754 __a[3 - __b] = __c; 18755 #else 18756 __a[__b] = __c; 18757 __a[2 + __b] = __c; 18758 #endif 18759 return __a; 18760 } 18761 18762 static __inline__ vector float __ATTRS_o_ai 18763 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 18764 #ifdef __LITTLE_ENDIAN__ 18765 __a[1 - __b] = __c; 18766 __a[3 - __b] = __c; 18767 #else 18768 __a[__b] = __c; 18769 __a[2 + __b] = __c; 18770 #endif 18771 return __a; 18772 } 18773 18774 /* vec_test_lsbb_all_ones */ 18775 18776 static __inline__ int __ATTRS_o_ai 18777 vec_test_lsbb_all_ones(vector unsigned char __a) { 18778 return __builtin_vsx_xvtlsbb(__a, 1); 18779 } 18780 18781 /* vec_test_lsbb_all_zeros */ 18782 18783 static __inline__ int __ATTRS_o_ai 18784 vec_test_lsbb_all_zeros(vector unsigned char __a) { 18785 return __builtin_vsx_xvtlsbb(__a, 0); 18786 } 18787 #endif /* __VSX__ */ 18788 18789 /* vec_stril */ 18790 18791 static __inline__ vector unsigned char __ATTRS_o_ai 18792 vec_stril(vector unsigned char __a) { 18793 #ifdef __LITTLE_ENDIAN__ 18794 return __builtin_altivec_vstribr((vector signed char)__a); 18795 #else 18796 return __builtin_altivec_vstribl((vector signed char)__a); 18797 #endif 18798 } 18799 18800 static __inline__ vector signed char __ATTRS_o_ai 18801 vec_stril(vector signed char __a) { 18802 #ifdef __LITTLE_ENDIAN__ 18803 return __builtin_altivec_vstribr(__a); 18804 #else 18805 return __builtin_altivec_vstribl(__a); 18806 #endif 18807 } 18808 18809 static __inline__ vector unsigned short __ATTRS_o_ai 18810 vec_stril(vector unsigned short __a) { 18811 #ifdef __LITTLE_ENDIAN__ 18812 return __builtin_altivec_vstrihr((vector signed short)__a); 18813 #else 18814 return __builtin_altivec_vstrihl((vector signed short)__a); 18815 #endif 18816 } 18817 18818 static __inline__ vector signed short __ATTRS_o_ai 18819 vec_stril(vector signed short __a) { 18820 #ifdef __LITTLE_ENDIAN__ 18821 return __builtin_altivec_vstrihr(__a); 18822 #else 18823 return __builtin_altivec_vstrihl(__a); 18824 #endif 18825 } 18826 18827 /* vec_stril_p */ 18828 18829 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { 18830 #ifdef __LITTLE_ENDIAN__ 18831 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18832 #else 18833 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18834 #endif 18835 } 18836 18837 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { 18838 #ifdef __LITTLE_ENDIAN__ 18839 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18840 #else 18841 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18842 #endif 18843 } 18844 18845 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { 18846 #ifdef __LITTLE_ENDIAN__ 18847 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18848 #else 18849 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18850 #endif 18851 } 18852 18853 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { 18854 #ifdef __LITTLE_ENDIAN__ 18855 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18856 #else 18857 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18858 #endif 18859 } 18860 18861 /* vec_strir */ 18862 18863 static __inline__ vector unsigned char __ATTRS_o_ai 18864 vec_strir(vector unsigned char __a) { 18865 #ifdef __LITTLE_ENDIAN__ 18866 return __builtin_altivec_vstribl((vector signed char)__a); 18867 #else 18868 return __builtin_altivec_vstribr((vector signed char)__a); 18869 #endif 18870 } 18871 18872 static __inline__ vector signed char __ATTRS_o_ai 18873 vec_strir(vector signed char __a) { 18874 #ifdef __LITTLE_ENDIAN__ 18875 return __builtin_altivec_vstribl(__a); 18876 #else 18877 return __builtin_altivec_vstribr(__a); 18878 #endif 18879 } 18880 18881 static __inline__ vector unsigned short __ATTRS_o_ai 18882 vec_strir(vector unsigned short __a) { 18883 #ifdef __LITTLE_ENDIAN__ 18884 return __builtin_altivec_vstrihl((vector signed short)__a); 18885 #else 18886 return __builtin_altivec_vstrihr((vector signed short)__a); 18887 #endif 18888 } 18889 18890 static __inline__ vector signed short __ATTRS_o_ai 18891 vec_strir(vector signed short __a) { 18892 #ifdef __LITTLE_ENDIAN__ 18893 return __builtin_altivec_vstrihl(__a); 18894 #else 18895 return __builtin_altivec_vstrihr(__a); 18896 #endif 18897 } 18898 18899 /* vec_strir_p */ 18900 18901 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { 18902 #ifdef __LITTLE_ENDIAN__ 18903 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18904 #else 18905 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18906 #endif 18907 } 18908 18909 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { 18910 #ifdef __LITTLE_ENDIAN__ 18911 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18912 #else 18913 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18914 #endif 18915 } 18916 18917 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { 18918 #ifdef __LITTLE_ENDIAN__ 18919 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18920 #else 18921 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18922 #endif 18923 } 18924 18925 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { 18926 #ifdef __LITTLE_ENDIAN__ 18927 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18928 #else 18929 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18930 #endif 18931 } 18932 18933 /* vs[l | r | ra] */ 18934 18935 #ifdef __SIZEOF_INT128__ 18936 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18937 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18938 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18939 __CHAR_BIT__)); 18940 } 18941 18942 static __inline__ vector signed __int128 __ATTRS_o_ai 18943 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { 18944 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18945 __CHAR_BIT__)); 18946 } 18947 18948 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18949 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18950 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18951 __CHAR_BIT__)); 18952 } 18953 18954 static __inline__ vector signed __int128 __ATTRS_o_ai 18955 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { 18956 return ( 18957 vector signed __int128)(((vector unsigned __int128)__a) >> 18958 (__b % 18959 (vector unsigned __int128)(sizeof( 18960 unsigned __int128) * 18961 __CHAR_BIT__))); 18962 } 18963 18964 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18965 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18966 return ( 18967 vector unsigned __int128)(((vector signed __int128)__a) >> 18968 (__b % 18969 (vector unsigned __int128)(sizeof( 18970 unsigned __int128) * 18971 __CHAR_BIT__))); 18972 } 18973 18974 static __inline__ vector signed __int128 __ATTRS_o_ai 18975 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { 18976 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 18977 __CHAR_BIT__)); 18978 } 18979 18980 #endif /* __SIZEOF_INT128__ */ 18981 #endif /* __POWER10_VECTOR__ */ 18982 18983 #undef __ATTRS_o_ai 18984 18985 #endif /* __ALTIVEC_H */ 18986