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 #define __CR6_GT 4 23 #define __CR6_GT_REV 5 24 #define __CR6_SO 6 25 #define __CR6_SO_REV 7 26 27 /* Constants for vec_test_data_class */ 28 #define __VEC_CLASS_FP_SUBNORMAL_N (1 << 0) 29 #define __VEC_CLASS_FP_SUBNORMAL_P (1 << 1) 30 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P | \ 31 __VEC_CLASS_FP_SUBNORMAL_N) 32 #define __VEC_CLASS_FP_ZERO_N (1<<2) 33 #define __VEC_CLASS_FP_ZERO_P (1<<3) 34 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | \ 35 __VEC_CLASS_FP_ZERO_N) 36 #define __VEC_CLASS_FP_INFINITY_N (1<<4) 37 #define __VEC_CLASS_FP_INFINITY_P (1<<5) 38 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P | \ 39 __VEC_CLASS_FP_INFINITY_N) 40 #define __VEC_CLASS_FP_NAN (1<<6) 41 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | \ 42 __VEC_CLASS_FP_SUBNORMAL | \ 43 __VEC_CLASS_FP_ZERO | \ 44 __VEC_CLASS_FP_INFINITY) 45 46 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__)) 47 48 #include <stddef.h> 49 50 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 51 vector signed char __a, vector signed char __b, vector unsigned char __c); 52 53 static __inline__ vector unsigned char __ATTRS_o_ai 54 vec_perm(vector unsigned char __a, vector unsigned char __b, 55 vector unsigned char __c); 56 57 static __inline__ vector bool char __ATTRS_o_ai 58 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c); 59 60 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 61 vector signed short __b, 62 vector unsigned char __c); 63 64 static __inline__ vector unsigned short __ATTRS_o_ai 65 vec_perm(vector unsigned short __a, vector unsigned short __b, 66 vector unsigned char __c); 67 68 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 69 vector bool short __a, vector bool short __b, vector unsigned char __c); 70 71 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 72 vector pixel __b, 73 vector unsigned char __c); 74 75 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 76 vector signed int __b, 77 vector unsigned char __c); 78 79 static __inline__ vector unsigned int __ATTRS_o_ai vec_perm( 80 vector unsigned int __a, vector unsigned int __b, vector unsigned char __c); 81 82 static __inline__ vector bool int __ATTRS_o_ai 83 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c); 84 85 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 86 vector float __b, 87 vector unsigned char __c); 88 89 #ifdef __VSX__ 90 static __inline__ vector long long __ATTRS_o_ai 91 vec_perm(vector signed long long __a, vector signed long long __b, 92 vector unsigned char __c); 93 94 static __inline__ vector unsigned long long __ATTRS_o_ai 95 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 96 vector unsigned char __c); 97 98 static __inline__ vector bool long long __ATTRS_o_ai 99 vec_perm(vector bool long long __a, vector bool long long __b, 100 vector unsigned char __c); 101 102 static __inline__ vector double __ATTRS_o_ai vec_perm(vector double __a, 103 vector double __b, 104 vector unsigned char __c); 105 #endif 106 107 static __inline__ vector unsigned char __ATTRS_o_ai 108 vec_xor(vector unsigned char __a, vector unsigned char __b); 109 110 /* vec_abs */ 111 112 #define __builtin_altivec_abs_v16qi vec_abs 113 #define __builtin_altivec_abs_v8hi vec_abs 114 #define __builtin_altivec_abs_v4si vec_abs 115 116 static __inline__ vector signed char __ATTRS_o_ai 117 vec_abs(vector signed char __a) { 118 return __builtin_altivec_vmaxsb(__a, -__a); 119 } 120 121 static __inline__ vector signed short __ATTRS_o_ai 122 vec_abs(vector signed short __a) { 123 return __builtin_altivec_vmaxsh(__a, -__a); 124 } 125 126 static __inline__ vector signed int __ATTRS_o_ai 127 vec_abs(vector signed int __a) { 128 return __builtin_altivec_vmaxsw(__a, -__a); 129 } 130 131 #ifdef __POWER8_VECTOR__ 132 static __inline__ vector signed long long __ATTRS_o_ai 133 vec_abs(vector signed long long __a) { 134 return __builtin_altivec_vmaxsd(__a, -__a); 135 } 136 #endif 137 138 static __inline__ vector float __ATTRS_o_ai vec_abs(vector float __a) { 139 #ifdef __VSX__ 140 return __builtin_vsx_xvabssp(__a); 141 #else 142 vector unsigned int __res = 143 (vector unsigned int)__a & (vector unsigned int)(0x7FFFFFFF); 144 return (vector float)__res; 145 #endif 146 } 147 148 #ifdef __VSX__ 149 static __inline__ vector double __ATTRS_o_ai vec_abs(vector double __a) { 150 return __builtin_vsx_xvabsdp(__a); 151 } 152 #endif 153 154 /* vec_abss */ 155 #define __builtin_altivec_abss_v16qi vec_abss 156 #define __builtin_altivec_abss_v8hi vec_abss 157 #define __builtin_altivec_abss_v4si vec_abss 158 159 static __inline__ vector signed char __ATTRS_o_ai 160 vec_abss(vector signed char __a) { 161 return __builtin_altivec_vmaxsb( 162 __a, __builtin_altivec_vsubsbs((vector signed char)(0), __a)); 163 } 164 165 static __inline__ vector signed short __ATTRS_o_ai 166 vec_abss(vector signed short __a) { 167 return __builtin_altivec_vmaxsh( 168 __a, __builtin_altivec_vsubshs((vector signed short)(0), __a)); 169 } 170 171 static __inline__ vector signed int __ATTRS_o_ai 172 vec_abss(vector signed int __a) { 173 return __builtin_altivec_vmaxsw( 174 __a, __builtin_altivec_vsubsws((vector signed int)(0), __a)); 175 } 176 177 /* vec_absd */ 178 #if defined(__POWER9_VECTOR__) 179 180 static __inline__ vector unsigned char __ATTRS_o_ai 181 vec_absd(vector unsigned char __a, vector unsigned char __b) { 182 return __builtin_altivec_vabsdub(__a, __b); 183 } 184 185 static __inline__ vector unsigned short __ATTRS_o_ai 186 vec_absd(vector unsigned short __a, vector unsigned short __b) { 187 return __builtin_altivec_vabsduh(__a, __b); 188 } 189 190 static __inline__ vector unsigned int __ATTRS_o_ai 191 vec_absd(vector unsigned int __a, vector unsigned int __b) { 192 return __builtin_altivec_vabsduw(__a, __b); 193 } 194 195 #endif /* End __POWER9_VECTOR__ */ 196 197 /* vec_add */ 198 199 static __inline__ vector signed char __ATTRS_o_ai 200 vec_add(vector signed char __a, vector signed char __b) { 201 return __a + __b; 202 } 203 204 static __inline__ vector signed char __ATTRS_o_ai 205 vec_add(vector bool char __a, vector signed char __b) { 206 return (vector signed char)__a + __b; 207 } 208 209 static __inline__ vector signed char __ATTRS_o_ai 210 vec_add(vector signed char __a, vector bool char __b) { 211 return __a + (vector signed char)__b; 212 } 213 214 static __inline__ vector unsigned char __ATTRS_o_ai 215 vec_add(vector unsigned char __a, vector unsigned char __b) { 216 return __a + __b; 217 } 218 219 static __inline__ vector unsigned char __ATTRS_o_ai 220 vec_add(vector bool char __a, vector unsigned char __b) { 221 return (vector unsigned char)__a + __b; 222 } 223 224 static __inline__ vector unsigned char __ATTRS_o_ai 225 vec_add(vector unsigned char __a, vector bool char __b) { 226 return __a + (vector unsigned char)__b; 227 } 228 229 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 230 vector short __b) { 231 return __a + __b; 232 } 233 234 static __inline__ vector short __ATTRS_o_ai vec_add(vector bool short __a, 235 vector short __b) { 236 return (vector short)__a + __b; 237 } 238 239 static __inline__ vector short __ATTRS_o_ai vec_add(vector short __a, 240 vector bool short __b) { 241 return __a + (vector short)__b; 242 } 243 244 static __inline__ vector unsigned short __ATTRS_o_ai 245 vec_add(vector unsigned short __a, vector unsigned short __b) { 246 return __a + __b; 247 } 248 249 static __inline__ vector unsigned short __ATTRS_o_ai 250 vec_add(vector bool short __a, vector unsigned short __b) { 251 return (vector unsigned short)__a + __b; 252 } 253 254 static __inline__ vector unsigned short __ATTRS_o_ai 255 vec_add(vector unsigned short __a, vector bool short __b) { 256 return __a + (vector unsigned short)__b; 257 } 258 259 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 260 vector int __b) { 261 return __a + __b; 262 } 263 264 static __inline__ vector int __ATTRS_o_ai vec_add(vector bool int __a, 265 vector int __b) { 266 return (vector int)__a + __b; 267 } 268 269 static __inline__ vector int __ATTRS_o_ai vec_add(vector int __a, 270 vector bool int __b) { 271 return __a + (vector int)__b; 272 } 273 274 static __inline__ vector unsigned int __ATTRS_o_ai 275 vec_add(vector unsigned int __a, vector unsigned int __b) { 276 return __a + __b; 277 } 278 279 static __inline__ vector unsigned int __ATTRS_o_ai 280 vec_add(vector bool int __a, vector unsigned int __b) { 281 return (vector unsigned int)__a + __b; 282 } 283 284 static __inline__ vector unsigned int __ATTRS_o_ai 285 vec_add(vector unsigned int __a, vector bool int __b) { 286 return __a + (vector unsigned int)__b; 287 } 288 289 #ifdef __POWER8_VECTOR__ 290 static __inline__ vector signed long long __ATTRS_o_ai 291 vec_add(vector signed long long __a, vector signed long long __b) { 292 return __a + __b; 293 } 294 295 static __inline__ vector unsigned long long __ATTRS_o_ai 296 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 297 return __a + __b; 298 } 299 300 #ifdef __SIZEOF_INT128__ 301 static __inline__ vector signed __int128 __ATTRS_o_ai 302 vec_add(vector signed __int128 __a, vector signed __int128 __b) { 303 return __a + __b; 304 } 305 306 static __inline__ vector unsigned __int128 __ATTRS_o_ai 307 vec_add(vector unsigned __int128 __a, vector unsigned __int128 __b) { 308 return __a + __b; 309 } 310 #endif 311 312 static __inline__ vector unsigned char __attribute__((__always_inline__)) 313 vec_add_u128(vector unsigned char __a, vector unsigned char __b) { 314 return __builtin_altivec_vadduqm(__a, __b); 315 } 316 #elif defined(__VSX__) 317 static __inline__ vector signed long long __ATTRS_o_ai 318 vec_add(vector signed long long __a, vector signed long long __b) { 319 #ifdef __LITTLE_ENDIAN__ 320 // Little endian systems on CPU's prior to Power8 don't really exist 321 // so scalarizing is fine. 322 return __a + __b; 323 #else 324 vector unsigned int __res = 325 (vector unsigned int)__a + (vector unsigned int)__b; 326 vector unsigned int __carry = __builtin_altivec_vaddcuw( 327 (vector unsigned int)__a, (vector unsigned int)__b); 328 __carry = __builtin_shufflevector((vector unsigned char)__carry, 329 (vector unsigned char)__carry, 0, 0, 0, 7, 330 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0); 331 return (vector signed long long)(__res + __carry); 332 #endif 333 } 334 335 static __inline__ vector unsigned long long __ATTRS_o_ai 336 vec_add(vector unsigned long long __a, vector unsigned long long __b) { 337 return (vector unsigned long long)vec_add((vector signed long long)__a, 338 (vector signed long long)__b); 339 } 340 #endif // __POWER8_VECTOR__ 341 342 static __inline__ vector float __ATTRS_o_ai vec_add(vector float __a, 343 vector float __b) { 344 return __a + __b; 345 } 346 347 #ifdef __VSX__ 348 static __inline__ vector double __ATTRS_o_ai vec_add(vector double __a, 349 vector double __b) { 350 return __a + __b; 351 } 352 #endif // __VSX__ 353 354 /* vec_adde */ 355 356 #ifdef __POWER8_VECTOR__ 357 #ifdef __SIZEOF_INT128__ 358 static __inline__ vector signed __int128 __ATTRS_o_ai 359 vec_adde(vector signed __int128 __a, vector signed __int128 __b, 360 vector signed __int128 __c) { 361 return __builtin_altivec_vaddeuqm(__a, __b, __c); 362 } 363 364 static __inline__ vector unsigned __int128 __ATTRS_o_ai 365 vec_adde(vector unsigned __int128 __a, vector unsigned __int128 __b, 366 vector unsigned __int128 __c) { 367 return __builtin_altivec_vaddeuqm(__a, __b, __c); 368 } 369 #endif 370 371 static __inline__ vector unsigned char __attribute__((__always_inline__)) 372 vec_adde_u128(vector unsigned char __a, vector unsigned char __b, 373 vector unsigned char __c) { 374 return (vector unsigned char)__builtin_altivec_vaddeuqm(__a, __b, __c); 375 } 376 #endif 377 378 static __inline__ vector signed int __ATTRS_o_ai 379 vec_adde(vector signed int __a, vector signed int __b, 380 vector signed int __c) { 381 vector signed int __mask = {1, 1, 1, 1}; 382 vector signed int __carry = __c & __mask; 383 return vec_add(vec_add(__a, __b), __carry); 384 } 385 386 static __inline__ vector unsigned int __ATTRS_o_ai 387 vec_adde(vector unsigned int __a, vector unsigned int __b, 388 vector unsigned int __c) { 389 vector unsigned int __mask = {1, 1, 1, 1}; 390 vector unsigned int __carry = __c & __mask; 391 return vec_add(vec_add(__a, __b), __carry); 392 } 393 394 /* vec_addec */ 395 396 #ifdef __POWER8_VECTOR__ 397 #ifdef __SIZEOF_INT128__ 398 static __inline__ vector signed __int128 __ATTRS_o_ai 399 vec_addec(vector signed __int128 __a, vector signed __int128 __b, 400 vector signed __int128 __c) { 401 return __builtin_altivec_vaddecuq(__a, __b, __c); 402 } 403 404 static __inline__ vector unsigned __int128 __ATTRS_o_ai 405 vec_addec(vector unsigned __int128 __a, vector unsigned __int128 __b, 406 vector unsigned __int128 __c) { 407 return __builtin_altivec_vaddecuq(__a, __b, __c); 408 } 409 #endif 410 411 static __inline__ vector unsigned char __attribute__((__always_inline__)) 412 vec_addec_u128(vector unsigned char __a, vector unsigned char __b, 413 vector unsigned char __c) { 414 return (vector unsigned char)__builtin_altivec_vaddecuq(__a, __b, __c); 415 } 416 417 #ifdef __powerpc64__ 418 static __inline__ vector signed int __ATTRS_o_ai 419 vec_addec(vector signed int __a, vector signed int __b, 420 vector signed int __c) { 421 422 signed int __result[4]; 423 for (int i = 0; i < 4; i++) { 424 unsigned int __tempa = (unsigned int) __a[i]; 425 unsigned int __tempb = (unsigned int) __b[i]; 426 unsigned int __tempc = (unsigned int) __c[i]; 427 __tempc = __tempc & 0x00000001; 428 unsigned long long __longa = (unsigned long long) __tempa; 429 unsigned long long __longb = (unsigned long long) __tempb; 430 unsigned long long __longc = (unsigned long long) __tempc; 431 unsigned long long __sum = __longa + __longb + __longc; 432 unsigned long long __res = (__sum >> 32) & 0x01; 433 unsigned long long __tempres = (unsigned int) __res; 434 __result[i] = (signed int) __tempres; 435 } 436 437 vector signed int ret = { __result[0], __result[1], __result[2], __result[3] }; 438 return ret; 439 } 440 441 static __inline__ vector unsigned int __ATTRS_o_ai 442 vec_addec(vector unsigned int __a, vector unsigned int __b, 443 vector unsigned int __c) { 444 445 unsigned int __result[4]; 446 for (int i = 0; i < 4; i++) { 447 unsigned int __tempc = __c[i] & 1; 448 unsigned long long __longa = (unsigned long long) __a[i]; 449 unsigned long long __longb = (unsigned long long) __b[i]; 450 unsigned long long __longc = (unsigned long long) __tempc; 451 unsigned long long __sum = __longa + __longb + __longc; 452 unsigned long long __res = (__sum >> 32) & 0x01; 453 unsigned long long __tempres = (unsigned int) __res; 454 __result[i] = (signed int) __tempres; 455 } 456 457 vector unsigned int ret = { __result[0], __result[1], __result[2], __result[3] }; 458 return ret; 459 } 460 #endif // __powerpc64__ 461 #endif // __POWER8_VECTOR__ 462 463 /* vec_vaddubm */ 464 465 #define __builtin_altivec_vaddubm vec_vaddubm 466 467 static __inline__ vector signed char __ATTRS_o_ai 468 vec_vaddubm(vector signed char __a, vector signed char __b) { 469 return __a + __b; 470 } 471 472 static __inline__ vector signed char __ATTRS_o_ai 473 vec_vaddubm(vector bool char __a, vector signed char __b) { 474 return (vector signed char)__a + __b; 475 } 476 477 static __inline__ vector signed char __ATTRS_o_ai 478 vec_vaddubm(vector signed char __a, vector bool char __b) { 479 return __a + (vector signed char)__b; 480 } 481 482 static __inline__ vector unsigned char __ATTRS_o_ai 483 vec_vaddubm(vector unsigned char __a, vector unsigned char __b) { 484 return __a + __b; 485 } 486 487 static __inline__ vector unsigned char __ATTRS_o_ai 488 vec_vaddubm(vector bool char __a, vector unsigned char __b) { 489 return (vector unsigned char)__a + __b; 490 } 491 492 static __inline__ vector unsigned char __ATTRS_o_ai 493 vec_vaddubm(vector unsigned char __a, vector bool char __b) { 494 return __a + (vector unsigned char)__b; 495 } 496 497 /* vec_vadduhm */ 498 499 #define __builtin_altivec_vadduhm vec_vadduhm 500 501 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 502 vector short __b) { 503 return __a + __b; 504 } 505 506 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector bool short __a, 507 vector short __b) { 508 return (vector short)__a + __b; 509 } 510 511 static __inline__ vector short __ATTRS_o_ai vec_vadduhm(vector short __a, 512 vector bool short __b) { 513 return __a + (vector short)__b; 514 } 515 516 static __inline__ vector unsigned short __ATTRS_o_ai 517 vec_vadduhm(vector unsigned short __a, vector unsigned short __b) { 518 return __a + __b; 519 } 520 521 static __inline__ vector unsigned short __ATTRS_o_ai 522 vec_vadduhm(vector bool short __a, vector unsigned short __b) { 523 return (vector unsigned short)__a + __b; 524 } 525 526 static __inline__ vector unsigned short __ATTRS_o_ai 527 vec_vadduhm(vector unsigned short __a, vector bool short __b) { 528 return __a + (vector unsigned short)__b; 529 } 530 531 /* vec_vadduwm */ 532 533 #define __builtin_altivec_vadduwm vec_vadduwm 534 535 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 536 vector int __b) { 537 return __a + __b; 538 } 539 540 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector bool int __a, 541 vector int __b) { 542 return (vector int)__a + __b; 543 } 544 545 static __inline__ vector int __ATTRS_o_ai vec_vadduwm(vector int __a, 546 vector bool int __b) { 547 return __a + (vector int)__b; 548 } 549 550 static __inline__ vector unsigned int __ATTRS_o_ai 551 vec_vadduwm(vector unsigned int __a, vector unsigned int __b) { 552 return __a + __b; 553 } 554 555 static __inline__ vector unsigned int __ATTRS_o_ai 556 vec_vadduwm(vector bool int __a, vector unsigned int __b) { 557 return (vector unsigned int)__a + __b; 558 } 559 560 static __inline__ vector unsigned int __ATTRS_o_ai 561 vec_vadduwm(vector unsigned int __a, vector bool int __b) { 562 return __a + (vector unsigned int)__b; 563 } 564 565 /* vec_vaddfp */ 566 567 #define __builtin_altivec_vaddfp vec_vaddfp 568 569 static __inline__ vector float __attribute__((__always_inline__)) 570 vec_vaddfp(vector float __a, vector float __b) { 571 return __a + __b; 572 } 573 574 /* vec_addc */ 575 576 static __inline__ vector signed int __ATTRS_o_ai 577 vec_addc(vector signed int __a, vector signed int __b) { 578 return (vector signed int)__builtin_altivec_vaddcuw((vector unsigned int)__a, 579 (vector unsigned int)__b); 580 } 581 582 static __inline__ vector unsigned int __ATTRS_o_ai 583 vec_addc(vector unsigned int __a, vector unsigned int __b) { 584 return __builtin_altivec_vaddcuw(__a, __b); 585 } 586 587 #ifdef __POWER8_VECTOR__ 588 #ifdef __SIZEOF_INT128__ 589 static __inline__ vector signed __int128 __ATTRS_o_ai 590 vec_addc(vector signed __int128 __a, vector signed __int128 __b) { 591 return (vector signed __int128)__builtin_altivec_vaddcuq( 592 (vector unsigned __int128)__a, (vector unsigned __int128)__b); 593 } 594 595 static __inline__ vector unsigned __int128 __ATTRS_o_ai 596 vec_addc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 597 return __builtin_altivec_vaddcuq(__a, __b); 598 } 599 #endif 600 601 static __inline__ vector unsigned char __attribute__((__always_inline__)) 602 vec_addc_u128(vector unsigned char __a, vector unsigned char __b) { 603 return (vector unsigned char)__builtin_altivec_vaddcuq(__a, __b); 604 } 605 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 606 607 /* vec_vaddcuw */ 608 609 static __inline__ vector unsigned int __attribute__((__always_inline__)) 610 vec_vaddcuw(vector unsigned int __a, vector unsigned int __b) { 611 return __builtin_altivec_vaddcuw(__a, __b); 612 } 613 614 /* vec_adds */ 615 616 static __inline__ vector signed char __ATTRS_o_ai 617 vec_adds(vector signed char __a, vector signed char __b) { 618 return __builtin_altivec_vaddsbs(__a, __b); 619 } 620 621 static __inline__ vector signed char __ATTRS_o_ai 622 vec_adds(vector bool char __a, vector signed char __b) { 623 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 624 } 625 626 static __inline__ vector signed char __ATTRS_o_ai 627 vec_adds(vector signed char __a, vector bool char __b) { 628 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 629 } 630 631 static __inline__ vector unsigned char __ATTRS_o_ai 632 vec_adds(vector unsigned char __a, vector unsigned char __b) { 633 return __builtin_altivec_vaddubs(__a, __b); 634 } 635 636 static __inline__ vector unsigned char __ATTRS_o_ai 637 vec_adds(vector bool char __a, vector unsigned char __b) { 638 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 639 } 640 641 static __inline__ vector unsigned char __ATTRS_o_ai 642 vec_adds(vector unsigned char __a, vector bool char __b) { 643 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 644 } 645 646 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 647 vector short __b) { 648 return __builtin_altivec_vaddshs(__a, __b); 649 } 650 651 static __inline__ vector short __ATTRS_o_ai vec_adds(vector bool short __a, 652 vector short __b) { 653 return __builtin_altivec_vaddshs((vector short)__a, __b); 654 } 655 656 static __inline__ vector short __ATTRS_o_ai vec_adds(vector short __a, 657 vector bool short __b) { 658 return __builtin_altivec_vaddshs(__a, (vector short)__b); 659 } 660 661 static __inline__ vector unsigned short __ATTRS_o_ai 662 vec_adds(vector unsigned short __a, vector unsigned short __b) { 663 return __builtin_altivec_vadduhs(__a, __b); 664 } 665 666 static __inline__ vector unsigned short __ATTRS_o_ai 667 vec_adds(vector bool short __a, vector unsigned short __b) { 668 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 669 } 670 671 static __inline__ vector unsigned short __ATTRS_o_ai 672 vec_adds(vector unsigned short __a, vector bool short __b) { 673 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 674 } 675 676 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 677 vector int __b) { 678 return __builtin_altivec_vaddsws(__a, __b); 679 } 680 681 static __inline__ vector int __ATTRS_o_ai vec_adds(vector bool int __a, 682 vector int __b) { 683 return __builtin_altivec_vaddsws((vector int)__a, __b); 684 } 685 686 static __inline__ vector int __ATTRS_o_ai vec_adds(vector int __a, 687 vector bool int __b) { 688 return __builtin_altivec_vaddsws(__a, (vector int)__b); 689 } 690 691 static __inline__ vector unsigned int __ATTRS_o_ai 692 vec_adds(vector unsigned int __a, vector unsigned int __b) { 693 return __builtin_altivec_vadduws(__a, __b); 694 } 695 696 static __inline__ vector unsigned int __ATTRS_o_ai 697 vec_adds(vector bool int __a, vector unsigned int __b) { 698 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 699 } 700 701 static __inline__ vector unsigned int __ATTRS_o_ai 702 vec_adds(vector unsigned int __a, vector bool int __b) { 703 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 704 } 705 706 /* vec_vaddsbs */ 707 708 static __inline__ vector signed char __ATTRS_o_ai 709 vec_vaddsbs(vector signed char __a, vector signed char __b) { 710 return __builtin_altivec_vaddsbs(__a, __b); 711 } 712 713 static __inline__ vector signed char __ATTRS_o_ai 714 vec_vaddsbs(vector bool char __a, vector signed char __b) { 715 return __builtin_altivec_vaddsbs((vector signed char)__a, __b); 716 } 717 718 static __inline__ vector signed char __ATTRS_o_ai 719 vec_vaddsbs(vector signed char __a, vector bool char __b) { 720 return __builtin_altivec_vaddsbs(__a, (vector signed char)__b); 721 } 722 723 /* vec_vaddubs */ 724 725 static __inline__ vector unsigned char __ATTRS_o_ai 726 vec_vaddubs(vector unsigned char __a, vector unsigned char __b) { 727 return __builtin_altivec_vaddubs(__a, __b); 728 } 729 730 static __inline__ vector unsigned char __ATTRS_o_ai 731 vec_vaddubs(vector bool char __a, vector unsigned char __b) { 732 return __builtin_altivec_vaddubs((vector unsigned char)__a, __b); 733 } 734 735 static __inline__ vector unsigned char __ATTRS_o_ai 736 vec_vaddubs(vector unsigned char __a, vector bool char __b) { 737 return __builtin_altivec_vaddubs(__a, (vector unsigned char)__b); 738 } 739 740 /* vec_vaddshs */ 741 742 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 743 vector short __b) { 744 return __builtin_altivec_vaddshs(__a, __b); 745 } 746 747 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector bool short __a, 748 vector short __b) { 749 return __builtin_altivec_vaddshs((vector short)__a, __b); 750 } 751 752 static __inline__ vector short __ATTRS_o_ai vec_vaddshs(vector short __a, 753 vector bool short __b) { 754 return __builtin_altivec_vaddshs(__a, (vector short)__b); 755 } 756 757 /* vec_vadduhs */ 758 759 static __inline__ vector unsigned short __ATTRS_o_ai 760 vec_vadduhs(vector unsigned short __a, vector unsigned short __b) { 761 return __builtin_altivec_vadduhs(__a, __b); 762 } 763 764 static __inline__ vector unsigned short __ATTRS_o_ai 765 vec_vadduhs(vector bool short __a, vector unsigned short __b) { 766 return __builtin_altivec_vadduhs((vector unsigned short)__a, __b); 767 } 768 769 static __inline__ vector unsigned short __ATTRS_o_ai 770 vec_vadduhs(vector unsigned short __a, vector bool short __b) { 771 return __builtin_altivec_vadduhs(__a, (vector unsigned short)__b); 772 } 773 774 /* vec_vaddsws */ 775 776 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 777 vector int __b) { 778 return __builtin_altivec_vaddsws(__a, __b); 779 } 780 781 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector bool int __a, 782 vector int __b) { 783 return __builtin_altivec_vaddsws((vector int)__a, __b); 784 } 785 786 static __inline__ vector int __ATTRS_o_ai vec_vaddsws(vector int __a, 787 vector bool int __b) { 788 return __builtin_altivec_vaddsws(__a, (vector int)__b); 789 } 790 791 /* vec_vadduws */ 792 793 static __inline__ vector unsigned int __ATTRS_o_ai 794 vec_vadduws(vector unsigned int __a, vector unsigned int __b) { 795 return __builtin_altivec_vadduws(__a, __b); 796 } 797 798 static __inline__ vector unsigned int __ATTRS_o_ai 799 vec_vadduws(vector bool int __a, vector unsigned int __b) { 800 return __builtin_altivec_vadduws((vector unsigned int)__a, __b); 801 } 802 803 static __inline__ vector unsigned int __ATTRS_o_ai 804 vec_vadduws(vector unsigned int __a, vector bool int __b) { 805 return __builtin_altivec_vadduws(__a, (vector unsigned int)__b); 806 } 807 808 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 809 defined(__SIZEOF_INT128__) 810 /* vec_vadduqm */ 811 812 static __inline__ vector signed __int128 __ATTRS_o_ai 813 vec_vadduqm(vector signed __int128 __a, vector signed __int128 __b) { 814 return __a + __b; 815 } 816 817 static __inline__ vector unsigned __int128 __ATTRS_o_ai 818 vec_vadduqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 819 return __a + __b; 820 } 821 822 /* vec_vaddeuqm */ 823 824 static __inline__ vector signed __int128 __ATTRS_o_ai 825 vec_vaddeuqm(vector signed __int128 __a, vector signed __int128 __b, 826 vector signed __int128 __c) { 827 return __builtin_altivec_vaddeuqm(__a, __b, __c); 828 } 829 830 static __inline__ vector unsigned __int128 __ATTRS_o_ai 831 vec_vaddeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 832 vector unsigned __int128 __c) { 833 return __builtin_altivec_vaddeuqm(__a, __b, __c); 834 } 835 836 /* vec_vaddcuq */ 837 838 static __inline__ vector signed __int128 __ATTRS_o_ai 839 vec_vaddcuq(vector signed __int128 __a, vector signed __int128 __b) { 840 return __builtin_altivec_vaddcuq(__a, __b); 841 } 842 843 static __inline__ vector unsigned __int128 __ATTRS_o_ai 844 vec_vaddcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 845 return __builtin_altivec_vaddcuq(__a, __b); 846 } 847 848 /* vec_vaddecuq */ 849 850 static __inline__ vector signed __int128 __ATTRS_o_ai 851 vec_vaddecuq(vector signed __int128 __a, vector signed __int128 __b, 852 vector signed __int128 __c) { 853 return __builtin_altivec_vaddecuq(__a, __b, __c); 854 } 855 856 static __inline__ vector unsigned __int128 __ATTRS_o_ai 857 vec_vaddecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 858 vector unsigned __int128 __c) { 859 return __builtin_altivec_vaddecuq(__a, __b, __c); 860 } 861 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) 862 863 /* vec_and */ 864 865 #define __builtin_altivec_vand vec_and 866 867 static __inline__ vector signed char __ATTRS_o_ai 868 vec_and(vector signed char __a, vector signed char __b) { 869 return __a & __b; 870 } 871 872 static __inline__ vector signed char __ATTRS_o_ai 873 vec_and(vector bool char __a, vector signed char __b) { 874 return (vector signed char)__a & __b; 875 } 876 877 static __inline__ vector signed char __ATTRS_o_ai 878 vec_and(vector signed char __a, vector bool char __b) { 879 return __a & (vector signed char)__b; 880 } 881 882 static __inline__ vector unsigned char __ATTRS_o_ai 883 vec_and(vector unsigned char __a, vector unsigned char __b) { 884 return __a & __b; 885 } 886 887 static __inline__ vector unsigned char __ATTRS_o_ai 888 vec_and(vector bool char __a, vector unsigned char __b) { 889 return (vector unsigned char)__a & __b; 890 } 891 892 static __inline__ vector unsigned char __ATTRS_o_ai 893 vec_and(vector unsigned char __a, vector bool char __b) { 894 return __a & (vector unsigned char)__b; 895 } 896 897 static __inline__ vector bool char __ATTRS_o_ai vec_and(vector bool char __a, 898 vector bool char __b) { 899 return __a & __b; 900 } 901 902 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 903 vector short __b) { 904 return __a & __b; 905 } 906 907 static __inline__ vector short __ATTRS_o_ai vec_and(vector bool short __a, 908 vector short __b) { 909 return (vector short)__a & __b; 910 } 911 912 static __inline__ vector short __ATTRS_o_ai vec_and(vector short __a, 913 vector bool short __b) { 914 return __a & (vector short)__b; 915 } 916 917 static __inline__ vector unsigned short __ATTRS_o_ai 918 vec_and(vector unsigned short __a, vector unsigned short __b) { 919 return __a & __b; 920 } 921 922 static __inline__ vector unsigned short __ATTRS_o_ai 923 vec_and(vector bool short __a, vector unsigned short __b) { 924 return (vector unsigned short)__a & __b; 925 } 926 927 static __inline__ vector unsigned short __ATTRS_o_ai 928 vec_and(vector unsigned short __a, vector bool short __b) { 929 return __a & (vector unsigned short)__b; 930 } 931 932 static __inline__ vector bool short __ATTRS_o_ai 933 vec_and(vector bool short __a, vector bool short __b) { 934 return __a & __b; 935 } 936 937 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 938 vector int __b) { 939 return __a & __b; 940 } 941 942 static __inline__ vector int __ATTRS_o_ai vec_and(vector bool int __a, 943 vector int __b) { 944 return (vector int)__a & __b; 945 } 946 947 static __inline__ vector int __ATTRS_o_ai vec_and(vector int __a, 948 vector bool int __b) { 949 return __a & (vector int)__b; 950 } 951 952 static __inline__ vector unsigned int __ATTRS_o_ai 953 vec_and(vector unsigned int __a, vector unsigned int __b) { 954 return __a & __b; 955 } 956 957 static __inline__ vector unsigned int __ATTRS_o_ai 958 vec_and(vector bool int __a, vector unsigned int __b) { 959 return (vector unsigned int)__a & __b; 960 } 961 962 static __inline__ vector unsigned int __ATTRS_o_ai 963 vec_and(vector unsigned int __a, vector bool int __b) { 964 return __a & (vector unsigned int)__b; 965 } 966 967 static __inline__ vector bool int __ATTRS_o_ai vec_and(vector bool int __a, 968 vector bool int __b) { 969 return __a & __b; 970 } 971 972 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 973 vector float __b) { 974 vector unsigned int __res = 975 (vector unsigned int)__a & (vector unsigned int)__b; 976 return (vector float)__res; 977 } 978 979 static __inline__ vector float __ATTRS_o_ai vec_and(vector bool int __a, 980 vector float __b) { 981 vector unsigned int __res = 982 (vector unsigned int)__a & (vector unsigned int)__b; 983 return (vector float)__res; 984 } 985 986 static __inline__ vector float __ATTRS_o_ai vec_and(vector float __a, 987 vector bool int __b) { 988 vector unsigned int __res = 989 (vector unsigned int)__a & (vector unsigned int)__b; 990 return (vector float)__res; 991 } 992 993 #ifdef __VSX__ 994 static __inline__ vector double __ATTRS_o_ai vec_and(vector bool long long __a, 995 vector double __b) { 996 vector unsigned long long __res = 997 (vector unsigned long long)__a & (vector unsigned long long)__b; 998 return (vector double)__res; 999 } 1000 1001 static __inline__ vector double __ATTRS_o_ai 1002 vec_and(vector double __a, vector bool long long __b) { 1003 vector unsigned long long __res = 1004 (vector unsigned long long)__a & (vector unsigned long long)__b; 1005 return (vector double)__res; 1006 } 1007 1008 static __inline__ vector double __ATTRS_o_ai vec_and(vector double __a, 1009 vector double __b) { 1010 vector unsigned long long __res = 1011 (vector unsigned long long)__a & (vector unsigned long long)__b; 1012 return (vector double)__res; 1013 } 1014 1015 static __inline__ vector signed long long __ATTRS_o_ai 1016 vec_and(vector signed long long __a, vector signed long long __b) { 1017 return __a & __b; 1018 } 1019 1020 static __inline__ vector signed long long __ATTRS_o_ai 1021 vec_and(vector bool long long __a, vector signed long long __b) { 1022 return (vector signed long long)__a & __b; 1023 } 1024 1025 static __inline__ vector signed long long __ATTRS_o_ai 1026 vec_and(vector signed long long __a, vector bool long long __b) { 1027 return __a & (vector signed long long)__b; 1028 } 1029 1030 static __inline__ vector unsigned long long __ATTRS_o_ai 1031 vec_and(vector unsigned long long __a, vector unsigned long long __b) { 1032 return __a & __b; 1033 } 1034 1035 static __inline__ vector unsigned long long __ATTRS_o_ai 1036 vec_and(vector bool long long __a, vector unsigned long long __b) { 1037 return (vector unsigned long long)__a & __b; 1038 } 1039 1040 static __inline__ vector unsigned long long __ATTRS_o_ai 1041 vec_and(vector unsigned long long __a, vector bool long long __b) { 1042 return __a & (vector unsigned long long)__b; 1043 } 1044 1045 static __inline__ vector bool long long __ATTRS_o_ai 1046 vec_and(vector bool long long __a, vector bool long long __b) { 1047 return __a & __b; 1048 } 1049 #endif 1050 1051 /* vec_vand */ 1052 1053 static __inline__ vector signed char __ATTRS_o_ai 1054 vec_vand(vector signed char __a, vector signed char __b) { 1055 return __a & __b; 1056 } 1057 1058 static __inline__ vector signed char __ATTRS_o_ai 1059 vec_vand(vector bool char __a, vector signed char __b) { 1060 return (vector signed char)__a & __b; 1061 } 1062 1063 static __inline__ vector signed char __ATTRS_o_ai 1064 vec_vand(vector signed char __a, vector bool char __b) { 1065 return __a & (vector signed char)__b; 1066 } 1067 1068 static __inline__ vector unsigned char __ATTRS_o_ai 1069 vec_vand(vector unsigned char __a, vector unsigned char __b) { 1070 return __a & __b; 1071 } 1072 1073 static __inline__ vector unsigned char __ATTRS_o_ai 1074 vec_vand(vector bool char __a, vector unsigned char __b) { 1075 return (vector unsigned char)__a & __b; 1076 } 1077 1078 static __inline__ vector unsigned char __ATTRS_o_ai 1079 vec_vand(vector unsigned char __a, vector bool char __b) { 1080 return __a & (vector unsigned char)__b; 1081 } 1082 1083 static __inline__ vector bool char __ATTRS_o_ai vec_vand(vector bool char __a, 1084 vector bool char __b) { 1085 return __a & __b; 1086 } 1087 1088 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1089 vector short __b) { 1090 return __a & __b; 1091 } 1092 1093 static __inline__ vector short __ATTRS_o_ai vec_vand(vector bool short __a, 1094 vector short __b) { 1095 return (vector short)__a & __b; 1096 } 1097 1098 static __inline__ vector short __ATTRS_o_ai vec_vand(vector short __a, 1099 vector bool short __b) { 1100 return __a & (vector short)__b; 1101 } 1102 1103 static __inline__ vector unsigned short __ATTRS_o_ai 1104 vec_vand(vector unsigned short __a, vector unsigned short __b) { 1105 return __a & __b; 1106 } 1107 1108 static __inline__ vector unsigned short __ATTRS_o_ai 1109 vec_vand(vector bool short __a, vector unsigned short __b) { 1110 return (vector unsigned short)__a & __b; 1111 } 1112 1113 static __inline__ vector unsigned short __ATTRS_o_ai 1114 vec_vand(vector unsigned short __a, vector bool short __b) { 1115 return __a & (vector unsigned short)__b; 1116 } 1117 1118 static __inline__ vector bool short __ATTRS_o_ai 1119 vec_vand(vector bool short __a, vector bool short __b) { 1120 return __a & __b; 1121 } 1122 1123 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1124 vector int __b) { 1125 return __a & __b; 1126 } 1127 1128 static __inline__ vector int __ATTRS_o_ai vec_vand(vector bool int __a, 1129 vector int __b) { 1130 return (vector int)__a & __b; 1131 } 1132 1133 static __inline__ vector int __ATTRS_o_ai vec_vand(vector int __a, 1134 vector bool int __b) { 1135 return __a & (vector int)__b; 1136 } 1137 1138 static __inline__ vector unsigned int __ATTRS_o_ai 1139 vec_vand(vector unsigned int __a, vector unsigned int __b) { 1140 return __a & __b; 1141 } 1142 1143 static __inline__ vector unsigned int __ATTRS_o_ai 1144 vec_vand(vector bool int __a, vector unsigned int __b) { 1145 return (vector unsigned int)__a & __b; 1146 } 1147 1148 static __inline__ vector unsigned int __ATTRS_o_ai 1149 vec_vand(vector unsigned int __a, vector bool int __b) { 1150 return __a & (vector unsigned int)__b; 1151 } 1152 1153 static __inline__ vector bool int __ATTRS_o_ai vec_vand(vector bool int __a, 1154 vector bool int __b) { 1155 return __a & __b; 1156 } 1157 1158 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1159 vector float __b) { 1160 vector unsigned int __res = 1161 (vector unsigned int)__a & (vector unsigned int)__b; 1162 return (vector float)__res; 1163 } 1164 1165 static __inline__ vector float __ATTRS_o_ai vec_vand(vector bool int __a, 1166 vector float __b) { 1167 vector unsigned int __res = 1168 (vector unsigned int)__a & (vector unsigned int)__b; 1169 return (vector float)__res; 1170 } 1171 1172 static __inline__ vector float __ATTRS_o_ai vec_vand(vector float __a, 1173 vector bool int __b) { 1174 vector unsigned int __res = 1175 (vector unsigned int)__a & (vector unsigned int)__b; 1176 return (vector float)__res; 1177 } 1178 1179 #ifdef __VSX__ 1180 static __inline__ vector signed long long __ATTRS_o_ai 1181 vec_vand(vector signed long long __a, vector signed long long __b) { 1182 return __a & __b; 1183 } 1184 1185 static __inline__ vector signed long long __ATTRS_o_ai 1186 vec_vand(vector bool long long __a, vector signed long long __b) { 1187 return (vector signed long long)__a & __b; 1188 } 1189 1190 static __inline__ vector signed long long __ATTRS_o_ai 1191 vec_vand(vector signed long long __a, vector bool long long __b) { 1192 return __a & (vector signed long long)__b; 1193 } 1194 1195 static __inline__ vector unsigned long long __ATTRS_o_ai 1196 vec_vand(vector unsigned long long __a, vector unsigned long long __b) { 1197 return __a & __b; 1198 } 1199 1200 static __inline__ vector unsigned long long __ATTRS_o_ai 1201 vec_vand(vector bool long long __a, vector unsigned long long __b) { 1202 return (vector unsigned long long)__a & __b; 1203 } 1204 1205 static __inline__ vector unsigned long long __ATTRS_o_ai 1206 vec_vand(vector unsigned long long __a, vector bool long long __b) { 1207 return __a & (vector unsigned long long)__b; 1208 } 1209 1210 static __inline__ vector bool long long __ATTRS_o_ai 1211 vec_vand(vector bool long long __a, vector bool long long __b) { 1212 return __a & __b; 1213 } 1214 #endif 1215 1216 /* vec_andc */ 1217 1218 #define __builtin_altivec_vandc vec_andc 1219 1220 static __inline__ vector signed char __ATTRS_o_ai 1221 vec_andc(vector signed char __a, vector signed char __b) { 1222 return __a & ~__b; 1223 } 1224 1225 static __inline__ vector signed char __ATTRS_o_ai 1226 vec_andc(vector bool char __a, vector signed char __b) { 1227 return (vector signed char)__a & ~__b; 1228 } 1229 1230 static __inline__ vector signed char __ATTRS_o_ai 1231 vec_andc(vector signed char __a, vector bool char __b) { 1232 return __a & ~(vector signed char)__b; 1233 } 1234 1235 static __inline__ vector unsigned char __ATTRS_o_ai 1236 vec_andc(vector unsigned char __a, vector unsigned char __b) { 1237 return __a & ~__b; 1238 } 1239 1240 static __inline__ vector unsigned char __ATTRS_o_ai 1241 vec_andc(vector bool char __a, vector unsigned char __b) { 1242 return (vector unsigned char)__a & ~__b; 1243 } 1244 1245 static __inline__ vector unsigned char __ATTRS_o_ai 1246 vec_andc(vector unsigned char __a, vector bool char __b) { 1247 return __a & ~(vector unsigned char)__b; 1248 } 1249 1250 static __inline__ vector bool char __ATTRS_o_ai vec_andc(vector bool char __a, 1251 vector bool char __b) { 1252 return __a & ~__b; 1253 } 1254 1255 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1256 vector short __b) { 1257 return __a & ~__b; 1258 } 1259 1260 static __inline__ vector short __ATTRS_o_ai vec_andc(vector bool short __a, 1261 vector short __b) { 1262 return (vector short)__a & ~__b; 1263 } 1264 1265 static __inline__ vector short __ATTRS_o_ai vec_andc(vector short __a, 1266 vector bool short __b) { 1267 return __a & ~(vector short)__b; 1268 } 1269 1270 static __inline__ vector unsigned short __ATTRS_o_ai 1271 vec_andc(vector unsigned short __a, vector unsigned short __b) { 1272 return __a & ~__b; 1273 } 1274 1275 static __inline__ vector unsigned short __ATTRS_o_ai 1276 vec_andc(vector bool short __a, vector unsigned short __b) { 1277 return (vector unsigned short)__a & ~__b; 1278 } 1279 1280 static __inline__ vector unsigned short __ATTRS_o_ai 1281 vec_andc(vector unsigned short __a, vector bool short __b) { 1282 return __a & ~(vector unsigned short)__b; 1283 } 1284 1285 static __inline__ vector bool short __ATTRS_o_ai 1286 vec_andc(vector bool short __a, vector bool short __b) { 1287 return __a & ~__b; 1288 } 1289 1290 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1291 vector int __b) { 1292 return __a & ~__b; 1293 } 1294 1295 static __inline__ vector int __ATTRS_o_ai vec_andc(vector bool int __a, 1296 vector int __b) { 1297 return (vector int)__a & ~__b; 1298 } 1299 1300 static __inline__ vector int __ATTRS_o_ai vec_andc(vector int __a, 1301 vector bool int __b) { 1302 return __a & ~(vector int)__b; 1303 } 1304 1305 static __inline__ vector unsigned int __ATTRS_o_ai 1306 vec_andc(vector unsigned int __a, vector unsigned int __b) { 1307 return __a & ~__b; 1308 } 1309 1310 static __inline__ vector unsigned int __ATTRS_o_ai 1311 vec_andc(vector bool int __a, vector unsigned int __b) { 1312 return (vector unsigned int)__a & ~__b; 1313 } 1314 1315 static __inline__ vector unsigned int __ATTRS_o_ai 1316 vec_andc(vector unsigned int __a, vector bool int __b) { 1317 return __a & ~(vector unsigned int)__b; 1318 } 1319 1320 static __inline__ vector bool int __ATTRS_o_ai vec_andc(vector bool int __a, 1321 vector bool int __b) { 1322 return __a & ~__b; 1323 } 1324 1325 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1326 vector float __b) { 1327 vector unsigned int __res = 1328 (vector unsigned int)__a & ~(vector unsigned int)__b; 1329 return (vector float)__res; 1330 } 1331 1332 static __inline__ vector float __ATTRS_o_ai vec_andc(vector bool int __a, 1333 vector float __b) { 1334 vector unsigned int __res = 1335 (vector unsigned int)__a & ~(vector unsigned int)__b; 1336 return (vector float)__res; 1337 } 1338 1339 static __inline__ vector float __ATTRS_o_ai vec_andc(vector float __a, 1340 vector bool int __b) { 1341 vector unsigned int __res = 1342 (vector unsigned int)__a & ~(vector unsigned int)__b; 1343 return (vector float)__res; 1344 } 1345 1346 #ifdef __VSX__ 1347 static __inline__ vector double __ATTRS_o_ai vec_andc(vector bool long long __a, 1348 vector double __b) { 1349 vector unsigned long long __res = 1350 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1351 return (vector double)__res; 1352 } 1353 1354 static __inline__ vector double __ATTRS_o_ai 1355 vec_andc(vector double __a, vector bool long long __b) { 1356 vector unsigned long long __res = 1357 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1358 return (vector double)__res; 1359 } 1360 1361 static __inline__ vector double __ATTRS_o_ai vec_andc(vector double __a, 1362 vector double __b) { 1363 vector unsigned long long __res = 1364 (vector unsigned long long)__a & ~(vector unsigned long long)__b; 1365 return (vector double)__res; 1366 } 1367 1368 static __inline__ vector signed long long __ATTRS_o_ai 1369 vec_andc(vector signed long long __a, vector signed long long __b) { 1370 return __a & ~__b; 1371 } 1372 1373 static __inline__ vector signed long long __ATTRS_o_ai 1374 vec_andc(vector bool long long __a, vector signed long long __b) { 1375 return (vector signed long long)__a & ~__b; 1376 } 1377 1378 static __inline__ vector signed long long __ATTRS_o_ai 1379 vec_andc(vector signed long long __a, vector bool long long __b) { 1380 return __a & ~(vector signed long long)__b; 1381 } 1382 1383 static __inline__ vector unsigned long long __ATTRS_o_ai 1384 vec_andc(vector unsigned long long __a, vector unsigned long long __b) { 1385 return __a & ~__b; 1386 } 1387 1388 static __inline__ vector unsigned long long __ATTRS_o_ai 1389 vec_andc(vector bool long long __a, vector unsigned long long __b) { 1390 return (vector unsigned long long)__a & ~__b; 1391 } 1392 1393 static __inline__ vector unsigned long long __ATTRS_o_ai 1394 vec_andc(vector unsigned long long __a, vector bool long long __b) { 1395 return __a & ~(vector unsigned long long)__b; 1396 } 1397 1398 static __inline__ vector bool long long __ATTRS_o_ai 1399 vec_andc(vector bool long long __a, vector bool long long __b) { 1400 return __a & ~__b; 1401 } 1402 #endif 1403 1404 /* vec_vandc */ 1405 1406 static __inline__ vector signed char __ATTRS_o_ai 1407 vec_vandc(vector signed char __a, vector signed char __b) { 1408 return __a & ~__b; 1409 } 1410 1411 static __inline__ vector signed char __ATTRS_o_ai 1412 vec_vandc(vector bool char __a, vector signed char __b) { 1413 return (vector signed char)__a & ~__b; 1414 } 1415 1416 static __inline__ vector signed char __ATTRS_o_ai 1417 vec_vandc(vector signed char __a, vector bool char __b) { 1418 return __a & ~(vector signed char)__b; 1419 } 1420 1421 static __inline__ vector unsigned char __ATTRS_o_ai 1422 vec_vandc(vector unsigned char __a, vector unsigned char __b) { 1423 return __a & ~__b; 1424 } 1425 1426 static __inline__ vector unsigned char __ATTRS_o_ai 1427 vec_vandc(vector bool char __a, vector unsigned char __b) { 1428 return (vector unsigned char)__a & ~__b; 1429 } 1430 1431 static __inline__ vector unsigned char __ATTRS_o_ai 1432 vec_vandc(vector unsigned char __a, vector bool char __b) { 1433 return __a & ~(vector unsigned char)__b; 1434 } 1435 1436 static __inline__ vector bool char __ATTRS_o_ai 1437 vec_vandc(vector bool char __a, vector bool char __b) { 1438 return __a & ~__b; 1439 } 1440 1441 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1442 vector short __b) { 1443 return __a & ~__b; 1444 } 1445 1446 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector bool short __a, 1447 vector short __b) { 1448 return (vector short)__a & ~__b; 1449 } 1450 1451 static __inline__ vector short __ATTRS_o_ai vec_vandc(vector short __a, 1452 vector bool short __b) { 1453 return __a & ~(vector short)__b; 1454 } 1455 1456 static __inline__ vector unsigned short __ATTRS_o_ai 1457 vec_vandc(vector unsigned short __a, vector unsigned short __b) { 1458 return __a & ~__b; 1459 } 1460 1461 static __inline__ vector unsigned short __ATTRS_o_ai 1462 vec_vandc(vector bool short __a, vector unsigned short __b) { 1463 return (vector unsigned short)__a & ~__b; 1464 } 1465 1466 static __inline__ vector unsigned short __ATTRS_o_ai 1467 vec_vandc(vector unsigned short __a, vector bool short __b) { 1468 return __a & ~(vector unsigned short)__b; 1469 } 1470 1471 static __inline__ vector bool short __ATTRS_o_ai 1472 vec_vandc(vector bool short __a, vector bool short __b) { 1473 return __a & ~__b; 1474 } 1475 1476 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1477 vector int __b) { 1478 return __a & ~__b; 1479 } 1480 1481 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector bool int __a, 1482 vector int __b) { 1483 return (vector int)__a & ~__b; 1484 } 1485 1486 static __inline__ vector int __ATTRS_o_ai vec_vandc(vector int __a, 1487 vector bool int __b) { 1488 return __a & ~(vector int)__b; 1489 } 1490 1491 static __inline__ vector unsigned int __ATTRS_o_ai 1492 vec_vandc(vector unsigned int __a, vector unsigned int __b) { 1493 return __a & ~__b; 1494 } 1495 1496 static __inline__ vector unsigned int __ATTRS_o_ai 1497 vec_vandc(vector bool int __a, vector unsigned int __b) { 1498 return (vector unsigned int)__a & ~__b; 1499 } 1500 1501 static __inline__ vector unsigned int __ATTRS_o_ai 1502 vec_vandc(vector unsigned int __a, vector bool int __b) { 1503 return __a & ~(vector unsigned int)__b; 1504 } 1505 1506 static __inline__ vector bool int __ATTRS_o_ai vec_vandc(vector bool int __a, 1507 vector bool int __b) { 1508 return __a & ~__b; 1509 } 1510 1511 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1512 vector float __b) { 1513 vector unsigned int __res = 1514 (vector unsigned int)__a & ~(vector unsigned int)__b; 1515 return (vector float)__res; 1516 } 1517 1518 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector bool int __a, 1519 vector float __b) { 1520 vector unsigned int __res = 1521 (vector unsigned int)__a & ~(vector unsigned int)__b; 1522 return (vector float)__res; 1523 } 1524 1525 static __inline__ vector float __ATTRS_o_ai vec_vandc(vector float __a, 1526 vector bool int __b) { 1527 vector unsigned int __res = 1528 (vector unsigned int)__a & ~(vector unsigned int)__b; 1529 return (vector float)__res; 1530 } 1531 1532 #ifdef __VSX__ 1533 static __inline__ vector signed long long __ATTRS_o_ai 1534 vec_vandc(vector signed long long __a, vector signed long long __b) { 1535 return __a & ~__b; 1536 } 1537 1538 static __inline__ vector signed long long __ATTRS_o_ai 1539 vec_vandc(vector bool long long __a, vector signed long long __b) { 1540 return (vector signed long long)__a & ~__b; 1541 } 1542 1543 static __inline__ vector signed long long __ATTRS_o_ai 1544 vec_vandc(vector signed long long __a, vector bool long long __b) { 1545 return __a & ~(vector signed long long)__b; 1546 } 1547 1548 static __inline__ vector unsigned long long __ATTRS_o_ai 1549 vec_vandc(vector unsigned long long __a, vector unsigned long long __b) { 1550 return __a & ~__b; 1551 } 1552 1553 static __inline__ vector unsigned long long __ATTRS_o_ai 1554 vec_vandc(vector bool long long __a, vector unsigned long long __b) { 1555 return (vector unsigned long long)__a & ~__b; 1556 } 1557 1558 static __inline__ vector unsigned long long __ATTRS_o_ai 1559 vec_vandc(vector unsigned long long __a, vector bool long long __b) { 1560 return __a & ~(vector unsigned long long)__b; 1561 } 1562 1563 static __inline__ vector bool long long __ATTRS_o_ai 1564 vec_vandc(vector bool long long __a, vector bool long long __b) { 1565 return __a & ~__b; 1566 } 1567 #endif 1568 1569 /* vec_avg */ 1570 1571 static __inline__ vector signed char __ATTRS_o_ai 1572 vec_avg(vector signed char __a, vector signed char __b) { 1573 return __builtin_altivec_vavgsb(__a, __b); 1574 } 1575 1576 static __inline__ vector unsigned char __ATTRS_o_ai 1577 vec_avg(vector unsigned char __a, vector unsigned char __b) { 1578 return __builtin_altivec_vavgub(__a, __b); 1579 } 1580 1581 static __inline__ vector short __ATTRS_o_ai vec_avg(vector short __a, 1582 vector short __b) { 1583 return __builtin_altivec_vavgsh(__a, __b); 1584 } 1585 1586 static __inline__ vector unsigned short __ATTRS_o_ai 1587 vec_avg(vector unsigned short __a, vector unsigned short __b) { 1588 return __builtin_altivec_vavguh(__a, __b); 1589 } 1590 1591 static __inline__ vector int __ATTRS_o_ai vec_avg(vector int __a, 1592 vector int __b) { 1593 return __builtin_altivec_vavgsw(__a, __b); 1594 } 1595 1596 static __inline__ vector unsigned int __ATTRS_o_ai 1597 vec_avg(vector unsigned int __a, vector unsigned int __b) { 1598 return __builtin_altivec_vavguw(__a, __b); 1599 } 1600 1601 /* vec_vavgsb */ 1602 1603 static __inline__ vector signed char __attribute__((__always_inline__)) 1604 vec_vavgsb(vector signed char __a, vector signed char __b) { 1605 return __builtin_altivec_vavgsb(__a, __b); 1606 } 1607 1608 /* vec_vavgub */ 1609 1610 static __inline__ vector unsigned char __attribute__((__always_inline__)) 1611 vec_vavgub(vector unsigned char __a, vector unsigned char __b) { 1612 return __builtin_altivec_vavgub(__a, __b); 1613 } 1614 1615 /* vec_vavgsh */ 1616 1617 static __inline__ vector short __attribute__((__always_inline__)) 1618 vec_vavgsh(vector short __a, vector short __b) { 1619 return __builtin_altivec_vavgsh(__a, __b); 1620 } 1621 1622 /* vec_vavguh */ 1623 1624 static __inline__ vector unsigned short __attribute__((__always_inline__)) 1625 vec_vavguh(vector unsigned short __a, vector unsigned short __b) { 1626 return __builtin_altivec_vavguh(__a, __b); 1627 } 1628 1629 /* vec_vavgsw */ 1630 1631 static __inline__ vector int __attribute__((__always_inline__)) 1632 vec_vavgsw(vector int __a, vector int __b) { 1633 return __builtin_altivec_vavgsw(__a, __b); 1634 } 1635 1636 /* vec_vavguw */ 1637 1638 static __inline__ vector unsigned int __attribute__((__always_inline__)) 1639 vec_vavguw(vector unsigned int __a, vector unsigned int __b) { 1640 return __builtin_altivec_vavguw(__a, __b); 1641 } 1642 1643 /* vec_ceil */ 1644 1645 static __inline__ vector float __ATTRS_o_ai vec_ceil(vector float __a) { 1646 #ifdef __VSX__ 1647 return __builtin_vsx_xvrspip(__a); 1648 #else 1649 return __builtin_altivec_vrfip(__a); 1650 #endif 1651 } 1652 1653 #ifdef __VSX__ 1654 static __inline__ vector double __ATTRS_o_ai vec_ceil(vector double __a) { 1655 return __builtin_vsx_xvrdpip(__a); 1656 } 1657 #endif 1658 1659 /* vec_roundp */ 1660 static __inline__ vector float __ATTRS_o_ai vec_roundp(vector float __a) { 1661 return vec_ceil(__a); 1662 } 1663 1664 #ifdef __VSX__ 1665 static __inline__ vector double __ATTRS_o_ai vec_roundp(vector double __a) { 1666 return vec_ceil(__a); 1667 } 1668 #endif 1669 1670 /* vec_vrfip */ 1671 1672 static __inline__ vector float __attribute__((__always_inline__)) 1673 vec_vrfip(vector float __a) { 1674 return __builtin_altivec_vrfip(__a); 1675 } 1676 1677 /* vec_cmpb */ 1678 1679 static __inline__ vector int __attribute__((__always_inline__)) 1680 vec_cmpb(vector float __a, vector float __b) { 1681 return __builtin_altivec_vcmpbfp(__a, __b); 1682 } 1683 1684 /* vec_vcmpbfp */ 1685 1686 static __inline__ vector int __attribute__((__always_inline__)) 1687 vec_vcmpbfp(vector float __a, vector float __b) { 1688 return __builtin_altivec_vcmpbfp(__a, __b); 1689 } 1690 1691 /* vec_cmpeq */ 1692 1693 static __inline__ vector bool char __ATTRS_o_ai 1694 vec_cmpeq(vector signed char __a, vector signed char __b) { 1695 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1696 (vector char)__b); 1697 } 1698 1699 static __inline__ vector bool char __ATTRS_o_ai 1700 vec_cmpeq(vector unsigned char __a, vector unsigned char __b) { 1701 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1702 (vector char)__b); 1703 } 1704 1705 static __inline__ vector bool char __ATTRS_o_ai 1706 vec_cmpeq(vector bool char __a, vector bool char __b) { 1707 return (vector bool char)__builtin_altivec_vcmpequb((vector char)__a, 1708 (vector char)__b); 1709 } 1710 1711 static __inline__ vector bool short __ATTRS_o_ai vec_cmpeq(vector short __a, 1712 vector short __b) { 1713 return (vector bool short)__builtin_altivec_vcmpequh(__a, __b); 1714 } 1715 1716 static __inline__ vector bool short __ATTRS_o_ai 1717 vec_cmpeq(vector unsigned short __a, vector unsigned short __b) { 1718 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1719 (vector short)__b); 1720 } 1721 1722 static __inline__ vector bool short __ATTRS_o_ai 1723 vec_cmpeq(vector bool short __a, vector bool short __b) { 1724 return (vector bool short)__builtin_altivec_vcmpequh((vector short)__a, 1725 (vector short)__b); 1726 } 1727 1728 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector int __a, 1729 vector int __b) { 1730 return (vector bool int)__builtin_altivec_vcmpequw(__a, __b); 1731 } 1732 1733 static __inline__ vector bool int __ATTRS_o_ai 1734 vec_cmpeq(vector unsigned int __a, vector unsigned int __b) { 1735 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1736 (vector int)__b); 1737 } 1738 1739 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector bool int __a, 1740 vector bool int __b) { 1741 return (vector bool int)__builtin_altivec_vcmpequw((vector int)__a, 1742 (vector int)__b); 1743 } 1744 1745 #ifdef __POWER8_VECTOR__ 1746 static __inline__ vector bool long long __ATTRS_o_ai 1747 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1748 return (vector bool long long)__builtin_altivec_vcmpequd(__a, __b); 1749 } 1750 1751 static __inline__ vector bool long long __ATTRS_o_ai 1752 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1753 return (vector bool long long)__builtin_altivec_vcmpequd( 1754 (vector long long)__a, (vector long long)__b); 1755 } 1756 1757 static __inline__ vector bool long long __ATTRS_o_ai 1758 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1759 return (vector bool long long)__builtin_altivec_vcmpequd( 1760 (vector long long)__a, (vector long long)__b); 1761 } 1762 #elif defined(__VSX__) 1763 static __inline__ vector bool long long __ATTRS_o_ai 1764 vec_cmpeq(vector signed long long __a, vector signed long long __b) { 1765 vector bool int __wordcmp = 1766 vec_cmpeq((vector signed int)__a, (vector signed int)__b); 1767 #ifdef __LITTLE_ENDIAN__ 1768 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 3, 0, 1, 2); 1769 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 1, 1770 1, 3, 3); 1771 #else 1772 __wordcmp &= __builtin_shufflevector(__wordcmp, __wordcmp, 1, 2, 3, 0); 1773 return (vector bool long long)__builtin_shufflevector(__wordcmp, __wordcmp, 0, 1774 0, 2, 2); 1775 #endif 1776 } 1777 1778 static __inline__ vector bool long long __ATTRS_o_ai 1779 vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) { 1780 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1781 } 1782 1783 static __inline__ vector bool long long __ATTRS_o_ai 1784 vec_cmpeq(vector bool long long __a, vector bool long long __b) { 1785 return vec_cmpeq((vector signed long long)__a, (vector signed long long)__b); 1786 } 1787 #endif 1788 1789 static __inline__ vector bool int __ATTRS_o_ai vec_cmpeq(vector float __a, 1790 vector float __b) { 1791 #ifdef __VSX__ 1792 return (vector bool int)__builtin_vsx_xvcmpeqsp(__a, __b); 1793 #else 1794 return (vector bool int)__builtin_altivec_vcmpeqfp(__a, __b); 1795 #endif 1796 } 1797 1798 #ifdef __VSX__ 1799 static __inline__ vector bool long long __ATTRS_o_ai 1800 vec_cmpeq(vector double __a, vector double __b) { 1801 return (vector bool long long)__builtin_vsx_xvcmpeqdp(__a, __b); 1802 } 1803 #endif 1804 1805 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1806 static __inline__ vector bool __int128 __ATTRS_o_ai 1807 vec_cmpeq(vector signed __int128 __a, vector signed __int128 __b) { 1808 return (vector bool __int128)__builtin_altivec_vcmpequq( 1809 (vector bool __int128)__a, (vector bool __int128)__b); 1810 } 1811 1812 static __inline__ vector bool __int128 __ATTRS_o_ai 1813 vec_cmpeq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1814 return (vector bool __int128)__builtin_altivec_vcmpequq( 1815 (vector bool __int128)__a, (vector bool __int128)__b); 1816 } 1817 1818 static __inline__ vector bool __int128 __ATTRS_o_ai 1819 vec_cmpeq(vector bool __int128 __a, vector bool __int128 __b) { 1820 return (vector bool __int128)__builtin_altivec_vcmpequq(__a, __b); 1821 } 1822 #endif 1823 1824 #ifdef __POWER9_VECTOR__ 1825 /* vec_cmpne */ 1826 1827 static __inline__ vector bool char __ATTRS_o_ai 1828 vec_cmpne(vector bool char __a, vector bool char __b) { 1829 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1830 (vector char)__b); 1831 } 1832 1833 static __inline__ vector bool char __ATTRS_o_ai 1834 vec_cmpne(vector signed char __a, vector signed char __b) { 1835 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1836 (vector char)__b); 1837 } 1838 1839 static __inline__ vector bool char __ATTRS_o_ai 1840 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 1841 return (vector bool char)__builtin_altivec_vcmpneb((vector char)__a, 1842 (vector char)__b); 1843 } 1844 1845 static __inline__ vector bool short __ATTRS_o_ai 1846 vec_cmpne(vector bool short __a, vector bool short __b) { 1847 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1848 (vector short)__b); 1849 } 1850 1851 static __inline__ vector bool short __ATTRS_o_ai 1852 vec_cmpne(vector signed short __a, vector signed short __b) { 1853 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1854 (vector short)__b); 1855 } 1856 1857 static __inline__ vector bool short __ATTRS_o_ai 1858 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 1859 return (vector bool short)__builtin_altivec_vcmpneh((vector short)__a, 1860 (vector short)__b); 1861 } 1862 1863 static __inline__ vector bool int __ATTRS_o_ai 1864 vec_cmpne(vector bool int __a, vector bool int __b) { 1865 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1866 (vector int)__b); 1867 } 1868 1869 static __inline__ vector bool int __ATTRS_o_ai 1870 vec_cmpne(vector signed int __a, vector signed int __b) { 1871 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1872 (vector int)__b); 1873 } 1874 1875 static __inline__ vector bool int __ATTRS_o_ai 1876 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 1877 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1878 (vector int)__b); 1879 } 1880 1881 static __inline__ vector bool int __ATTRS_o_ai 1882 vec_cmpne(vector float __a, vector float __b) { 1883 return (vector bool int)__builtin_altivec_vcmpnew((vector int)__a, 1884 (vector int)__b); 1885 } 1886 1887 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 1888 static __inline__ vector bool __int128 __ATTRS_o_ai 1889 vec_cmpne(vector unsigned __int128 __a, vector unsigned __int128 __b) { 1890 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1891 (vector bool __int128)__a, (vector bool __int128)__b)); 1892 } 1893 1894 static __inline__ vector bool __int128 __ATTRS_o_ai 1895 vec_cmpne(vector signed __int128 __a, vector signed __int128 __b) { 1896 return (vector bool __int128) ~(__builtin_altivec_vcmpequq( 1897 (vector bool __int128)__a, (vector bool __int128)__b)); 1898 } 1899 1900 static __inline__ vector bool __int128 __ATTRS_o_ai 1901 vec_cmpne(vector bool __int128 __a, vector bool __int128 __b) { 1902 return (vector bool __int128) ~(__builtin_altivec_vcmpequq(__a, __b)); 1903 } 1904 #endif 1905 1906 /* vec_cmpnez */ 1907 1908 static __inline__ vector bool char __ATTRS_o_ai 1909 vec_cmpnez(vector signed char __a, vector signed char __b) { 1910 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1911 (vector char)__b); 1912 } 1913 1914 static __inline__ vector bool char __ATTRS_o_ai 1915 vec_cmpnez(vector unsigned char __a, vector unsigned char __b) { 1916 return (vector bool char)__builtin_altivec_vcmpnezb((vector char)__a, 1917 (vector char)__b); 1918 } 1919 1920 static __inline__ vector bool short __ATTRS_o_ai 1921 vec_cmpnez(vector signed short __a, vector signed short __b) { 1922 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1923 (vector short)__b); 1924 } 1925 1926 static __inline__ vector bool short __ATTRS_o_ai 1927 vec_cmpnez(vector unsigned short __a, vector unsigned short __b) { 1928 return (vector bool short)__builtin_altivec_vcmpnezh((vector short)__a, 1929 (vector short)__b); 1930 } 1931 1932 static __inline__ vector bool int __ATTRS_o_ai 1933 vec_cmpnez(vector signed int __a, vector signed int __b) { 1934 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1935 (vector int)__b); 1936 } 1937 1938 static __inline__ vector bool int __ATTRS_o_ai 1939 vec_cmpnez(vector unsigned int __a, vector unsigned int __b) { 1940 return (vector bool int)__builtin_altivec_vcmpnezw((vector int)__a, 1941 (vector int)__b); 1942 } 1943 1944 static __inline__ signed int __ATTRS_o_ai 1945 vec_cntlz_lsbb(vector signed char __a) { 1946 #ifdef __LITTLE_ENDIAN__ 1947 return __builtin_altivec_vctzlsbb(__a); 1948 #else 1949 return __builtin_altivec_vclzlsbb(__a); 1950 #endif 1951 } 1952 1953 static __inline__ signed int __ATTRS_o_ai 1954 vec_cntlz_lsbb(vector unsigned char __a) { 1955 #ifdef __LITTLE_ENDIAN__ 1956 return __builtin_altivec_vctzlsbb(__a); 1957 #else 1958 return __builtin_altivec_vclzlsbb(__a); 1959 #endif 1960 } 1961 1962 static __inline__ signed int __ATTRS_o_ai 1963 vec_cnttz_lsbb(vector signed char __a) { 1964 #ifdef __LITTLE_ENDIAN__ 1965 return __builtin_altivec_vclzlsbb(__a); 1966 #else 1967 return __builtin_altivec_vctzlsbb(__a); 1968 #endif 1969 } 1970 1971 static __inline__ signed int __ATTRS_o_ai 1972 vec_cnttz_lsbb(vector unsigned char __a) { 1973 #ifdef __LITTLE_ENDIAN__ 1974 return __builtin_altivec_vclzlsbb(__a); 1975 #else 1976 return __builtin_altivec_vctzlsbb(__a); 1977 #endif 1978 } 1979 1980 static __inline__ vector unsigned int __ATTRS_o_ai 1981 vec_parity_lsbb(vector unsigned int __a) { 1982 return __builtin_altivec_vprtybw(__a); 1983 } 1984 1985 static __inline__ vector unsigned int __ATTRS_o_ai 1986 vec_parity_lsbb(vector signed int __a) { 1987 return __builtin_altivec_vprtybw(__a); 1988 } 1989 1990 #ifdef __SIZEOF_INT128__ 1991 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1992 vec_parity_lsbb(vector unsigned __int128 __a) { 1993 return __builtin_altivec_vprtybq(__a); 1994 } 1995 1996 static __inline__ vector unsigned __int128 __ATTRS_o_ai 1997 vec_parity_lsbb(vector signed __int128 __a) { 1998 return __builtin_altivec_vprtybq(__a); 1999 } 2000 #endif 2001 2002 static __inline__ vector unsigned long long __ATTRS_o_ai 2003 vec_parity_lsbb(vector unsigned long long __a) { 2004 return __builtin_altivec_vprtybd(__a); 2005 } 2006 2007 static __inline__ vector unsigned long long __ATTRS_o_ai 2008 vec_parity_lsbb(vector signed long long __a) { 2009 return __builtin_altivec_vprtybd(__a); 2010 } 2011 2012 #else 2013 /* vec_cmpne */ 2014 2015 static __inline__ vector bool char __ATTRS_o_ai 2016 vec_cmpne(vector bool char __a, vector bool char __b) { 2017 return ~(vec_cmpeq(__a, __b)); 2018 } 2019 2020 static __inline__ vector bool char __ATTRS_o_ai 2021 vec_cmpne(vector signed char __a, vector signed char __b) { 2022 return ~(vec_cmpeq(__a, __b)); 2023 } 2024 2025 static __inline__ vector bool char __ATTRS_o_ai 2026 vec_cmpne(vector unsigned char __a, vector unsigned char __b) { 2027 return ~(vec_cmpeq(__a, __b)); 2028 } 2029 2030 static __inline__ vector bool short __ATTRS_o_ai 2031 vec_cmpne(vector bool short __a, vector bool short __b) { 2032 return ~(vec_cmpeq(__a, __b)); 2033 } 2034 2035 static __inline__ vector bool short __ATTRS_o_ai 2036 vec_cmpne(vector signed short __a, vector signed short __b) { 2037 return ~(vec_cmpeq(__a, __b)); 2038 } 2039 2040 static __inline__ vector bool short __ATTRS_o_ai 2041 vec_cmpne(vector unsigned short __a, vector unsigned short __b) { 2042 return ~(vec_cmpeq(__a, __b)); 2043 } 2044 2045 static __inline__ vector bool int __ATTRS_o_ai 2046 vec_cmpne(vector bool int __a, vector bool int __b) { 2047 return ~(vec_cmpeq(__a, __b)); 2048 } 2049 2050 static __inline__ vector bool int __ATTRS_o_ai 2051 vec_cmpne(vector signed int __a, vector signed int __b) { 2052 return ~(vec_cmpeq(__a, __b)); 2053 } 2054 2055 static __inline__ vector bool int __ATTRS_o_ai 2056 vec_cmpne(vector unsigned int __a, vector unsigned int __b) { 2057 return ~(vec_cmpeq(__a, __b)); 2058 } 2059 2060 static __inline__ vector bool int __ATTRS_o_ai 2061 vec_cmpne(vector float __a, vector float __b) { 2062 return ~(vec_cmpeq(__a, __b)); 2063 } 2064 #endif 2065 2066 #ifdef __POWER8_VECTOR__ 2067 static __inline__ vector bool long long __ATTRS_o_ai 2068 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2069 return (vector bool long long) 2070 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2071 } 2072 2073 static __inline__ vector bool long long __ATTRS_o_ai 2074 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2075 return (vector bool long long) 2076 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2077 } 2078 2079 static __inline__ vector bool long long __ATTRS_o_ai 2080 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2081 return (vector bool long long) 2082 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2083 } 2084 #elif defined(__VSX__) 2085 static __inline__ vector bool long long __ATTRS_o_ai 2086 vec_cmpne(vector bool long long __a, vector bool long long __b) { 2087 return (vector bool long long)~( 2088 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2089 } 2090 2091 static __inline__ vector bool long long __ATTRS_o_ai 2092 vec_cmpne(vector signed long long __a, vector signed long long __b) { 2093 return (vector bool long long)~( 2094 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2095 } 2096 2097 static __inline__ vector bool long long __ATTRS_o_ai 2098 vec_cmpne(vector unsigned long long __a, vector unsigned long long __b) { 2099 return (vector bool long long)~( 2100 vec_cmpeq((vector signed long long)__a, (vector signed long long)__b)); 2101 } 2102 #endif 2103 2104 #ifdef __VSX__ 2105 static __inline__ vector bool long long __ATTRS_o_ai 2106 vec_cmpne(vector double __a, vector double __b) { 2107 return (vector bool long long) 2108 ~(__builtin_altivec_vcmpequd((vector long long)__a, (vector long long)__b)); 2109 } 2110 #endif 2111 2112 /* vec_cmpgt */ 2113 2114 static __inline__ vector bool char __ATTRS_o_ai 2115 vec_cmpgt(vector signed char __a, vector signed char __b) { 2116 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2117 } 2118 2119 static __inline__ vector bool char __ATTRS_o_ai 2120 vec_cmpgt(vector unsigned char __a, vector unsigned char __b) { 2121 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2122 } 2123 2124 static __inline__ vector bool short __ATTRS_o_ai vec_cmpgt(vector short __a, 2125 vector short __b) { 2126 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2127 } 2128 2129 static __inline__ vector bool short __ATTRS_o_ai 2130 vec_cmpgt(vector unsigned short __a, vector unsigned short __b) { 2131 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2132 } 2133 2134 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector int __a, 2135 vector int __b) { 2136 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2137 } 2138 2139 static __inline__ vector bool int __ATTRS_o_ai 2140 vec_cmpgt(vector unsigned int __a, vector unsigned int __b) { 2141 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2142 } 2143 2144 #ifdef __POWER8_VECTOR__ 2145 static __inline__ vector bool long long __ATTRS_o_ai 2146 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2147 return (vector bool long long)__builtin_altivec_vcmpgtsd(__a, __b); 2148 } 2149 2150 static __inline__ vector bool long long __ATTRS_o_ai 2151 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2152 return (vector bool long long)__builtin_altivec_vcmpgtud(__a, __b); 2153 } 2154 #elif defined(__VSX__) 2155 static __inline__ vector bool long long __ATTRS_o_ai 2156 vec_cmpgt(vector signed long long __a, vector signed long long __b) { 2157 vector signed int __sgtw = (vector signed int)vec_cmpgt( 2158 (vector signed int)__a, (vector signed int)__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 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2165 __sgtw |= (vector signed int)__ugtw; 2166 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 1, 1, 3, 2167 3); 2168 #else 2169 __ugtw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2170 __sgtw |= (vector signed int)__ugtw; 2171 return (vector bool long long)__builtin_shufflevector(__sgtw, __sgtw, 0, 0, 2, 2172 2); 2173 #endif 2174 } 2175 2176 static __inline__ vector bool long long __ATTRS_o_ai 2177 vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) { 2178 vector unsigned int __ugtw = (vector unsigned int)vec_cmpgt( 2179 (vector unsigned int)__a, (vector unsigned int)__b); 2180 vector unsigned int __eqw = (vector unsigned int)vec_cmpeq( 2181 (vector signed int)__a, (vector signed int)__b); 2182 #ifdef __LITTLE_ENDIAN__ 2183 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 3, 0, 1, 2) & __eqw; 2184 __ugtw |= __eqw; 2185 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 1, 1, 3, 2186 3); 2187 #else 2188 __eqw = __builtin_shufflevector(__ugtw, __ugtw, 1, 2, 3, 0) & __eqw; 2189 __ugtw |= __eqw; 2190 return (vector bool long long)__builtin_shufflevector(__ugtw, __ugtw, 0, 0, 2, 2191 2); 2192 #endif 2193 } 2194 #endif 2195 2196 static __inline__ vector bool int __ATTRS_o_ai vec_cmpgt(vector float __a, 2197 vector float __b) { 2198 #ifdef __VSX__ 2199 return (vector bool int)__builtin_vsx_xvcmpgtsp(__a, __b); 2200 #else 2201 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2202 #endif 2203 } 2204 2205 #ifdef __VSX__ 2206 static __inline__ vector bool long long __ATTRS_o_ai 2207 vec_cmpgt(vector double __a, vector double __b) { 2208 return (vector bool long long)__builtin_vsx_xvcmpgtdp(__a, __b); 2209 } 2210 #endif 2211 2212 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2213 static __inline__ vector bool __int128 __ATTRS_o_ai 2214 vec_cmpgt(vector signed __int128 __a, vector signed __int128 __b) { 2215 return (vector bool __int128)__builtin_altivec_vcmpgtsq( 2216 (vector bool __int128)__a, (vector bool __int128)__b); 2217 } 2218 2219 static __inline__ vector bool __int128 __ATTRS_o_ai 2220 vec_cmpgt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2221 return (vector bool __int128)__builtin_altivec_vcmpgtuq( 2222 (vector bool __int128)__a, (vector bool __int128)__b); 2223 } 2224 #endif 2225 2226 /* vec_cmpge */ 2227 2228 static __inline__ vector bool char __ATTRS_o_ai 2229 vec_cmpge(vector signed char __a, vector signed char __b) { 2230 return ~(vec_cmpgt(__b, __a)); 2231 } 2232 2233 static __inline__ vector bool char __ATTRS_o_ai 2234 vec_cmpge(vector unsigned char __a, vector unsigned char __b) { 2235 return ~(vec_cmpgt(__b, __a)); 2236 } 2237 2238 static __inline__ vector bool short __ATTRS_o_ai 2239 vec_cmpge(vector signed short __a, vector signed short __b) { 2240 return ~(vec_cmpgt(__b, __a)); 2241 } 2242 2243 static __inline__ vector bool short __ATTRS_o_ai 2244 vec_cmpge(vector unsigned short __a, vector unsigned short __b) { 2245 return ~(vec_cmpgt(__b, __a)); 2246 } 2247 2248 static __inline__ vector bool int __ATTRS_o_ai 2249 vec_cmpge(vector signed int __a, vector signed int __b) { 2250 return ~(vec_cmpgt(__b, __a)); 2251 } 2252 2253 static __inline__ vector bool int __ATTRS_o_ai 2254 vec_cmpge(vector unsigned int __a, vector unsigned int __b) { 2255 return ~(vec_cmpgt(__b, __a)); 2256 } 2257 2258 static __inline__ vector bool int __ATTRS_o_ai vec_cmpge(vector float __a, 2259 vector float __b) { 2260 #ifdef __VSX__ 2261 return (vector bool int)__builtin_vsx_xvcmpgesp(__a, __b); 2262 #else 2263 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2264 #endif 2265 } 2266 2267 #ifdef __VSX__ 2268 static __inline__ vector bool long long __ATTRS_o_ai 2269 vec_cmpge(vector double __a, vector double __b) { 2270 return (vector bool long long)__builtin_vsx_xvcmpgedp(__a, __b); 2271 } 2272 2273 static __inline__ vector bool long long __ATTRS_o_ai 2274 vec_cmpge(vector signed long long __a, vector signed long long __b) { 2275 return ~(vec_cmpgt(__b, __a)); 2276 } 2277 2278 static __inline__ vector bool long long __ATTRS_o_ai 2279 vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) { 2280 return ~(vec_cmpgt(__b, __a)); 2281 } 2282 #endif 2283 2284 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2285 static __inline__ vector bool __int128 __ATTRS_o_ai 2286 vec_cmpge(vector signed __int128 __a, vector signed __int128 __b) { 2287 return ~(vec_cmpgt(__b, __a)); 2288 } 2289 2290 static __inline__ vector bool __int128 __ATTRS_o_ai 2291 vec_cmpge(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2292 return ~(vec_cmpgt(__b, __a)); 2293 } 2294 #endif 2295 2296 /* vec_vcmpgefp */ 2297 2298 static __inline__ vector bool int __attribute__((__always_inline__)) 2299 vec_vcmpgefp(vector float __a, vector float __b) { 2300 return (vector bool int)__builtin_altivec_vcmpgefp(__a, __b); 2301 } 2302 2303 /* vec_vcmpgtsb */ 2304 2305 static __inline__ vector bool char __attribute__((__always_inline__)) 2306 vec_vcmpgtsb(vector signed char __a, vector signed char __b) { 2307 return (vector bool char)__builtin_altivec_vcmpgtsb(__a, __b); 2308 } 2309 2310 /* vec_vcmpgtub */ 2311 2312 static __inline__ vector bool char __attribute__((__always_inline__)) 2313 vec_vcmpgtub(vector unsigned char __a, vector unsigned char __b) { 2314 return (vector bool char)__builtin_altivec_vcmpgtub(__a, __b); 2315 } 2316 2317 /* vec_vcmpgtsh */ 2318 2319 static __inline__ vector bool short __attribute__((__always_inline__)) 2320 vec_vcmpgtsh(vector short __a, vector short __b) { 2321 return (vector bool short)__builtin_altivec_vcmpgtsh(__a, __b); 2322 } 2323 2324 /* vec_vcmpgtuh */ 2325 2326 static __inline__ vector bool short __attribute__((__always_inline__)) 2327 vec_vcmpgtuh(vector unsigned short __a, vector unsigned short __b) { 2328 return (vector bool short)__builtin_altivec_vcmpgtuh(__a, __b); 2329 } 2330 2331 /* vec_vcmpgtsw */ 2332 2333 static __inline__ vector bool int __attribute__((__always_inline__)) 2334 vec_vcmpgtsw(vector int __a, vector int __b) { 2335 return (vector bool int)__builtin_altivec_vcmpgtsw(__a, __b); 2336 } 2337 2338 /* vec_vcmpgtuw */ 2339 2340 static __inline__ vector bool int __attribute__((__always_inline__)) 2341 vec_vcmpgtuw(vector unsigned int __a, vector unsigned int __b) { 2342 return (vector bool int)__builtin_altivec_vcmpgtuw(__a, __b); 2343 } 2344 2345 /* vec_vcmpgtfp */ 2346 2347 static __inline__ vector bool int __attribute__((__always_inline__)) 2348 vec_vcmpgtfp(vector float __a, vector float __b) { 2349 return (vector bool int)__builtin_altivec_vcmpgtfp(__a, __b); 2350 } 2351 2352 /* vec_cmple */ 2353 2354 static __inline__ vector bool char __ATTRS_o_ai 2355 vec_cmple(vector signed char __a, vector signed char __b) { 2356 return vec_cmpge(__b, __a); 2357 } 2358 2359 static __inline__ vector bool char __ATTRS_o_ai 2360 vec_cmple(vector unsigned char __a, vector unsigned char __b) { 2361 return vec_cmpge(__b, __a); 2362 } 2363 2364 static __inline__ vector bool short __ATTRS_o_ai 2365 vec_cmple(vector signed short __a, vector signed short __b) { 2366 return vec_cmpge(__b, __a); 2367 } 2368 2369 static __inline__ vector bool short __ATTRS_o_ai 2370 vec_cmple(vector unsigned short __a, vector unsigned short __b) { 2371 return vec_cmpge(__b, __a); 2372 } 2373 2374 static __inline__ vector bool int __ATTRS_o_ai 2375 vec_cmple(vector signed int __a, vector signed int __b) { 2376 return vec_cmpge(__b, __a); 2377 } 2378 2379 static __inline__ vector bool int __ATTRS_o_ai 2380 vec_cmple(vector unsigned int __a, vector unsigned int __b) { 2381 return vec_cmpge(__b, __a); 2382 } 2383 2384 static __inline__ vector bool int __ATTRS_o_ai vec_cmple(vector float __a, 2385 vector float __b) { 2386 return vec_cmpge(__b, __a); 2387 } 2388 2389 #ifdef __VSX__ 2390 static __inline__ vector bool long long __ATTRS_o_ai 2391 vec_cmple(vector double __a, vector double __b) { 2392 return vec_cmpge(__b, __a); 2393 } 2394 2395 static __inline__ vector bool long long __ATTRS_o_ai 2396 vec_cmple(vector signed long long __a, vector signed long long __b) { 2397 return vec_cmpge(__b, __a); 2398 } 2399 2400 static __inline__ vector bool long long __ATTRS_o_ai 2401 vec_cmple(vector unsigned long long __a, vector unsigned long long __b) { 2402 return vec_cmpge(__b, __a); 2403 } 2404 #endif 2405 2406 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2407 static __inline__ vector bool __int128 __ATTRS_o_ai 2408 vec_cmple(vector signed __int128 __a, vector signed __int128 __b) { 2409 return vec_cmpge(__b, __a); 2410 } 2411 2412 static __inline__ vector bool __int128 __ATTRS_o_ai 2413 vec_cmple(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2414 return vec_cmpge(__b, __a); 2415 } 2416 #endif 2417 2418 /* vec_cmplt */ 2419 2420 static __inline__ vector bool char __ATTRS_o_ai 2421 vec_cmplt(vector signed char __a, vector signed char __b) { 2422 return vec_cmpgt(__b, __a); 2423 } 2424 2425 static __inline__ vector bool char __ATTRS_o_ai 2426 vec_cmplt(vector unsigned char __a, vector unsigned char __b) { 2427 return vec_cmpgt(__b, __a); 2428 } 2429 2430 static __inline__ vector bool short __ATTRS_o_ai vec_cmplt(vector short __a, 2431 vector short __b) { 2432 return vec_cmpgt(__b, __a); 2433 } 2434 2435 static __inline__ vector bool short __ATTRS_o_ai 2436 vec_cmplt(vector unsigned short __a, vector unsigned short __b) { 2437 return vec_cmpgt(__b, __a); 2438 } 2439 2440 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector int __a, 2441 vector int __b) { 2442 return vec_cmpgt(__b, __a); 2443 } 2444 2445 static __inline__ vector bool int __ATTRS_o_ai 2446 vec_cmplt(vector unsigned int __a, vector unsigned int __b) { 2447 return vec_cmpgt(__b, __a); 2448 } 2449 2450 static __inline__ vector bool int __ATTRS_o_ai vec_cmplt(vector float __a, 2451 vector float __b) { 2452 return vec_cmpgt(__b, __a); 2453 } 2454 2455 #ifdef __VSX__ 2456 static __inline__ vector bool long long __ATTRS_o_ai 2457 vec_cmplt(vector double __a, vector double __b) { 2458 return vec_cmpgt(__b, __a); 2459 } 2460 #endif 2461 2462 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 2463 static __inline__ vector bool __int128 __ATTRS_o_ai 2464 vec_cmplt(vector signed __int128 __a, vector signed __int128 __b) { 2465 return vec_cmpgt(__b, __a); 2466 } 2467 2468 static __inline__ vector bool __int128 __ATTRS_o_ai 2469 vec_cmplt(vector unsigned __int128 __a, vector unsigned __int128 __b) { 2470 return vec_cmpgt(__b, __a); 2471 } 2472 #endif 2473 2474 #ifdef __VSX__ 2475 static __inline__ vector bool long long __ATTRS_o_ai 2476 vec_cmplt(vector signed long long __a, vector signed long long __b) { 2477 return vec_cmpgt(__b, __a); 2478 } 2479 2480 static __inline__ vector bool long long __ATTRS_o_ai 2481 vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) { 2482 return vec_cmpgt(__b, __a); 2483 } 2484 #endif 2485 2486 #ifdef __POWER8_VECTOR__ 2487 /* vec_popcnt */ 2488 2489 static __inline__ vector unsigned char __ATTRS_o_ai 2490 vec_popcnt(vector signed char __a) { 2491 return __builtin_altivec_vpopcntb(__a); 2492 } 2493 static __inline__ vector unsigned char __ATTRS_o_ai 2494 vec_popcnt(vector unsigned char __a) { 2495 return __builtin_altivec_vpopcntb(__a); 2496 } 2497 static __inline__ vector unsigned short __ATTRS_o_ai 2498 vec_popcnt(vector signed short __a) { 2499 return __builtin_altivec_vpopcnth(__a); 2500 } 2501 static __inline__ vector unsigned short __ATTRS_o_ai 2502 vec_popcnt(vector unsigned short __a) { 2503 return __builtin_altivec_vpopcnth(__a); 2504 } 2505 static __inline__ vector unsigned int __ATTRS_o_ai 2506 vec_popcnt(vector signed int __a) { 2507 return __builtin_altivec_vpopcntw(__a); 2508 } 2509 static __inline__ vector unsigned int __ATTRS_o_ai 2510 vec_popcnt(vector unsigned int __a) { 2511 return __builtin_altivec_vpopcntw(__a); 2512 } 2513 static __inline__ vector unsigned long long __ATTRS_o_ai 2514 vec_popcnt(vector signed long long __a) { 2515 return __builtin_altivec_vpopcntd(__a); 2516 } 2517 static __inline__ vector unsigned long long __ATTRS_o_ai 2518 vec_popcnt(vector unsigned long long __a) { 2519 return __builtin_altivec_vpopcntd(__a); 2520 } 2521 2522 #define vec_vclz vec_cntlz 2523 /* vec_cntlz */ 2524 2525 static __inline__ vector signed char __ATTRS_o_ai 2526 vec_cntlz(vector signed char __a) { 2527 return __builtin_altivec_vclzb(__a); 2528 } 2529 static __inline__ vector unsigned char __ATTRS_o_ai 2530 vec_cntlz(vector unsigned char __a) { 2531 return __builtin_altivec_vclzb(__a); 2532 } 2533 static __inline__ vector signed short __ATTRS_o_ai 2534 vec_cntlz(vector signed short __a) { 2535 return __builtin_altivec_vclzh(__a); 2536 } 2537 static __inline__ vector unsigned short __ATTRS_o_ai 2538 vec_cntlz(vector unsigned short __a) { 2539 return __builtin_altivec_vclzh(__a); 2540 } 2541 static __inline__ vector signed int __ATTRS_o_ai 2542 vec_cntlz(vector signed int __a) { 2543 return __builtin_altivec_vclzw(__a); 2544 } 2545 static __inline__ vector unsigned int __ATTRS_o_ai 2546 vec_cntlz(vector unsigned int __a) { 2547 return __builtin_altivec_vclzw(__a); 2548 } 2549 static __inline__ vector signed long long __ATTRS_o_ai 2550 vec_cntlz(vector signed long long __a) { 2551 return __builtin_altivec_vclzd(__a); 2552 } 2553 static __inline__ vector unsigned long long __ATTRS_o_ai 2554 vec_cntlz(vector unsigned long long __a) { 2555 return __builtin_altivec_vclzd(__a); 2556 } 2557 #endif 2558 2559 #ifdef __POWER9_VECTOR__ 2560 2561 /* vec_cnttz */ 2562 2563 static __inline__ vector signed char __ATTRS_o_ai 2564 vec_cnttz(vector signed char __a) { 2565 return __builtin_altivec_vctzb(__a); 2566 } 2567 static __inline__ vector unsigned char __ATTRS_o_ai 2568 vec_cnttz(vector unsigned char __a) { 2569 return __builtin_altivec_vctzb(__a); 2570 } 2571 static __inline__ vector signed short __ATTRS_o_ai 2572 vec_cnttz(vector signed short __a) { 2573 return __builtin_altivec_vctzh(__a); 2574 } 2575 static __inline__ vector unsigned short __ATTRS_o_ai 2576 vec_cnttz(vector unsigned short __a) { 2577 return __builtin_altivec_vctzh(__a); 2578 } 2579 static __inline__ vector signed int __ATTRS_o_ai 2580 vec_cnttz(vector signed int __a) { 2581 return __builtin_altivec_vctzw(__a); 2582 } 2583 static __inline__ vector unsigned int __ATTRS_o_ai 2584 vec_cnttz(vector unsigned int __a) { 2585 return __builtin_altivec_vctzw(__a); 2586 } 2587 static __inline__ vector signed long long __ATTRS_o_ai 2588 vec_cnttz(vector signed long long __a) { 2589 return __builtin_altivec_vctzd(__a); 2590 } 2591 static __inline__ vector unsigned long long __ATTRS_o_ai 2592 vec_cnttz(vector unsigned long long __a) { 2593 return __builtin_altivec_vctzd(__a); 2594 } 2595 2596 /* vec_first_match_index */ 2597 2598 static __inline__ unsigned __ATTRS_o_ai 2599 vec_first_match_index(vector signed char __a, vector signed char __b) { 2600 vector unsigned long long __res = 2601 #ifdef __LITTLE_ENDIAN__ 2602 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2603 #else 2604 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2605 #endif 2606 if (__res[0] == 64) { 2607 return (__res[1] + 64) >> 3; 2608 } 2609 return __res[0] >> 3; 2610 } 2611 2612 static __inline__ unsigned __ATTRS_o_ai 2613 vec_first_match_index(vector unsigned char __a, vector unsigned char __b) { 2614 vector unsigned long long __res = 2615 #ifdef __LITTLE_ENDIAN__ 2616 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2617 #else 2618 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2619 #endif 2620 if (__res[0] == 64) { 2621 return (__res[1] + 64) >> 3; 2622 } 2623 return __res[0] >> 3; 2624 } 2625 2626 static __inline__ unsigned __ATTRS_o_ai 2627 vec_first_match_index(vector signed short __a, vector signed short __b) { 2628 vector unsigned long long __res = 2629 #ifdef __LITTLE_ENDIAN__ 2630 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2631 #else 2632 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2633 #endif 2634 if (__res[0] == 64) { 2635 return (__res[1] + 64) >> 4; 2636 } 2637 return __res[0] >> 4; 2638 } 2639 2640 static __inline__ unsigned __ATTRS_o_ai 2641 vec_first_match_index(vector unsigned short __a, vector unsigned short __b) { 2642 vector unsigned long long __res = 2643 #ifdef __LITTLE_ENDIAN__ 2644 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2645 #else 2646 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2647 #endif 2648 if (__res[0] == 64) { 2649 return (__res[1] + 64) >> 4; 2650 } 2651 return __res[0] >> 4; 2652 } 2653 2654 static __inline__ unsigned __ATTRS_o_ai 2655 vec_first_match_index(vector signed int __a, vector signed int __b) { 2656 vector unsigned long long __res = 2657 #ifdef __LITTLE_ENDIAN__ 2658 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2659 #else 2660 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2661 #endif 2662 if (__res[0] == 64) { 2663 return (__res[1] + 64) >> 5; 2664 } 2665 return __res[0] >> 5; 2666 } 2667 2668 static __inline__ unsigned __ATTRS_o_ai 2669 vec_first_match_index(vector unsigned int __a, vector unsigned int __b) { 2670 vector unsigned long long __res = 2671 #ifdef __LITTLE_ENDIAN__ 2672 vec_cnttz((vector unsigned long long)vec_cmpeq(__a, __b)); 2673 #else 2674 vec_cntlz((vector unsigned long long)vec_cmpeq(__a, __b)); 2675 #endif 2676 if (__res[0] == 64) { 2677 return (__res[1] + 64) >> 5; 2678 } 2679 return __res[0] >> 5; 2680 } 2681 2682 /* vec_first_match_or_eos_index */ 2683 2684 static __inline__ unsigned __ATTRS_o_ai 2685 vec_first_match_or_eos_index(vector signed char __a, vector signed char __b) { 2686 /* Compare the result of the comparison of two vectors with either and OR the 2687 result. Either the elements are equal or one will equal the comparison 2688 result if either is zero. 2689 */ 2690 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2691 vector bool char __tmp2 = __tmp1 | 2692 vec_cmpeq((vector signed char)__tmp1, __a) | 2693 vec_cmpeq((vector signed char)__tmp1, __b); 2694 2695 vector unsigned long long __res = 2696 #ifdef __LITTLE_ENDIAN__ 2697 vec_cnttz((vector unsigned long long)__tmp2); 2698 #else 2699 vec_cntlz((vector unsigned long long)__tmp2); 2700 #endif 2701 if (__res[0] == 64) { 2702 return (__res[1] + 64) >> 3; 2703 } 2704 return __res[0] >> 3; 2705 } 2706 2707 static __inline__ unsigned __ATTRS_o_ai 2708 vec_first_match_or_eos_index(vector unsigned char __a, 2709 vector unsigned char __b) { 2710 vector bool char __tmp1 = vec_cmpeq(__a, __b); 2711 vector bool char __tmp2 = __tmp1 | 2712 vec_cmpeq((vector unsigned char)__tmp1, __a) | 2713 vec_cmpeq((vector unsigned char)__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) >> 3; 2723 } 2724 return __res[0] >> 3; 2725 } 2726 2727 static __inline__ unsigned __ATTRS_o_ai 2728 vec_first_match_or_eos_index(vector signed short __a, vector signed short __b) { 2729 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2730 vector bool short __tmp2 = __tmp1 | 2731 vec_cmpeq((vector signed short)__tmp1, __a) | 2732 vec_cmpeq((vector signed short)__tmp1, __b); 2733 2734 vector unsigned long long __res = 2735 #ifdef __LITTLE_ENDIAN__ 2736 vec_cnttz((vector unsigned long long)__tmp2); 2737 #else 2738 vec_cntlz((vector unsigned long long)__tmp2); 2739 #endif 2740 if (__res[0] == 64) { 2741 return (__res[1] + 64) >> 4; 2742 } 2743 return __res[0] >> 4; 2744 } 2745 2746 static __inline__ unsigned __ATTRS_o_ai 2747 vec_first_match_or_eos_index(vector unsigned short __a, 2748 vector unsigned short __b) { 2749 vector bool short __tmp1 = vec_cmpeq(__a, __b); 2750 vector bool short __tmp2 = __tmp1 | 2751 vec_cmpeq((vector unsigned short)__tmp1, __a) | 2752 vec_cmpeq((vector unsigned short)__tmp1, __b); 2753 2754 vector unsigned long long __res = 2755 #ifdef __LITTLE_ENDIAN__ 2756 vec_cnttz((vector unsigned long long)__tmp2); 2757 #else 2758 vec_cntlz((vector unsigned long long)__tmp2); 2759 #endif 2760 if (__res[0] == 64) { 2761 return (__res[1] + 64) >> 4; 2762 } 2763 return __res[0] >> 4; 2764 } 2765 2766 static __inline__ unsigned __ATTRS_o_ai 2767 vec_first_match_or_eos_index(vector signed int __a, vector signed int __b) { 2768 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2769 vector bool int __tmp2 = __tmp1 | vec_cmpeq((vector signed int)__tmp1, __a) | 2770 vec_cmpeq((vector signed 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 static __inline__ unsigned __ATTRS_o_ai 2785 vec_first_match_or_eos_index(vector unsigned int __a, vector unsigned int __b) { 2786 vector bool int __tmp1 = vec_cmpeq(__a, __b); 2787 vector bool int __tmp2 = __tmp1 | 2788 vec_cmpeq((vector unsigned int)__tmp1, __a) | 2789 vec_cmpeq((vector unsigned int)__tmp1, __b); 2790 2791 vector unsigned long long __res = 2792 #ifdef __LITTLE_ENDIAN__ 2793 vec_cnttz((vector unsigned long long)__tmp2); 2794 #else 2795 vec_cntlz((vector unsigned long long)__tmp2); 2796 #endif 2797 if (__res[0] == 64) { 2798 return (__res[1] + 64) >> 5; 2799 } 2800 return __res[0] >> 5; 2801 } 2802 2803 /* vec_first_mismatch_index */ 2804 2805 static __inline__ unsigned __ATTRS_o_ai 2806 vec_first_mismatch_index(vector signed char __a, vector signed char __b) { 2807 vector unsigned long long __res = 2808 #ifdef __LITTLE_ENDIAN__ 2809 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2810 #else 2811 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2812 #endif 2813 if (__res[0] == 64) { 2814 return (__res[1] + 64) >> 3; 2815 } 2816 return __res[0] >> 3; 2817 } 2818 2819 static __inline__ unsigned __ATTRS_o_ai 2820 vec_first_mismatch_index(vector unsigned char __a, vector unsigned char __b) { 2821 vector unsigned long long __res = 2822 #ifdef __LITTLE_ENDIAN__ 2823 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2824 #else 2825 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2826 #endif 2827 if (__res[0] == 64) { 2828 return (__res[1] + 64) >> 3; 2829 } 2830 return __res[0] >> 3; 2831 } 2832 2833 static __inline__ unsigned __ATTRS_o_ai 2834 vec_first_mismatch_index(vector signed short __a, vector signed short __b) { 2835 vector unsigned long long __res = 2836 #ifdef __LITTLE_ENDIAN__ 2837 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2838 #else 2839 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2840 #endif 2841 if (__res[0] == 64) { 2842 return (__res[1] + 64) >> 4; 2843 } 2844 return __res[0] >> 4; 2845 } 2846 2847 static __inline__ unsigned __ATTRS_o_ai 2848 vec_first_mismatch_index(vector unsigned short __a, vector unsigned short __b) { 2849 vector unsigned long long __res = 2850 #ifdef __LITTLE_ENDIAN__ 2851 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2852 #else 2853 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2854 #endif 2855 if (__res[0] == 64) { 2856 return (__res[1] + 64) >> 4; 2857 } 2858 return __res[0] >> 4; 2859 } 2860 2861 static __inline__ unsigned __ATTRS_o_ai 2862 vec_first_mismatch_index(vector signed int __a, vector signed int __b) { 2863 vector unsigned long long __res = 2864 #ifdef __LITTLE_ENDIAN__ 2865 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2866 #else 2867 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2868 #endif 2869 if (__res[0] == 64) { 2870 return (__res[1] + 64) >> 5; 2871 } 2872 return __res[0] >> 5; 2873 } 2874 2875 static __inline__ unsigned __ATTRS_o_ai 2876 vec_first_mismatch_index(vector unsigned int __a, vector unsigned int __b) { 2877 vector unsigned long long __res = 2878 #ifdef __LITTLE_ENDIAN__ 2879 vec_cnttz((vector unsigned long long)vec_cmpne(__a, __b)); 2880 #else 2881 vec_cntlz((vector unsigned long long)vec_cmpne(__a, __b)); 2882 #endif 2883 if (__res[0] == 64) { 2884 return (__res[1] + 64) >> 5; 2885 } 2886 return __res[0] >> 5; 2887 } 2888 2889 /* vec_first_mismatch_or_eos_index */ 2890 2891 static __inline__ unsigned __ATTRS_o_ai 2892 vec_first_mismatch_or_eos_index(vector signed char __a, 2893 vector signed char __b) { 2894 vector unsigned long long __res = 2895 #ifdef __LITTLE_ENDIAN__ 2896 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2897 #else 2898 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2899 #endif 2900 if (__res[0] == 64) { 2901 return (__res[1] + 64) >> 3; 2902 } 2903 return __res[0] >> 3; 2904 } 2905 2906 static __inline__ unsigned __ATTRS_o_ai 2907 vec_first_mismatch_or_eos_index(vector unsigned char __a, 2908 vector unsigned char __b) { 2909 vector unsigned long long __res = 2910 #ifdef __LITTLE_ENDIAN__ 2911 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2912 #else 2913 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2914 #endif 2915 if (__res[0] == 64) { 2916 return (__res[1] + 64) >> 3; 2917 } 2918 return __res[0] >> 3; 2919 } 2920 2921 static __inline__ unsigned __ATTRS_o_ai 2922 vec_first_mismatch_or_eos_index(vector signed short __a, 2923 vector signed short __b) { 2924 vector unsigned long long __res = 2925 #ifdef __LITTLE_ENDIAN__ 2926 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2927 #else 2928 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2929 #endif 2930 if (__res[0] == 64) { 2931 return (__res[1] + 64) >> 4; 2932 } 2933 return __res[0] >> 4; 2934 } 2935 2936 static __inline__ unsigned __ATTRS_o_ai 2937 vec_first_mismatch_or_eos_index(vector unsigned short __a, 2938 vector unsigned short __b) { 2939 vector unsigned long long __res = 2940 #ifdef __LITTLE_ENDIAN__ 2941 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2942 #else 2943 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2944 #endif 2945 if (__res[0] == 64) { 2946 return (__res[1] + 64) >> 4; 2947 } 2948 return __res[0] >> 4; 2949 } 2950 2951 static __inline__ unsigned __ATTRS_o_ai 2952 vec_first_mismatch_or_eos_index(vector signed int __a, vector signed int __b) { 2953 vector unsigned long long __res = 2954 #ifdef __LITTLE_ENDIAN__ 2955 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2956 #else 2957 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2958 #endif 2959 if (__res[0] == 64) { 2960 return (__res[1] + 64) >> 5; 2961 } 2962 return __res[0] >> 5; 2963 } 2964 2965 static __inline__ unsigned __ATTRS_o_ai 2966 vec_first_mismatch_or_eos_index(vector unsigned int __a, 2967 vector unsigned int __b) { 2968 vector unsigned long long __res = 2969 #ifdef __LITTLE_ENDIAN__ 2970 vec_cnttz((vector unsigned long long)vec_cmpnez(__a, __b)); 2971 #else 2972 vec_cntlz((vector unsigned long long)vec_cmpnez(__a, __b)); 2973 #endif 2974 if (__res[0] == 64) { 2975 return (__res[1] + 64) >> 5; 2976 } 2977 return __res[0] >> 5; 2978 } 2979 2980 static __inline__ vector double __ATTRS_o_ai 2981 vec_insert_exp(vector double __a, vector unsigned long long __b) { 2982 return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b); 2983 } 2984 2985 static __inline__ vector double __ATTRS_o_ai 2986 vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) { 2987 return __builtin_vsx_xviexpdp(__a,__b); 2988 } 2989 2990 static __inline__ vector float __ATTRS_o_ai 2991 vec_insert_exp(vector float __a, vector unsigned int __b) { 2992 return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b); 2993 } 2994 2995 static __inline__ vector float __ATTRS_o_ai 2996 vec_insert_exp(vector unsigned int __a, vector unsigned int __b) { 2997 return __builtin_vsx_xviexpsp(__a,__b); 2998 } 2999 3000 #if defined(__powerpc64__) 3001 static __inline__ vector signed char __ATTRS_o_ai vec_xl_len(const signed char *__a, 3002 size_t __b) { 3003 return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56)); 3004 } 3005 3006 static __inline__ vector unsigned char __ATTRS_o_ai 3007 vec_xl_len(const unsigned char *__a, size_t __b) { 3008 return (vector unsigned char)__builtin_vsx_lxvl(__a, (__b << 56)); 3009 } 3010 3011 static __inline__ vector signed short __ATTRS_o_ai vec_xl_len(const signed short *__a, 3012 size_t __b) { 3013 return (vector signed short)__builtin_vsx_lxvl(__a, (__b << 56)); 3014 } 3015 3016 static __inline__ vector unsigned short __ATTRS_o_ai 3017 vec_xl_len(const unsigned short *__a, size_t __b) { 3018 return (vector unsigned short)__builtin_vsx_lxvl(__a, (__b << 56)); 3019 } 3020 3021 static __inline__ vector signed int __ATTRS_o_ai vec_xl_len(const signed int *__a, 3022 size_t __b) { 3023 return (vector signed int)__builtin_vsx_lxvl(__a, (__b << 56)); 3024 } 3025 3026 static __inline__ vector unsigned int __ATTRS_o_ai vec_xl_len(const unsigned int *__a, 3027 size_t __b) { 3028 return (vector unsigned int)__builtin_vsx_lxvl(__a, (__b << 56)); 3029 } 3030 3031 static __inline__ vector float __ATTRS_o_ai vec_xl_len(const float *__a, size_t __b) { 3032 return (vector float)__builtin_vsx_lxvl(__a, (__b << 56)); 3033 } 3034 3035 #ifdef __SIZEOF_INT128__ 3036 static __inline__ vector signed __int128 __ATTRS_o_ai 3037 vec_xl_len(const signed __int128 *__a, size_t __b) { 3038 return (vector signed __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3039 } 3040 3041 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3042 vec_xl_len(const unsigned __int128 *__a, size_t __b) { 3043 return (vector unsigned __int128)__builtin_vsx_lxvl(__a, (__b << 56)); 3044 } 3045 #endif 3046 3047 static __inline__ vector signed long long __ATTRS_o_ai 3048 vec_xl_len(const signed long long *__a, size_t __b) { 3049 return (vector signed long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3050 } 3051 3052 static __inline__ vector unsigned long long __ATTRS_o_ai 3053 vec_xl_len(const unsigned long long *__a, size_t __b) { 3054 return (vector unsigned long long)__builtin_vsx_lxvl(__a, (__b << 56)); 3055 } 3056 3057 static __inline__ vector double __ATTRS_o_ai vec_xl_len(const double *__a, 3058 size_t __b) { 3059 return (vector double)__builtin_vsx_lxvl(__a, (__b << 56)); 3060 } 3061 3062 static __inline__ vector unsigned char __ATTRS_o_ai 3063 vec_xl_len_r(const unsigned char *__a, size_t __b) { 3064 vector unsigned char __res = 3065 (vector unsigned char)__builtin_vsx_lxvll(__a, (__b << 56)); 3066 vector unsigned char __mask = 3067 (vector unsigned char)__builtin_altivec_lvsr(16 - __b, (int *)NULL); 3068 return (vector unsigned char)__builtin_altivec_vperm_4si( 3069 (vector int)__res, (vector int)__res, __mask); 3070 } 3071 3072 // vec_xst_len 3073 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned char __a, 3074 unsigned char *__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 char __a, 3080 signed char *__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 signed short __a, 3085 signed short *__b, size_t __c) { 3086 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3087 } 3088 3089 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned short __a, 3090 unsigned short *__b, 3091 size_t __c) { 3092 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3093 } 3094 3095 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed int __a, 3096 signed int *__b, size_t __c) { 3097 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3098 } 3099 3100 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned int __a, 3101 unsigned int *__b, size_t __c) { 3102 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3103 } 3104 3105 static __inline__ void __ATTRS_o_ai vec_xst_len(vector float __a, float *__b, 3106 size_t __c) { 3107 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3108 } 3109 3110 #ifdef __SIZEOF_INT128__ 3111 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed __int128 __a, 3112 signed __int128 *__b, 3113 size_t __c) { 3114 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3115 } 3116 3117 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned __int128 __a, 3118 unsigned __int128 *__b, 3119 size_t __c) { 3120 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3121 } 3122 #endif 3123 3124 static __inline__ void __ATTRS_o_ai vec_xst_len(vector signed long long __a, 3125 signed long long *__b, 3126 size_t __c) { 3127 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3128 } 3129 3130 static __inline__ void __ATTRS_o_ai vec_xst_len(vector unsigned long long __a, 3131 unsigned long long *__b, 3132 size_t __c) { 3133 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3134 } 3135 3136 static __inline__ void __ATTRS_o_ai vec_xst_len(vector double __a, double *__b, 3137 size_t __c) { 3138 return __builtin_vsx_stxvl((vector int)__a, __b, (__c << 56)); 3139 } 3140 3141 static __inline__ void __ATTRS_o_ai vec_xst_len_r(vector unsigned char __a, 3142 unsigned char *__b, 3143 size_t __c) { 3144 vector unsigned char __mask = 3145 (vector unsigned char)__builtin_altivec_lvsl(16 - __c, (int *)NULL); 3146 vector unsigned char __res = 3147 __builtin_altivec_vperm_4si((vector int)__a, (vector int)__a, __mask); 3148 return __builtin_vsx_stxvll((vector int)__res, __b, (__c << 56)); 3149 } 3150 #endif 3151 #endif 3152 3153 #if defined(__POWER9_VECTOR__) && defined(__powerpc64__) 3154 #define __vec_ldrmb(PTR, CNT) vec_xl_len_r((const unsigned char *)(PTR), (CNT)) 3155 #define __vec_strmb(PTR, CNT, VAL) \ 3156 vec_xst_len_r((VAL), (unsigned char *)(PTR), (CNT)) 3157 #else 3158 #define __vec_ldrmb __builtin_vsx_ldrmb 3159 #define __vec_strmb __builtin_vsx_strmb 3160 #endif 3161 3162 /* vec_cpsgn */ 3163 3164 #ifdef __VSX__ 3165 static __inline__ vector float __ATTRS_o_ai vec_cpsgn(vector float __a, 3166 vector float __b) { 3167 return __builtin_vsx_xvcpsgnsp(__b, __a); 3168 } 3169 3170 static __inline__ vector double __ATTRS_o_ai vec_cpsgn(vector double __a, 3171 vector double __b) { 3172 return __builtin_vsx_xvcpsgndp(__b, __a); 3173 } 3174 #endif 3175 3176 /* vec_ctf */ 3177 3178 #ifdef __VSX__ 3179 // There are some functions that have different signatures with the XL compiler 3180 // from those in Clang/GCC and documented in the PVIPR. This macro ensures that 3181 // the XL-compatible signatures are used for those functions. 3182 #ifdef __XL_COMPAT_ALTIVEC__ 3183 #define vec_ctf(__a, __b) \ 3184 _Generic((__a), vector int \ 3185 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3186 vector unsigned int \ 3187 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3188 (__b)), \ 3189 vector unsigned long long \ 3190 : (__builtin_vsx_xvcvuxdsp((vector unsigned long long)(__a)) * \ 3191 (vector float)(vector unsigned)((0x7f - (__b)) << 23)), \ 3192 vector signed long long \ 3193 : (__builtin_vsx_xvcvsxdsp((vector signed long long)(__a)) * \ 3194 (vector float)(vector unsigned)((0x7f - (__b)) << 23))) 3195 #else // __XL_COMPAT_ALTIVEC__ 3196 #define vec_ctf(__a, __b) \ 3197 _Generic((__a), vector int \ 3198 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3199 vector unsigned int \ 3200 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3201 (__b)), \ 3202 vector unsigned long long \ 3203 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3204 vector double) * \ 3205 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3206 << 52)), \ 3207 vector signed long long \ 3208 : (__builtin_convertvector((vector signed long long)(__a), \ 3209 vector double) * \ 3210 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3211 << 52))) 3212 #endif // __XL_COMPAT_ALTIVEC__ 3213 #else 3214 #define vec_ctf(__a, __b) \ 3215 _Generic((__a), vector int \ 3216 : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)), \ 3217 vector unsigned int \ 3218 : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a), \ 3219 (__b))) 3220 #endif 3221 3222 /* vec_ctd */ 3223 #ifdef __VSX__ 3224 #define vec_ctd(__a, __b) \ 3225 _Generic((__a), vector signed int \ 3226 : (vec_doublee((vector signed int)(__a)) * \ 3227 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3228 << 52)), \ 3229 vector unsigned int \ 3230 : (vec_doublee((vector unsigned int)(__a)) * \ 3231 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3232 << 52)), \ 3233 vector unsigned long long \ 3234 : (__builtin_convertvector((vector unsigned long long)(__a), \ 3235 vector double) * \ 3236 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3237 << 52)), \ 3238 vector signed long long \ 3239 : (__builtin_convertvector((vector signed long long)(__a), \ 3240 vector double) * \ 3241 (vector double)(vector unsigned long long)((0x3ffULL - (__b)) \ 3242 << 52))) 3243 #endif // __VSX__ 3244 3245 /* vec_vcfsx */ 3246 3247 #define vec_vcfux __builtin_altivec_vcfux 3248 /* vec_vcfux */ 3249 3250 #define vec_vcfsx(__a, __b) __builtin_altivec_vcfsx((vector int)(__a), (__b)) 3251 3252 /* vec_cts */ 3253 3254 #ifdef __VSX__ 3255 #ifdef __XL_COMPAT_ALTIVEC__ 3256 #define vec_cts(__a, __b) \ 3257 _Generic((__a), vector float \ 3258 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3259 vector double \ 3260 : __extension__({ \ 3261 vector double __ret = \ 3262 (vector double)(__a) * \ 3263 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3264 << 52); \ 3265 __builtin_vsx_xvcvdpsxws(__ret); \ 3266 })) 3267 #else // __XL_COMPAT_ALTIVEC__ 3268 #define vec_cts(__a, __b) \ 3269 _Generic((__a), vector float \ 3270 : __builtin_altivec_vctsxs((vector float)(__a), (__b)), \ 3271 vector double \ 3272 : __extension__({ \ 3273 vector double __ret = \ 3274 (vector double)(__a) * \ 3275 (vector double)(vector unsigned long long)((0x3ffULL + (__b)) \ 3276 << 52); \ 3277 __builtin_convertvector(__ret, vector signed long long); \ 3278 })) 3279 #endif // __XL_COMPAT_ALTIVEC__ 3280 #else 3281 #define vec_cts __builtin_altivec_vctsxs 3282 #endif 3283 3284 /* vec_vctsxs */ 3285 3286 #define vec_vctsxs __builtin_altivec_vctsxs 3287 3288 /* vec_ctu */ 3289 3290 #ifdef __VSX__ 3291 #ifdef __XL_COMPAT_ALTIVEC__ 3292 #define vec_ctu(__a, __b) \ 3293 _Generic((__a), vector float \ 3294 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3295 vector double \ 3296 : __extension__({ \ 3297 vector double __ret = \ 3298 (vector double)(__a) * \ 3299 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3300 << 52); \ 3301 __builtin_vsx_xvcvdpuxws(__ret); \ 3302 })) 3303 #else // __XL_COMPAT_ALTIVEC__ 3304 #define vec_ctu(__a, __b) \ 3305 _Generic((__a), vector float \ 3306 : __builtin_altivec_vctuxs((vector float)(__a), (__b)), \ 3307 vector double \ 3308 : __extension__({ \ 3309 vector double __ret = \ 3310 (vector double)(__a) * \ 3311 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3312 << 52); \ 3313 __builtin_convertvector(__ret, vector unsigned long long); \ 3314 })) 3315 #endif // __XL_COMPAT_ALTIVEC__ 3316 #else 3317 #define vec_ctu __builtin_altivec_vctuxs 3318 #endif 3319 3320 #ifdef __LITTLE_ENDIAN__ 3321 /* vec_ctsl */ 3322 3323 #ifdef __VSX__ 3324 #define vec_ctsl(__a, __b) \ 3325 _Generic((__a), vector float \ 3326 : __extension__({ \ 3327 vector float __ret = \ 3328 (vector float)(__a) * \ 3329 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3330 __builtin_vsx_xvcvspsxds( \ 3331 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 3332 }), \ 3333 vector double \ 3334 : __extension__({ \ 3335 vector double __ret = \ 3336 (vector double)(__a) * \ 3337 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3338 << 52); \ 3339 __builtin_convertvector(__ret, vector signed long long); \ 3340 })) 3341 3342 /* vec_ctul */ 3343 3344 #define vec_ctul(__a, __b) \ 3345 _Generic((__a), vector float \ 3346 : __extension__({ \ 3347 vector float __ret = \ 3348 (vector float)(__a) * \ 3349 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3350 __builtin_vsx_xvcvspuxds( \ 3351 __builtin_vsx_xxsldwi(__ret, __ret, 1)); \ 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 unsigned long long); \ 3360 })) 3361 #endif 3362 #else // __LITTLE_ENDIAN__ 3363 /* vec_ctsl */ 3364 3365 #ifdef __VSX__ 3366 #define vec_ctsl(__a, __b) \ 3367 _Generic((__a), vector float \ 3368 : __extension__({ \ 3369 vector float __ret = \ 3370 (vector float)(__a) * \ 3371 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3372 __builtin_vsx_xvcvspsxds(__ret); \ 3373 }), \ 3374 vector double \ 3375 : __extension__({ \ 3376 vector double __ret = \ 3377 (vector double)(__a) * \ 3378 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3379 << 52); \ 3380 __builtin_convertvector(__ret, vector signed long long); \ 3381 })) 3382 3383 /* vec_ctul */ 3384 3385 #define vec_ctul(__a, __b) \ 3386 _Generic((__a), vector float \ 3387 : __extension__({ \ 3388 vector float __ret = \ 3389 (vector float)(__a) * \ 3390 (vector float)(vector unsigned)((0x7f + (__b)) << 23); \ 3391 __builtin_vsx_xvcvspuxds(__ret); \ 3392 }), \ 3393 vector double \ 3394 : __extension__({ \ 3395 vector double __ret = \ 3396 (vector double)(__a) * \ 3397 (vector double)(vector unsigned long long)((0x3ffULL + __b) \ 3398 << 52); \ 3399 __builtin_convertvector(__ret, vector unsigned long long); \ 3400 })) 3401 #endif 3402 #endif // __LITTLE_ENDIAN__ 3403 3404 /* vec_vctuxs */ 3405 3406 #define vec_vctuxs __builtin_altivec_vctuxs 3407 3408 /* vec_signext */ 3409 3410 #ifdef __POWER9_VECTOR__ 3411 static __inline__ vector signed int __ATTRS_o_ai 3412 vec_signexti(vector signed char __a) { 3413 return __builtin_altivec_vextsb2w(__a); 3414 } 3415 3416 static __inline__ vector signed int __ATTRS_o_ai 3417 vec_signexti(vector signed short __a) { 3418 return __builtin_altivec_vextsh2w(__a); 3419 } 3420 3421 static __inline__ vector signed long long __ATTRS_o_ai 3422 vec_signextll(vector signed char __a) { 3423 return __builtin_altivec_vextsb2d(__a); 3424 } 3425 3426 static __inline__ vector signed long long __ATTRS_o_ai 3427 vec_signextll(vector signed short __a) { 3428 return __builtin_altivec_vextsh2d(__a); 3429 } 3430 3431 static __inline__ vector signed long long __ATTRS_o_ai 3432 vec_signextll(vector signed int __a) { 3433 return __builtin_altivec_vextsw2d(__a); 3434 } 3435 #endif 3436 3437 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3438 static __inline__ vector signed __int128 __ATTRS_o_ai 3439 vec_signextq(vector signed long long __a) { 3440 return __builtin_altivec_vextsd2q(__a); 3441 } 3442 #endif 3443 3444 /* vec_signed */ 3445 3446 static __inline__ vector signed int __ATTRS_o_ai 3447 vec_sld(vector signed int, vector signed int, unsigned const int __c); 3448 3449 static __inline__ vector signed int __ATTRS_o_ai 3450 vec_signed(vector float __a) { 3451 return __builtin_convertvector(__a, vector signed int); 3452 } 3453 3454 #ifdef __VSX__ 3455 static __inline__ vector signed long long __ATTRS_o_ai 3456 vec_signed(vector double __a) { 3457 return __builtin_convertvector(__a, vector signed long long); 3458 } 3459 3460 static __inline__ vector signed int __attribute__((__always_inline__)) 3461 vec_signed2(vector double __a, vector double __b) { 3462 return (vector signed int) { __a[0], __a[1], __b[0], __b[1] }; 3463 } 3464 3465 static __inline__ vector signed int __ATTRS_o_ai 3466 vec_signede(vector double __a) { 3467 #ifdef __LITTLE_ENDIAN__ 3468 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3469 return vec_sld(__ret, __ret, 12); 3470 #else 3471 return __builtin_vsx_xvcvdpsxws(__a); 3472 #endif 3473 } 3474 3475 static __inline__ vector signed int __ATTRS_o_ai 3476 vec_signedo(vector double __a) { 3477 #ifdef __LITTLE_ENDIAN__ 3478 return __builtin_vsx_xvcvdpsxws(__a); 3479 #else 3480 vector signed int __ret = __builtin_vsx_xvcvdpsxws(__a); 3481 return vec_sld(__ret, __ret, 12); 3482 #endif 3483 } 3484 #endif 3485 3486 /* vec_unsigned */ 3487 3488 static __inline__ vector unsigned int __ATTRS_o_ai 3489 vec_sld(vector unsigned int, vector unsigned int, unsigned const int __c); 3490 3491 static __inline__ vector unsigned int __ATTRS_o_ai 3492 vec_unsigned(vector float __a) { 3493 return __builtin_convertvector(__a, vector unsigned int); 3494 } 3495 3496 #ifdef __VSX__ 3497 static __inline__ vector unsigned long long __ATTRS_o_ai 3498 vec_unsigned(vector double __a) { 3499 return __builtin_convertvector(__a, vector unsigned long long); 3500 } 3501 3502 static __inline__ vector unsigned int __attribute__((__always_inline__)) 3503 vec_unsigned2(vector double __a, vector double __b) { 3504 return (vector unsigned int) { __a[0], __a[1], __b[0], __b[1] }; 3505 } 3506 3507 static __inline__ vector unsigned int __ATTRS_o_ai 3508 vec_unsignede(vector double __a) { 3509 #ifdef __LITTLE_ENDIAN__ 3510 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3511 return vec_sld(__ret, __ret, 12); 3512 #else 3513 return __builtin_vsx_xvcvdpuxws(__a); 3514 #endif 3515 } 3516 3517 static __inline__ vector unsigned int __ATTRS_o_ai 3518 vec_unsignedo(vector double __a) { 3519 #ifdef __LITTLE_ENDIAN__ 3520 return __builtin_vsx_xvcvdpuxws(__a); 3521 #else 3522 vector unsigned int __ret = __builtin_vsx_xvcvdpuxws(__a); 3523 return vec_sld(__ret, __ret, 12); 3524 #endif 3525 } 3526 #endif 3527 3528 /* vec_float */ 3529 3530 static __inline__ vector float __ATTRS_o_ai 3531 vec_sld(vector float, vector float, unsigned const int __c); 3532 3533 static __inline__ vector float __ATTRS_o_ai 3534 vec_float(vector signed int __a) { 3535 return __builtin_convertvector(__a, vector float); 3536 } 3537 3538 static __inline__ vector float __ATTRS_o_ai 3539 vec_float(vector unsigned int __a) { 3540 return __builtin_convertvector(__a, vector float); 3541 } 3542 3543 #ifdef __VSX__ 3544 static __inline__ vector float __ATTRS_o_ai 3545 vec_float2(vector signed long long __a, vector signed long long __b) { 3546 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3547 } 3548 3549 static __inline__ vector float __ATTRS_o_ai 3550 vec_float2(vector unsigned long long __a, vector unsigned long long __b) { 3551 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3552 } 3553 3554 static __inline__ vector float __ATTRS_o_ai 3555 vec_float2(vector double __a, vector double __b) { 3556 return (vector float) { __a[0], __a[1], __b[0], __b[1] }; 3557 } 3558 3559 static __inline__ vector float __ATTRS_o_ai 3560 vec_floate(vector signed long long __a) { 3561 #ifdef __LITTLE_ENDIAN__ 3562 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3563 return vec_sld(__ret, __ret, 12); 3564 #else 3565 return __builtin_vsx_xvcvsxdsp(__a); 3566 #endif 3567 } 3568 3569 static __inline__ vector float __ATTRS_o_ai 3570 vec_floate(vector unsigned long long __a) { 3571 #ifdef __LITTLE_ENDIAN__ 3572 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3573 return vec_sld(__ret, __ret, 12); 3574 #else 3575 return __builtin_vsx_xvcvuxdsp(__a); 3576 #endif 3577 } 3578 3579 static __inline__ vector float __ATTRS_o_ai 3580 vec_floate(vector double __a) { 3581 #ifdef __LITTLE_ENDIAN__ 3582 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3583 return vec_sld(__ret, __ret, 12); 3584 #else 3585 return __builtin_vsx_xvcvdpsp(__a); 3586 #endif 3587 } 3588 3589 static __inline__ vector float __ATTRS_o_ai 3590 vec_floato(vector signed long long __a) { 3591 #ifdef __LITTLE_ENDIAN__ 3592 return __builtin_vsx_xvcvsxdsp(__a); 3593 #else 3594 vector float __ret = __builtin_vsx_xvcvsxdsp(__a); 3595 return vec_sld(__ret, __ret, 12); 3596 #endif 3597 } 3598 3599 static __inline__ vector float __ATTRS_o_ai 3600 vec_floato(vector unsigned long long __a) { 3601 #ifdef __LITTLE_ENDIAN__ 3602 return __builtin_vsx_xvcvuxdsp(__a); 3603 #else 3604 vector float __ret = __builtin_vsx_xvcvuxdsp(__a); 3605 return vec_sld(__ret, __ret, 12); 3606 #endif 3607 } 3608 3609 static __inline__ vector float __ATTRS_o_ai 3610 vec_floato(vector double __a) { 3611 #ifdef __LITTLE_ENDIAN__ 3612 return __builtin_vsx_xvcvdpsp(__a); 3613 #else 3614 vector float __ret = __builtin_vsx_xvcvdpsp(__a); 3615 return vec_sld(__ret, __ret, 12); 3616 #endif 3617 } 3618 #endif 3619 3620 /* vec_double */ 3621 3622 #ifdef __VSX__ 3623 static __inline__ vector double __ATTRS_o_ai 3624 vec_double(vector signed long long __a) { 3625 return __builtin_convertvector(__a, vector double); 3626 } 3627 3628 static __inline__ vector double __ATTRS_o_ai 3629 vec_double(vector unsigned long long __a) { 3630 return __builtin_convertvector(__a, vector double); 3631 } 3632 3633 static __inline__ vector double __ATTRS_o_ai 3634 vec_doublee(vector signed int __a) { 3635 #ifdef __LITTLE_ENDIAN__ 3636 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3637 #else 3638 return __builtin_vsx_xvcvsxwdp(__a); 3639 #endif 3640 } 3641 3642 static __inline__ vector double __ATTRS_o_ai 3643 vec_doublee(vector unsigned int __a) { 3644 #ifdef __LITTLE_ENDIAN__ 3645 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3646 #else 3647 return __builtin_vsx_xvcvuxwdp(__a); 3648 #endif 3649 } 3650 3651 static __inline__ vector double __ATTRS_o_ai 3652 vec_doublee(vector float __a) { 3653 #ifdef __LITTLE_ENDIAN__ 3654 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3655 #else 3656 return __builtin_vsx_xvcvspdp(__a); 3657 #endif 3658 } 3659 3660 static __inline__ vector double __ATTRS_o_ai 3661 vec_doubleh(vector signed int __a) { 3662 vector double __ret = {__a[0], __a[1]}; 3663 return __ret; 3664 } 3665 3666 static __inline__ vector double __ATTRS_o_ai 3667 vec_doubleh(vector unsigned int __a) { 3668 vector double __ret = {__a[0], __a[1]}; 3669 return __ret; 3670 } 3671 3672 static __inline__ vector double __ATTRS_o_ai 3673 vec_doubleh(vector float __a) { 3674 vector double __ret = {__a[0], __a[1]}; 3675 return __ret; 3676 } 3677 3678 static __inline__ vector double __ATTRS_o_ai 3679 vec_doublel(vector signed int __a) { 3680 vector double __ret = {__a[2], __a[3]}; 3681 return __ret; 3682 } 3683 3684 static __inline__ vector double __ATTRS_o_ai 3685 vec_doublel(vector unsigned int __a) { 3686 vector double __ret = {__a[2], __a[3]}; 3687 return __ret; 3688 } 3689 3690 static __inline__ vector double __ATTRS_o_ai 3691 vec_doublel(vector float __a) { 3692 vector double __ret = {__a[2], __a[3]}; 3693 return __ret; 3694 } 3695 3696 static __inline__ vector double __ATTRS_o_ai 3697 vec_doubleo(vector signed int __a) { 3698 #ifdef __LITTLE_ENDIAN__ 3699 return __builtin_vsx_xvcvsxwdp(__a); 3700 #else 3701 return __builtin_vsx_xvcvsxwdp(vec_sld(__a, __a, 4)); 3702 #endif 3703 } 3704 3705 static __inline__ vector double __ATTRS_o_ai 3706 vec_doubleo(vector unsigned int __a) { 3707 #ifdef __LITTLE_ENDIAN__ 3708 return __builtin_vsx_xvcvuxwdp(__a); 3709 #else 3710 return __builtin_vsx_xvcvuxwdp(vec_sld(__a, __a, 4)); 3711 #endif 3712 } 3713 3714 static __inline__ vector double __ATTRS_o_ai 3715 vec_doubleo(vector float __a) { 3716 #ifdef __LITTLE_ENDIAN__ 3717 return __builtin_vsx_xvcvspdp(__a); 3718 #else 3719 return __builtin_vsx_xvcvspdp(vec_sld(__a, __a, 4)); 3720 #endif 3721 } 3722 3723 /* vec_cvf */ 3724 static __inline__ vector double __ATTRS_o_ai vec_cvf(vector float __a) { 3725 return vec_doublee(__a); 3726 } 3727 3728 static __inline__ vector float __ATTRS_o_ai vec_cvf(vector double __a) { 3729 return vec_floate(__a); 3730 } 3731 #endif 3732 3733 /* vec_div */ 3734 3735 /* Integer vector divides (vectors are scalarized, elements divided 3736 and the vectors reassembled). 3737 */ 3738 static __inline__ vector signed char __ATTRS_o_ai 3739 vec_div(vector signed char __a, vector signed char __b) { 3740 return __a / __b; 3741 } 3742 3743 static __inline__ vector unsigned char __ATTRS_o_ai 3744 vec_div(vector unsigned char __a, vector unsigned char __b) { 3745 return __a / __b; 3746 } 3747 3748 static __inline__ vector signed short __ATTRS_o_ai 3749 vec_div(vector signed short __a, vector signed short __b) { 3750 return __a / __b; 3751 } 3752 3753 static __inline__ vector unsigned short __ATTRS_o_ai 3754 vec_div(vector unsigned short __a, vector unsigned short __b) { 3755 return __a / __b; 3756 } 3757 3758 static __inline__ vector signed int __ATTRS_o_ai 3759 vec_div(vector signed int __a, vector signed int __b) { 3760 return __a / __b; 3761 } 3762 3763 static __inline__ vector unsigned int __ATTRS_o_ai 3764 vec_div(vector unsigned int __a, vector unsigned int __b) { 3765 return __a / __b; 3766 } 3767 3768 #ifdef __VSX__ 3769 static __inline__ vector signed long long __ATTRS_o_ai 3770 vec_div(vector signed long long __a, vector signed long long __b) { 3771 return __a / __b; 3772 } 3773 3774 static __inline__ vector unsigned long long __ATTRS_o_ai 3775 vec_div(vector unsigned long long __a, vector unsigned long long __b) { 3776 return __a / __b; 3777 } 3778 3779 static __inline__ vector float __ATTRS_o_ai vec_div(vector float __a, 3780 vector float __b) { 3781 return __a / __b; 3782 } 3783 3784 static __inline__ vector double __ATTRS_o_ai vec_div(vector double __a, 3785 vector double __b) { 3786 return __a / __b; 3787 } 3788 #endif 3789 3790 /* vec_dive */ 3791 3792 #ifdef __POWER10_VECTOR__ 3793 static __inline__ vector signed int __ATTRS_o_ai 3794 vec_dive(vector signed int __a, vector signed int __b) { 3795 return __builtin_altivec_vdivesw(__a, __b); 3796 } 3797 3798 static __inline__ vector unsigned int __ATTRS_o_ai 3799 vec_dive(vector unsigned int __a, vector unsigned int __b) { 3800 return __builtin_altivec_vdiveuw(__a, __b); 3801 } 3802 3803 static __inline__ vector signed long long __ATTRS_o_ai 3804 vec_dive(vector signed long long __a, vector signed long long __b) { 3805 return __builtin_altivec_vdivesd(__a, __b); 3806 } 3807 3808 static __inline__ vector unsigned long long __ATTRS_o_ai 3809 vec_dive(vector unsigned long long __a, vector unsigned long long __b) { 3810 return __builtin_altivec_vdiveud(__a, __b); 3811 } 3812 3813 #ifdef __SIZEOF_INT128__ 3814 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3815 vec_dive(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3816 return __builtin_altivec_vdiveuq(__a, __b); 3817 } 3818 3819 static __inline__ vector signed __int128 __ATTRS_o_ai 3820 vec_dive(vector signed __int128 __a, vector signed __int128 __b) { 3821 return __builtin_altivec_vdivesq(__a, __b); 3822 } 3823 #endif 3824 #endif 3825 3826 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 3827 static __inline__ vector unsigned __int128 __ATTRS_o_ai 3828 vec_div(vector unsigned __int128 __a, vector unsigned __int128 __b) { 3829 return __a / __b; 3830 } 3831 3832 static __inline__ vector signed __int128 __ATTRS_o_ai 3833 vec_div(vector signed __int128 __a, vector signed __int128 __b) { 3834 return __a / __b; 3835 } 3836 #endif /* __POWER10_VECTOR__ */ 3837 3838 /* vec_xvtdiv */ 3839 3840 #ifdef __VSX__ 3841 static __inline__ int __ATTRS_o_ai vec_test_swdiv(vector double __a, 3842 vector double __b) { 3843 return __builtin_vsx_xvtdivdp(__a, __b); 3844 } 3845 3846 static __inline__ int __ATTRS_o_ai vec_test_swdivs(vector float __a, 3847 vector float __b) { 3848 return __builtin_vsx_xvtdivsp(__a, __b); 3849 } 3850 #endif 3851 3852 /* vec_dss */ 3853 3854 #define vec_dss __builtin_altivec_dss 3855 3856 /* vec_dssall */ 3857 3858 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) { 3859 __builtin_altivec_dssall(); 3860 } 3861 3862 /* vec_dst */ 3863 #define vec_dst(__PTR, __CW, __STR) \ 3864 __builtin_altivec_dst((const void *)(__PTR), (__CW), (__STR)) 3865 3866 /* vec_dstst */ 3867 #define vec_dstst(__PTR, __CW, __STR) \ 3868 __builtin_altivec_dstst((const void *)(__PTR), (__CW), (__STR)) 3869 3870 /* vec_dststt */ 3871 #define vec_dststt(__PTR, __CW, __STR) \ 3872 __builtin_altivec_dststt((const void *)(__PTR), (__CW), (__STR)) 3873 3874 /* vec_dstt */ 3875 #define vec_dstt(__PTR, __CW, __STR) \ 3876 __builtin_altivec_dstt((const void *)(__PTR), (__CW), (__STR)) 3877 3878 /* vec_eqv */ 3879 3880 #ifdef __POWER8_VECTOR__ 3881 static __inline__ vector signed char __ATTRS_o_ai 3882 vec_eqv(vector signed char __a, vector signed char __b) { 3883 return (vector signed char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3884 (vector unsigned int)__b); 3885 } 3886 3887 static __inline__ vector unsigned char __ATTRS_o_ai 3888 vec_eqv(vector unsigned char __a, vector unsigned char __b) { 3889 return (vector unsigned char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3890 (vector unsigned int)__b); 3891 } 3892 3893 static __inline__ vector bool char __ATTRS_o_ai vec_eqv(vector bool char __a, 3894 vector bool char __b) { 3895 return (vector bool char)__builtin_vsx_xxleqv((vector unsigned int)__a, 3896 (vector unsigned int)__b); 3897 } 3898 3899 static __inline__ vector signed short __ATTRS_o_ai 3900 vec_eqv(vector signed short __a, vector signed short __b) { 3901 return (vector signed short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3902 (vector unsigned int)__b); 3903 } 3904 3905 static __inline__ vector unsigned short __ATTRS_o_ai 3906 vec_eqv(vector unsigned short __a, vector unsigned short __b) { 3907 return (vector unsigned short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3908 (vector unsigned int)__b); 3909 } 3910 3911 static __inline__ vector bool short __ATTRS_o_ai 3912 vec_eqv(vector bool short __a, vector bool short __b) { 3913 return (vector bool short)__builtin_vsx_xxleqv((vector unsigned int)__a, 3914 (vector unsigned int)__b); 3915 } 3916 3917 static __inline__ vector signed int __ATTRS_o_ai 3918 vec_eqv(vector signed int __a, vector signed int __b) { 3919 return (vector signed int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3920 (vector unsigned int)__b); 3921 } 3922 3923 static __inline__ vector unsigned int __ATTRS_o_ai 3924 vec_eqv(vector unsigned int __a, vector unsigned int __b) { 3925 return __builtin_vsx_xxleqv(__a, __b); 3926 } 3927 3928 static __inline__ vector bool int __ATTRS_o_ai vec_eqv(vector bool int __a, 3929 vector bool int __b) { 3930 return (vector bool int)__builtin_vsx_xxleqv((vector unsigned int)__a, 3931 (vector unsigned int)__b); 3932 } 3933 3934 static __inline__ vector signed long long __ATTRS_o_ai 3935 vec_eqv(vector signed long long __a, vector signed long long __b) { 3936 return (vector signed long long)__builtin_vsx_xxleqv( 3937 (vector unsigned int)__a, (vector unsigned int)__b); 3938 } 3939 3940 static __inline__ vector unsigned long long __ATTRS_o_ai 3941 vec_eqv(vector unsigned long long __a, vector unsigned long long __b) { 3942 return (vector unsigned long long)__builtin_vsx_xxleqv( 3943 (vector unsigned int)__a, (vector unsigned int)__b); 3944 } 3945 3946 static __inline__ vector bool long long __ATTRS_o_ai 3947 vec_eqv(vector bool long long __a, vector bool long long __b) { 3948 return (vector bool long long)__builtin_vsx_xxleqv((vector unsigned int)__a, 3949 (vector unsigned int)__b); 3950 } 3951 3952 static __inline__ vector float __ATTRS_o_ai vec_eqv(vector float __a, 3953 vector float __b) { 3954 return (vector float)__builtin_vsx_xxleqv((vector unsigned int)__a, 3955 (vector unsigned int)__b); 3956 } 3957 3958 static __inline__ vector double __ATTRS_o_ai vec_eqv(vector double __a, 3959 vector double __b) { 3960 return (vector double)__builtin_vsx_xxleqv((vector unsigned int)__a, 3961 (vector unsigned int)__b); 3962 } 3963 #endif 3964 3965 /* vec_expte */ 3966 3967 static __inline__ vector float __attribute__((__always_inline__)) 3968 vec_expte(vector float __a) { 3969 return __builtin_altivec_vexptefp(__a); 3970 } 3971 3972 /* vec_vexptefp */ 3973 3974 static __inline__ vector float __attribute__((__always_inline__)) 3975 vec_vexptefp(vector float __a) { 3976 return __builtin_altivec_vexptefp(__a); 3977 } 3978 3979 /* vec_floor */ 3980 3981 static __inline__ vector float __ATTRS_o_ai vec_floor(vector float __a) { 3982 #ifdef __VSX__ 3983 return __builtin_vsx_xvrspim(__a); 3984 #else 3985 return __builtin_altivec_vrfim(__a); 3986 #endif 3987 } 3988 3989 #ifdef __VSX__ 3990 static __inline__ vector double __ATTRS_o_ai vec_floor(vector double __a) { 3991 return __builtin_vsx_xvrdpim(__a); 3992 } 3993 #endif 3994 3995 /* vec_roundm */ 3996 static __inline__ vector float __ATTRS_o_ai vec_roundm(vector float __a) { 3997 return vec_floor(__a); 3998 } 3999 4000 #ifdef __VSX__ 4001 static __inline__ vector double __ATTRS_o_ai vec_roundm(vector double __a) { 4002 return vec_floor(__a); 4003 } 4004 #endif 4005 4006 /* vec_vrfim */ 4007 4008 static __inline__ vector float __attribute__((__always_inline__)) 4009 vec_vrfim(vector float __a) { 4010 return __builtin_altivec_vrfim(__a); 4011 } 4012 4013 /* vec_ld */ 4014 4015 static __inline__ vector signed char __ATTRS_o_ai 4016 vec_ld(long __a, const vector signed char *__b) { 4017 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4018 } 4019 4020 static __inline__ vector signed char __ATTRS_o_ai 4021 vec_ld(long __a, const signed char *__b) { 4022 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4023 } 4024 4025 static __inline__ vector unsigned char __ATTRS_o_ai 4026 vec_ld(long __a, const vector unsigned char *__b) { 4027 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4028 } 4029 4030 static __inline__ vector unsigned char __ATTRS_o_ai 4031 vec_ld(long __a, const unsigned char *__b) { 4032 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4033 } 4034 4035 static __inline__ vector bool char __ATTRS_o_ai 4036 vec_ld(long __a, const vector bool char *__b) { 4037 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4038 } 4039 4040 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, 4041 const vector short *__b) { 4042 return (vector short)__builtin_altivec_lvx(__a, __b); 4043 } 4044 4045 static __inline__ vector short __ATTRS_o_ai vec_ld(long __a, const short *__b) { 4046 return (vector short)__builtin_altivec_lvx(__a, __b); 4047 } 4048 4049 static __inline__ vector unsigned short __ATTRS_o_ai 4050 vec_ld(long __a, const vector unsigned short *__b) { 4051 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4052 } 4053 4054 static __inline__ vector unsigned short __ATTRS_o_ai 4055 vec_ld(long __a, const unsigned short *__b) { 4056 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4057 } 4058 4059 static __inline__ vector bool short __ATTRS_o_ai 4060 vec_ld(long __a, const vector bool short *__b) { 4061 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4062 } 4063 4064 static __inline__ vector pixel __ATTRS_o_ai vec_ld(long __a, 4065 const vector pixel *__b) { 4066 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4067 } 4068 4069 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, 4070 const vector int *__b) { 4071 return (vector int)__builtin_altivec_lvx(__a, __b); 4072 } 4073 4074 static __inline__ vector int __ATTRS_o_ai vec_ld(long __a, const int *__b) { 4075 return (vector int)__builtin_altivec_lvx(__a, __b); 4076 } 4077 4078 static __inline__ vector unsigned int __ATTRS_o_ai 4079 vec_ld(long __a, const vector unsigned int *__b) { 4080 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4081 } 4082 4083 static __inline__ vector unsigned int __ATTRS_o_ai 4084 vec_ld(long __a, const unsigned int *__b) { 4085 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4086 } 4087 4088 static __inline__ vector bool int __ATTRS_o_ai 4089 vec_ld(long __a, const vector bool int *__b) { 4090 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4091 } 4092 4093 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, 4094 const vector float *__b) { 4095 return (vector float)__builtin_altivec_lvx(__a, __b); 4096 } 4097 4098 static __inline__ vector float __ATTRS_o_ai vec_ld(long __a, const float *__b) { 4099 return (vector float)__builtin_altivec_lvx(__a, __b); 4100 } 4101 4102 /* vec_lvx */ 4103 4104 static __inline__ vector signed char __ATTRS_o_ai 4105 vec_lvx(long __a, const vector signed char *__b) { 4106 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4107 } 4108 4109 static __inline__ vector signed char __ATTRS_o_ai 4110 vec_lvx(long __a, const signed char *__b) { 4111 return (vector signed char)__builtin_altivec_lvx(__a, __b); 4112 } 4113 4114 static __inline__ vector unsigned char __ATTRS_o_ai 4115 vec_lvx(long __a, const vector unsigned char *__b) { 4116 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4117 } 4118 4119 static __inline__ vector unsigned char __ATTRS_o_ai 4120 vec_lvx(long __a, const unsigned char *__b) { 4121 return (vector unsigned char)__builtin_altivec_lvx(__a, __b); 4122 } 4123 4124 static __inline__ vector bool char __ATTRS_o_ai 4125 vec_lvx(long __a, const vector bool char *__b) { 4126 return (vector bool char)__builtin_altivec_lvx(__a, __b); 4127 } 4128 4129 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, 4130 const vector short *__b) { 4131 return (vector short)__builtin_altivec_lvx(__a, __b); 4132 } 4133 4134 static __inline__ vector short __ATTRS_o_ai vec_lvx(long __a, const short *__b) { 4135 return (vector short)__builtin_altivec_lvx(__a, __b); 4136 } 4137 4138 static __inline__ vector unsigned short __ATTRS_o_ai 4139 vec_lvx(long __a, const vector unsigned short *__b) { 4140 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4141 } 4142 4143 static __inline__ vector unsigned short __ATTRS_o_ai 4144 vec_lvx(long __a, const unsigned short *__b) { 4145 return (vector unsigned short)__builtin_altivec_lvx(__a, __b); 4146 } 4147 4148 static __inline__ vector bool short __ATTRS_o_ai 4149 vec_lvx(long __a, const vector bool short *__b) { 4150 return (vector bool short)__builtin_altivec_lvx(__a, __b); 4151 } 4152 4153 static __inline__ vector pixel __ATTRS_o_ai vec_lvx(long __a, 4154 const vector pixel *__b) { 4155 return (vector pixel)__builtin_altivec_lvx(__a, __b); 4156 } 4157 4158 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, 4159 const vector int *__b) { 4160 return (vector int)__builtin_altivec_lvx(__a, __b); 4161 } 4162 4163 static __inline__ vector int __ATTRS_o_ai vec_lvx(long __a, const int *__b) { 4164 return (vector int)__builtin_altivec_lvx(__a, __b); 4165 } 4166 4167 static __inline__ vector unsigned int __ATTRS_o_ai 4168 vec_lvx(long __a, const vector unsigned int *__b) { 4169 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4170 } 4171 4172 static __inline__ vector unsigned int __ATTRS_o_ai 4173 vec_lvx(long __a, const unsigned int *__b) { 4174 return (vector unsigned int)__builtin_altivec_lvx(__a, __b); 4175 } 4176 4177 static __inline__ vector bool int __ATTRS_o_ai 4178 vec_lvx(long __a, const vector bool int *__b) { 4179 return (vector bool int)__builtin_altivec_lvx(__a, __b); 4180 } 4181 4182 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, 4183 const vector float *__b) { 4184 return (vector float)__builtin_altivec_lvx(__a, __b); 4185 } 4186 4187 static __inline__ vector float __ATTRS_o_ai vec_lvx(long __a, const float *__b) { 4188 return (vector float)__builtin_altivec_lvx(__a, __b); 4189 } 4190 4191 /* vec_lde */ 4192 4193 static __inline__ vector signed char __ATTRS_o_ai 4194 vec_lde(long __a, const signed char *__b) { 4195 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4196 } 4197 4198 static __inline__ vector unsigned char __ATTRS_o_ai 4199 vec_lde(long __a, const unsigned char *__b) { 4200 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4201 } 4202 4203 static __inline__ vector short __ATTRS_o_ai vec_lde(long __a, const short *__b) { 4204 return (vector short)__builtin_altivec_lvehx(__a, __b); 4205 } 4206 4207 static __inline__ vector unsigned short __ATTRS_o_ai 4208 vec_lde(long __a, const unsigned short *__b) { 4209 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4210 } 4211 4212 static __inline__ vector int __ATTRS_o_ai vec_lde(long __a, const int *__b) { 4213 return (vector int)__builtin_altivec_lvewx(__a, __b); 4214 } 4215 4216 static __inline__ vector unsigned int __ATTRS_o_ai 4217 vec_lde(long __a, const unsigned int *__b) { 4218 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4219 } 4220 4221 static __inline__ vector float __ATTRS_o_ai vec_lde(long __a, const float *__b) { 4222 return (vector float)__builtin_altivec_lvewx(__a, __b); 4223 } 4224 4225 /* vec_lvebx */ 4226 4227 static __inline__ vector signed char __ATTRS_o_ai 4228 vec_lvebx(long __a, const signed char *__b) { 4229 return (vector signed char)__builtin_altivec_lvebx(__a, __b); 4230 } 4231 4232 static __inline__ vector unsigned char __ATTRS_o_ai 4233 vec_lvebx(long __a, const unsigned char *__b) { 4234 return (vector unsigned char)__builtin_altivec_lvebx(__a, __b); 4235 } 4236 4237 /* vec_lvehx */ 4238 4239 static __inline__ vector short __ATTRS_o_ai vec_lvehx(long __a, 4240 const short *__b) { 4241 return (vector short)__builtin_altivec_lvehx(__a, __b); 4242 } 4243 4244 static __inline__ vector unsigned short __ATTRS_o_ai 4245 vec_lvehx(long __a, const unsigned short *__b) { 4246 return (vector unsigned short)__builtin_altivec_lvehx(__a, __b); 4247 } 4248 4249 /* vec_lvewx */ 4250 4251 static __inline__ vector int __ATTRS_o_ai vec_lvewx(long __a, const int *__b) { 4252 return (vector int)__builtin_altivec_lvewx(__a, __b); 4253 } 4254 4255 static __inline__ vector unsigned int __ATTRS_o_ai 4256 vec_lvewx(long __a, const unsigned int *__b) { 4257 return (vector unsigned int)__builtin_altivec_lvewx(__a, __b); 4258 } 4259 4260 static __inline__ vector float __ATTRS_o_ai vec_lvewx(long __a, 4261 const float *__b) { 4262 return (vector float)__builtin_altivec_lvewx(__a, __b); 4263 } 4264 4265 /* vec_ldl */ 4266 4267 static __inline__ vector signed char __ATTRS_o_ai 4268 vec_ldl(long __a, const vector signed char *__b) { 4269 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4270 } 4271 4272 static __inline__ vector signed char __ATTRS_o_ai 4273 vec_ldl(long __a, const signed char *__b) { 4274 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4275 } 4276 4277 static __inline__ vector unsigned char __ATTRS_o_ai 4278 vec_ldl(long __a, const vector unsigned char *__b) { 4279 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4280 } 4281 4282 static __inline__ vector unsigned char __ATTRS_o_ai 4283 vec_ldl(long __a, const unsigned char *__b) { 4284 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4285 } 4286 4287 static __inline__ vector bool char __ATTRS_o_ai 4288 vec_ldl(long __a, const vector bool char *__b) { 4289 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4290 } 4291 4292 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, 4293 const vector short *__b) { 4294 return (vector short)__builtin_altivec_lvxl(__a, __b); 4295 } 4296 4297 static __inline__ vector short __ATTRS_o_ai vec_ldl(long __a, const short *__b) { 4298 return (vector short)__builtin_altivec_lvxl(__a, __b); 4299 } 4300 4301 static __inline__ vector unsigned short __ATTRS_o_ai 4302 vec_ldl(long __a, const vector unsigned short *__b) { 4303 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4304 } 4305 4306 static __inline__ vector unsigned short __ATTRS_o_ai 4307 vec_ldl(long __a, const unsigned short *__b) { 4308 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4309 } 4310 4311 static __inline__ vector bool short __ATTRS_o_ai 4312 vec_ldl(long __a, const vector bool short *__b) { 4313 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4314 } 4315 4316 static __inline__ vector pixel __ATTRS_o_ai vec_ldl(long __a, 4317 const vector pixel *__b) { 4318 return (vector pixel short)__builtin_altivec_lvxl(__a, __b); 4319 } 4320 4321 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, 4322 const vector int *__b) { 4323 return (vector int)__builtin_altivec_lvxl(__a, __b); 4324 } 4325 4326 static __inline__ vector int __ATTRS_o_ai vec_ldl(long __a, const int *__b) { 4327 return (vector int)__builtin_altivec_lvxl(__a, __b); 4328 } 4329 4330 static __inline__ vector unsigned int __ATTRS_o_ai 4331 vec_ldl(long __a, const vector unsigned int *__b) { 4332 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4333 } 4334 4335 static __inline__ vector unsigned int __ATTRS_o_ai 4336 vec_ldl(long __a, const unsigned int *__b) { 4337 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4338 } 4339 4340 static __inline__ vector bool int __ATTRS_o_ai 4341 vec_ldl(long __a, const vector bool int *__b) { 4342 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4343 } 4344 4345 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, 4346 const vector float *__b) { 4347 return (vector float)__builtin_altivec_lvxl(__a, __b); 4348 } 4349 4350 static __inline__ vector float __ATTRS_o_ai vec_ldl(long __a, const float *__b) { 4351 return (vector float)__builtin_altivec_lvxl(__a, __b); 4352 } 4353 4354 /* vec_lvxl */ 4355 4356 static __inline__ vector signed char __ATTRS_o_ai 4357 vec_lvxl(long __a, const vector signed char *__b) { 4358 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4359 } 4360 4361 static __inline__ vector signed char __ATTRS_o_ai 4362 vec_lvxl(long __a, const signed char *__b) { 4363 return (vector signed char)__builtin_altivec_lvxl(__a, __b); 4364 } 4365 4366 static __inline__ vector unsigned char __ATTRS_o_ai 4367 vec_lvxl(long __a, const vector unsigned char *__b) { 4368 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4369 } 4370 4371 static __inline__ vector unsigned char __ATTRS_o_ai 4372 vec_lvxl(long __a, const unsigned char *__b) { 4373 return (vector unsigned char)__builtin_altivec_lvxl(__a, __b); 4374 } 4375 4376 static __inline__ vector bool char __ATTRS_o_ai 4377 vec_lvxl(long __a, const vector bool char *__b) { 4378 return (vector bool char)__builtin_altivec_lvxl(__a, __b); 4379 } 4380 4381 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4382 const vector short *__b) { 4383 return (vector short)__builtin_altivec_lvxl(__a, __b); 4384 } 4385 4386 static __inline__ vector short __ATTRS_o_ai vec_lvxl(long __a, 4387 const short *__b) { 4388 return (vector short)__builtin_altivec_lvxl(__a, __b); 4389 } 4390 4391 static __inline__ vector unsigned short __ATTRS_o_ai 4392 vec_lvxl(long __a, const vector unsigned short *__b) { 4393 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4394 } 4395 4396 static __inline__ vector unsigned short __ATTRS_o_ai 4397 vec_lvxl(long __a, const unsigned short *__b) { 4398 return (vector unsigned short)__builtin_altivec_lvxl(__a, __b); 4399 } 4400 4401 static __inline__ vector bool short __ATTRS_o_ai 4402 vec_lvxl(long __a, const vector bool short *__b) { 4403 return (vector bool short)__builtin_altivec_lvxl(__a, __b); 4404 } 4405 4406 static __inline__ vector pixel __ATTRS_o_ai vec_lvxl(long __a, 4407 const vector pixel *__b) { 4408 return (vector pixel)__builtin_altivec_lvxl(__a, __b); 4409 } 4410 4411 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, 4412 const vector int *__b) { 4413 return (vector int)__builtin_altivec_lvxl(__a, __b); 4414 } 4415 4416 static __inline__ vector int __ATTRS_o_ai vec_lvxl(long __a, const int *__b) { 4417 return (vector int)__builtin_altivec_lvxl(__a, __b); 4418 } 4419 4420 static __inline__ vector unsigned int __ATTRS_o_ai 4421 vec_lvxl(long __a, const vector unsigned int *__b) { 4422 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4423 } 4424 4425 static __inline__ vector unsigned int __ATTRS_o_ai 4426 vec_lvxl(long __a, const unsigned int *__b) { 4427 return (vector unsigned int)__builtin_altivec_lvxl(__a, __b); 4428 } 4429 4430 static __inline__ vector bool int __ATTRS_o_ai 4431 vec_lvxl(long __a, const vector bool int *__b) { 4432 return (vector bool int)__builtin_altivec_lvxl(__a, __b); 4433 } 4434 4435 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4436 const vector float *__b) { 4437 return (vector float)__builtin_altivec_lvxl(__a, __b); 4438 } 4439 4440 static __inline__ vector float __ATTRS_o_ai vec_lvxl(long __a, 4441 const float *__b) { 4442 return (vector float)__builtin_altivec_lvxl(__a, __b); 4443 } 4444 4445 /* vec_loge */ 4446 4447 static __inline__ vector float __attribute__((__always_inline__)) 4448 vec_loge(vector float __a) { 4449 return __builtin_altivec_vlogefp(__a); 4450 } 4451 4452 /* vec_vlogefp */ 4453 4454 static __inline__ vector float __attribute__((__always_inline__)) 4455 vec_vlogefp(vector float __a) { 4456 return __builtin_altivec_vlogefp(__a); 4457 } 4458 4459 /* vec_lvsl */ 4460 4461 #ifdef __LITTLE_ENDIAN__ 4462 static __inline__ vector unsigned char __ATTRS_o_ai 4463 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4464 loads/stores"))) vec_lvsl(int __a, const signed char *__b) { 4465 vector unsigned char mask = 4466 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4467 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4468 7, 6, 5, 4, 3, 2, 1, 0}; 4469 return vec_perm(mask, mask, reverse); 4470 } 4471 #else 4472 static __inline__ vector unsigned char __ATTRS_o_ai 4473 vec_lvsl(int __a, const signed char *__b) { 4474 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4475 } 4476 #endif 4477 4478 #ifdef __LITTLE_ENDIAN__ 4479 static __inline__ vector unsigned char __ATTRS_o_ai 4480 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4481 loads/stores"))) vec_lvsl(int __a, const unsigned char *__b) { 4482 vector unsigned char mask = 4483 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4484 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4485 7, 6, 5, 4, 3, 2, 1, 0}; 4486 return vec_perm(mask, mask, reverse); 4487 } 4488 #else 4489 static __inline__ vector unsigned char __ATTRS_o_ai 4490 vec_lvsl(int __a, const unsigned char *__b) { 4491 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4492 } 4493 #endif 4494 4495 #ifdef __LITTLE_ENDIAN__ 4496 static __inline__ vector unsigned char __ATTRS_o_ai 4497 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4498 loads/stores"))) vec_lvsl(int __a, const short *__b) { 4499 vector unsigned char mask = 4500 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4501 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4502 7, 6, 5, 4, 3, 2, 1, 0}; 4503 return vec_perm(mask, mask, reverse); 4504 } 4505 #else 4506 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4507 const short *__b) { 4508 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4509 } 4510 #endif 4511 4512 #ifdef __LITTLE_ENDIAN__ 4513 static __inline__ vector unsigned char __ATTRS_o_ai 4514 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4515 loads/stores"))) vec_lvsl(int __a, const unsigned short *__b) { 4516 vector unsigned char mask = 4517 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4518 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4519 7, 6, 5, 4, 3, 2, 1, 0}; 4520 return vec_perm(mask, mask, reverse); 4521 } 4522 #else 4523 static __inline__ vector unsigned char __ATTRS_o_ai 4524 vec_lvsl(int __a, const unsigned short *__b) { 4525 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4526 } 4527 #endif 4528 4529 #ifdef __LITTLE_ENDIAN__ 4530 static __inline__ vector unsigned char __ATTRS_o_ai 4531 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4532 loads/stores"))) vec_lvsl(int __a, const int *__b) { 4533 vector unsigned char mask = 4534 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4535 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4536 7, 6, 5, 4, 3, 2, 1, 0}; 4537 return vec_perm(mask, mask, reverse); 4538 } 4539 #else 4540 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4541 const int *__b) { 4542 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4543 } 4544 #endif 4545 4546 #ifdef __LITTLE_ENDIAN__ 4547 static __inline__ vector unsigned char __ATTRS_o_ai 4548 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4549 loads/stores"))) vec_lvsl(int __a, const unsigned int *__b) { 4550 vector unsigned char mask = 4551 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4552 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4553 7, 6, 5, 4, 3, 2, 1, 0}; 4554 return vec_perm(mask, mask, reverse); 4555 } 4556 #else 4557 static __inline__ vector unsigned char __ATTRS_o_ai 4558 vec_lvsl(int __a, const unsigned int *__b) { 4559 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4560 } 4561 #endif 4562 4563 #ifdef __LITTLE_ENDIAN__ 4564 static __inline__ vector unsigned char __ATTRS_o_ai 4565 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4566 loads/stores"))) vec_lvsl(int __a, const float *__b) { 4567 vector unsigned char mask = 4568 (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4569 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4570 7, 6, 5, 4, 3, 2, 1, 0}; 4571 return vec_perm(mask, mask, reverse); 4572 } 4573 #else 4574 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsl(int __a, 4575 const float *__b) { 4576 return (vector unsigned char)__builtin_altivec_lvsl(__a, __b); 4577 } 4578 #endif 4579 4580 /* vec_lvsr */ 4581 4582 #ifdef __LITTLE_ENDIAN__ 4583 static __inline__ vector unsigned char __ATTRS_o_ai 4584 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4585 loads/stores"))) vec_lvsr(int __a, const signed char *__b) { 4586 vector unsigned char mask = 4587 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4588 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4589 7, 6, 5, 4, 3, 2, 1, 0}; 4590 return vec_perm(mask, mask, reverse); 4591 } 4592 #else 4593 static __inline__ vector unsigned char __ATTRS_o_ai 4594 vec_lvsr(int __a, const signed char *__b) { 4595 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4596 } 4597 #endif 4598 4599 #ifdef __LITTLE_ENDIAN__ 4600 static __inline__ vector unsigned char __ATTRS_o_ai 4601 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4602 loads/stores"))) vec_lvsr(int __a, const unsigned char *__b) { 4603 vector unsigned char mask = 4604 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4605 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4606 7, 6, 5, 4, 3, 2, 1, 0}; 4607 return vec_perm(mask, mask, reverse); 4608 } 4609 #else 4610 static __inline__ vector unsigned char __ATTRS_o_ai 4611 vec_lvsr(int __a, const unsigned char *__b) { 4612 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4613 } 4614 #endif 4615 4616 #ifdef __LITTLE_ENDIAN__ 4617 static __inline__ vector unsigned char __ATTRS_o_ai 4618 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4619 loads/stores"))) vec_lvsr(int __a, const short *__b) { 4620 vector unsigned char mask = 4621 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4622 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4623 7, 6, 5, 4, 3, 2, 1, 0}; 4624 return vec_perm(mask, mask, reverse); 4625 } 4626 #else 4627 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4628 const short *__b) { 4629 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4630 } 4631 #endif 4632 4633 #ifdef __LITTLE_ENDIAN__ 4634 static __inline__ vector unsigned char __ATTRS_o_ai 4635 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4636 loads/stores"))) vec_lvsr(int __a, const unsigned short *__b) { 4637 vector unsigned char mask = 4638 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4639 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4640 7, 6, 5, 4, 3, 2, 1, 0}; 4641 return vec_perm(mask, mask, reverse); 4642 } 4643 #else 4644 static __inline__ vector unsigned char __ATTRS_o_ai 4645 vec_lvsr(int __a, const unsigned short *__b) { 4646 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4647 } 4648 #endif 4649 4650 #ifdef __LITTLE_ENDIAN__ 4651 static __inline__ vector unsigned char __ATTRS_o_ai 4652 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4653 loads/stores"))) vec_lvsr(int __a, const int *__b) { 4654 vector unsigned char mask = 4655 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4656 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4657 7, 6, 5, 4, 3, 2, 1, 0}; 4658 return vec_perm(mask, mask, reverse); 4659 } 4660 #else 4661 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4662 const int *__b) { 4663 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4664 } 4665 #endif 4666 4667 #ifdef __LITTLE_ENDIAN__ 4668 static __inline__ vector unsigned char __ATTRS_o_ai 4669 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4670 loads/stores"))) vec_lvsr(int __a, const unsigned int *__b) { 4671 vector unsigned char mask = 4672 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4673 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4674 7, 6, 5, 4, 3, 2, 1, 0}; 4675 return vec_perm(mask, mask, reverse); 4676 } 4677 #else 4678 static __inline__ vector unsigned char __ATTRS_o_ai 4679 vec_lvsr(int __a, const unsigned int *__b) { 4680 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4681 } 4682 #endif 4683 4684 #ifdef __LITTLE_ENDIAN__ 4685 static __inline__ vector unsigned char __ATTRS_o_ai 4686 __attribute__((__deprecated__("use assignment for unaligned little endian \ 4687 loads/stores"))) vec_lvsr(int __a, const float *__b) { 4688 vector unsigned char mask = 4689 (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4690 vector unsigned char reverse = {15, 14, 13, 12, 11, 10, 9, 8, 4691 7, 6, 5, 4, 3, 2, 1, 0}; 4692 return vec_perm(mask, mask, reverse); 4693 } 4694 #else 4695 static __inline__ vector unsigned char __ATTRS_o_ai vec_lvsr(int __a, 4696 const float *__b) { 4697 return (vector unsigned char)__builtin_altivec_lvsr(__a, __b); 4698 } 4699 #endif 4700 4701 /* vec_madd */ 4702 static __inline__ vector signed short __ATTRS_o_ai 4703 vec_mladd(vector signed short, vector signed short, vector signed short); 4704 static __inline__ vector signed short __ATTRS_o_ai 4705 vec_mladd(vector signed short, vector unsigned short, vector unsigned short); 4706 static __inline__ vector signed short __ATTRS_o_ai 4707 vec_mladd(vector unsigned short, vector signed short, vector signed short); 4708 static __inline__ vector unsigned short __ATTRS_o_ai 4709 vec_mladd(vector unsigned short, vector unsigned short, vector unsigned short); 4710 4711 static __inline__ vector signed short __ATTRS_o_ai vec_madd( 4712 vector signed short __a, vector signed short __b, vector signed short __c) { 4713 return vec_mladd(__a, __b, __c); 4714 } 4715 4716 static __inline__ vector signed short __ATTRS_o_ai 4717 vec_madd(vector signed short __a, vector unsigned short __b, 4718 vector unsigned short __c) { 4719 return vec_mladd(__a, __b, __c); 4720 } 4721 4722 static __inline__ vector signed short __ATTRS_o_ai 4723 vec_madd(vector unsigned short __a, vector signed short __b, 4724 vector signed short __c) { 4725 return vec_mladd(__a, __b, __c); 4726 } 4727 4728 static __inline__ vector unsigned short __ATTRS_o_ai 4729 vec_madd(vector unsigned short __a, vector unsigned short __b, 4730 vector unsigned short __c) { 4731 return vec_mladd(__a, __b, __c); 4732 } 4733 4734 static __inline__ vector float __ATTRS_o_ai vec_madd(vector float __a, 4735 vector float __b, 4736 vector float __c) { 4737 #ifdef __VSX__ 4738 return __builtin_vsx_xvmaddasp(__a, __b, __c); 4739 #else 4740 return __builtin_altivec_vmaddfp(__a, __b, __c); 4741 #endif 4742 } 4743 4744 #ifdef __VSX__ 4745 static __inline__ vector double __ATTRS_o_ai vec_madd(vector double __a, 4746 vector double __b, 4747 vector double __c) { 4748 return __builtin_vsx_xvmaddadp(__a, __b, __c); 4749 } 4750 #endif 4751 4752 /* vec_vmaddfp */ 4753 4754 static __inline__ vector float __attribute__((__always_inline__)) 4755 vec_vmaddfp(vector float __a, vector float __b, vector float __c) { 4756 return __builtin_altivec_vmaddfp(__a, __b, __c); 4757 } 4758 4759 /* vec_madds */ 4760 4761 static __inline__ vector signed short __attribute__((__always_inline__)) 4762 vec_madds(vector signed short __a, vector signed short __b, 4763 vector signed short __c) { 4764 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4765 } 4766 4767 /* vec_vmhaddshs */ 4768 static __inline__ vector signed short __attribute__((__always_inline__)) 4769 vec_vmhaddshs(vector signed short __a, vector signed short __b, 4770 vector signed short __c) { 4771 return __builtin_altivec_vmhaddshs(__a, __b, __c); 4772 } 4773 4774 /* vec_msub */ 4775 4776 #ifdef __VSX__ 4777 static __inline__ vector float __ATTRS_o_ai vec_msub(vector float __a, 4778 vector float __b, 4779 vector float __c) { 4780 return __builtin_vsx_xvmsubasp(__a, __b, __c); 4781 } 4782 4783 static __inline__ vector double __ATTRS_o_ai vec_msub(vector double __a, 4784 vector double __b, 4785 vector double __c) { 4786 return __builtin_vsx_xvmsubadp(__a, __b, __c); 4787 } 4788 #endif 4789 4790 /* vec_max */ 4791 4792 static __inline__ vector signed char __ATTRS_o_ai 4793 vec_max(vector signed char __a, vector signed char __b) { 4794 return __builtin_altivec_vmaxsb(__a, __b); 4795 } 4796 4797 static __inline__ vector signed char __ATTRS_o_ai 4798 vec_max(vector bool char __a, vector signed char __b) { 4799 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4800 } 4801 4802 static __inline__ vector signed char __ATTRS_o_ai 4803 vec_max(vector signed char __a, vector bool char __b) { 4804 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4805 } 4806 4807 static __inline__ vector unsigned char __ATTRS_o_ai 4808 vec_max(vector unsigned char __a, vector unsigned char __b) { 4809 return __builtin_altivec_vmaxub(__a, __b); 4810 } 4811 4812 static __inline__ vector unsigned char __ATTRS_o_ai 4813 vec_max(vector bool char __a, vector unsigned char __b) { 4814 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4815 } 4816 4817 static __inline__ vector unsigned char __ATTRS_o_ai 4818 vec_max(vector unsigned char __a, vector bool char __b) { 4819 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4820 } 4821 4822 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4823 vector short __b) { 4824 return __builtin_altivec_vmaxsh(__a, __b); 4825 } 4826 4827 static __inline__ vector short __ATTRS_o_ai vec_max(vector bool short __a, 4828 vector short __b) { 4829 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4830 } 4831 4832 static __inline__ vector short __ATTRS_o_ai vec_max(vector short __a, 4833 vector bool short __b) { 4834 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4835 } 4836 4837 static __inline__ vector unsigned short __ATTRS_o_ai 4838 vec_max(vector unsigned short __a, vector unsigned short __b) { 4839 return __builtin_altivec_vmaxuh(__a, __b); 4840 } 4841 4842 static __inline__ vector unsigned short __ATTRS_o_ai 4843 vec_max(vector bool short __a, vector unsigned short __b) { 4844 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4845 } 4846 4847 static __inline__ vector unsigned short __ATTRS_o_ai 4848 vec_max(vector unsigned short __a, vector bool short __b) { 4849 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4850 } 4851 4852 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4853 vector int __b) { 4854 return __builtin_altivec_vmaxsw(__a, __b); 4855 } 4856 4857 static __inline__ vector int __ATTRS_o_ai vec_max(vector bool int __a, 4858 vector int __b) { 4859 return __builtin_altivec_vmaxsw((vector int)__a, __b); 4860 } 4861 4862 static __inline__ vector int __ATTRS_o_ai vec_max(vector int __a, 4863 vector bool int __b) { 4864 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 4865 } 4866 4867 static __inline__ vector unsigned int __ATTRS_o_ai 4868 vec_max(vector unsigned int __a, vector unsigned int __b) { 4869 return __builtin_altivec_vmaxuw(__a, __b); 4870 } 4871 4872 static __inline__ vector unsigned int __ATTRS_o_ai 4873 vec_max(vector bool int __a, vector unsigned int __b) { 4874 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 4875 } 4876 4877 static __inline__ vector unsigned int __ATTRS_o_ai 4878 vec_max(vector unsigned int __a, vector bool int __b) { 4879 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 4880 } 4881 4882 #ifdef __POWER8_VECTOR__ 4883 static __inline__ vector signed long long __ATTRS_o_ai 4884 vec_max(vector signed long long __a, vector signed long long __b) { 4885 return __builtin_altivec_vmaxsd(__a, __b); 4886 } 4887 4888 static __inline__ vector signed long long __ATTRS_o_ai 4889 vec_max(vector bool long long __a, vector signed long long __b) { 4890 return __builtin_altivec_vmaxsd((vector signed long long)__a, __b); 4891 } 4892 4893 static __inline__ vector signed long long __ATTRS_o_ai 4894 vec_max(vector signed long long __a, vector bool long long __b) { 4895 return __builtin_altivec_vmaxsd(__a, (vector signed long long)__b); 4896 } 4897 4898 static __inline__ vector unsigned long long __ATTRS_o_ai 4899 vec_max(vector unsigned long long __a, vector unsigned long long __b) { 4900 return __builtin_altivec_vmaxud(__a, __b); 4901 } 4902 4903 static __inline__ vector unsigned long long __ATTRS_o_ai 4904 vec_max(vector bool long long __a, vector unsigned long long __b) { 4905 return __builtin_altivec_vmaxud((vector unsigned long long)__a, __b); 4906 } 4907 4908 static __inline__ vector unsigned long long __ATTRS_o_ai 4909 vec_max(vector unsigned long long __a, vector bool long long __b) { 4910 return __builtin_altivec_vmaxud(__a, (vector unsigned long long)__b); 4911 } 4912 #endif 4913 4914 static __inline__ vector float __ATTRS_o_ai vec_max(vector float __a, 4915 vector float __b) { 4916 #ifdef __VSX__ 4917 return __builtin_vsx_xvmaxsp(__a, __b); 4918 #else 4919 return __builtin_altivec_vmaxfp(__a, __b); 4920 #endif 4921 } 4922 4923 #ifdef __VSX__ 4924 static __inline__ vector double __ATTRS_o_ai vec_max(vector double __a, 4925 vector double __b) { 4926 return __builtin_vsx_xvmaxdp(__a, __b); 4927 } 4928 #endif 4929 4930 /* vec_vmaxsb */ 4931 4932 static __inline__ vector signed char __ATTRS_o_ai 4933 vec_vmaxsb(vector signed char __a, vector signed char __b) { 4934 return __builtin_altivec_vmaxsb(__a, __b); 4935 } 4936 4937 static __inline__ vector signed char __ATTRS_o_ai 4938 vec_vmaxsb(vector bool char __a, vector signed char __b) { 4939 return __builtin_altivec_vmaxsb((vector signed char)__a, __b); 4940 } 4941 4942 static __inline__ vector signed char __ATTRS_o_ai 4943 vec_vmaxsb(vector signed char __a, vector bool char __b) { 4944 return __builtin_altivec_vmaxsb(__a, (vector signed char)__b); 4945 } 4946 4947 /* vec_vmaxub */ 4948 4949 static __inline__ vector unsigned char __ATTRS_o_ai 4950 vec_vmaxub(vector unsigned char __a, vector unsigned char __b) { 4951 return __builtin_altivec_vmaxub(__a, __b); 4952 } 4953 4954 static __inline__ vector unsigned char __ATTRS_o_ai 4955 vec_vmaxub(vector bool char __a, vector unsigned char __b) { 4956 return __builtin_altivec_vmaxub((vector unsigned char)__a, __b); 4957 } 4958 4959 static __inline__ vector unsigned char __ATTRS_o_ai 4960 vec_vmaxub(vector unsigned char __a, vector bool char __b) { 4961 return __builtin_altivec_vmaxub(__a, (vector unsigned char)__b); 4962 } 4963 4964 /* vec_vmaxsh */ 4965 4966 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4967 vector short __b) { 4968 return __builtin_altivec_vmaxsh(__a, __b); 4969 } 4970 4971 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector bool short __a, 4972 vector short __b) { 4973 return __builtin_altivec_vmaxsh((vector short)__a, __b); 4974 } 4975 4976 static __inline__ vector short __ATTRS_o_ai vec_vmaxsh(vector short __a, 4977 vector bool short __b) { 4978 return __builtin_altivec_vmaxsh(__a, (vector short)__b); 4979 } 4980 4981 /* vec_vmaxuh */ 4982 4983 static __inline__ vector unsigned short __ATTRS_o_ai 4984 vec_vmaxuh(vector unsigned short __a, vector unsigned short __b) { 4985 return __builtin_altivec_vmaxuh(__a, __b); 4986 } 4987 4988 static __inline__ vector unsigned short __ATTRS_o_ai 4989 vec_vmaxuh(vector bool short __a, vector unsigned short __b) { 4990 return __builtin_altivec_vmaxuh((vector unsigned short)__a, __b); 4991 } 4992 4993 static __inline__ vector unsigned short __ATTRS_o_ai 4994 vec_vmaxuh(vector unsigned short __a, vector bool short __b) { 4995 return __builtin_altivec_vmaxuh(__a, (vector unsigned short)__b); 4996 } 4997 4998 /* vec_vmaxsw */ 4999 5000 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 5001 vector int __b) { 5002 return __builtin_altivec_vmaxsw(__a, __b); 5003 } 5004 5005 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector bool int __a, 5006 vector int __b) { 5007 return __builtin_altivec_vmaxsw((vector int)__a, __b); 5008 } 5009 5010 static __inline__ vector int __ATTRS_o_ai vec_vmaxsw(vector int __a, 5011 vector bool int __b) { 5012 return __builtin_altivec_vmaxsw(__a, (vector int)__b); 5013 } 5014 5015 /* vec_vmaxuw */ 5016 5017 static __inline__ vector unsigned int __ATTRS_o_ai 5018 vec_vmaxuw(vector unsigned int __a, vector unsigned int __b) { 5019 return __builtin_altivec_vmaxuw(__a, __b); 5020 } 5021 5022 static __inline__ vector unsigned int __ATTRS_o_ai 5023 vec_vmaxuw(vector bool int __a, vector unsigned int __b) { 5024 return __builtin_altivec_vmaxuw((vector unsigned int)__a, __b); 5025 } 5026 5027 static __inline__ vector unsigned int __ATTRS_o_ai 5028 vec_vmaxuw(vector unsigned int __a, vector bool int __b) { 5029 return __builtin_altivec_vmaxuw(__a, (vector unsigned int)__b); 5030 } 5031 5032 /* vec_vmaxfp */ 5033 5034 static __inline__ vector float __attribute__((__always_inline__)) 5035 vec_vmaxfp(vector float __a, vector float __b) { 5036 #ifdef __VSX__ 5037 return __builtin_vsx_xvmaxsp(__a, __b); 5038 #else 5039 return __builtin_altivec_vmaxfp(__a, __b); 5040 #endif 5041 } 5042 5043 /* vec_mergeh */ 5044 5045 static __inline__ vector signed char __ATTRS_o_ai 5046 vec_mergeh(vector signed char __a, vector signed char __b) { 5047 return vec_perm(__a, __b, 5048 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5049 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5050 0x06, 0x16, 0x07, 0x17)); 5051 } 5052 5053 static __inline__ vector unsigned char __ATTRS_o_ai 5054 vec_mergeh(vector unsigned char __a, vector unsigned char __b) { 5055 return vec_perm(__a, __b, 5056 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5057 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5058 0x06, 0x16, 0x07, 0x17)); 5059 } 5060 5061 static __inline__ vector bool char __ATTRS_o_ai 5062 vec_mergeh(vector bool char __a, vector bool char __b) { 5063 return vec_perm(__a, __b, 5064 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5065 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5066 0x06, 0x16, 0x07, 0x17)); 5067 } 5068 5069 static __inline__ vector short __ATTRS_o_ai vec_mergeh(vector short __a, 5070 vector short __b) { 5071 return vec_perm(__a, __b, 5072 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5073 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5074 0x06, 0x07, 0x16, 0x17)); 5075 } 5076 5077 static __inline__ vector unsigned short __ATTRS_o_ai 5078 vec_mergeh(vector unsigned short __a, vector unsigned short __b) { 5079 return vec_perm(__a, __b, 5080 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5081 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5082 0x06, 0x07, 0x16, 0x17)); 5083 } 5084 5085 static __inline__ vector bool short __ATTRS_o_ai 5086 vec_mergeh(vector bool short __a, vector bool short __b) { 5087 return vec_perm(__a, __b, 5088 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5089 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5090 0x06, 0x07, 0x16, 0x17)); 5091 } 5092 5093 static __inline__ vector pixel __ATTRS_o_ai vec_mergeh(vector pixel __a, 5094 vector pixel __b) { 5095 return vec_perm(__a, __b, 5096 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5097 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5098 0x06, 0x07, 0x16, 0x17)); 5099 } 5100 5101 static __inline__ vector int __ATTRS_o_ai vec_mergeh(vector int __a, 5102 vector int __b) { 5103 return vec_perm(__a, __b, 5104 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5105 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5106 0x14, 0x15, 0x16, 0x17)); 5107 } 5108 5109 static __inline__ vector unsigned int __ATTRS_o_ai 5110 vec_mergeh(vector unsigned int __a, vector unsigned int __b) { 5111 return vec_perm(__a, __b, 5112 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5113 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5114 0x14, 0x15, 0x16, 0x17)); 5115 } 5116 5117 static __inline__ vector bool int __ATTRS_o_ai vec_mergeh(vector bool int __a, 5118 vector bool int __b) { 5119 return vec_perm(__a, __b, 5120 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5121 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5122 0x14, 0x15, 0x16, 0x17)); 5123 } 5124 5125 static __inline__ vector float __ATTRS_o_ai vec_mergeh(vector float __a, 5126 vector float __b) { 5127 return vec_perm(__a, __b, 5128 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5129 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5130 0x14, 0x15, 0x16, 0x17)); 5131 } 5132 5133 #ifdef __VSX__ 5134 static __inline__ vector signed long long __ATTRS_o_ai 5135 vec_mergeh(vector signed long long __a, vector signed long long __b) { 5136 return vec_perm(__a, __b, 5137 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5138 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5139 0x14, 0x15, 0x16, 0x17)); 5140 } 5141 5142 static __inline__ vector signed long long __ATTRS_o_ai 5143 vec_mergeh(vector signed long long __a, vector bool long long __b) { 5144 return vec_perm(__a, (vector signed long long)__b, 5145 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5146 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5147 0x14, 0x15, 0x16, 0x17)); 5148 } 5149 5150 static __inline__ vector signed long long __ATTRS_o_ai 5151 vec_mergeh(vector bool long long __a, vector signed long long __b) { 5152 return vec_perm((vector signed long long)__a, __b, 5153 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5154 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5155 0x14, 0x15, 0x16, 0x17)); 5156 } 5157 5158 static __inline__ vector unsigned long long __ATTRS_o_ai 5159 vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) { 5160 return vec_perm(__a, __b, 5161 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5162 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5163 0x14, 0x15, 0x16, 0x17)); 5164 } 5165 5166 static __inline__ vector unsigned long long __ATTRS_o_ai 5167 vec_mergeh(vector unsigned long long __a, vector bool long long __b) { 5168 return vec_perm(__a, (vector unsigned long long)__b, 5169 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5170 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5171 0x14, 0x15, 0x16, 0x17)); 5172 } 5173 5174 static __inline__ vector unsigned long long __ATTRS_o_ai 5175 vec_mergeh(vector bool long long __a, vector unsigned long long __b) { 5176 return vec_perm((vector unsigned long long)__a, __b, 5177 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5178 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5179 0x14, 0x15, 0x16, 0x17)); 5180 } 5181 5182 static __inline__ vector bool long long __ATTRS_o_ai 5183 vec_mergeh(vector bool long long __a, vector bool long long __b) { 5184 return vec_perm(__a, __b, 5185 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5186 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5187 0x14, 0x15, 0x16, 0x17)); 5188 } 5189 5190 static __inline__ vector double __ATTRS_o_ai vec_mergeh(vector double __a, 5191 vector double __b) { 5192 return vec_perm(__a, __b, 5193 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5194 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5195 0x14, 0x15, 0x16, 0x17)); 5196 } 5197 static __inline__ vector double __ATTRS_o_ai 5198 vec_mergeh(vector double __a, vector bool long long __b) { 5199 return vec_perm(__a, (vector double)__b, 5200 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5201 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5202 0x14, 0x15, 0x16, 0x17)); 5203 } 5204 static __inline__ vector double __ATTRS_o_ai 5205 vec_mergeh(vector bool long long __a, vector double __b) { 5206 return vec_perm((vector double)__a, __b, 5207 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 5208 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 5209 0x14, 0x15, 0x16, 0x17)); 5210 } 5211 #endif 5212 5213 /* vec_vmrghb */ 5214 5215 #define __builtin_altivec_vmrghb vec_vmrghb 5216 5217 static __inline__ vector signed char __ATTRS_o_ai 5218 vec_vmrghb(vector signed char __a, vector signed char __b) { 5219 return vec_perm(__a, __b, 5220 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5221 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5222 0x06, 0x16, 0x07, 0x17)); 5223 } 5224 5225 static __inline__ vector unsigned char __ATTRS_o_ai 5226 vec_vmrghb(vector unsigned char __a, vector unsigned char __b) { 5227 return vec_perm(__a, __b, 5228 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5229 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5230 0x06, 0x16, 0x07, 0x17)); 5231 } 5232 5233 static __inline__ vector bool char __ATTRS_o_ai 5234 vec_vmrghb(vector bool char __a, vector bool char __b) { 5235 return vec_perm(__a, __b, 5236 (vector unsigned char)(0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 5237 0x03, 0x13, 0x04, 0x14, 0x05, 0x15, 5238 0x06, 0x16, 0x07, 0x17)); 5239 } 5240 5241 /* vec_vmrghh */ 5242 5243 #define __builtin_altivec_vmrghh vec_vmrghh 5244 5245 static __inline__ vector short __ATTRS_o_ai vec_vmrghh(vector short __a, 5246 vector short __b) { 5247 return vec_perm(__a, __b, 5248 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5249 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5250 0x06, 0x07, 0x16, 0x17)); 5251 } 5252 5253 static __inline__ vector unsigned short __ATTRS_o_ai 5254 vec_vmrghh(vector unsigned short __a, vector unsigned short __b) { 5255 return vec_perm(__a, __b, 5256 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5257 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5258 0x06, 0x07, 0x16, 0x17)); 5259 } 5260 5261 static __inline__ vector bool short __ATTRS_o_ai 5262 vec_vmrghh(vector bool short __a, vector bool short __b) { 5263 return vec_perm(__a, __b, 5264 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5265 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5266 0x06, 0x07, 0x16, 0x17)); 5267 } 5268 5269 static __inline__ vector pixel __ATTRS_o_ai vec_vmrghh(vector pixel __a, 5270 vector pixel __b) { 5271 return vec_perm(__a, __b, 5272 (vector unsigned char)(0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 5273 0x12, 0x13, 0x04, 0x05, 0x14, 0x15, 5274 0x06, 0x07, 0x16, 0x17)); 5275 } 5276 5277 /* vec_vmrghw */ 5278 5279 #define __builtin_altivec_vmrghw vec_vmrghw 5280 5281 static __inline__ vector int __ATTRS_o_ai vec_vmrghw(vector int __a, 5282 vector int __b) { 5283 return vec_perm(__a, __b, 5284 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5285 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5286 0x14, 0x15, 0x16, 0x17)); 5287 } 5288 5289 static __inline__ vector unsigned int __ATTRS_o_ai 5290 vec_vmrghw(vector unsigned int __a, vector unsigned int __b) { 5291 return vec_perm(__a, __b, 5292 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5293 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5294 0x14, 0x15, 0x16, 0x17)); 5295 } 5296 5297 static __inline__ vector bool int __ATTRS_o_ai vec_vmrghw(vector bool int __a, 5298 vector bool int __b) { 5299 return vec_perm(__a, __b, 5300 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5301 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5302 0x14, 0x15, 0x16, 0x17)); 5303 } 5304 5305 static __inline__ vector float __ATTRS_o_ai vec_vmrghw(vector float __a, 5306 vector float __b) { 5307 return vec_perm(__a, __b, 5308 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5309 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 5310 0x14, 0x15, 0x16, 0x17)); 5311 } 5312 5313 /* vec_mergel */ 5314 5315 static __inline__ vector signed char __ATTRS_o_ai 5316 vec_mergel(vector signed char __a, vector signed char __b) { 5317 return vec_perm(__a, __b, 5318 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5319 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5320 0x0E, 0x1E, 0x0F, 0x1F)); 5321 } 5322 5323 static __inline__ vector unsigned char __ATTRS_o_ai 5324 vec_mergel(vector unsigned char __a, vector unsigned char __b) { 5325 return vec_perm(__a, __b, 5326 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5327 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5328 0x0E, 0x1E, 0x0F, 0x1F)); 5329 } 5330 5331 static __inline__ vector bool char __ATTRS_o_ai 5332 vec_mergel(vector bool char __a, vector bool char __b) { 5333 return vec_perm(__a, __b, 5334 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5335 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5336 0x0E, 0x1E, 0x0F, 0x1F)); 5337 } 5338 5339 static __inline__ vector short __ATTRS_o_ai vec_mergel(vector short __a, 5340 vector short __b) { 5341 return vec_perm(__a, __b, 5342 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5343 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5344 0x0E, 0x0F, 0x1E, 0x1F)); 5345 } 5346 5347 static __inline__ vector unsigned short __ATTRS_o_ai 5348 vec_mergel(vector unsigned short __a, vector unsigned short __b) { 5349 return vec_perm(__a, __b, 5350 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5351 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5352 0x0E, 0x0F, 0x1E, 0x1F)); 5353 } 5354 5355 static __inline__ vector bool short __ATTRS_o_ai 5356 vec_mergel(vector bool short __a, vector bool short __b) { 5357 return vec_perm(__a, __b, 5358 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5359 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5360 0x0E, 0x0F, 0x1E, 0x1F)); 5361 } 5362 5363 static __inline__ vector pixel __ATTRS_o_ai vec_mergel(vector pixel __a, 5364 vector pixel __b) { 5365 return vec_perm(__a, __b, 5366 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5367 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5368 0x0E, 0x0F, 0x1E, 0x1F)); 5369 } 5370 5371 static __inline__ vector int __ATTRS_o_ai vec_mergel(vector int __a, 5372 vector int __b) { 5373 return vec_perm(__a, __b, 5374 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5375 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5376 0x1C, 0x1D, 0x1E, 0x1F)); 5377 } 5378 5379 static __inline__ vector unsigned int __ATTRS_o_ai 5380 vec_mergel(vector unsigned int __a, vector unsigned int __b) { 5381 return vec_perm(__a, __b, 5382 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5383 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5384 0x1C, 0x1D, 0x1E, 0x1F)); 5385 } 5386 5387 static __inline__ vector bool int __ATTRS_o_ai vec_mergel(vector bool int __a, 5388 vector bool int __b) { 5389 return vec_perm(__a, __b, 5390 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5391 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5392 0x1C, 0x1D, 0x1E, 0x1F)); 5393 } 5394 5395 static __inline__ vector float __ATTRS_o_ai vec_mergel(vector float __a, 5396 vector float __b) { 5397 return vec_perm(__a, __b, 5398 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5399 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5400 0x1C, 0x1D, 0x1E, 0x1F)); 5401 } 5402 5403 #ifdef __VSX__ 5404 static __inline__ vector signed long long __ATTRS_o_ai 5405 vec_mergel(vector signed long long __a, vector signed 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 signed long long __ATTRS_o_ai 5412 vec_mergel(vector signed long long __a, vector bool long long __b) { 5413 return vec_perm(__a, (vector signed 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 signed long long __ATTRS_o_ai 5419 vec_mergel(vector bool long long __a, vector signed long long __b) { 5420 return vec_perm((vector signed 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 unsigned long long __ATTRS_o_ai 5426 vec_mergel(vector unsigned long long __a, vector unsigned 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 unsigned long long __ATTRS_o_ai 5433 vec_mergel(vector unsigned long long __a, vector bool long long __b) { 5434 return vec_perm(__a, (vector unsigned long long)__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 unsigned long long __ATTRS_o_ai 5440 vec_mergel(vector bool long long __a, vector unsigned long long __b) { 5441 return vec_perm((vector unsigned long long)__a, __b, 5442 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5443 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5444 0x1C, 0x1D, 0x1E, 0x1F)); 5445 } 5446 static __inline__ vector bool long long __ATTRS_o_ai 5447 vec_mergel(vector bool long long __a, vector bool long long __b) { 5448 return vec_perm(__a, __b, 5449 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5450 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5451 0x1C, 0x1D, 0x1E, 0x1F)); 5452 } 5453 static __inline__ vector double __ATTRS_o_ai vec_mergel(vector double __a, 5454 vector double __b) { 5455 return vec_perm(__a, __b, 5456 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5457 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5458 0x1C, 0x1D, 0x1E, 0x1F)); 5459 } 5460 static __inline__ vector double __ATTRS_o_ai 5461 vec_mergel(vector double __a, vector bool long long __b) { 5462 return vec_perm(__a, (vector double)__b, 5463 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5464 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5465 0x1C, 0x1D, 0x1E, 0x1F)); 5466 } 5467 static __inline__ vector double __ATTRS_o_ai 5468 vec_mergel(vector bool long long __a, vector double __b) { 5469 return vec_perm((vector double)__a, __b, 5470 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 5471 0x0E, 0x0F, 0x18, 0X19, 0x1A, 0x1B, 5472 0x1C, 0x1D, 0x1E, 0x1F)); 5473 } 5474 #endif 5475 5476 /* vec_vmrglb */ 5477 5478 #define __builtin_altivec_vmrglb vec_vmrglb 5479 5480 static __inline__ vector signed char __ATTRS_o_ai 5481 vec_vmrglb(vector signed char __a, vector signed char __b) { 5482 return vec_perm(__a, __b, 5483 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5484 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5485 0x0E, 0x1E, 0x0F, 0x1F)); 5486 } 5487 5488 static __inline__ vector unsigned char __ATTRS_o_ai 5489 vec_vmrglb(vector unsigned char __a, vector unsigned char __b) { 5490 return vec_perm(__a, __b, 5491 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5492 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5493 0x0E, 0x1E, 0x0F, 0x1F)); 5494 } 5495 5496 static __inline__ vector bool char __ATTRS_o_ai 5497 vec_vmrglb(vector bool char __a, vector bool char __b) { 5498 return vec_perm(__a, __b, 5499 (vector unsigned char)(0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 5500 0x0B, 0x1B, 0x0C, 0x1C, 0x0D, 0x1D, 5501 0x0E, 0x1E, 0x0F, 0x1F)); 5502 } 5503 5504 /* vec_vmrglh */ 5505 5506 #define __builtin_altivec_vmrglh vec_vmrglh 5507 5508 static __inline__ vector short __ATTRS_o_ai vec_vmrglh(vector short __a, 5509 vector short __b) { 5510 return vec_perm(__a, __b, 5511 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5512 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5513 0x0E, 0x0F, 0x1E, 0x1F)); 5514 } 5515 5516 static __inline__ vector unsigned short __ATTRS_o_ai 5517 vec_vmrglh(vector unsigned short __a, vector unsigned short __b) { 5518 return vec_perm(__a, __b, 5519 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5520 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5521 0x0E, 0x0F, 0x1E, 0x1F)); 5522 } 5523 5524 static __inline__ vector bool short __ATTRS_o_ai 5525 vec_vmrglh(vector bool short __a, vector bool short __b) { 5526 return vec_perm(__a, __b, 5527 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5528 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5529 0x0E, 0x0F, 0x1E, 0x1F)); 5530 } 5531 5532 static __inline__ vector pixel __ATTRS_o_ai vec_vmrglh(vector pixel __a, 5533 vector pixel __b) { 5534 return vec_perm(__a, __b, 5535 (vector unsigned char)(0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 5536 0x1A, 0x1B, 0x0C, 0x0D, 0x1C, 0x1D, 5537 0x0E, 0x0F, 0x1E, 0x1F)); 5538 } 5539 5540 /* vec_vmrglw */ 5541 5542 #define __builtin_altivec_vmrglw vec_vmrglw 5543 5544 static __inline__ vector int __ATTRS_o_ai vec_vmrglw(vector int __a, 5545 vector int __b) { 5546 return vec_perm(__a, __b, 5547 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5548 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5549 0x1C, 0x1D, 0x1E, 0x1F)); 5550 } 5551 5552 static __inline__ vector unsigned int __ATTRS_o_ai 5553 vec_vmrglw(vector unsigned int __a, vector unsigned int __b) { 5554 return vec_perm(__a, __b, 5555 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5556 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5557 0x1C, 0x1D, 0x1E, 0x1F)); 5558 } 5559 5560 static __inline__ vector bool int __ATTRS_o_ai vec_vmrglw(vector bool int __a, 5561 vector bool int __b) { 5562 return vec_perm(__a, __b, 5563 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5564 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5565 0x1C, 0x1D, 0x1E, 0x1F)); 5566 } 5567 5568 static __inline__ vector float __ATTRS_o_ai vec_vmrglw(vector float __a, 5569 vector float __b) { 5570 return vec_perm(__a, __b, 5571 (vector unsigned char)(0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 5572 0x1A, 0x1B, 0x0C, 0x0D, 0x0E, 0x0F, 5573 0x1C, 0x1D, 0x1E, 0x1F)); 5574 } 5575 5576 #ifdef __POWER8_VECTOR__ 5577 /* vec_mergee */ 5578 5579 static __inline__ vector bool int __ATTRS_o_ai vec_mergee(vector bool int __a, 5580 vector bool int __b) { 5581 return vec_perm(__a, __b, 5582 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5583 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5584 0x18, 0x19, 0x1A, 0x1B)); 5585 } 5586 5587 static __inline__ vector signed int __ATTRS_o_ai 5588 vec_mergee(vector signed int __a, vector signed int __b) { 5589 return vec_perm(__a, __b, 5590 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5591 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5592 0x18, 0x19, 0x1A, 0x1B)); 5593 } 5594 5595 static __inline__ vector unsigned int __ATTRS_o_ai 5596 vec_mergee(vector unsigned int __a, vector unsigned int __b) { 5597 return vec_perm(__a, __b, 5598 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5599 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5600 0x18, 0x19, 0x1A, 0x1B)); 5601 } 5602 5603 static __inline__ vector bool long long __ATTRS_o_ai 5604 vec_mergee(vector bool long long __a, vector bool long long __b) { 5605 return vec_mergeh(__a, __b); 5606 } 5607 5608 static __inline__ vector signed long long __ATTRS_o_ai 5609 vec_mergee(vector signed long long __a, vector signed long long __b) { 5610 return vec_mergeh(__a, __b); 5611 } 5612 5613 static __inline__ vector unsigned long long __ATTRS_o_ai 5614 vec_mergee(vector unsigned long long __a, vector unsigned long long __b) { 5615 return vec_mergeh(__a, __b); 5616 } 5617 5618 static __inline__ vector float __ATTRS_o_ai 5619 vec_mergee(vector float __a, vector float __b) { 5620 return vec_perm(__a, __b, 5621 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 5622 0x12, 0x13, 0x08, 0x09, 0x0A, 0x0B, 5623 0x18, 0x19, 0x1A, 0x1B)); 5624 } 5625 5626 static __inline__ vector double __ATTRS_o_ai 5627 vec_mergee(vector double __a, vector double __b) { 5628 return vec_mergeh(__a, __b); 5629 } 5630 5631 /* vec_mergeo */ 5632 5633 static __inline__ vector bool int __ATTRS_o_ai vec_mergeo(vector bool int __a, 5634 vector bool int __b) { 5635 return vec_perm(__a, __b, 5636 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5637 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5638 0x1C, 0x1D, 0x1E, 0x1F)); 5639 } 5640 5641 static __inline__ vector signed int __ATTRS_o_ai 5642 vec_mergeo(vector signed int __a, vector signed int __b) { 5643 return vec_perm(__a, __b, 5644 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5645 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5646 0x1C, 0x1D, 0x1E, 0x1F)); 5647 } 5648 5649 static __inline__ vector unsigned int __ATTRS_o_ai 5650 vec_mergeo(vector unsigned int __a, vector unsigned int __b) { 5651 return vec_perm(__a, __b, 5652 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5653 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5654 0x1C, 0x1D, 0x1E, 0x1F)); 5655 } 5656 5657 static __inline__ vector bool long long __ATTRS_o_ai 5658 vec_mergeo(vector bool long long __a, vector bool long long __b) { 5659 return vec_mergel(__a, __b); 5660 } 5661 5662 static __inline__ vector signed long long __ATTRS_o_ai 5663 vec_mergeo(vector signed long long __a, vector signed long long __b) { 5664 return vec_mergel(__a, __b); 5665 } 5666 5667 static __inline__ vector unsigned long long __ATTRS_o_ai 5668 vec_mergeo(vector unsigned long long __a, vector unsigned long long __b) { 5669 return vec_mergel(__a, __b); 5670 } 5671 5672 static __inline__ vector float __ATTRS_o_ai 5673 vec_mergeo(vector float __a, vector float __b) { 5674 return vec_perm(__a, __b, 5675 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 5676 0x16, 0x17, 0x0C, 0x0D, 0x0E, 0x0F, 5677 0x1C, 0x1D, 0x1E, 0x1F)); 5678 } 5679 5680 static __inline__ vector double __ATTRS_o_ai 5681 vec_mergeo(vector double __a, vector double __b) { 5682 return vec_mergel(__a, __b); 5683 } 5684 5685 #endif 5686 5687 /* vec_mfvscr */ 5688 5689 static __inline__ vector unsigned short __attribute__((__always_inline__)) 5690 vec_mfvscr(void) { 5691 return __builtin_altivec_mfvscr(); 5692 } 5693 5694 /* vec_min */ 5695 5696 static __inline__ vector signed char __ATTRS_o_ai 5697 vec_min(vector signed char __a, vector signed char __b) { 5698 return __builtin_altivec_vminsb(__a, __b); 5699 } 5700 5701 static __inline__ vector signed char __ATTRS_o_ai 5702 vec_min(vector bool char __a, vector signed char __b) { 5703 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5704 } 5705 5706 static __inline__ vector signed char __ATTRS_o_ai 5707 vec_min(vector signed char __a, vector bool char __b) { 5708 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5709 } 5710 5711 static __inline__ vector unsigned char __ATTRS_o_ai 5712 vec_min(vector unsigned char __a, vector unsigned char __b) { 5713 return __builtin_altivec_vminub(__a, __b); 5714 } 5715 5716 static __inline__ vector unsigned char __ATTRS_o_ai 5717 vec_min(vector bool char __a, vector unsigned char __b) { 5718 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5719 } 5720 5721 static __inline__ vector unsigned char __ATTRS_o_ai 5722 vec_min(vector unsigned char __a, vector bool char __b) { 5723 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5724 } 5725 5726 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5727 vector short __b) { 5728 return __builtin_altivec_vminsh(__a, __b); 5729 } 5730 5731 static __inline__ vector short __ATTRS_o_ai vec_min(vector bool short __a, 5732 vector short __b) { 5733 return __builtin_altivec_vminsh((vector short)__a, __b); 5734 } 5735 5736 static __inline__ vector short __ATTRS_o_ai vec_min(vector short __a, 5737 vector bool short __b) { 5738 return __builtin_altivec_vminsh(__a, (vector short)__b); 5739 } 5740 5741 static __inline__ vector unsigned short __ATTRS_o_ai 5742 vec_min(vector unsigned short __a, vector unsigned short __b) { 5743 return __builtin_altivec_vminuh(__a, __b); 5744 } 5745 5746 static __inline__ vector unsigned short __ATTRS_o_ai 5747 vec_min(vector bool short __a, vector unsigned short __b) { 5748 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5749 } 5750 5751 static __inline__ vector unsigned short __ATTRS_o_ai 5752 vec_min(vector unsigned short __a, vector bool short __b) { 5753 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5754 } 5755 5756 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5757 vector int __b) { 5758 return __builtin_altivec_vminsw(__a, __b); 5759 } 5760 5761 static __inline__ vector int __ATTRS_o_ai vec_min(vector bool int __a, 5762 vector int __b) { 5763 return __builtin_altivec_vminsw((vector int)__a, __b); 5764 } 5765 5766 static __inline__ vector int __ATTRS_o_ai vec_min(vector int __a, 5767 vector bool int __b) { 5768 return __builtin_altivec_vminsw(__a, (vector int)__b); 5769 } 5770 5771 static __inline__ vector unsigned int __ATTRS_o_ai 5772 vec_min(vector unsigned int __a, vector unsigned int __b) { 5773 return __builtin_altivec_vminuw(__a, __b); 5774 } 5775 5776 static __inline__ vector unsigned int __ATTRS_o_ai 5777 vec_min(vector bool int __a, vector unsigned int __b) { 5778 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5779 } 5780 5781 static __inline__ vector unsigned int __ATTRS_o_ai 5782 vec_min(vector unsigned int __a, vector bool int __b) { 5783 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5784 } 5785 5786 #ifdef __POWER8_VECTOR__ 5787 static __inline__ vector signed long long __ATTRS_o_ai 5788 vec_min(vector signed long long __a, vector signed long long __b) { 5789 return __builtin_altivec_vminsd(__a, __b); 5790 } 5791 5792 static __inline__ vector signed long long __ATTRS_o_ai 5793 vec_min(vector bool long long __a, vector signed long long __b) { 5794 return __builtin_altivec_vminsd((vector signed long long)__a, __b); 5795 } 5796 5797 static __inline__ vector signed long long __ATTRS_o_ai 5798 vec_min(vector signed long long __a, vector bool long long __b) { 5799 return __builtin_altivec_vminsd(__a, (vector signed long long)__b); 5800 } 5801 5802 static __inline__ vector unsigned long long __ATTRS_o_ai 5803 vec_min(vector unsigned long long __a, vector unsigned long long __b) { 5804 return __builtin_altivec_vminud(__a, __b); 5805 } 5806 5807 static __inline__ vector unsigned long long __ATTRS_o_ai 5808 vec_min(vector bool long long __a, vector unsigned long long __b) { 5809 return __builtin_altivec_vminud((vector unsigned long long)__a, __b); 5810 } 5811 5812 static __inline__ vector unsigned long long __ATTRS_o_ai 5813 vec_min(vector unsigned long long __a, vector bool long long __b) { 5814 return __builtin_altivec_vminud(__a, (vector unsigned long long)__b); 5815 } 5816 #endif 5817 5818 static __inline__ vector float __ATTRS_o_ai vec_min(vector float __a, 5819 vector float __b) { 5820 #ifdef __VSX__ 5821 return __builtin_vsx_xvminsp(__a, __b); 5822 #else 5823 return __builtin_altivec_vminfp(__a, __b); 5824 #endif 5825 } 5826 5827 #ifdef __VSX__ 5828 static __inline__ vector double __ATTRS_o_ai vec_min(vector double __a, 5829 vector double __b) { 5830 return __builtin_vsx_xvmindp(__a, __b); 5831 } 5832 #endif 5833 5834 /* vec_vminsb */ 5835 5836 static __inline__ vector signed char __ATTRS_o_ai 5837 vec_vminsb(vector signed char __a, vector signed char __b) { 5838 return __builtin_altivec_vminsb(__a, __b); 5839 } 5840 5841 static __inline__ vector signed char __ATTRS_o_ai 5842 vec_vminsb(vector bool char __a, vector signed char __b) { 5843 return __builtin_altivec_vminsb((vector signed char)__a, __b); 5844 } 5845 5846 static __inline__ vector signed char __ATTRS_o_ai 5847 vec_vminsb(vector signed char __a, vector bool char __b) { 5848 return __builtin_altivec_vminsb(__a, (vector signed char)__b); 5849 } 5850 5851 /* vec_vminub */ 5852 5853 static __inline__ vector unsigned char __ATTRS_o_ai 5854 vec_vminub(vector unsigned char __a, vector unsigned char __b) { 5855 return __builtin_altivec_vminub(__a, __b); 5856 } 5857 5858 static __inline__ vector unsigned char __ATTRS_o_ai 5859 vec_vminub(vector bool char __a, vector unsigned char __b) { 5860 return __builtin_altivec_vminub((vector unsigned char)__a, __b); 5861 } 5862 5863 static __inline__ vector unsigned char __ATTRS_o_ai 5864 vec_vminub(vector unsigned char __a, vector bool char __b) { 5865 return __builtin_altivec_vminub(__a, (vector unsigned char)__b); 5866 } 5867 5868 /* vec_vminsh */ 5869 5870 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5871 vector short __b) { 5872 return __builtin_altivec_vminsh(__a, __b); 5873 } 5874 5875 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector bool short __a, 5876 vector short __b) { 5877 return __builtin_altivec_vminsh((vector short)__a, __b); 5878 } 5879 5880 static __inline__ vector short __ATTRS_o_ai vec_vminsh(vector short __a, 5881 vector bool short __b) { 5882 return __builtin_altivec_vminsh(__a, (vector short)__b); 5883 } 5884 5885 /* vec_vminuh */ 5886 5887 static __inline__ vector unsigned short __ATTRS_o_ai 5888 vec_vminuh(vector unsigned short __a, vector unsigned short __b) { 5889 return __builtin_altivec_vminuh(__a, __b); 5890 } 5891 5892 static __inline__ vector unsigned short __ATTRS_o_ai 5893 vec_vminuh(vector bool short __a, vector unsigned short __b) { 5894 return __builtin_altivec_vminuh((vector unsigned short)__a, __b); 5895 } 5896 5897 static __inline__ vector unsigned short __ATTRS_o_ai 5898 vec_vminuh(vector unsigned short __a, vector bool short __b) { 5899 return __builtin_altivec_vminuh(__a, (vector unsigned short)__b); 5900 } 5901 5902 /* vec_vminsw */ 5903 5904 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5905 vector int __b) { 5906 return __builtin_altivec_vminsw(__a, __b); 5907 } 5908 5909 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector bool int __a, 5910 vector int __b) { 5911 return __builtin_altivec_vminsw((vector int)__a, __b); 5912 } 5913 5914 static __inline__ vector int __ATTRS_o_ai vec_vminsw(vector int __a, 5915 vector bool int __b) { 5916 return __builtin_altivec_vminsw(__a, (vector int)__b); 5917 } 5918 5919 /* vec_vminuw */ 5920 5921 static __inline__ vector unsigned int __ATTRS_o_ai 5922 vec_vminuw(vector unsigned int __a, vector unsigned int __b) { 5923 return __builtin_altivec_vminuw(__a, __b); 5924 } 5925 5926 static __inline__ vector unsigned int __ATTRS_o_ai 5927 vec_vminuw(vector bool int __a, vector unsigned int __b) { 5928 return __builtin_altivec_vminuw((vector unsigned int)__a, __b); 5929 } 5930 5931 static __inline__ vector unsigned int __ATTRS_o_ai 5932 vec_vminuw(vector unsigned int __a, vector bool int __b) { 5933 return __builtin_altivec_vminuw(__a, (vector unsigned int)__b); 5934 } 5935 5936 /* vec_vminfp */ 5937 5938 static __inline__ vector float __attribute__((__always_inline__)) 5939 vec_vminfp(vector float __a, vector float __b) { 5940 #ifdef __VSX__ 5941 return __builtin_vsx_xvminsp(__a, __b); 5942 #else 5943 return __builtin_altivec_vminfp(__a, __b); 5944 #endif 5945 } 5946 5947 /* vec_mladd */ 5948 5949 #define __builtin_altivec_vmladduhm vec_mladd 5950 5951 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector short __a, 5952 vector short __b, 5953 vector short __c) { 5954 return __a * __b + __c; 5955 } 5956 5957 static __inline__ vector short __ATTRS_o_ai vec_mladd( 5958 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5959 return __a * (vector short)__b + (vector short)__c; 5960 } 5961 5962 static __inline__ vector short __ATTRS_o_ai vec_mladd(vector unsigned short __a, 5963 vector short __b, 5964 vector short __c) { 5965 return (vector short)__a * __b + __c; 5966 } 5967 5968 static __inline__ vector unsigned short __ATTRS_o_ai 5969 vec_mladd(vector unsigned short __a, vector unsigned short __b, 5970 vector unsigned short __c) { 5971 return __a * __b + __c; 5972 } 5973 5974 /* vec_vmladduhm */ 5975 5976 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm(vector short __a, 5977 vector short __b, 5978 vector short __c) { 5979 return __a * __b + __c; 5980 } 5981 5982 static __inline__ vector short __ATTRS_o_ai vec_vmladduhm( 5983 vector short __a, vector unsigned short __b, vector unsigned short __c) { 5984 return __a * (vector short)__b + (vector short)__c; 5985 } 5986 5987 static __inline__ vector short __ATTRS_o_ai 5988 vec_vmladduhm(vector unsigned short __a, vector short __b, vector short __c) { 5989 return (vector short)__a * __b + __c; 5990 } 5991 5992 static __inline__ vector unsigned short __ATTRS_o_ai 5993 vec_vmladduhm(vector unsigned short __a, vector unsigned short __b, 5994 vector unsigned short __c) { 5995 return __a * __b + __c; 5996 } 5997 5998 /* vec_mradds */ 5999 6000 static __inline__ vector short __attribute__((__always_inline__)) 6001 vec_mradds(vector short __a, vector short __b, vector short __c) { 6002 return __builtin_altivec_vmhraddshs(__a, __b, __c); 6003 } 6004 6005 /* vec_vmhraddshs */ 6006 6007 static __inline__ vector short __attribute__((__always_inline__)) 6008 vec_vmhraddshs(vector short __a, vector short __b, vector short __c) { 6009 return __builtin_altivec_vmhraddshs(__a, __b, __c); 6010 } 6011 6012 /* vec_msum */ 6013 6014 static __inline__ vector int __ATTRS_o_ai vec_msum(vector signed char __a, 6015 vector unsigned char __b, 6016 vector int __c) { 6017 return __builtin_altivec_vmsummbm(__a, __b, __c); 6018 } 6019 6020 static __inline__ vector unsigned int __ATTRS_o_ai 6021 vec_msum(vector unsigned char __a, vector unsigned char __b, 6022 vector unsigned int __c) { 6023 return __builtin_altivec_vmsumubm(__a, __b, __c); 6024 } 6025 6026 static __inline__ vector int __ATTRS_o_ai vec_msum(vector short __a, 6027 vector short __b, 6028 vector int __c) { 6029 return __builtin_altivec_vmsumshm(__a, __b, __c); 6030 } 6031 6032 static __inline__ vector unsigned int __ATTRS_o_ai 6033 vec_msum(vector unsigned short __a, vector unsigned short __b, 6034 vector unsigned int __c) { 6035 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6036 } 6037 6038 /* vec_msumc */ 6039 6040 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6041 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6042 vec_msumc(vector unsigned long long __a, vector unsigned long long __b, 6043 vector unsigned __int128 __c) { 6044 return __builtin_altivec_vmsumcud(__a, __b, __c); 6045 } 6046 #endif 6047 6048 /* vec_vmsummbm */ 6049 6050 static __inline__ vector int __attribute__((__always_inline__)) 6051 vec_vmsummbm(vector signed char __a, vector unsigned char __b, vector int __c) { 6052 return __builtin_altivec_vmsummbm(__a, __b, __c); 6053 } 6054 6055 /* vec_vmsumubm */ 6056 6057 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6058 vec_vmsumubm(vector unsigned char __a, vector unsigned char __b, 6059 vector unsigned int __c) { 6060 return __builtin_altivec_vmsumubm(__a, __b, __c); 6061 } 6062 6063 /* vec_vmsumshm */ 6064 6065 static __inline__ vector int __attribute__((__always_inline__)) 6066 vec_vmsumshm(vector short __a, vector short __b, vector int __c) { 6067 return __builtin_altivec_vmsumshm(__a, __b, __c); 6068 } 6069 6070 /* vec_vmsumuhm */ 6071 6072 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6073 vec_vmsumuhm(vector unsigned short __a, vector unsigned short __b, 6074 vector unsigned int __c) { 6075 return __builtin_altivec_vmsumuhm(__a, __b, __c); 6076 } 6077 6078 /* vec_msums */ 6079 6080 static __inline__ vector int __ATTRS_o_ai vec_msums(vector short __a, 6081 vector short __b, 6082 vector int __c) { 6083 return __builtin_altivec_vmsumshs(__a, __b, __c); 6084 } 6085 6086 static __inline__ vector unsigned int __ATTRS_o_ai 6087 vec_msums(vector unsigned short __a, vector unsigned short __b, 6088 vector unsigned int __c) { 6089 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6090 } 6091 6092 /* vec_vmsumshs */ 6093 6094 static __inline__ vector int __attribute__((__always_inline__)) 6095 vec_vmsumshs(vector short __a, vector short __b, vector int __c) { 6096 return __builtin_altivec_vmsumshs(__a, __b, __c); 6097 } 6098 6099 /* vec_vmsumuhs */ 6100 6101 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6102 vec_vmsumuhs(vector unsigned short __a, vector unsigned short __b, 6103 vector unsigned int __c) { 6104 return __builtin_altivec_vmsumuhs(__a, __b, __c); 6105 } 6106 6107 /* vec_mtvscr */ 6108 6109 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector signed char __a) { 6110 __builtin_altivec_mtvscr((vector int)__a); 6111 } 6112 6113 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned char __a) { 6114 __builtin_altivec_mtvscr((vector int)__a); 6115 } 6116 6117 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool char __a) { 6118 __builtin_altivec_mtvscr((vector int)__a); 6119 } 6120 6121 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector short __a) { 6122 __builtin_altivec_mtvscr((vector int)__a); 6123 } 6124 6125 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned short __a) { 6126 __builtin_altivec_mtvscr((vector int)__a); 6127 } 6128 6129 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool short __a) { 6130 __builtin_altivec_mtvscr((vector int)__a); 6131 } 6132 6133 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector pixel __a) { 6134 __builtin_altivec_mtvscr((vector int)__a); 6135 } 6136 6137 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector int __a) { 6138 __builtin_altivec_mtvscr((vector int)__a); 6139 } 6140 6141 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector unsigned int __a) { 6142 __builtin_altivec_mtvscr((vector int)__a); 6143 } 6144 6145 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector bool int __a) { 6146 __builtin_altivec_mtvscr((vector int)__a); 6147 } 6148 6149 static __inline__ void __ATTRS_o_ai vec_mtvscr(vector float __a) { 6150 __builtin_altivec_mtvscr((vector int)__a); 6151 } 6152 6153 /* vec_mul */ 6154 6155 /* Integer vector multiplication will involve multiplication of the odd/even 6156 elements separately, then truncating the results and moving to the 6157 result vector. 6158 */ 6159 static __inline__ vector signed char __ATTRS_o_ai 6160 vec_mul(vector signed char __a, vector signed char __b) { 6161 return __a * __b; 6162 } 6163 6164 static __inline__ vector unsigned char __ATTRS_o_ai 6165 vec_mul(vector unsigned char __a, vector unsigned char __b) { 6166 return __a * __b; 6167 } 6168 6169 static __inline__ vector signed short __ATTRS_o_ai 6170 vec_mul(vector signed short __a, vector signed short __b) { 6171 return __a * __b; 6172 } 6173 6174 static __inline__ vector unsigned short __ATTRS_o_ai 6175 vec_mul(vector unsigned short __a, vector unsigned short __b) { 6176 return __a * __b; 6177 } 6178 6179 static __inline__ vector signed int __ATTRS_o_ai 6180 vec_mul(vector signed int __a, vector signed int __b) { 6181 return __a * __b; 6182 } 6183 6184 static __inline__ vector unsigned int __ATTRS_o_ai 6185 vec_mul(vector unsigned int __a, vector unsigned int __b) { 6186 return __a * __b; 6187 } 6188 6189 #ifdef __VSX__ 6190 static __inline__ vector signed long long __ATTRS_o_ai 6191 vec_mul(vector signed long long __a, vector signed long long __b) { 6192 return __a * __b; 6193 } 6194 6195 static __inline__ vector unsigned long long __ATTRS_o_ai 6196 vec_mul(vector unsigned long long __a, vector unsigned long long __b) { 6197 return __a * __b; 6198 } 6199 #endif 6200 6201 static __inline__ vector float __ATTRS_o_ai vec_mul(vector float __a, 6202 vector float __b) { 6203 return __a * __b; 6204 } 6205 6206 #ifdef __VSX__ 6207 static __inline__ vector double __ATTRS_o_ai vec_mul(vector double __a, 6208 vector double __b) { 6209 return __a * __b; 6210 } 6211 #endif 6212 6213 /* The vmulos* and vmules* instructions have a big endian bias, so 6214 we must reverse the meaning of "even" and "odd" for little endian. */ 6215 6216 /* vec_mule */ 6217 6218 static __inline__ vector short __ATTRS_o_ai vec_mule(vector signed char __a, 6219 vector signed char __b) { 6220 #ifdef __LITTLE_ENDIAN__ 6221 return __builtin_altivec_vmulosb(__a, __b); 6222 #else 6223 return __builtin_altivec_vmulesb(__a, __b); 6224 #endif 6225 } 6226 6227 static __inline__ vector unsigned short __ATTRS_o_ai 6228 vec_mule(vector unsigned char __a, vector unsigned char __b) { 6229 #ifdef __LITTLE_ENDIAN__ 6230 return __builtin_altivec_vmuloub(__a, __b); 6231 #else 6232 return __builtin_altivec_vmuleub(__a, __b); 6233 #endif 6234 } 6235 6236 static __inline__ vector int __ATTRS_o_ai vec_mule(vector short __a, 6237 vector short __b) { 6238 #ifdef __LITTLE_ENDIAN__ 6239 return __builtin_altivec_vmulosh(__a, __b); 6240 #else 6241 return __builtin_altivec_vmulesh(__a, __b); 6242 #endif 6243 } 6244 6245 static __inline__ vector unsigned int __ATTRS_o_ai 6246 vec_mule(vector unsigned short __a, vector unsigned short __b) { 6247 #ifdef __LITTLE_ENDIAN__ 6248 return __builtin_altivec_vmulouh(__a, __b); 6249 #else 6250 return __builtin_altivec_vmuleuh(__a, __b); 6251 #endif 6252 } 6253 6254 #ifdef __POWER8_VECTOR__ 6255 static __inline__ vector signed long long __ATTRS_o_ai 6256 vec_mule(vector signed int __a, vector signed int __b) { 6257 #ifdef __LITTLE_ENDIAN__ 6258 return __builtin_altivec_vmulosw(__a, __b); 6259 #else 6260 return __builtin_altivec_vmulesw(__a, __b); 6261 #endif 6262 } 6263 6264 static __inline__ vector unsigned long long __ATTRS_o_ai 6265 vec_mule(vector unsigned int __a, vector unsigned int __b) { 6266 #ifdef __LITTLE_ENDIAN__ 6267 return __builtin_altivec_vmulouw(__a, __b); 6268 #else 6269 return __builtin_altivec_vmuleuw(__a, __b); 6270 #endif 6271 } 6272 #endif 6273 6274 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6275 static __inline__ vector signed __int128 __ATTRS_o_ai 6276 vec_mule(vector signed long long __a, vector signed long long __b) { 6277 #ifdef __LITTLE_ENDIAN__ 6278 return __builtin_altivec_vmulosd(__a, __b); 6279 #else 6280 return __builtin_altivec_vmulesd(__a, __b); 6281 #endif 6282 } 6283 6284 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6285 vec_mule(vector unsigned long long __a, vector unsigned long long __b) { 6286 #ifdef __LITTLE_ENDIAN__ 6287 return __builtin_altivec_vmuloud(__a, __b); 6288 #else 6289 return __builtin_altivec_vmuleud(__a, __b); 6290 #endif 6291 } 6292 #endif 6293 6294 /* vec_vmulesb */ 6295 6296 static __inline__ vector short __attribute__((__always_inline__)) 6297 vec_vmulesb(vector signed char __a, vector signed char __b) { 6298 #ifdef __LITTLE_ENDIAN__ 6299 return __builtin_altivec_vmulosb(__a, __b); 6300 #else 6301 return __builtin_altivec_vmulesb(__a, __b); 6302 #endif 6303 } 6304 6305 /* vec_vmuleub */ 6306 6307 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6308 vec_vmuleub(vector unsigned char __a, vector unsigned char __b) { 6309 #ifdef __LITTLE_ENDIAN__ 6310 return __builtin_altivec_vmuloub(__a, __b); 6311 #else 6312 return __builtin_altivec_vmuleub(__a, __b); 6313 #endif 6314 } 6315 6316 /* vec_vmulesh */ 6317 6318 static __inline__ vector int __attribute__((__always_inline__)) 6319 vec_vmulesh(vector short __a, vector short __b) { 6320 #ifdef __LITTLE_ENDIAN__ 6321 return __builtin_altivec_vmulosh(__a, __b); 6322 #else 6323 return __builtin_altivec_vmulesh(__a, __b); 6324 #endif 6325 } 6326 6327 /* vec_vmuleuh */ 6328 6329 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6330 vec_vmuleuh(vector unsigned short __a, vector unsigned short __b) { 6331 #ifdef __LITTLE_ENDIAN__ 6332 return __builtin_altivec_vmulouh(__a, __b); 6333 #else 6334 return __builtin_altivec_vmuleuh(__a, __b); 6335 #endif 6336 } 6337 6338 /* vec_mulh */ 6339 6340 #ifdef __POWER10_VECTOR__ 6341 static __inline__ vector signed int __ATTRS_o_ai 6342 vec_mulh(vector signed int __a, vector signed int __b) { 6343 return __builtin_altivec_vmulhsw(__a, __b); 6344 } 6345 6346 static __inline__ vector unsigned int __ATTRS_o_ai 6347 vec_mulh(vector unsigned int __a, vector unsigned int __b) { 6348 return __builtin_altivec_vmulhuw(__a, __b); 6349 } 6350 6351 static __inline__ vector signed long long __ATTRS_o_ai 6352 vec_mulh(vector signed long long __a, vector signed long long __b) { 6353 return __builtin_altivec_vmulhsd(__a, __b); 6354 } 6355 6356 static __inline__ vector unsigned long long __ATTRS_o_ai 6357 vec_mulh(vector unsigned long long __a, vector unsigned long long __b) { 6358 return __builtin_altivec_vmulhud(__a, __b); 6359 } 6360 #endif 6361 6362 /* vec_mulo */ 6363 6364 static __inline__ vector short __ATTRS_o_ai vec_mulo(vector signed char __a, 6365 vector signed char __b) { 6366 #ifdef __LITTLE_ENDIAN__ 6367 return __builtin_altivec_vmulesb(__a, __b); 6368 #else 6369 return __builtin_altivec_vmulosb(__a, __b); 6370 #endif 6371 } 6372 6373 static __inline__ vector unsigned short __ATTRS_o_ai 6374 vec_mulo(vector unsigned char __a, vector unsigned char __b) { 6375 #ifdef __LITTLE_ENDIAN__ 6376 return __builtin_altivec_vmuleub(__a, __b); 6377 #else 6378 return __builtin_altivec_vmuloub(__a, __b); 6379 #endif 6380 } 6381 6382 static __inline__ vector int __ATTRS_o_ai vec_mulo(vector short __a, 6383 vector short __b) { 6384 #ifdef __LITTLE_ENDIAN__ 6385 return __builtin_altivec_vmulesh(__a, __b); 6386 #else 6387 return __builtin_altivec_vmulosh(__a, __b); 6388 #endif 6389 } 6390 6391 static __inline__ vector unsigned int __ATTRS_o_ai 6392 vec_mulo(vector unsigned short __a, vector unsigned short __b) { 6393 #ifdef __LITTLE_ENDIAN__ 6394 return __builtin_altivec_vmuleuh(__a, __b); 6395 #else 6396 return __builtin_altivec_vmulouh(__a, __b); 6397 #endif 6398 } 6399 6400 #ifdef __POWER8_VECTOR__ 6401 static __inline__ vector signed long long __ATTRS_o_ai 6402 vec_mulo(vector signed int __a, vector signed int __b) { 6403 #ifdef __LITTLE_ENDIAN__ 6404 return __builtin_altivec_vmulesw(__a, __b); 6405 #else 6406 return __builtin_altivec_vmulosw(__a, __b); 6407 #endif 6408 } 6409 6410 static __inline__ vector unsigned long long __ATTRS_o_ai 6411 vec_mulo(vector unsigned int __a, vector unsigned int __b) { 6412 #ifdef __LITTLE_ENDIAN__ 6413 return __builtin_altivec_vmuleuw(__a, __b); 6414 #else 6415 return __builtin_altivec_vmulouw(__a, __b); 6416 #endif 6417 } 6418 #endif 6419 6420 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 6421 static __inline__ vector signed __int128 __ATTRS_o_ai 6422 vec_mulo(vector signed long long __a, vector signed long long __b) { 6423 #ifdef __LITTLE_ENDIAN__ 6424 return __builtin_altivec_vmulesd(__a, __b); 6425 #else 6426 return __builtin_altivec_vmulosd(__a, __b); 6427 #endif 6428 } 6429 6430 static __inline__ vector unsigned __int128 __ATTRS_o_ai 6431 vec_mulo(vector unsigned long long __a, vector unsigned long long __b) { 6432 #ifdef __LITTLE_ENDIAN__ 6433 return __builtin_altivec_vmuleud(__a, __b); 6434 #else 6435 return __builtin_altivec_vmuloud(__a, __b); 6436 #endif 6437 } 6438 #endif 6439 6440 /* vec_vmulosb */ 6441 6442 static __inline__ vector short __attribute__((__always_inline__)) 6443 vec_vmulosb(vector signed char __a, vector signed char __b) { 6444 #ifdef __LITTLE_ENDIAN__ 6445 return __builtin_altivec_vmulesb(__a, __b); 6446 #else 6447 return __builtin_altivec_vmulosb(__a, __b); 6448 #endif 6449 } 6450 6451 /* vec_vmuloub */ 6452 6453 static __inline__ vector unsigned short __attribute__((__always_inline__)) 6454 vec_vmuloub(vector unsigned char __a, vector unsigned char __b) { 6455 #ifdef __LITTLE_ENDIAN__ 6456 return __builtin_altivec_vmuleub(__a, __b); 6457 #else 6458 return __builtin_altivec_vmuloub(__a, __b); 6459 #endif 6460 } 6461 6462 /* vec_vmulosh */ 6463 6464 static __inline__ vector int __attribute__((__always_inline__)) 6465 vec_vmulosh(vector short __a, vector short __b) { 6466 #ifdef __LITTLE_ENDIAN__ 6467 return __builtin_altivec_vmulesh(__a, __b); 6468 #else 6469 return __builtin_altivec_vmulosh(__a, __b); 6470 #endif 6471 } 6472 6473 /* vec_vmulouh */ 6474 6475 static __inline__ vector unsigned int __attribute__((__always_inline__)) 6476 vec_vmulouh(vector unsigned short __a, vector unsigned short __b) { 6477 #ifdef __LITTLE_ENDIAN__ 6478 return __builtin_altivec_vmuleuh(__a, __b); 6479 #else 6480 return __builtin_altivec_vmulouh(__a, __b); 6481 #endif 6482 } 6483 6484 /* vec_nand */ 6485 6486 #ifdef __POWER8_VECTOR__ 6487 static __inline__ vector signed char __ATTRS_o_ai 6488 vec_nand(vector signed char __a, vector signed char __b) { 6489 return ~(__a & __b); 6490 } 6491 6492 static __inline__ vector signed char __ATTRS_o_ai 6493 vec_nand(vector signed char __a, vector bool char __b) { 6494 return ~(__a & __b); 6495 } 6496 6497 static __inline__ vector signed char __ATTRS_o_ai 6498 vec_nand(vector bool char __a, vector signed char __b) { 6499 return ~(__a & __b); 6500 } 6501 6502 static __inline__ vector unsigned char __ATTRS_o_ai 6503 vec_nand(vector unsigned char __a, vector unsigned char __b) { 6504 return ~(__a & __b); 6505 } 6506 6507 static __inline__ vector unsigned char __ATTRS_o_ai 6508 vec_nand(vector unsigned char __a, vector bool char __b) { 6509 return ~(__a & __b); 6510 } 6511 6512 static __inline__ vector unsigned char __ATTRS_o_ai 6513 vec_nand(vector bool char __a, vector unsigned char __b) { 6514 return ~(__a & __b); 6515 } 6516 6517 static __inline__ vector bool char __ATTRS_o_ai vec_nand(vector bool char __a, 6518 vector bool char __b) { 6519 return ~(__a & __b); 6520 } 6521 6522 static __inline__ vector signed short __ATTRS_o_ai 6523 vec_nand(vector signed short __a, vector signed short __b) { 6524 return ~(__a & __b); 6525 } 6526 6527 static __inline__ vector signed short __ATTRS_o_ai 6528 vec_nand(vector signed short __a, vector bool short __b) { 6529 return ~(__a & __b); 6530 } 6531 6532 static __inline__ vector signed short __ATTRS_o_ai 6533 vec_nand(vector bool short __a, vector signed short __b) { 6534 return ~(__a & __b); 6535 } 6536 6537 static __inline__ vector unsigned short __ATTRS_o_ai 6538 vec_nand(vector unsigned short __a, vector unsigned short __b) { 6539 return ~(__a & __b); 6540 } 6541 6542 static __inline__ vector unsigned short __ATTRS_o_ai 6543 vec_nand(vector unsigned short __a, vector bool short __b) { 6544 return ~(__a & __b); 6545 } 6546 6547 static __inline__ vector bool short __ATTRS_o_ai 6548 vec_nand(vector bool short __a, vector bool short __b) { 6549 return ~(__a & __b); 6550 } 6551 6552 static __inline__ vector signed int __ATTRS_o_ai 6553 vec_nand(vector signed int __a, vector signed int __b) { 6554 return ~(__a & __b); 6555 } 6556 6557 static __inline__ vector signed int __ATTRS_o_ai vec_nand(vector signed int __a, 6558 vector bool int __b) { 6559 return ~(__a & __b); 6560 } 6561 6562 static __inline__ vector signed int __ATTRS_o_ai 6563 vec_nand(vector bool int __a, vector signed int __b) { 6564 return ~(__a & __b); 6565 } 6566 6567 static __inline__ vector unsigned int __ATTRS_o_ai 6568 vec_nand(vector unsigned int __a, vector unsigned int __b) { 6569 return ~(__a & __b); 6570 } 6571 6572 static __inline__ vector unsigned int __ATTRS_o_ai 6573 vec_nand(vector unsigned int __a, vector bool int __b) { 6574 return ~(__a & __b); 6575 } 6576 6577 static __inline__ vector unsigned int __ATTRS_o_ai 6578 vec_nand(vector bool int __a, vector unsigned int __b) { 6579 return ~(__a & __b); 6580 } 6581 6582 static __inline__ vector bool int __ATTRS_o_ai vec_nand(vector bool int __a, 6583 vector bool int __b) { 6584 return ~(__a & __b); 6585 } 6586 6587 static __inline__ vector float __ATTRS_o_ai 6588 vec_nand(vector float __a, vector float __b) { 6589 return (vector float)(~((vector unsigned int)__a & 6590 (vector unsigned int)__b)); 6591 } 6592 6593 static __inline__ vector signed long long __ATTRS_o_ai 6594 vec_nand(vector signed long long __a, vector signed long long __b) { 6595 return ~(__a & __b); 6596 } 6597 6598 static __inline__ vector signed long long __ATTRS_o_ai 6599 vec_nand(vector signed long long __a, vector bool long long __b) { 6600 return ~(__a & __b); 6601 } 6602 6603 static __inline__ vector signed long long __ATTRS_o_ai 6604 vec_nand(vector bool long long __a, vector signed long long __b) { 6605 return ~(__a & __b); 6606 } 6607 6608 static __inline__ vector unsigned long long __ATTRS_o_ai 6609 vec_nand(vector unsigned long long __a, vector unsigned long long __b) { 6610 return ~(__a & __b); 6611 } 6612 6613 static __inline__ vector unsigned long long __ATTRS_o_ai 6614 vec_nand(vector unsigned long long __a, vector bool long long __b) { 6615 return ~(__a & __b); 6616 } 6617 6618 static __inline__ vector unsigned long long __ATTRS_o_ai 6619 vec_nand(vector bool long long __a, vector unsigned long long __b) { 6620 return ~(__a & __b); 6621 } 6622 6623 static __inline__ vector bool long long __ATTRS_o_ai 6624 vec_nand(vector bool long long __a, vector bool long long __b) { 6625 return ~(__a & __b); 6626 } 6627 6628 static __inline__ vector double __ATTRS_o_ai 6629 vec_nand(vector double __a, vector double __b) { 6630 return (vector double)(~((vector unsigned long long)__a & 6631 (vector unsigned long long)__b)); 6632 } 6633 6634 #endif 6635 6636 /* vec_nmadd */ 6637 6638 #ifdef __VSX__ 6639 static __inline__ vector float __ATTRS_o_ai vec_nmadd(vector float __a, 6640 vector float __b, 6641 vector float __c) { 6642 return __builtin_vsx_xvnmaddasp(__a, __b, __c); 6643 } 6644 6645 static __inline__ vector double __ATTRS_o_ai vec_nmadd(vector double __a, 6646 vector double __b, 6647 vector double __c) { 6648 return __builtin_vsx_xvnmaddadp(__a, __b, __c); 6649 } 6650 #endif 6651 6652 /* vec_nmsub */ 6653 6654 static __inline__ vector float __ATTRS_o_ai vec_nmsub(vector float __a, 6655 vector float __b, 6656 vector float __c) { 6657 #ifdef __VSX__ 6658 return __builtin_vsx_xvnmsubasp(__a, __b, __c); 6659 #else 6660 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6661 #endif 6662 } 6663 6664 #ifdef __VSX__ 6665 static __inline__ vector double __ATTRS_o_ai vec_nmsub(vector double __a, 6666 vector double __b, 6667 vector double __c) { 6668 return __builtin_vsx_xvnmsubadp(__a, __b, __c); 6669 } 6670 #endif 6671 6672 /* vec_vnmsubfp */ 6673 6674 static __inline__ vector float __attribute__((__always_inline__)) 6675 vec_vnmsubfp(vector float __a, vector float __b, vector float __c) { 6676 return __builtin_altivec_vnmsubfp(__a, __b, __c); 6677 } 6678 6679 /* vec_nor */ 6680 6681 #define __builtin_altivec_vnor vec_nor 6682 6683 static __inline__ vector signed char __ATTRS_o_ai 6684 vec_nor(vector signed char __a, vector signed char __b) { 6685 return ~(__a | __b); 6686 } 6687 6688 static __inline__ vector unsigned char __ATTRS_o_ai 6689 vec_nor(vector unsigned char __a, vector unsigned char __b) { 6690 return ~(__a | __b); 6691 } 6692 6693 static __inline__ vector bool char __ATTRS_o_ai vec_nor(vector bool char __a, 6694 vector bool char __b) { 6695 return ~(__a | __b); 6696 } 6697 6698 static __inline__ vector short __ATTRS_o_ai vec_nor(vector short __a, 6699 vector short __b) { 6700 return ~(__a | __b); 6701 } 6702 6703 static __inline__ vector unsigned short __ATTRS_o_ai 6704 vec_nor(vector unsigned short __a, vector unsigned short __b) { 6705 return ~(__a | __b); 6706 } 6707 6708 static __inline__ vector bool short __ATTRS_o_ai 6709 vec_nor(vector bool short __a, vector bool short __b) { 6710 return ~(__a | __b); 6711 } 6712 6713 static __inline__ vector int __ATTRS_o_ai vec_nor(vector int __a, 6714 vector int __b) { 6715 return ~(__a | __b); 6716 } 6717 6718 static __inline__ vector unsigned int __ATTRS_o_ai 6719 vec_nor(vector unsigned int __a, vector unsigned int __b) { 6720 return ~(__a | __b); 6721 } 6722 6723 static __inline__ vector bool int __ATTRS_o_ai vec_nor(vector bool int __a, 6724 vector bool int __b) { 6725 return ~(__a | __b); 6726 } 6727 6728 static __inline__ vector float __ATTRS_o_ai vec_nor(vector float __a, 6729 vector float __b) { 6730 vector unsigned int __res = 6731 ~((vector unsigned int)__a | (vector unsigned int)__b); 6732 return (vector float)__res; 6733 } 6734 6735 #ifdef __VSX__ 6736 static __inline__ vector double __ATTRS_o_ai vec_nor(vector double __a, 6737 vector double __b) { 6738 vector unsigned long long __res = 6739 ~((vector unsigned long long)__a | (vector unsigned long long)__b); 6740 return (vector double)__res; 6741 } 6742 #endif 6743 6744 /* vec_vnor */ 6745 6746 static __inline__ vector signed char __ATTRS_o_ai 6747 vec_vnor(vector signed char __a, vector signed char __b) { 6748 return ~(__a | __b); 6749 } 6750 6751 static __inline__ vector unsigned char __ATTRS_o_ai 6752 vec_vnor(vector unsigned char __a, vector unsigned char __b) { 6753 return ~(__a | __b); 6754 } 6755 6756 static __inline__ vector bool char __ATTRS_o_ai vec_vnor(vector bool char __a, 6757 vector bool char __b) { 6758 return ~(__a | __b); 6759 } 6760 6761 static __inline__ vector short __ATTRS_o_ai vec_vnor(vector short __a, 6762 vector short __b) { 6763 return ~(__a | __b); 6764 } 6765 6766 static __inline__ vector unsigned short __ATTRS_o_ai 6767 vec_vnor(vector unsigned short __a, vector unsigned short __b) { 6768 return ~(__a | __b); 6769 } 6770 6771 static __inline__ vector bool short __ATTRS_o_ai 6772 vec_vnor(vector bool short __a, vector bool short __b) { 6773 return ~(__a | __b); 6774 } 6775 6776 static __inline__ vector int __ATTRS_o_ai vec_vnor(vector int __a, 6777 vector int __b) { 6778 return ~(__a | __b); 6779 } 6780 6781 static __inline__ vector unsigned int __ATTRS_o_ai 6782 vec_vnor(vector unsigned int __a, vector unsigned int __b) { 6783 return ~(__a | __b); 6784 } 6785 6786 static __inline__ vector bool int __ATTRS_o_ai vec_vnor(vector bool int __a, 6787 vector bool int __b) { 6788 return ~(__a | __b); 6789 } 6790 6791 static __inline__ vector float __ATTRS_o_ai vec_vnor(vector float __a, 6792 vector float __b) { 6793 vector unsigned int __res = 6794 ~((vector unsigned int)__a | (vector unsigned int)__b); 6795 return (vector float)__res; 6796 } 6797 6798 #ifdef __VSX__ 6799 static __inline__ vector signed long long __ATTRS_o_ai 6800 vec_nor(vector signed long long __a, vector signed long long __b) { 6801 return ~(__a | __b); 6802 } 6803 6804 static __inline__ vector unsigned long long __ATTRS_o_ai 6805 vec_nor(vector unsigned long long __a, vector unsigned long long __b) { 6806 return ~(__a | __b); 6807 } 6808 6809 static __inline__ vector bool long long __ATTRS_o_ai 6810 vec_nor(vector bool long long __a, vector bool long long __b) { 6811 return ~(__a | __b); 6812 } 6813 #endif 6814 6815 /* vec_or */ 6816 6817 #define __builtin_altivec_vor vec_or 6818 6819 static __inline__ vector signed char __ATTRS_o_ai 6820 vec_or(vector signed char __a, vector signed char __b) { 6821 return __a | __b; 6822 } 6823 6824 static __inline__ vector signed char __ATTRS_o_ai 6825 vec_or(vector bool char __a, vector signed char __b) { 6826 return (vector signed char)__a | __b; 6827 } 6828 6829 static __inline__ vector signed char __ATTRS_o_ai vec_or(vector signed char __a, 6830 vector bool char __b) { 6831 return __a | (vector signed char)__b; 6832 } 6833 6834 static __inline__ vector unsigned char __ATTRS_o_ai 6835 vec_or(vector unsigned char __a, vector unsigned char __b) { 6836 return __a | __b; 6837 } 6838 6839 static __inline__ vector unsigned char __ATTRS_o_ai 6840 vec_or(vector bool char __a, vector unsigned char __b) { 6841 return (vector unsigned char)__a | __b; 6842 } 6843 6844 static __inline__ vector unsigned char __ATTRS_o_ai 6845 vec_or(vector unsigned char __a, vector bool char __b) { 6846 return __a | (vector unsigned char)__b; 6847 } 6848 6849 static __inline__ vector bool char __ATTRS_o_ai vec_or(vector bool char __a, 6850 vector bool char __b) { 6851 return __a | __b; 6852 } 6853 6854 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6855 vector short __b) { 6856 return __a | __b; 6857 } 6858 6859 static __inline__ vector short __ATTRS_o_ai vec_or(vector bool short __a, 6860 vector short __b) { 6861 return (vector short)__a | __b; 6862 } 6863 6864 static __inline__ vector short __ATTRS_o_ai vec_or(vector short __a, 6865 vector bool short __b) { 6866 return __a | (vector short)__b; 6867 } 6868 6869 static __inline__ vector unsigned short __ATTRS_o_ai 6870 vec_or(vector unsigned short __a, vector unsigned short __b) { 6871 return __a | __b; 6872 } 6873 6874 static __inline__ vector unsigned short __ATTRS_o_ai 6875 vec_or(vector bool short __a, vector unsigned short __b) { 6876 return (vector unsigned short)__a | __b; 6877 } 6878 6879 static __inline__ vector unsigned short __ATTRS_o_ai 6880 vec_or(vector unsigned short __a, vector bool short __b) { 6881 return __a | (vector unsigned short)__b; 6882 } 6883 6884 static __inline__ vector bool short __ATTRS_o_ai vec_or(vector bool short __a, 6885 vector bool short __b) { 6886 return __a | __b; 6887 } 6888 6889 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6890 vector int __b) { 6891 return __a | __b; 6892 } 6893 6894 static __inline__ vector int __ATTRS_o_ai vec_or(vector bool int __a, 6895 vector int __b) { 6896 return (vector int)__a | __b; 6897 } 6898 6899 static __inline__ vector int __ATTRS_o_ai vec_or(vector int __a, 6900 vector bool int __b) { 6901 return __a | (vector int)__b; 6902 } 6903 6904 static __inline__ vector unsigned int __ATTRS_o_ai 6905 vec_or(vector unsigned int __a, vector unsigned int __b) { 6906 return __a | __b; 6907 } 6908 6909 static __inline__ vector unsigned int __ATTRS_o_ai 6910 vec_or(vector bool int __a, vector unsigned int __b) { 6911 return (vector unsigned int)__a | __b; 6912 } 6913 6914 static __inline__ vector unsigned int __ATTRS_o_ai 6915 vec_or(vector unsigned int __a, vector bool int __b) { 6916 return __a | (vector unsigned int)__b; 6917 } 6918 6919 static __inline__ vector bool int __ATTRS_o_ai vec_or(vector bool int __a, 6920 vector bool int __b) { 6921 return __a | __b; 6922 } 6923 6924 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6925 vector float __b) { 6926 vector unsigned int __res = 6927 (vector unsigned int)__a | (vector unsigned int)__b; 6928 return (vector float)__res; 6929 } 6930 6931 static __inline__ vector float __ATTRS_o_ai vec_or(vector bool int __a, 6932 vector float __b) { 6933 vector unsigned int __res = 6934 (vector unsigned int)__a | (vector unsigned int)__b; 6935 return (vector float)__res; 6936 } 6937 6938 static __inline__ vector float __ATTRS_o_ai vec_or(vector float __a, 6939 vector bool int __b) { 6940 vector unsigned int __res = 6941 (vector unsigned int)__a | (vector unsigned int)__b; 6942 return (vector float)__res; 6943 } 6944 6945 #ifdef __VSX__ 6946 static __inline__ vector double __ATTRS_o_ai vec_or(vector bool long long __a, 6947 vector double __b) { 6948 return (vector double)((vector unsigned long long)__a | 6949 (vector unsigned long long)__b); 6950 } 6951 6952 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6953 vector bool long long __b) { 6954 return (vector double)((vector unsigned long long)__a | 6955 (vector unsigned long long)__b); 6956 } 6957 6958 static __inline__ vector double __ATTRS_o_ai vec_or(vector double __a, 6959 vector double __b) { 6960 return (vector double)((vector unsigned long long)__a | 6961 (vector unsigned long long)__b); 6962 } 6963 6964 static __inline__ vector signed long long __ATTRS_o_ai 6965 vec_or(vector signed long long __a, vector signed long long __b) { 6966 return __a | __b; 6967 } 6968 6969 static __inline__ vector signed long long __ATTRS_o_ai 6970 vec_or(vector bool long long __a, vector signed long long __b) { 6971 return (vector signed long long)__a | __b; 6972 } 6973 6974 static __inline__ vector signed long long __ATTRS_o_ai 6975 vec_or(vector signed long long __a, vector bool long long __b) { 6976 return __a | (vector signed long long)__b; 6977 } 6978 6979 static __inline__ vector unsigned long long __ATTRS_o_ai 6980 vec_or(vector unsigned long long __a, vector unsigned long long __b) { 6981 return __a | __b; 6982 } 6983 6984 static __inline__ vector unsigned long long __ATTRS_o_ai 6985 vec_or(vector bool long long __a, vector unsigned long long __b) { 6986 return (vector unsigned long long)__a | __b; 6987 } 6988 6989 static __inline__ vector unsigned long long __ATTRS_o_ai 6990 vec_or(vector unsigned long long __a, vector bool long long __b) { 6991 return __a | (vector unsigned long long)__b; 6992 } 6993 6994 static __inline__ vector bool long long __ATTRS_o_ai 6995 vec_or(vector bool long long __a, vector bool long long __b) { 6996 return __a | __b; 6997 } 6998 #endif 6999 7000 #ifdef __POWER8_VECTOR__ 7001 static __inline__ vector signed char __ATTRS_o_ai 7002 vec_orc(vector signed char __a, vector signed char __b) { 7003 return __a | ~__b; 7004 } 7005 7006 static __inline__ vector signed char __ATTRS_o_ai 7007 vec_orc(vector signed char __a, vector bool char __b) { 7008 return __a | ~__b; 7009 } 7010 7011 static __inline__ vector signed char __ATTRS_o_ai 7012 vec_orc(vector bool char __a, vector signed char __b) { 7013 return __a | ~__b; 7014 } 7015 7016 static __inline__ vector unsigned char __ATTRS_o_ai 7017 vec_orc(vector unsigned char __a, vector unsigned char __b) { 7018 return __a | ~__b; 7019 } 7020 7021 static __inline__ vector unsigned char __ATTRS_o_ai 7022 vec_orc(vector unsigned char __a, vector bool char __b) { 7023 return __a | ~__b; 7024 } 7025 7026 static __inline__ vector unsigned char __ATTRS_o_ai 7027 vec_orc(vector bool char __a, vector unsigned char __b) { 7028 return __a | ~__b; 7029 } 7030 7031 static __inline__ vector bool char __ATTRS_o_ai vec_orc(vector bool char __a, 7032 vector bool char __b) { 7033 return __a | ~__b; 7034 } 7035 7036 static __inline__ vector signed short __ATTRS_o_ai 7037 vec_orc(vector signed short __a, vector signed short __b) { 7038 return __a | ~__b; 7039 } 7040 7041 static __inline__ vector signed short __ATTRS_o_ai 7042 vec_orc(vector signed short __a, vector bool short __b) { 7043 return __a | ~__b; 7044 } 7045 7046 static __inline__ vector signed short __ATTRS_o_ai 7047 vec_orc(vector bool short __a, vector signed short __b) { 7048 return __a | ~__b; 7049 } 7050 7051 static __inline__ vector unsigned short __ATTRS_o_ai 7052 vec_orc(vector unsigned short __a, vector unsigned short __b) { 7053 return __a | ~__b; 7054 } 7055 7056 static __inline__ vector unsigned short __ATTRS_o_ai 7057 vec_orc(vector unsigned short __a, vector bool short __b) { 7058 return __a | ~__b; 7059 } 7060 7061 static __inline__ vector unsigned short __ATTRS_o_ai 7062 vec_orc(vector bool short __a, vector unsigned short __b) { 7063 return __a | ~__b; 7064 } 7065 7066 static __inline__ vector bool short __ATTRS_o_ai 7067 vec_orc(vector bool short __a, vector bool short __b) { 7068 return __a | ~__b; 7069 } 7070 7071 static __inline__ vector signed int __ATTRS_o_ai 7072 vec_orc(vector signed int __a, vector signed int __b) { 7073 return __a | ~__b; 7074 } 7075 7076 static __inline__ vector signed int __ATTRS_o_ai vec_orc(vector signed int __a, 7077 vector bool int __b) { 7078 return __a | ~__b; 7079 } 7080 7081 static __inline__ vector signed int __ATTRS_o_ai 7082 vec_orc(vector bool int __a, vector signed int __b) { 7083 return __a | ~__b; 7084 } 7085 7086 static __inline__ vector unsigned int __ATTRS_o_ai 7087 vec_orc(vector unsigned int __a, vector unsigned int __b) { 7088 return __a | ~__b; 7089 } 7090 7091 static __inline__ vector unsigned int __ATTRS_o_ai 7092 vec_orc(vector unsigned int __a, vector bool int __b) { 7093 return __a | ~__b; 7094 } 7095 7096 static __inline__ vector unsigned int __ATTRS_o_ai 7097 vec_orc(vector bool int __a, vector unsigned int __b) { 7098 return __a | ~__b; 7099 } 7100 7101 static __inline__ vector bool int __ATTRS_o_ai vec_orc(vector bool int __a, 7102 vector bool int __b) { 7103 return __a | ~__b; 7104 } 7105 7106 static __inline__ vector float __ATTRS_o_ai 7107 vec_orc(vector bool int __a, vector float __b) { 7108 return (vector float)(__a | ~(vector unsigned int)__b); 7109 } 7110 7111 static __inline__ vector float __ATTRS_o_ai 7112 vec_orc(vector float __a, vector bool int __b) { 7113 return (vector float)((vector unsigned int)__a | ~__b); 7114 } 7115 7116 static __inline__ vector float __ATTRS_o_ai vec_orc(vector float __a, 7117 vector float __b) { 7118 return (vector float)((vector unsigned int)__a | ~(vector unsigned int)__b); 7119 } 7120 7121 static __inline__ vector signed long long __ATTRS_o_ai 7122 vec_orc(vector signed long long __a, vector signed long long __b) { 7123 return __a | ~__b; 7124 } 7125 7126 static __inline__ vector signed long long __ATTRS_o_ai 7127 vec_orc(vector signed long long __a, vector bool long long __b) { 7128 return __a | ~__b; 7129 } 7130 7131 static __inline__ vector signed long long __ATTRS_o_ai 7132 vec_orc(vector bool long long __a, vector signed long long __b) { 7133 return __a | ~__b; 7134 } 7135 7136 static __inline__ vector unsigned long long __ATTRS_o_ai 7137 vec_orc(vector unsigned long long __a, vector unsigned long long __b) { 7138 return __a | ~__b; 7139 } 7140 7141 static __inline__ vector unsigned long long __ATTRS_o_ai 7142 vec_orc(vector unsigned long long __a, vector bool long long __b) { 7143 return __a | ~__b; 7144 } 7145 7146 static __inline__ vector unsigned long long __ATTRS_o_ai 7147 vec_orc(vector bool long long __a, vector unsigned long long __b) { 7148 return __a | ~__b; 7149 } 7150 7151 static __inline__ vector bool long long __ATTRS_o_ai 7152 vec_orc(vector bool long long __a, vector bool long long __b) { 7153 return __a | ~__b; 7154 } 7155 7156 static __inline__ vector double __ATTRS_o_ai 7157 vec_orc(vector double __a, vector bool long long __b) { 7158 return (vector double)((vector unsigned long long)__a | ~__b); 7159 } 7160 7161 static __inline__ vector double __ATTRS_o_ai 7162 vec_orc(vector bool long long __a, vector double __b) { 7163 return (vector double)(__a | ~(vector unsigned long long)__b); 7164 } 7165 7166 static __inline__ vector double __ATTRS_o_ai vec_orc(vector double __a, 7167 vector double __b) { 7168 return (vector double)((vector bool long long)__a | 7169 ~(vector unsigned long long)__b); 7170 } 7171 #endif 7172 7173 /* vec_vor */ 7174 7175 static __inline__ vector signed char __ATTRS_o_ai 7176 vec_vor(vector signed char __a, vector signed char __b) { 7177 return __a | __b; 7178 } 7179 7180 static __inline__ vector signed char __ATTRS_o_ai 7181 vec_vor(vector bool char __a, vector signed char __b) { 7182 return (vector signed char)__a | __b; 7183 } 7184 7185 static __inline__ vector signed char __ATTRS_o_ai 7186 vec_vor(vector signed char __a, vector bool char __b) { 7187 return __a | (vector signed char)__b; 7188 } 7189 7190 static __inline__ vector unsigned char __ATTRS_o_ai 7191 vec_vor(vector unsigned char __a, vector unsigned char __b) { 7192 return __a | __b; 7193 } 7194 7195 static __inline__ vector unsigned char __ATTRS_o_ai 7196 vec_vor(vector bool char __a, vector unsigned char __b) { 7197 return (vector unsigned char)__a | __b; 7198 } 7199 7200 static __inline__ vector unsigned char __ATTRS_o_ai 7201 vec_vor(vector unsigned char __a, vector bool char __b) { 7202 return __a | (vector unsigned char)__b; 7203 } 7204 7205 static __inline__ vector bool char __ATTRS_o_ai vec_vor(vector bool char __a, 7206 vector bool char __b) { 7207 return __a | __b; 7208 } 7209 7210 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7211 vector short __b) { 7212 return __a | __b; 7213 } 7214 7215 static __inline__ vector short __ATTRS_o_ai vec_vor(vector bool short __a, 7216 vector short __b) { 7217 return (vector short)__a | __b; 7218 } 7219 7220 static __inline__ vector short __ATTRS_o_ai vec_vor(vector short __a, 7221 vector bool short __b) { 7222 return __a | (vector short)__b; 7223 } 7224 7225 static __inline__ vector unsigned short __ATTRS_o_ai 7226 vec_vor(vector unsigned short __a, vector unsigned short __b) { 7227 return __a | __b; 7228 } 7229 7230 static __inline__ vector unsigned short __ATTRS_o_ai 7231 vec_vor(vector bool short __a, vector unsigned short __b) { 7232 return (vector unsigned short)__a | __b; 7233 } 7234 7235 static __inline__ vector unsigned short __ATTRS_o_ai 7236 vec_vor(vector unsigned short __a, vector bool short __b) { 7237 return __a | (vector unsigned short)__b; 7238 } 7239 7240 static __inline__ vector bool short __ATTRS_o_ai 7241 vec_vor(vector bool short __a, vector bool short __b) { 7242 return __a | __b; 7243 } 7244 7245 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7246 vector int __b) { 7247 return __a | __b; 7248 } 7249 7250 static __inline__ vector int __ATTRS_o_ai vec_vor(vector bool int __a, 7251 vector int __b) { 7252 return (vector int)__a | __b; 7253 } 7254 7255 static __inline__ vector int __ATTRS_o_ai vec_vor(vector int __a, 7256 vector bool int __b) { 7257 return __a | (vector int)__b; 7258 } 7259 7260 static __inline__ vector unsigned int __ATTRS_o_ai 7261 vec_vor(vector unsigned int __a, vector unsigned int __b) { 7262 return __a | __b; 7263 } 7264 7265 static __inline__ vector unsigned int __ATTRS_o_ai 7266 vec_vor(vector bool int __a, vector unsigned int __b) { 7267 return (vector unsigned int)__a | __b; 7268 } 7269 7270 static __inline__ vector unsigned int __ATTRS_o_ai 7271 vec_vor(vector unsigned int __a, vector bool int __b) { 7272 return __a | (vector unsigned int)__b; 7273 } 7274 7275 static __inline__ vector bool int __ATTRS_o_ai vec_vor(vector bool int __a, 7276 vector bool int __b) { 7277 return __a | __b; 7278 } 7279 7280 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7281 vector float __b) { 7282 vector unsigned int __res = 7283 (vector unsigned int)__a | (vector unsigned int)__b; 7284 return (vector float)__res; 7285 } 7286 7287 static __inline__ vector float __ATTRS_o_ai vec_vor(vector bool int __a, 7288 vector float __b) { 7289 vector unsigned int __res = 7290 (vector unsigned int)__a | (vector unsigned int)__b; 7291 return (vector float)__res; 7292 } 7293 7294 static __inline__ vector float __ATTRS_o_ai vec_vor(vector float __a, 7295 vector bool int __b) { 7296 vector unsigned int __res = 7297 (vector unsigned int)__a | (vector unsigned int)__b; 7298 return (vector float)__res; 7299 } 7300 7301 #ifdef __VSX__ 7302 static __inline__ vector signed long long __ATTRS_o_ai 7303 vec_vor(vector signed long long __a, vector signed long long __b) { 7304 return __a | __b; 7305 } 7306 7307 static __inline__ vector signed long long __ATTRS_o_ai 7308 vec_vor(vector bool long long __a, vector signed long long __b) { 7309 return (vector signed long long)__a | __b; 7310 } 7311 7312 static __inline__ vector signed long long __ATTRS_o_ai 7313 vec_vor(vector signed long long __a, vector bool long long __b) { 7314 return __a | (vector signed long long)__b; 7315 } 7316 7317 static __inline__ vector unsigned long long __ATTRS_o_ai 7318 vec_vor(vector unsigned long long __a, vector unsigned long long __b) { 7319 return __a | __b; 7320 } 7321 7322 static __inline__ vector unsigned long long __ATTRS_o_ai 7323 vec_vor(vector bool long long __a, vector unsigned long long __b) { 7324 return (vector unsigned long long)__a | __b; 7325 } 7326 7327 static __inline__ vector unsigned long long __ATTRS_o_ai 7328 vec_vor(vector unsigned long long __a, vector bool long long __b) { 7329 return __a | (vector unsigned long long)__b; 7330 } 7331 7332 static __inline__ vector bool long long __ATTRS_o_ai 7333 vec_vor(vector bool long long __a, vector bool long long __b) { 7334 return __a | __b; 7335 } 7336 #endif 7337 7338 /* vec_pack */ 7339 7340 /* The various vector pack instructions have a big-endian bias, so for 7341 little endian we must handle reversed element numbering. */ 7342 7343 static __inline__ vector signed char __ATTRS_o_ai 7344 vec_pack(vector signed short __a, vector signed short __b) { 7345 #ifdef __LITTLE_ENDIAN__ 7346 return (vector signed char)vec_perm( 7347 __a, __b, 7348 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7349 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7350 #else 7351 return (vector signed char)vec_perm( 7352 __a, __b, 7353 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7354 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7355 #endif 7356 } 7357 7358 static __inline__ vector unsigned char __ATTRS_o_ai 7359 vec_pack(vector unsigned short __a, vector unsigned short __b) { 7360 #ifdef __LITTLE_ENDIAN__ 7361 return (vector unsigned char)vec_perm( 7362 __a, __b, 7363 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7364 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7365 #else 7366 return (vector unsigned char)vec_perm( 7367 __a, __b, 7368 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7369 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7370 #endif 7371 } 7372 7373 static __inline__ vector bool char __ATTRS_o_ai 7374 vec_pack(vector bool short __a, vector bool short __b) { 7375 #ifdef __LITTLE_ENDIAN__ 7376 return (vector bool char)vec_perm( 7377 __a, __b, 7378 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7379 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7380 #else 7381 return (vector bool char)vec_perm( 7382 __a, __b, 7383 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7384 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7385 #endif 7386 } 7387 7388 static __inline__ vector short __ATTRS_o_ai vec_pack(vector int __a, 7389 vector int __b) { 7390 #ifdef __LITTLE_ENDIAN__ 7391 return (vector short)vec_perm( 7392 __a, __b, 7393 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7394 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7395 #else 7396 return (vector short)vec_perm( 7397 __a, __b, 7398 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7399 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7400 #endif 7401 } 7402 7403 static __inline__ vector unsigned short __ATTRS_o_ai 7404 vec_pack(vector unsigned int __a, vector unsigned int __b) { 7405 #ifdef __LITTLE_ENDIAN__ 7406 return (vector unsigned short)vec_perm( 7407 __a, __b, 7408 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7409 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7410 #else 7411 return (vector unsigned short)vec_perm( 7412 __a, __b, 7413 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7414 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7415 #endif 7416 } 7417 7418 static __inline__ vector bool short __ATTRS_o_ai vec_pack(vector bool int __a, 7419 vector bool int __b) { 7420 #ifdef __LITTLE_ENDIAN__ 7421 return (vector bool short)vec_perm( 7422 __a, __b, 7423 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7424 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7425 #else 7426 return (vector bool short)vec_perm( 7427 __a, __b, 7428 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7429 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7430 #endif 7431 } 7432 7433 #ifdef __VSX__ 7434 static __inline__ vector signed int __ATTRS_o_ai 7435 vec_pack(vector signed long long __a, vector signed long long __b) { 7436 #ifdef __LITTLE_ENDIAN__ 7437 return (vector signed int)vec_perm( 7438 __a, __b, 7439 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7440 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7441 #else 7442 return (vector signed int)vec_perm( 7443 __a, __b, 7444 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7445 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7446 #endif 7447 } 7448 static __inline__ vector unsigned int __ATTRS_o_ai 7449 vec_pack(vector unsigned long long __a, vector unsigned long long __b) { 7450 #ifdef __LITTLE_ENDIAN__ 7451 return (vector unsigned int)vec_perm( 7452 __a, __b, 7453 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7454 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7455 #else 7456 return (vector unsigned int)vec_perm( 7457 __a, __b, 7458 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7459 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7460 #endif 7461 } 7462 7463 static __inline__ vector bool int __ATTRS_o_ai 7464 vec_pack(vector bool long long __a, vector bool long long __b) { 7465 #ifdef __LITTLE_ENDIAN__ 7466 return (vector bool int)vec_perm( 7467 __a, __b, 7468 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7469 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7470 #else 7471 return (vector bool int)vec_perm( 7472 __a, __b, 7473 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7474 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7475 #endif 7476 } 7477 7478 static __inline__ vector float __ATTRS_o_ai 7479 vec_pack(vector double __a, vector double __b) { 7480 return (vector float) (__a[0], __a[1], __b[0], __b[1]); 7481 } 7482 #endif 7483 7484 #ifdef __POWER9_VECTOR__ 7485 static __inline__ vector unsigned short __ATTRS_o_ai 7486 vec_pack_to_short_fp32(vector float __a, vector float __b) { 7487 vector float __resa = __builtin_vsx_xvcvsphp(__a); 7488 vector float __resb = __builtin_vsx_xvcvsphp(__b); 7489 #ifdef __LITTLE_ENDIAN__ 7490 return (vector unsigned short)vec_mergee(__resa, __resb); 7491 #else 7492 return (vector unsigned short)vec_mergeo(__resa, __resb); 7493 #endif 7494 } 7495 7496 #endif 7497 /* vec_vpkuhum */ 7498 7499 #define __builtin_altivec_vpkuhum vec_vpkuhum 7500 7501 static __inline__ vector signed char __ATTRS_o_ai 7502 vec_vpkuhum(vector signed short __a, vector signed short __b) { 7503 #ifdef __LITTLE_ENDIAN__ 7504 return (vector signed char)vec_perm( 7505 __a, __b, 7506 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7507 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7508 #else 7509 return (vector signed char)vec_perm( 7510 __a, __b, 7511 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7512 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7513 #endif 7514 } 7515 7516 static __inline__ vector unsigned char __ATTRS_o_ai 7517 vec_vpkuhum(vector unsigned short __a, vector unsigned short __b) { 7518 #ifdef __LITTLE_ENDIAN__ 7519 return (vector unsigned char)vec_perm( 7520 __a, __b, 7521 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7522 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7523 #else 7524 return (vector unsigned char)vec_perm( 7525 __a, __b, 7526 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7527 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7528 #endif 7529 } 7530 7531 static __inline__ vector bool char __ATTRS_o_ai 7532 vec_vpkuhum(vector bool short __a, vector bool short __b) { 7533 #ifdef __LITTLE_ENDIAN__ 7534 return (vector bool char)vec_perm( 7535 __a, __b, 7536 (vector unsigned char)(0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 7537 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E)); 7538 #else 7539 return (vector bool char)vec_perm( 7540 __a, __b, 7541 (vector unsigned char)(0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 7542 0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F)); 7543 #endif 7544 } 7545 7546 /* vec_vpkuwum */ 7547 7548 #define __builtin_altivec_vpkuwum vec_vpkuwum 7549 7550 static __inline__ vector short __ATTRS_o_ai vec_vpkuwum(vector int __a, 7551 vector int __b) { 7552 #ifdef __LITTLE_ENDIAN__ 7553 return (vector short)vec_perm( 7554 __a, __b, 7555 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7556 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7557 #else 7558 return (vector short)vec_perm( 7559 __a, __b, 7560 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7561 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7562 #endif 7563 } 7564 7565 static __inline__ vector unsigned short __ATTRS_o_ai 7566 vec_vpkuwum(vector unsigned int __a, vector unsigned int __b) { 7567 #ifdef __LITTLE_ENDIAN__ 7568 return (vector unsigned short)vec_perm( 7569 __a, __b, 7570 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7571 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7572 #else 7573 return (vector unsigned short)vec_perm( 7574 __a, __b, 7575 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7576 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7577 #endif 7578 } 7579 7580 static __inline__ vector bool short __ATTRS_o_ai 7581 vec_vpkuwum(vector bool int __a, vector bool int __b) { 7582 #ifdef __LITTLE_ENDIAN__ 7583 return (vector bool short)vec_perm( 7584 __a, __b, 7585 (vector unsigned char)(0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0C, 0x0D, 7586 0x10, 0x11, 0x14, 0x15, 0x18, 0x19, 0x1C, 0x1D)); 7587 #else 7588 return (vector bool short)vec_perm( 7589 __a, __b, 7590 (vector unsigned char)(0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F, 7591 0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F)); 7592 #endif 7593 } 7594 7595 /* vec_vpkudum */ 7596 7597 #ifdef __POWER8_VECTOR__ 7598 #define __builtin_altivec_vpkudum vec_vpkudum 7599 7600 static __inline__ vector int __ATTRS_o_ai vec_vpkudum(vector long long __a, 7601 vector long long __b) { 7602 #ifdef __LITTLE_ENDIAN__ 7603 return (vector int)vec_perm( 7604 __a, __b, 7605 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7606 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7607 #else 7608 return (vector int)vec_perm( 7609 __a, __b, 7610 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7611 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7612 #endif 7613 } 7614 7615 static __inline__ vector unsigned int __ATTRS_o_ai 7616 vec_vpkudum(vector unsigned long long __a, vector unsigned long long __b) { 7617 #ifdef __LITTLE_ENDIAN__ 7618 return (vector unsigned int)vec_perm( 7619 __a, __b, 7620 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7621 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7622 #else 7623 return (vector unsigned int)vec_perm( 7624 __a, __b, 7625 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7626 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7627 #endif 7628 } 7629 7630 static __inline__ vector bool int __ATTRS_o_ai 7631 vec_vpkudum(vector bool long long __a, vector bool long long __b) { 7632 #ifdef __LITTLE_ENDIAN__ 7633 return (vector bool int)vec_perm( 7634 (vector long long)__a, (vector long long)__b, 7635 (vector unsigned char)(0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 7636 0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B)); 7637 #else 7638 return (vector bool int)vec_perm( 7639 (vector long long)__a, (vector long long)__b, 7640 (vector unsigned char)(0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 7641 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F)); 7642 #endif 7643 } 7644 #endif 7645 7646 /* vec_packpx */ 7647 7648 static __inline__ vector pixel __attribute__((__always_inline__)) 7649 vec_packpx(vector unsigned int __a, vector unsigned int __b) { 7650 #ifdef __LITTLE_ENDIAN__ 7651 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7652 #else 7653 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7654 #endif 7655 } 7656 7657 /* vec_vpkpx */ 7658 7659 static __inline__ vector pixel __attribute__((__always_inline__)) 7660 vec_vpkpx(vector unsigned int __a, vector unsigned int __b) { 7661 #ifdef __LITTLE_ENDIAN__ 7662 return (vector pixel)__builtin_altivec_vpkpx(__b, __a); 7663 #else 7664 return (vector pixel)__builtin_altivec_vpkpx(__a, __b); 7665 #endif 7666 } 7667 7668 /* vec_packs */ 7669 7670 static __inline__ vector signed char __ATTRS_o_ai vec_packs(vector short __a, 7671 vector short __b) { 7672 #ifdef __LITTLE_ENDIAN__ 7673 return __builtin_altivec_vpkshss(__b, __a); 7674 #else 7675 return __builtin_altivec_vpkshss(__a, __b); 7676 #endif 7677 } 7678 7679 static __inline__ vector unsigned char __ATTRS_o_ai 7680 vec_packs(vector unsigned short __a, vector unsigned short __b) { 7681 #ifdef __LITTLE_ENDIAN__ 7682 return __builtin_altivec_vpkuhus(__b, __a); 7683 #else 7684 return __builtin_altivec_vpkuhus(__a, __b); 7685 #endif 7686 } 7687 7688 static __inline__ vector signed short __ATTRS_o_ai vec_packs(vector int __a, 7689 vector int __b) { 7690 #ifdef __LITTLE_ENDIAN__ 7691 return __builtin_altivec_vpkswss(__b, __a); 7692 #else 7693 return __builtin_altivec_vpkswss(__a, __b); 7694 #endif 7695 } 7696 7697 static __inline__ vector unsigned short __ATTRS_o_ai 7698 vec_packs(vector unsigned int __a, vector unsigned int __b) { 7699 #ifdef __LITTLE_ENDIAN__ 7700 return __builtin_altivec_vpkuwus(__b, __a); 7701 #else 7702 return __builtin_altivec_vpkuwus(__a, __b); 7703 #endif 7704 } 7705 7706 #ifdef __POWER8_VECTOR__ 7707 static __inline__ vector int __ATTRS_o_ai vec_packs(vector long long __a, 7708 vector long long __b) { 7709 #ifdef __LITTLE_ENDIAN__ 7710 return __builtin_altivec_vpksdss(__b, __a); 7711 #else 7712 return __builtin_altivec_vpksdss(__a, __b); 7713 #endif 7714 } 7715 7716 static __inline__ vector unsigned int __ATTRS_o_ai 7717 vec_packs(vector unsigned long long __a, vector unsigned long long __b) { 7718 #ifdef __LITTLE_ENDIAN__ 7719 return __builtin_altivec_vpkudus(__b, __a); 7720 #else 7721 return __builtin_altivec_vpkudus(__a, __b); 7722 #endif 7723 } 7724 #endif 7725 7726 /* vec_vpkshss */ 7727 7728 static __inline__ vector signed char __attribute__((__always_inline__)) 7729 vec_vpkshss(vector short __a, vector short __b) { 7730 #ifdef __LITTLE_ENDIAN__ 7731 return __builtin_altivec_vpkshss(__b, __a); 7732 #else 7733 return __builtin_altivec_vpkshss(__a, __b); 7734 #endif 7735 } 7736 7737 /* vec_vpksdss */ 7738 7739 #ifdef __POWER8_VECTOR__ 7740 static __inline__ vector int __ATTRS_o_ai vec_vpksdss(vector long long __a, 7741 vector long long __b) { 7742 #ifdef __LITTLE_ENDIAN__ 7743 return __builtin_altivec_vpksdss(__b, __a); 7744 #else 7745 return __builtin_altivec_vpksdss(__a, __b); 7746 #endif 7747 } 7748 #endif 7749 7750 /* vec_vpkuhus */ 7751 7752 static __inline__ vector unsigned char __attribute__((__always_inline__)) 7753 vec_vpkuhus(vector unsigned short __a, vector unsigned short __b) { 7754 #ifdef __LITTLE_ENDIAN__ 7755 return __builtin_altivec_vpkuhus(__b, __a); 7756 #else 7757 return __builtin_altivec_vpkuhus(__a, __b); 7758 #endif 7759 } 7760 7761 /* vec_vpkudus */ 7762 7763 #ifdef __POWER8_VECTOR__ 7764 static __inline__ vector unsigned int __attribute__((__always_inline__)) 7765 vec_vpkudus(vector unsigned long long __a, vector unsigned long long __b) { 7766 #ifdef __LITTLE_ENDIAN__ 7767 return __builtin_altivec_vpkudus(__b, __a); 7768 #else 7769 return __builtin_altivec_vpkudus(__a, __b); 7770 #endif 7771 } 7772 #endif 7773 7774 /* vec_vpkswss */ 7775 7776 static __inline__ vector signed short __attribute__((__always_inline__)) 7777 vec_vpkswss(vector int __a, vector int __b) { 7778 #ifdef __LITTLE_ENDIAN__ 7779 return __builtin_altivec_vpkswss(__b, __a); 7780 #else 7781 return __builtin_altivec_vpkswss(__a, __b); 7782 #endif 7783 } 7784 7785 /* vec_vpkuwus */ 7786 7787 static __inline__ vector unsigned short __attribute__((__always_inline__)) 7788 vec_vpkuwus(vector unsigned int __a, vector unsigned int __b) { 7789 #ifdef __LITTLE_ENDIAN__ 7790 return __builtin_altivec_vpkuwus(__b, __a); 7791 #else 7792 return __builtin_altivec_vpkuwus(__a, __b); 7793 #endif 7794 } 7795 7796 /* vec_packsu */ 7797 7798 static __inline__ vector unsigned char __ATTRS_o_ai 7799 vec_packsu(vector short __a, vector short __b) { 7800 #ifdef __LITTLE_ENDIAN__ 7801 return __builtin_altivec_vpkshus(__b, __a); 7802 #else 7803 return __builtin_altivec_vpkshus(__a, __b); 7804 #endif 7805 } 7806 7807 static __inline__ vector unsigned char __ATTRS_o_ai 7808 vec_packsu(vector unsigned short __a, vector unsigned short __b) { 7809 #ifdef __LITTLE_ENDIAN__ 7810 return __builtin_altivec_vpkuhus(__b, __a); 7811 #else 7812 return __builtin_altivec_vpkuhus(__a, __b); 7813 #endif 7814 } 7815 7816 static __inline__ vector unsigned short __ATTRS_o_ai 7817 vec_packsu(vector int __a, vector int __b) { 7818 #ifdef __LITTLE_ENDIAN__ 7819 return __builtin_altivec_vpkswus(__b, __a); 7820 #else 7821 return __builtin_altivec_vpkswus(__a, __b); 7822 #endif 7823 } 7824 7825 static __inline__ vector unsigned short __ATTRS_o_ai 7826 vec_packsu(vector unsigned int __a, vector unsigned int __b) { 7827 #ifdef __LITTLE_ENDIAN__ 7828 return __builtin_altivec_vpkuwus(__b, __a); 7829 #else 7830 return __builtin_altivec_vpkuwus(__a, __b); 7831 #endif 7832 } 7833 7834 #ifdef __POWER8_VECTOR__ 7835 static __inline__ vector unsigned int __ATTRS_o_ai 7836 vec_packsu(vector long long __a, vector long long __b) { 7837 #ifdef __LITTLE_ENDIAN__ 7838 return __builtin_altivec_vpksdus(__b, __a); 7839 #else 7840 return __builtin_altivec_vpksdus(__a, __b); 7841 #endif 7842 } 7843 7844 static __inline__ vector unsigned int __ATTRS_o_ai 7845 vec_packsu(vector unsigned long long __a, vector unsigned long long __b) { 7846 #ifdef __LITTLE_ENDIAN__ 7847 return __builtin_altivec_vpkudus(__b, __a); 7848 #else 7849 return __builtin_altivec_vpkudus(__a, __b); 7850 #endif 7851 } 7852 #endif 7853 7854 /* vec_vpkshus */ 7855 7856 static __inline__ vector unsigned char __ATTRS_o_ai 7857 vec_vpkshus(vector short __a, vector short __b) { 7858 #ifdef __LITTLE_ENDIAN__ 7859 return __builtin_altivec_vpkshus(__b, __a); 7860 #else 7861 return __builtin_altivec_vpkshus(__a, __b); 7862 #endif 7863 } 7864 7865 static __inline__ vector unsigned char __ATTRS_o_ai 7866 vec_vpkshus(vector unsigned short __a, vector unsigned short __b) { 7867 #ifdef __LITTLE_ENDIAN__ 7868 return __builtin_altivec_vpkuhus(__b, __a); 7869 #else 7870 return __builtin_altivec_vpkuhus(__a, __b); 7871 #endif 7872 } 7873 7874 /* vec_vpkswus */ 7875 7876 static __inline__ vector unsigned short __ATTRS_o_ai 7877 vec_vpkswus(vector int __a, vector int __b) { 7878 #ifdef __LITTLE_ENDIAN__ 7879 return __builtin_altivec_vpkswus(__b, __a); 7880 #else 7881 return __builtin_altivec_vpkswus(__a, __b); 7882 #endif 7883 } 7884 7885 static __inline__ vector unsigned short __ATTRS_o_ai 7886 vec_vpkswus(vector unsigned int __a, vector unsigned int __b) { 7887 #ifdef __LITTLE_ENDIAN__ 7888 return __builtin_altivec_vpkuwus(__b, __a); 7889 #else 7890 return __builtin_altivec_vpkuwus(__a, __b); 7891 #endif 7892 } 7893 7894 /* vec_vpksdus */ 7895 7896 #ifdef __POWER8_VECTOR__ 7897 static __inline__ vector unsigned int __ATTRS_o_ai 7898 vec_vpksdus(vector long long __a, vector long long __b) { 7899 #ifdef __LITTLE_ENDIAN__ 7900 return __builtin_altivec_vpksdus(__b, __a); 7901 #else 7902 return __builtin_altivec_vpksdus(__a, __b); 7903 #endif 7904 } 7905 #endif 7906 7907 /* vec_perm */ 7908 7909 // The vperm instruction is defined architecturally with a big-endian bias. 7910 // For little endian, we swap the input operands and invert the permute 7911 // control vector. Only the rightmost 5 bits matter, so we could use 7912 // a vector of all 31s instead of all 255s to perform the inversion. 7913 // However, when the PCV is not a constant, using 255 has an advantage 7914 // in that the vec_xor can be recognized as a vec_nor (and for P8 and 7915 // later, possibly a vec_nand). 7916 7917 static __inline__ vector signed char __ATTRS_o_ai vec_perm( 7918 vector signed char __a, vector signed char __b, vector unsigned char __c) { 7919 #ifdef __LITTLE_ENDIAN__ 7920 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7921 255, 255, 255, 255, 255, 255, 255, 255}; 7922 __d = vec_xor(__c, __d); 7923 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__b, 7924 (vector int)__a, __d); 7925 #else 7926 return (vector signed char)__builtin_altivec_vperm_4si((vector int)__a, 7927 (vector int)__b, __c); 7928 #endif 7929 } 7930 7931 static __inline__ vector unsigned char __ATTRS_o_ai 7932 vec_perm(vector unsigned char __a, vector unsigned char __b, 7933 vector unsigned char __c) { 7934 #ifdef __LITTLE_ENDIAN__ 7935 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7936 255, 255, 255, 255, 255, 255, 255, 255}; 7937 __d = vec_xor(__c, __d); 7938 return (vector unsigned char)__builtin_altivec_vperm_4si( 7939 (vector int)__b, (vector int)__a, __d); 7940 #else 7941 return (vector unsigned char)__builtin_altivec_vperm_4si( 7942 (vector int)__a, (vector int)__b, __c); 7943 #endif 7944 } 7945 7946 static __inline__ vector bool char __ATTRS_o_ai 7947 vec_perm(vector bool char __a, vector bool char __b, vector unsigned char __c) { 7948 #ifdef __LITTLE_ENDIAN__ 7949 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7950 255, 255, 255, 255, 255, 255, 255, 255}; 7951 __d = vec_xor(__c, __d); 7952 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__b, 7953 (vector int)__a, __d); 7954 #else 7955 return (vector bool char)__builtin_altivec_vperm_4si((vector int)__a, 7956 (vector int)__b, __c); 7957 #endif 7958 } 7959 7960 static __inline__ vector short __ATTRS_o_ai vec_perm(vector signed short __a, 7961 vector signed short __b, 7962 vector unsigned char __c) { 7963 #ifdef __LITTLE_ENDIAN__ 7964 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7965 255, 255, 255, 255, 255, 255, 255, 255}; 7966 __d = vec_xor(__c, __d); 7967 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__b, 7968 (vector int)__a, __d); 7969 #else 7970 return (vector signed short)__builtin_altivec_vperm_4si((vector int)__a, 7971 (vector int)__b, __c); 7972 #endif 7973 } 7974 7975 static __inline__ vector unsigned short __ATTRS_o_ai 7976 vec_perm(vector unsigned short __a, vector unsigned short __b, 7977 vector unsigned char __c) { 7978 #ifdef __LITTLE_ENDIAN__ 7979 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7980 255, 255, 255, 255, 255, 255, 255, 255}; 7981 __d = vec_xor(__c, __d); 7982 return (vector unsigned short)__builtin_altivec_vperm_4si( 7983 (vector int)__b, (vector int)__a, __d); 7984 #else 7985 return (vector unsigned short)__builtin_altivec_vperm_4si( 7986 (vector int)__a, (vector int)__b, __c); 7987 #endif 7988 } 7989 7990 static __inline__ vector bool short __ATTRS_o_ai vec_perm( 7991 vector bool short __a, vector bool short __b, vector unsigned char __c) { 7992 #ifdef __LITTLE_ENDIAN__ 7993 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 7994 255, 255, 255, 255, 255, 255, 255, 255}; 7995 __d = vec_xor(__c, __d); 7996 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__b, 7997 (vector int)__a, __d); 7998 #else 7999 return (vector bool short)__builtin_altivec_vperm_4si((vector int)__a, 8000 (vector int)__b, __c); 8001 #endif 8002 } 8003 8004 static __inline__ vector pixel __ATTRS_o_ai vec_perm(vector pixel __a, 8005 vector pixel __b, 8006 vector unsigned char __c) { 8007 #ifdef __LITTLE_ENDIAN__ 8008 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8009 255, 255, 255, 255, 255, 255, 255, 255}; 8010 __d = vec_xor(__c, __d); 8011 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__b, 8012 (vector int)__a, __d); 8013 #else 8014 return (vector pixel)__builtin_altivec_vperm_4si((vector int)__a, 8015 (vector int)__b, __c); 8016 #endif 8017 } 8018 8019 static __inline__ vector int __ATTRS_o_ai vec_perm(vector signed int __a, 8020 vector signed int __b, 8021 vector unsigned char __c) { 8022 #ifdef __LITTLE_ENDIAN__ 8023 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8024 255, 255, 255, 255, 255, 255, 255, 255}; 8025 __d = vec_xor(__c, __d); 8026 return (vector signed int)__builtin_altivec_vperm_4si(__b, __a, __d); 8027 #else 8028 return (vector signed int)__builtin_altivec_vperm_4si(__a, __b, __c); 8029 #endif 8030 } 8031 8032 static __inline__ vector unsigned int __ATTRS_o_ai 8033 vec_perm(vector unsigned int __a, vector unsigned int __b, 8034 vector unsigned char __c) { 8035 #ifdef __LITTLE_ENDIAN__ 8036 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8037 255, 255, 255, 255, 255, 255, 255, 255}; 8038 __d = vec_xor(__c, __d); 8039 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__b, 8040 (vector int)__a, __d); 8041 #else 8042 return (vector unsigned int)__builtin_altivec_vperm_4si((vector int)__a, 8043 (vector int)__b, __c); 8044 #endif 8045 } 8046 8047 static __inline__ vector bool int __ATTRS_o_ai 8048 vec_perm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8049 #ifdef __LITTLE_ENDIAN__ 8050 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8051 255, 255, 255, 255, 255, 255, 255, 255}; 8052 __d = vec_xor(__c, __d); 8053 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__b, 8054 (vector int)__a, __d); 8055 #else 8056 return (vector bool int)__builtin_altivec_vperm_4si((vector int)__a, 8057 (vector int)__b, __c); 8058 #endif 8059 } 8060 8061 static __inline__ vector float __ATTRS_o_ai vec_perm(vector float __a, 8062 vector float __b, 8063 vector unsigned char __c) { 8064 #ifdef __LITTLE_ENDIAN__ 8065 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8066 255, 255, 255, 255, 255, 255, 255, 255}; 8067 __d = vec_xor(__c, __d); 8068 return (vector float)__builtin_altivec_vperm_4si((vector int)__b, 8069 (vector int)__a, __d); 8070 #else 8071 return (vector float)__builtin_altivec_vperm_4si((vector int)__a, 8072 (vector int)__b, __c); 8073 #endif 8074 } 8075 8076 #ifdef __VSX__ 8077 static __inline__ vector long long __ATTRS_o_ai 8078 vec_perm(vector signed long long __a, vector signed long long __b, 8079 vector unsigned char __c) { 8080 #ifdef __LITTLE_ENDIAN__ 8081 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8082 255, 255, 255, 255, 255, 255, 255, 255}; 8083 __d = vec_xor(__c, __d); 8084 return (vector signed long long)__builtin_altivec_vperm_4si( 8085 (vector int)__b, (vector int)__a, __d); 8086 #else 8087 return (vector signed long long)__builtin_altivec_vperm_4si( 8088 (vector int)__a, (vector int)__b, __c); 8089 #endif 8090 } 8091 8092 static __inline__ vector unsigned long long __ATTRS_o_ai 8093 vec_perm(vector unsigned long long __a, vector unsigned long long __b, 8094 vector unsigned char __c) { 8095 #ifdef __LITTLE_ENDIAN__ 8096 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8097 255, 255, 255, 255, 255, 255, 255, 255}; 8098 __d = vec_xor(__c, __d); 8099 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8100 (vector int)__b, (vector int)__a, __d); 8101 #else 8102 return (vector unsigned long long)__builtin_altivec_vperm_4si( 8103 (vector int)__a, (vector int)__b, __c); 8104 #endif 8105 } 8106 8107 static __inline__ vector bool long long __ATTRS_o_ai 8108 vec_perm(vector bool long long __a, vector bool long long __b, 8109 vector unsigned char __c) { 8110 #ifdef __LITTLE_ENDIAN__ 8111 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8112 255, 255, 255, 255, 255, 255, 255, 255}; 8113 __d = vec_xor(__c, __d); 8114 return (vector bool long long)__builtin_altivec_vperm_4si( 8115 (vector int)__b, (vector int)__a, __d); 8116 #else 8117 return (vector bool long long)__builtin_altivec_vperm_4si( 8118 (vector int)__a, (vector int)__b, __c); 8119 #endif 8120 } 8121 8122 static __inline__ vector double __ATTRS_o_ai 8123 vec_perm(vector double __a, vector double __b, vector unsigned char __c) { 8124 #ifdef __LITTLE_ENDIAN__ 8125 vector unsigned char __d = {255, 255, 255, 255, 255, 255, 255, 255, 8126 255, 255, 255, 255, 255, 255, 255, 255}; 8127 __d = vec_xor(__c, __d); 8128 return (vector double)__builtin_altivec_vperm_4si((vector int)__b, 8129 (vector int)__a, __d); 8130 #else 8131 return (vector double)__builtin_altivec_vperm_4si((vector int)__a, 8132 (vector int)__b, __c); 8133 #endif 8134 } 8135 #endif 8136 8137 /* vec_vperm */ 8138 8139 static __inline__ vector signed char __ATTRS_o_ai vec_vperm( 8140 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8141 return vec_perm(__a, __b, __c); 8142 } 8143 8144 static __inline__ vector unsigned char __ATTRS_o_ai 8145 vec_vperm(vector unsigned char __a, vector unsigned char __b, 8146 vector unsigned char __c) { 8147 return vec_perm(__a, __b, __c); 8148 } 8149 8150 static __inline__ vector bool char __ATTRS_o_ai vec_vperm( 8151 vector bool char __a, vector bool char __b, vector unsigned char __c) { 8152 return vec_perm(__a, __b, __c); 8153 } 8154 8155 static __inline__ vector short __ATTRS_o_ai 8156 vec_vperm(vector short __a, vector short __b, vector unsigned char __c) { 8157 return vec_perm(__a, __b, __c); 8158 } 8159 8160 static __inline__ vector unsigned short __ATTRS_o_ai 8161 vec_vperm(vector unsigned short __a, vector unsigned short __b, 8162 vector unsigned char __c) { 8163 return vec_perm(__a, __b, __c); 8164 } 8165 8166 static __inline__ vector bool short __ATTRS_o_ai vec_vperm( 8167 vector bool short __a, vector bool short __b, vector unsigned char __c) { 8168 return vec_perm(__a, __b, __c); 8169 } 8170 8171 static __inline__ vector pixel __ATTRS_o_ai 8172 vec_vperm(vector pixel __a, vector pixel __b, vector unsigned char __c) { 8173 return vec_perm(__a, __b, __c); 8174 } 8175 8176 static __inline__ vector int __ATTRS_o_ai vec_vperm(vector int __a, 8177 vector int __b, 8178 vector unsigned char __c) { 8179 return vec_perm(__a, __b, __c); 8180 } 8181 8182 static __inline__ vector unsigned int __ATTRS_o_ai 8183 vec_vperm(vector unsigned int __a, vector unsigned int __b, 8184 vector unsigned char __c) { 8185 return vec_perm(__a, __b, __c); 8186 } 8187 8188 static __inline__ vector bool int __ATTRS_o_ai 8189 vec_vperm(vector bool int __a, vector bool int __b, vector unsigned char __c) { 8190 return vec_perm(__a, __b, __c); 8191 } 8192 8193 static __inline__ vector float __ATTRS_o_ai 8194 vec_vperm(vector float __a, vector float __b, vector unsigned char __c) { 8195 return vec_perm(__a, __b, __c); 8196 } 8197 8198 #ifdef __VSX__ 8199 static __inline__ vector long long __ATTRS_o_ai vec_vperm( 8200 vector long long __a, vector long long __b, vector unsigned char __c) { 8201 return vec_perm(__a, __b, __c); 8202 } 8203 8204 static __inline__ vector unsigned long long __ATTRS_o_ai 8205 vec_vperm(vector unsigned long long __a, vector unsigned long long __b, 8206 vector unsigned char __c) { 8207 return vec_perm(__a, __b, __c); 8208 } 8209 8210 static __inline__ vector double __ATTRS_o_ai 8211 vec_vperm(vector double __a, vector double __b, vector unsigned char __c) { 8212 return vec_perm(__a, __b, __c); 8213 } 8214 #endif 8215 8216 /* vec_re */ 8217 8218 static __inline__ vector float __ATTRS_o_ai vec_re(vector float __a) { 8219 #ifdef __VSX__ 8220 return __builtin_vsx_xvresp(__a); 8221 #else 8222 return __builtin_altivec_vrefp(__a); 8223 #endif 8224 } 8225 8226 #ifdef __VSX__ 8227 static __inline__ vector double __ATTRS_o_ai vec_re(vector double __a) { 8228 return __builtin_vsx_xvredp(__a); 8229 } 8230 #endif 8231 8232 /* vec_vrefp */ 8233 8234 static __inline__ vector float __attribute__((__always_inline__)) 8235 vec_vrefp(vector float __a) { 8236 return __builtin_altivec_vrefp(__a); 8237 } 8238 8239 /* vec_rl */ 8240 8241 static __inline__ vector signed char __ATTRS_o_ai 8242 vec_rl(vector signed char __a, vector unsigned char __b) { 8243 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8244 } 8245 8246 static __inline__ vector unsigned char __ATTRS_o_ai 8247 vec_rl(vector unsigned char __a, vector unsigned char __b) { 8248 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8249 } 8250 8251 static __inline__ vector short __ATTRS_o_ai vec_rl(vector short __a, 8252 vector unsigned short __b) { 8253 return __builtin_altivec_vrlh(__a, __b); 8254 } 8255 8256 static __inline__ vector unsigned short __ATTRS_o_ai 8257 vec_rl(vector unsigned short __a, vector unsigned short __b) { 8258 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8259 } 8260 8261 static __inline__ vector int __ATTRS_o_ai vec_rl(vector int __a, 8262 vector unsigned int __b) { 8263 return __builtin_altivec_vrlw(__a, __b); 8264 } 8265 8266 static __inline__ vector unsigned int __ATTRS_o_ai 8267 vec_rl(vector unsigned int __a, vector unsigned int __b) { 8268 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8269 } 8270 8271 #ifdef __POWER8_VECTOR__ 8272 static __inline__ vector signed long long __ATTRS_o_ai 8273 vec_rl(vector signed long long __a, vector unsigned long long __b) { 8274 return __builtin_altivec_vrld(__a, __b); 8275 } 8276 8277 static __inline__ vector unsigned long long __ATTRS_o_ai 8278 vec_rl(vector unsigned long long __a, vector unsigned long long __b) { 8279 return __builtin_altivec_vrld(__a, __b); 8280 } 8281 #endif 8282 8283 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8284 static __inline__ vector signed __int128 __ATTRS_o_ai 8285 vec_rl(vector signed __int128 __a, vector unsigned __int128 __b) { 8286 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector signed __int128)) - __a)); 8287 } 8288 8289 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8290 vec_rl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 8291 return (__b << __a)|(__b >> ((__CHAR_BIT__ * sizeof(vector unsigned __int128)) - __a)); 8292 } 8293 #endif 8294 8295 /* vec_rlmi */ 8296 #ifdef __POWER9_VECTOR__ 8297 static __inline__ vector unsigned int __ATTRS_o_ai 8298 vec_rlmi(vector unsigned int __a, vector unsigned int __b, 8299 vector unsigned int __c) { 8300 return __builtin_altivec_vrlwmi(__a, __c, __b); 8301 } 8302 8303 static __inline__ vector unsigned long long __ATTRS_o_ai 8304 vec_rlmi(vector unsigned long long __a, vector unsigned long long __b, 8305 vector unsigned long long __c) { 8306 return __builtin_altivec_vrldmi(__a, __c, __b); 8307 } 8308 #endif 8309 8310 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8311 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8312 vec_rlmi(vector unsigned __int128 __a, vector unsigned __int128 __b, 8313 vector unsigned __int128 __c) { 8314 return __builtin_altivec_vrlqmi(__a, __c, __b); 8315 } 8316 8317 static __inline__ vector signed __int128 __ATTRS_o_ai 8318 vec_rlmi(vector signed __int128 __a, vector signed __int128 __b, 8319 vector signed __int128 __c) { 8320 return __builtin_altivec_vrlqmi(__a, __c, __b); 8321 } 8322 #endif 8323 8324 /* vec_rlnm */ 8325 #ifdef __POWER9_VECTOR__ 8326 static __inline__ vector unsigned int __ATTRS_o_ai 8327 vec_rlnm(vector unsigned int __a, vector unsigned int __b, 8328 vector unsigned int __c) { 8329 vector unsigned int OneByte = { 0x8, 0x8, 0x8, 0x8 }; 8330 return __builtin_altivec_vrlwnm(__a, ((__c << OneByte) | __b)); 8331 } 8332 8333 static __inline__ vector unsigned long long __ATTRS_o_ai 8334 vec_rlnm(vector unsigned long long __a, vector unsigned long long __b, 8335 vector unsigned long long __c) { 8336 vector unsigned long long OneByte = { 0x8, 0x8 }; 8337 return __builtin_altivec_vrldnm(__a, ((__c << OneByte) | __b)); 8338 } 8339 #endif 8340 8341 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 8342 static __inline__ vector unsigned __int128 __ATTRS_o_ai 8343 vec_rlnm(vector unsigned __int128 __a, vector unsigned __int128 __b, 8344 vector unsigned __int128 __c) { 8345 // Merge __b and __c using an appropriate shuffle. 8346 vector unsigned char TmpB = (vector unsigned char)__b; 8347 vector unsigned char TmpC = (vector unsigned char)__c; 8348 vector unsigned char MaskAndShift = 8349 #ifdef __LITTLE_ENDIAN__ 8350 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8351 1, -1, -1, -1, -1, -1); 8352 #else 8353 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8354 -1, -1, -1, -1, -1, -1, -1); 8355 #endif 8356 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8357 } 8358 8359 static __inline__ vector signed __int128 __ATTRS_o_ai 8360 vec_rlnm(vector signed __int128 __a, vector signed __int128 __b, 8361 vector signed __int128 __c) { 8362 // Merge __b and __c using an appropriate shuffle. 8363 vector unsigned char TmpB = (vector unsigned char)__b; 8364 vector unsigned char TmpC = (vector unsigned char)__c; 8365 vector unsigned char MaskAndShift = 8366 #ifdef __LITTLE_ENDIAN__ 8367 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, -1, -1, -1, 16, 0, 8368 1, -1, -1, -1, -1, -1); 8369 #else 8370 __builtin_shufflevector(TmpB, TmpC, -1, -1, -1, -1, -1, 31, 30, 15, -1, 8371 -1, -1, -1, -1, -1, -1, -1); 8372 #endif 8373 return __builtin_altivec_vrlqnm(__a, (vector unsigned __int128) MaskAndShift); 8374 } 8375 #endif 8376 8377 /* vec_vrlb */ 8378 8379 static __inline__ vector signed char __ATTRS_o_ai 8380 vec_vrlb(vector signed char __a, vector unsigned char __b) { 8381 return (vector signed char)__builtin_altivec_vrlb((vector char)__a, __b); 8382 } 8383 8384 static __inline__ vector unsigned char __ATTRS_o_ai 8385 vec_vrlb(vector unsigned char __a, vector unsigned char __b) { 8386 return (vector unsigned char)__builtin_altivec_vrlb((vector char)__a, __b); 8387 } 8388 8389 /* vec_vrlh */ 8390 8391 static __inline__ vector short __ATTRS_o_ai 8392 vec_vrlh(vector short __a, vector unsigned short __b) { 8393 return __builtin_altivec_vrlh(__a, __b); 8394 } 8395 8396 static __inline__ vector unsigned short __ATTRS_o_ai 8397 vec_vrlh(vector unsigned short __a, vector unsigned short __b) { 8398 return (vector unsigned short)__builtin_altivec_vrlh((vector short)__a, __b); 8399 } 8400 8401 /* vec_vrlw */ 8402 8403 static __inline__ vector int __ATTRS_o_ai vec_vrlw(vector int __a, 8404 vector unsigned int __b) { 8405 return __builtin_altivec_vrlw(__a, __b); 8406 } 8407 8408 static __inline__ vector unsigned int __ATTRS_o_ai 8409 vec_vrlw(vector unsigned int __a, vector unsigned int __b) { 8410 return (vector unsigned int)__builtin_altivec_vrlw((vector int)__a, __b); 8411 } 8412 8413 /* vec_round */ 8414 8415 static __inline__ vector float __ATTRS_o_ai vec_round(vector float __a) { 8416 return __builtin_altivec_vrfin(__a); 8417 } 8418 8419 #ifdef __VSX__ 8420 #ifdef __XL_COMPAT_ALTIVEC__ 8421 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a); 8422 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8423 double __fpscr = __builtin_readflm(); 8424 __builtin_setrnd(0); 8425 vector double __rounded = vec_rint(__a); 8426 __builtin_setflm(__fpscr); 8427 return __rounded; 8428 } 8429 #else 8430 static __inline__ vector double __ATTRS_o_ai vec_round(vector double __a) { 8431 return __builtin_vsx_xvrdpi(__a); 8432 } 8433 #endif 8434 8435 /* vec_rint */ 8436 8437 static __inline__ vector float __ATTRS_o_ai vec_rint(vector float __a) { 8438 return __builtin_vsx_xvrspic(__a); 8439 } 8440 8441 static __inline__ vector double __ATTRS_o_ai vec_rint(vector double __a) { 8442 return __builtin_vsx_xvrdpic(__a); 8443 } 8444 8445 /* vec_roundc */ 8446 8447 static __inline__ vector float __ATTRS_o_ai vec_roundc(vector float __a) { 8448 return __builtin_vsx_xvrspic(__a); 8449 } 8450 8451 static __inline__ vector double __ATTRS_o_ai vec_roundc(vector double __a) { 8452 return __builtin_vsx_xvrdpic(__a); 8453 } 8454 8455 /* vec_nearbyint */ 8456 8457 static __inline__ vector float __ATTRS_o_ai vec_nearbyint(vector float __a) { 8458 return __builtin_vsx_xvrspi(__a); 8459 } 8460 8461 static __inline__ vector double __ATTRS_o_ai vec_nearbyint(vector double __a) { 8462 return __builtin_vsx_xvrdpi(__a); 8463 } 8464 #endif 8465 8466 /* vec_vrfin */ 8467 8468 static __inline__ vector float __attribute__((__always_inline__)) 8469 vec_vrfin(vector float __a) { 8470 return __builtin_altivec_vrfin(__a); 8471 } 8472 8473 /* vec_sqrt */ 8474 8475 #ifdef __VSX__ 8476 static __inline__ vector float __ATTRS_o_ai vec_sqrt(vector float __a) { 8477 return __builtin_vsx_xvsqrtsp(__a); 8478 } 8479 8480 static __inline__ vector double __ATTRS_o_ai vec_sqrt(vector double __a) { 8481 return __builtin_vsx_xvsqrtdp(__a); 8482 } 8483 #endif 8484 8485 /* vec_rsqrte */ 8486 8487 static __inline__ vector float __ATTRS_o_ai vec_rsqrte(vector float __a) { 8488 #ifdef __VSX__ 8489 return __builtin_vsx_xvrsqrtesp(__a); 8490 #else 8491 return __builtin_altivec_vrsqrtefp(__a); 8492 #endif 8493 } 8494 8495 #ifdef __VSX__ 8496 static __inline__ vector double __ATTRS_o_ai vec_rsqrte(vector double __a) { 8497 return __builtin_vsx_xvrsqrtedp(__a); 8498 } 8499 #endif 8500 8501 static vector float __ATTRS_o_ai vec_rsqrt(vector float __a) { 8502 return __builtin_ppc_rsqrtf(__a); 8503 } 8504 8505 #ifdef __VSX__ 8506 static vector double __ATTRS_o_ai vec_rsqrt(vector double __a) { 8507 return __builtin_ppc_rsqrtd(__a); 8508 } 8509 #endif 8510 8511 /* vec_vrsqrtefp */ 8512 8513 static __inline__ __vector float __attribute__((__always_inline__)) 8514 vec_vrsqrtefp(vector float __a) { 8515 return __builtin_altivec_vrsqrtefp(__a); 8516 } 8517 8518 /* vec_xvtsqrt */ 8519 8520 #ifdef __VSX__ 8521 static __inline__ int __ATTRS_o_ai vec_test_swsqrt(vector double __a) { 8522 return __builtin_vsx_xvtsqrtdp(__a); 8523 } 8524 8525 static __inline__ int __ATTRS_o_ai vec_test_swsqrts(vector float __a) { 8526 return __builtin_vsx_xvtsqrtsp(__a); 8527 } 8528 #endif 8529 8530 /* vec_sel */ 8531 8532 #define __builtin_altivec_vsel_4si vec_sel 8533 8534 static __inline__ vector signed char __ATTRS_o_ai vec_sel( 8535 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8536 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8537 } 8538 8539 static __inline__ vector signed char __ATTRS_o_ai 8540 vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) { 8541 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8542 } 8543 8544 static __inline__ vector unsigned char __ATTRS_o_ai 8545 vec_sel(vector unsigned char __a, vector unsigned char __b, 8546 vector unsigned char __c) { 8547 return (__a & ~__c) | (__b & __c); 8548 } 8549 8550 static __inline__ vector unsigned char __ATTRS_o_ai vec_sel( 8551 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8552 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8553 } 8554 8555 static __inline__ vector bool char __ATTRS_o_ai 8556 vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8557 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8558 } 8559 8560 static __inline__ vector bool char __ATTRS_o_ai vec_sel(vector bool char __a, 8561 vector bool char __b, 8562 vector bool char __c) { 8563 return (__a & ~__c) | (__b & __c); 8564 } 8565 8566 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8567 vector short __b, 8568 vector unsigned short __c) { 8569 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8570 } 8571 8572 static __inline__ vector short __ATTRS_o_ai vec_sel(vector short __a, 8573 vector short __b, 8574 vector bool short __c) { 8575 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8576 } 8577 8578 static __inline__ vector unsigned short __ATTRS_o_ai 8579 vec_sel(vector unsigned short __a, vector unsigned short __b, 8580 vector unsigned short __c) { 8581 return (__a & ~__c) | (__b & __c); 8582 } 8583 8584 static __inline__ vector unsigned short __ATTRS_o_ai 8585 vec_sel(vector unsigned short __a, vector unsigned short __b, 8586 vector bool short __c) { 8587 return (__a & ~(vector unsigned short)__c) | 8588 (__b & (vector unsigned short)__c); 8589 } 8590 8591 static __inline__ vector bool short __ATTRS_o_ai vec_sel( 8592 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8593 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8594 } 8595 8596 static __inline__ vector bool short __ATTRS_o_ai 8597 vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) { 8598 return (__a & ~__c) | (__b & __c); 8599 } 8600 8601 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8602 vector int __b, 8603 vector unsigned int __c) { 8604 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8605 } 8606 8607 static __inline__ vector int __ATTRS_o_ai vec_sel(vector int __a, 8608 vector int __b, 8609 vector bool int __c) { 8610 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8611 } 8612 8613 static __inline__ vector unsigned int __ATTRS_o_ai vec_sel( 8614 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8615 return (__a & ~__c) | (__b & __c); 8616 } 8617 8618 static __inline__ vector unsigned int __ATTRS_o_ai 8619 vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8620 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8621 } 8622 8623 static __inline__ vector bool int __ATTRS_o_ai 8624 vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8625 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8626 } 8627 8628 static __inline__ vector bool int __ATTRS_o_ai vec_sel(vector bool int __a, 8629 vector bool int __b, 8630 vector bool int __c) { 8631 return (__a & ~__c) | (__b & __c); 8632 } 8633 8634 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8635 vector float __b, 8636 vector unsigned int __c) { 8637 vector int __res = ((vector int)__a & ~(vector int)__c) | 8638 ((vector int)__b & (vector int)__c); 8639 return (vector float)__res; 8640 } 8641 8642 static __inline__ vector float __ATTRS_o_ai vec_sel(vector float __a, 8643 vector float __b, 8644 vector bool int __c) { 8645 vector int __res = ((vector int)__a & ~(vector int)__c) | 8646 ((vector int)__b & (vector int)__c); 8647 return (vector float)__res; 8648 } 8649 8650 #ifdef __VSX__ 8651 static __inline__ vector double __ATTRS_o_ai 8652 vec_sel(vector double __a, vector double __b, vector bool long long __c) { 8653 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8654 ((vector long long)__b & (vector long long)__c); 8655 return (vector double)__res; 8656 } 8657 8658 static __inline__ vector double __ATTRS_o_ai 8659 vec_sel(vector double __a, vector double __b, vector unsigned long long __c) { 8660 vector long long __res = ((vector long long)__a & ~(vector long long)__c) | 8661 ((vector long long)__b & (vector long long)__c); 8662 return (vector double)__res; 8663 } 8664 8665 static __inline__ vector bool long long __ATTRS_o_ai 8666 vec_sel(vector bool long long __a, vector bool long long __b, 8667 vector bool long long __c) { 8668 return (__a & ~__c) | (__b & __c); 8669 } 8670 8671 static __inline__ vector bool long long __ATTRS_o_ai 8672 vec_sel(vector bool long long __a, vector bool long long __b, 8673 vector unsigned long long __c) { 8674 return (__a & ~(vector bool long long)__c) | 8675 (__b & (vector bool long long)__c); 8676 } 8677 8678 static __inline__ vector signed long long __ATTRS_o_ai 8679 vec_sel(vector signed long long __a, vector signed long long __b, 8680 vector bool long long __c) { 8681 return (__a & ~(vector signed long long)__c) | 8682 (__b & (vector signed long long)__c); 8683 } 8684 8685 static __inline__ vector signed long long __ATTRS_o_ai 8686 vec_sel(vector signed long long __a, vector signed long long __b, 8687 vector unsigned long long __c) { 8688 return (__a & ~(vector signed long long)__c) | 8689 (__b & (vector signed long long)__c); 8690 } 8691 8692 static __inline__ vector unsigned long long __ATTRS_o_ai 8693 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8694 vector bool long long __c) { 8695 return (__a & ~(vector unsigned long long)__c) | 8696 (__b & (vector unsigned long long)__c); 8697 } 8698 8699 static __inline__ vector unsigned long long __ATTRS_o_ai 8700 vec_sel(vector unsigned long long __a, vector unsigned long long __b, 8701 vector unsigned long long __c) { 8702 return (__a & ~__c) | (__b & __c); 8703 } 8704 #endif 8705 8706 /* vec_vsel */ 8707 8708 static __inline__ vector signed char __ATTRS_o_ai vec_vsel( 8709 vector signed char __a, vector signed char __b, vector unsigned char __c) { 8710 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8711 } 8712 8713 static __inline__ vector signed char __ATTRS_o_ai 8714 vec_vsel(vector signed char __a, vector signed char __b, vector bool char __c) { 8715 return (__a & ~(vector signed char)__c) | (__b & (vector signed char)__c); 8716 } 8717 8718 static __inline__ vector unsigned char __ATTRS_o_ai 8719 vec_vsel(vector unsigned char __a, vector unsigned char __b, 8720 vector unsigned char __c) { 8721 return (__a & ~__c) | (__b & __c); 8722 } 8723 8724 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsel( 8725 vector unsigned char __a, vector unsigned char __b, vector bool char __c) { 8726 return (__a & ~(vector unsigned char)__c) | (__b & (vector unsigned char)__c); 8727 } 8728 8729 static __inline__ vector bool char __ATTRS_o_ai 8730 vec_vsel(vector bool char __a, vector bool char __b, vector unsigned char __c) { 8731 return (__a & ~(vector bool char)__c) | (__b & (vector bool char)__c); 8732 } 8733 8734 static __inline__ vector bool char __ATTRS_o_ai vec_vsel(vector bool char __a, 8735 vector bool char __b, 8736 vector bool char __c) { 8737 return (__a & ~__c) | (__b & __c); 8738 } 8739 8740 static __inline__ vector short __ATTRS_o_ai 8741 vec_vsel(vector short __a, vector short __b, vector unsigned short __c) { 8742 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8743 } 8744 8745 static __inline__ vector short __ATTRS_o_ai vec_vsel(vector short __a, 8746 vector short __b, 8747 vector bool short __c) { 8748 return (__a & ~(vector short)__c) | (__b & (vector short)__c); 8749 } 8750 8751 static __inline__ vector unsigned short __ATTRS_o_ai 8752 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8753 vector unsigned short __c) { 8754 return (__a & ~__c) | (__b & __c); 8755 } 8756 8757 static __inline__ vector unsigned short __ATTRS_o_ai 8758 vec_vsel(vector unsigned short __a, vector unsigned short __b, 8759 vector bool short __c) { 8760 return (__a & ~(vector unsigned short)__c) | 8761 (__b & (vector unsigned short)__c); 8762 } 8763 8764 static __inline__ vector bool short __ATTRS_o_ai vec_vsel( 8765 vector bool short __a, vector bool short __b, vector unsigned short __c) { 8766 return (__a & ~(vector bool short)__c) | (__b & (vector bool short)__c); 8767 } 8768 8769 static __inline__ vector bool short __ATTRS_o_ai 8770 vec_vsel(vector bool short __a, vector bool short __b, vector bool short __c) { 8771 return (__a & ~__c) | (__b & __c); 8772 } 8773 8774 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8775 vector int __b, 8776 vector unsigned int __c) { 8777 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8778 } 8779 8780 static __inline__ vector int __ATTRS_o_ai vec_vsel(vector int __a, 8781 vector int __b, 8782 vector bool int __c) { 8783 return (__a & ~(vector int)__c) | (__b & (vector int)__c); 8784 } 8785 8786 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8787 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 8788 return (__a & ~__c) | (__b & __c); 8789 } 8790 8791 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsel( 8792 vector unsigned int __a, vector unsigned int __b, vector bool int __c) { 8793 return (__a & ~(vector unsigned int)__c) | (__b & (vector unsigned int)__c); 8794 } 8795 8796 static __inline__ vector bool int __ATTRS_o_ai 8797 vec_vsel(vector bool int __a, vector bool int __b, vector unsigned int __c) { 8798 return (__a & ~(vector bool int)__c) | (__b & (vector bool int)__c); 8799 } 8800 8801 static __inline__ vector bool int __ATTRS_o_ai vec_vsel(vector bool int __a, 8802 vector bool int __b, 8803 vector bool int __c) { 8804 return (__a & ~__c) | (__b & __c); 8805 } 8806 8807 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8808 vector float __b, 8809 vector unsigned int __c) { 8810 vector int __res = ((vector int)__a & ~(vector int)__c) | 8811 ((vector int)__b & (vector int)__c); 8812 return (vector float)__res; 8813 } 8814 8815 static __inline__ vector float __ATTRS_o_ai vec_vsel(vector float __a, 8816 vector float __b, 8817 vector bool int __c) { 8818 vector int __res = ((vector int)__a & ~(vector int)__c) | 8819 ((vector int)__b & (vector int)__c); 8820 return (vector float)__res; 8821 } 8822 8823 /* vec_sl */ 8824 8825 // vec_sl does modulo arithmetic on __b first, so __b is allowed to be more 8826 // than the length of __a. 8827 static __inline__ vector unsigned char __ATTRS_o_ai 8828 vec_sl(vector unsigned char __a, vector unsigned char __b) { 8829 return __a << (__b % 8830 (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 8831 } 8832 8833 static __inline__ vector signed char __ATTRS_o_ai 8834 vec_sl(vector signed char __a, vector unsigned char __b) { 8835 return (vector signed char)vec_sl((vector unsigned char)__a, __b); 8836 } 8837 8838 static __inline__ vector unsigned short __ATTRS_o_ai 8839 vec_sl(vector unsigned short __a, vector unsigned short __b) { 8840 return __a << (__b % (vector unsigned short)(sizeof(unsigned short) * 8841 __CHAR_BIT__)); 8842 } 8843 8844 static __inline__ vector short __ATTRS_o_ai vec_sl(vector short __a, 8845 vector unsigned short __b) { 8846 return (vector short)vec_sl((vector unsigned short)__a, __b); 8847 } 8848 8849 static __inline__ vector unsigned int __ATTRS_o_ai 8850 vec_sl(vector unsigned int __a, vector unsigned int __b) { 8851 return __a << (__b % 8852 (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 8853 } 8854 8855 static __inline__ vector int __ATTRS_o_ai vec_sl(vector int __a, 8856 vector unsigned int __b) { 8857 return (vector int)vec_sl((vector unsigned int)__a, __b); 8858 } 8859 8860 #ifdef __POWER8_VECTOR__ 8861 static __inline__ vector unsigned long long __ATTRS_o_ai 8862 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8863 return __a << (__b % (vector unsigned long long)(sizeof(unsigned long long) * 8864 __CHAR_BIT__)); 8865 } 8866 8867 static __inline__ vector long long __ATTRS_o_ai 8868 vec_sl(vector long long __a, vector unsigned long long __b) { 8869 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8870 } 8871 #elif defined(__VSX__) 8872 static __inline__ vector unsigned char __ATTRS_o_ai 8873 vec_vspltb(vector unsigned char __a, unsigned char __b); 8874 static __inline__ vector unsigned long long __ATTRS_o_ai 8875 vec_sl(vector unsigned long long __a, vector unsigned long long __b) { 8876 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 8877 8878 // Big endian element one (the right doubleword) can be left shifted as-is. 8879 // The other element needs to be swapped into the right doubleword and 8880 // shifted. Then the right doublewords of the two result vectors are merged. 8881 vector signed long long __rightelt = 8882 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8883 (vector signed int)__b); 8884 #ifdef __LITTLE_ENDIAN__ 8885 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8886 (vector signed int)__rightelt, 8887 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8888 #else 8889 __rightelt = (vector signed long long)__builtin_altivec_vsl( 8890 (vector signed int)__rightelt, 8891 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8892 #endif 8893 __a = __builtin_shufflevector(__a, __a, 1, 0); 8894 __b = __builtin_shufflevector(__b, __b, 1, 0); 8895 vector signed long long __leftelt = 8896 (vector signed long long)__builtin_altivec_vslo((vector signed int)__a, 8897 (vector signed int)__b); 8898 #ifdef __LITTLE_ENDIAN__ 8899 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8900 (vector signed int)__leftelt, 8901 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 8902 return (vector unsigned long long)__builtin_shufflevector(__rightelt, 8903 __leftelt, 0, 2); 8904 #else 8905 __leftelt = (vector signed long long)__builtin_altivec_vsl( 8906 (vector signed int)__leftelt, 8907 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 8908 return (vector unsigned long long)__builtin_shufflevector(__leftelt, 8909 __rightelt, 1, 3); 8910 #endif 8911 } 8912 8913 static __inline__ vector long long __ATTRS_o_ai 8914 vec_sl(vector long long __a, vector unsigned long long __b) { 8915 return (vector long long)vec_sl((vector unsigned long long)__a, __b); 8916 } 8917 #endif /* __VSX__ */ 8918 8919 /* vec_vslb */ 8920 8921 #define __builtin_altivec_vslb vec_vslb 8922 8923 static __inline__ vector signed char __ATTRS_o_ai 8924 vec_vslb(vector signed char __a, vector unsigned char __b) { 8925 return vec_sl(__a, __b); 8926 } 8927 8928 static __inline__ vector unsigned char __ATTRS_o_ai 8929 vec_vslb(vector unsigned char __a, vector unsigned char __b) { 8930 return vec_sl(__a, __b); 8931 } 8932 8933 /* vec_vslh */ 8934 8935 #define __builtin_altivec_vslh vec_vslh 8936 8937 static __inline__ vector short __ATTRS_o_ai 8938 vec_vslh(vector short __a, vector unsigned short __b) { 8939 return vec_sl(__a, __b); 8940 } 8941 8942 static __inline__ vector unsigned short __ATTRS_o_ai 8943 vec_vslh(vector unsigned short __a, vector unsigned short __b) { 8944 return vec_sl(__a, __b); 8945 } 8946 8947 /* vec_vslw */ 8948 8949 #define __builtin_altivec_vslw vec_vslw 8950 8951 static __inline__ vector int __ATTRS_o_ai vec_vslw(vector int __a, 8952 vector unsigned int __b) { 8953 return vec_sl(__a, __b); 8954 } 8955 8956 static __inline__ vector unsigned int __ATTRS_o_ai 8957 vec_vslw(vector unsigned int __a, vector unsigned int __b) { 8958 return vec_sl(__a, __b); 8959 } 8960 8961 /* vec_sld */ 8962 8963 #define __builtin_altivec_vsldoi_4si vec_sld 8964 8965 static __inline__ vector signed char __ATTRS_o_ai vec_sld( 8966 vector signed char __a, vector signed char __b, unsigned const int __c) { 8967 unsigned char __d = __c & 0x0F; 8968 #ifdef __LITTLE_ENDIAN__ 8969 return vec_perm( 8970 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8971 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8972 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8973 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8974 #else 8975 return vec_perm( 8976 __a, __b, 8977 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8978 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8979 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8980 #endif 8981 } 8982 8983 static __inline__ vector unsigned char __ATTRS_o_ai 8984 vec_sld(vector unsigned char __a, vector unsigned char __b, 8985 unsigned const int __c) { 8986 unsigned char __d = __c & 0x0F; 8987 #ifdef __LITTLE_ENDIAN__ 8988 return vec_perm( 8989 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 8990 20 - __d, 21 - __d, 22 - __d, 23 - __d, 8991 24 - __d, 25 - __d, 26 - __d, 27 - __d, 8992 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 8993 #else 8994 return vec_perm( 8995 __a, __b, 8996 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 8997 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 8998 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 8999 #endif 9000 } 9001 9002 static __inline__ vector bool char __ATTRS_o_ai 9003 vec_sld(vector bool char __a, vector bool char __b, unsigned const int __c) { 9004 unsigned char __d = __c & 0x0F; 9005 #ifdef __LITTLE_ENDIAN__ 9006 return vec_perm( 9007 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9008 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9009 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9010 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9011 #else 9012 return vec_perm( 9013 __a, __b, 9014 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9015 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9016 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9017 #endif 9018 } 9019 9020 static __inline__ vector signed short __ATTRS_o_ai vec_sld( 9021 vector signed short __a, vector signed short __b, unsigned const int __c) { 9022 unsigned char __d = __c & 0x0F; 9023 #ifdef __LITTLE_ENDIAN__ 9024 return vec_perm( 9025 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9026 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9027 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9028 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9029 #else 9030 return vec_perm( 9031 __a, __b, 9032 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9033 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9034 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9035 #endif 9036 } 9037 9038 static __inline__ vector unsigned short __ATTRS_o_ai 9039 vec_sld(vector unsigned short __a, vector unsigned short __b, 9040 unsigned const int __c) { 9041 unsigned char __d = __c & 0x0F; 9042 #ifdef __LITTLE_ENDIAN__ 9043 return vec_perm( 9044 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9045 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9046 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9047 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9048 #else 9049 return vec_perm( 9050 __a, __b, 9051 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9052 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9053 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9054 #endif 9055 } 9056 9057 static __inline__ vector bool short __ATTRS_o_ai 9058 vec_sld(vector bool short __a, vector bool short __b, unsigned const int __c) { 9059 unsigned char __d = __c & 0x0F; 9060 #ifdef __LITTLE_ENDIAN__ 9061 return vec_perm( 9062 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9063 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9064 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9065 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9066 #else 9067 return vec_perm( 9068 __a, __b, 9069 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9070 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9071 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9072 #endif 9073 } 9074 9075 static __inline__ vector pixel __ATTRS_o_ai vec_sld(vector pixel __a, 9076 vector pixel __b, 9077 unsigned const int __c) { 9078 unsigned char __d = __c & 0x0F; 9079 #ifdef __LITTLE_ENDIAN__ 9080 return vec_perm( 9081 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9082 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9083 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9084 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9085 #else 9086 return vec_perm( 9087 __a, __b, 9088 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9089 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9090 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9091 #endif 9092 } 9093 9094 static __inline__ vector signed int __ATTRS_o_ai 9095 vec_sld(vector signed int __a, vector signed int __b, unsigned const int __c) { 9096 unsigned char __d = __c & 0x0F; 9097 #ifdef __LITTLE_ENDIAN__ 9098 return vec_perm( 9099 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9100 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9101 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9102 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9103 #else 9104 return vec_perm( 9105 __a, __b, 9106 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9107 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9108 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9109 #endif 9110 } 9111 9112 static __inline__ vector unsigned int __ATTRS_o_ai vec_sld( 9113 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9114 unsigned char __d = __c & 0x0F; 9115 #ifdef __LITTLE_ENDIAN__ 9116 return vec_perm( 9117 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9118 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9119 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9120 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9121 #else 9122 return vec_perm( 9123 __a, __b, 9124 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9125 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9126 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9127 #endif 9128 } 9129 9130 static __inline__ vector bool int __ATTRS_o_ai vec_sld(vector bool int __a, 9131 vector bool int __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 float __ATTRS_o_ai vec_sld(vector float __a, 9150 vector float __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 #ifdef __VSX__ 9169 static __inline__ vector bool long long __ATTRS_o_ai 9170 vec_sld(vector bool long long __a, vector bool long long __b, 9171 unsigned const int __c) { 9172 unsigned char __d = __c & 0x0F; 9173 #ifdef __LITTLE_ENDIAN__ 9174 return vec_perm( 9175 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9176 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9177 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9178 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9179 #else 9180 return vec_perm( 9181 __a, __b, 9182 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9183 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9184 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9185 #endif 9186 } 9187 9188 static __inline__ vector signed long long __ATTRS_o_ai 9189 vec_sld(vector signed long long __a, vector signed long long __b, 9190 unsigned const int __c) { 9191 unsigned char __d = __c & 0x0F; 9192 #ifdef __LITTLE_ENDIAN__ 9193 return vec_perm( 9194 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9195 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9196 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9197 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9198 #else 9199 return vec_perm( 9200 __a, __b, 9201 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9202 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9203 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9204 #endif 9205 } 9206 9207 static __inline__ vector unsigned long long __ATTRS_o_ai 9208 vec_sld(vector unsigned long long __a, vector unsigned long long __b, 9209 unsigned const int __c) { 9210 unsigned char __d = __c & 0x0F; 9211 #ifdef __LITTLE_ENDIAN__ 9212 return vec_perm( 9213 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9214 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9215 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9216 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9217 #else 9218 return vec_perm( 9219 __a, __b, 9220 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9221 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9222 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9223 #endif 9224 } 9225 9226 static __inline__ vector double __ATTRS_o_ai vec_sld(vector double __a, 9227 vector double __b, 9228 unsigned const int __c) { 9229 unsigned char __d = __c & 0x0F; 9230 #ifdef __LITTLE_ENDIAN__ 9231 return vec_perm( 9232 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9233 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9234 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9235 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9236 #else 9237 return vec_perm( 9238 __a, __b, 9239 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9240 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9241 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9242 #endif 9243 } 9244 #endif 9245 9246 /* vec_sldw */ 9247 static __inline__ vector signed char __ATTRS_o_ai vec_sldw( 9248 vector signed char __a, vector signed char __b, unsigned const int __c) { 9249 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9250 } 9251 9252 static __inline__ vector unsigned char __ATTRS_o_ai 9253 vec_sldw(vector unsigned char __a, vector unsigned char __b, 9254 unsigned const int __c) { 9255 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9256 } 9257 9258 static __inline__ vector signed short __ATTRS_o_ai vec_sldw( 9259 vector signed short __a, vector signed short __b, unsigned const int __c) { 9260 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9261 } 9262 9263 static __inline__ vector unsigned short __ATTRS_o_ai 9264 vec_sldw(vector unsigned short __a, vector unsigned short __b, 9265 unsigned const int __c) { 9266 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9267 } 9268 9269 static __inline__ vector signed int __ATTRS_o_ai 9270 vec_sldw(vector signed int __a, vector signed int __b, unsigned const int __c) { 9271 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9272 } 9273 9274 static __inline__ vector unsigned int __ATTRS_o_ai vec_sldw( 9275 vector unsigned int __a, vector unsigned int __b, unsigned const int __c) { 9276 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9277 } 9278 9279 static __inline__ vector float __ATTRS_o_ai vec_sldw( 9280 vector float __a, vector float __b, unsigned const int __c) { 9281 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9282 } 9283 9284 #ifdef __VSX__ 9285 static __inline__ vector signed long long __ATTRS_o_ai 9286 vec_sldw(vector signed long long __a, vector signed long long __b, 9287 unsigned const int __c) { 9288 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9289 } 9290 9291 static __inline__ vector unsigned long long __ATTRS_o_ai 9292 vec_sldw(vector unsigned long long __a, vector unsigned long long __b, 9293 unsigned const int __c) { 9294 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9295 } 9296 9297 static __inline__ vector double __ATTRS_o_ai vec_sldw( 9298 vector double __a, vector double __b, unsigned const int __c) { 9299 return vec_sld(__a, __b, ((__c << 2) & 0x0F)); 9300 } 9301 #endif 9302 9303 #ifdef __POWER9_VECTOR__ 9304 /* vec_slv */ 9305 static __inline__ vector unsigned char __ATTRS_o_ai 9306 vec_slv(vector unsigned char __a, vector unsigned char __b) { 9307 return __builtin_altivec_vslv(__a, __b); 9308 } 9309 9310 /* vec_srv */ 9311 static __inline__ vector unsigned char __ATTRS_o_ai 9312 vec_srv(vector unsigned char __a, vector unsigned char __b) { 9313 return __builtin_altivec_vsrv(__a, __b); 9314 } 9315 #endif 9316 9317 /* vec_vsldoi */ 9318 9319 static __inline__ vector signed char __ATTRS_o_ai 9320 vec_vsldoi(vector signed char __a, vector signed char __b, unsigned char __c) { 9321 unsigned char __d = __c & 0x0F; 9322 #ifdef __LITTLE_ENDIAN__ 9323 return vec_perm( 9324 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9325 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9326 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9327 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9328 #else 9329 return vec_perm( 9330 __a, __b, 9331 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9332 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9333 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9334 #endif 9335 } 9336 9337 static __inline__ vector unsigned char __ATTRS_o_ai vec_vsldoi( 9338 vector unsigned char __a, vector unsigned char __b, unsigned char __c) { 9339 unsigned char __d = __c & 0x0F; 9340 #ifdef __LITTLE_ENDIAN__ 9341 return vec_perm( 9342 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9343 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9344 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9345 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9346 #else 9347 return vec_perm( 9348 __a, __b, 9349 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9350 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9351 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9352 #endif 9353 } 9354 9355 static __inline__ vector short __ATTRS_o_ai vec_vsldoi(vector short __a, 9356 vector short __b, 9357 unsigned char __c) { 9358 unsigned char __d = __c & 0x0F; 9359 #ifdef __LITTLE_ENDIAN__ 9360 return vec_perm( 9361 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9362 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9363 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9364 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9365 #else 9366 return vec_perm( 9367 __a, __b, 9368 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9369 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9370 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9371 #endif 9372 } 9373 9374 static __inline__ vector unsigned short __ATTRS_o_ai vec_vsldoi( 9375 vector unsigned short __a, vector unsigned short __b, unsigned char __c) { 9376 unsigned char __d = __c & 0x0F; 9377 #ifdef __LITTLE_ENDIAN__ 9378 return vec_perm( 9379 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9380 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9381 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9382 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9383 #else 9384 return vec_perm( 9385 __a, __b, 9386 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9387 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9388 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9389 #endif 9390 } 9391 9392 static __inline__ vector pixel __ATTRS_o_ai vec_vsldoi(vector pixel __a, 9393 vector pixel __b, 9394 unsigned char __c) { 9395 unsigned char __d = __c & 0x0F; 9396 #ifdef __LITTLE_ENDIAN__ 9397 return vec_perm( 9398 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9399 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9400 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9401 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9402 #else 9403 return vec_perm( 9404 __a, __b, 9405 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9406 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9407 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9408 #endif 9409 } 9410 9411 static __inline__ vector int __ATTRS_o_ai vec_vsldoi(vector int __a, 9412 vector int __b, 9413 unsigned char __c) { 9414 unsigned char __d = __c & 0x0F; 9415 #ifdef __LITTLE_ENDIAN__ 9416 return vec_perm( 9417 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9418 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9419 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9420 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9421 #else 9422 return vec_perm( 9423 __a, __b, 9424 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9425 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9426 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9427 #endif 9428 } 9429 9430 static __inline__ vector unsigned int __ATTRS_o_ai vec_vsldoi( 9431 vector unsigned int __a, vector unsigned int __b, unsigned char __c) { 9432 unsigned char __d = __c & 0x0F; 9433 #ifdef __LITTLE_ENDIAN__ 9434 return vec_perm( 9435 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9436 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9437 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9438 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9439 #else 9440 return vec_perm( 9441 __a, __b, 9442 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9443 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9444 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9445 #endif 9446 } 9447 9448 static __inline__ vector float __ATTRS_o_ai vec_vsldoi(vector float __a, 9449 vector float __b, 9450 unsigned char __c) { 9451 unsigned char __d = __c & 0x0F; 9452 #ifdef __LITTLE_ENDIAN__ 9453 return vec_perm( 9454 __b, __a, (vector unsigned char)(16 - __d, 17 - __d, 18 - __d, 19 - __d, 9455 20 - __d, 21 - __d, 22 - __d, 23 - __d, 9456 24 - __d, 25 - __d, 26 - __d, 27 - __d, 9457 28 - __d, 29 - __d, 30 - __d, 31 - __d)); 9458 #else 9459 return vec_perm( 9460 __a, __b, 9461 (vector unsigned char)(__d, __d + 1, __d + 2, __d + 3, __d + 4, __d + 5, 9462 __d + 6, __d + 7, __d + 8, __d + 9, __d + 10, 9463 __d + 11, __d + 12, __d + 13, __d + 14, __d + 15)); 9464 #endif 9465 } 9466 9467 /* vec_sll */ 9468 9469 static __inline__ vector signed char __ATTRS_o_ai 9470 vec_sll(vector signed char __a, vector unsigned char __b) { 9471 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9472 (vector int)__b); 9473 } 9474 9475 static __inline__ vector signed char __ATTRS_o_ai 9476 vec_sll(vector signed char __a, vector unsigned short __b) { 9477 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9478 (vector int)__b); 9479 } 9480 9481 static __inline__ vector signed char __ATTRS_o_ai 9482 vec_sll(vector signed char __a, vector unsigned int __b) { 9483 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9484 (vector int)__b); 9485 } 9486 9487 static __inline__ vector unsigned char __ATTRS_o_ai 9488 vec_sll(vector unsigned char __a, vector unsigned char __b) { 9489 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9490 (vector int)__b); 9491 } 9492 9493 static __inline__ vector unsigned char __ATTRS_o_ai 9494 vec_sll(vector unsigned char __a, vector unsigned short __b) { 9495 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9496 (vector int)__b); 9497 } 9498 9499 static __inline__ vector unsigned char __ATTRS_o_ai 9500 vec_sll(vector unsigned char __a, vector unsigned int __b) { 9501 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9502 (vector int)__b); 9503 } 9504 9505 static __inline__ vector bool char __ATTRS_o_ai 9506 vec_sll(vector bool char __a, vector unsigned char __b) { 9507 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9508 (vector int)__b); 9509 } 9510 9511 static __inline__ vector bool char __ATTRS_o_ai 9512 vec_sll(vector bool char __a, vector unsigned short __b) { 9513 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9514 (vector int)__b); 9515 } 9516 9517 static __inline__ vector bool char __ATTRS_o_ai 9518 vec_sll(vector bool char __a, vector unsigned int __b) { 9519 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9520 (vector int)__b); 9521 } 9522 9523 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9524 vector unsigned char __b) { 9525 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9526 } 9527 9528 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9529 vector unsigned short __b) { 9530 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9531 } 9532 9533 static __inline__ vector short __ATTRS_o_ai vec_sll(vector short __a, 9534 vector unsigned int __b) { 9535 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9536 } 9537 9538 static __inline__ vector unsigned short __ATTRS_o_ai 9539 vec_sll(vector unsigned short __a, vector unsigned char __b) { 9540 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9541 (vector int)__b); 9542 } 9543 9544 static __inline__ vector unsigned short __ATTRS_o_ai 9545 vec_sll(vector unsigned short __a, vector unsigned short __b) { 9546 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9547 (vector int)__b); 9548 } 9549 9550 static __inline__ vector unsigned short __ATTRS_o_ai 9551 vec_sll(vector unsigned short __a, vector unsigned int __b) { 9552 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9553 (vector int)__b); 9554 } 9555 9556 static __inline__ vector bool short __ATTRS_o_ai 9557 vec_sll(vector bool short __a, vector unsigned char __b) { 9558 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9559 (vector int)__b); 9560 } 9561 9562 static __inline__ vector bool short __ATTRS_o_ai 9563 vec_sll(vector bool short __a, vector unsigned short __b) { 9564 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9565 (vector int)__b); 9566 } 9567 9568 static __inline__ vector bool short __ATTRS_o_ai 9569 vec_sll(vector bool short __a, vector unsigned int __b) { 9570 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9571 (vector int)__b); 9572 } 9573 9574 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9575 vector unsigned char __b) { 9576 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9577 } 9578 9579 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9580 vector unsigned short __b) { 9581 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9582 } 9583 9584 static __inline__ vector pixel __ATTRS_o_ai vec_sll(vector pixel __a, 9585 vector unsigned int __b) { 9586 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9587 } 9588 9589 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9590 vector unsigned char __b) { 9591 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9592 } 9593 9594 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9595 vector unsigned short __b) { 9596 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9597 } 9598 9599 static __inline__ vector int __ATTRS_o_ai vec_sll(vector int __a, 9600 vector unsigned int __b) { 9601 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9602 } 9603 9604 static __inline__ vector unsigned int __ATTRS_o_ai 9605 vec_sll(vector unsigned int __a, vector unsigned char __b) { 9606 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9607 (vector int)__b); 9608 } 9609 9610 static __inline__ vector unsigned int __ATTRS_o_ai 9611 vec_sll(vector unsigned int __a, vector unsigned short __b) { 9612 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9613 (vector int)__b); 9614 } 9615 9616 static __inline__ vector unsigned int __ATTRS_o_ai 9617 vec_sll(vector unsigned int __a, vector unsigned int __b) { 9618 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9619 (vector int)__b); 9620 } 9621 9622 static __inline__ vector bool int __ATTRS_o_ai 9623 vec_sll(vector bool int __a, vector unsigned char __b) { 9624 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9625 (vector int)__b); 9626 } 9627 9628 static __inline__ vector bool int __ATTRS_o_ai 9629 vec_sll(vector bool int __a, vector unsigned short __b) { 9630 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9631 (vector int)__b); 9632 } 9633 9634 static __inline__ vector bool int __ATTRS_o_ai 9635 vec_sll(vector bool int __a, vector unsigned int __b) { 9636 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9637 (vector int)__b); 9638 } 9639 9640 #ifdef __VSX__ 9641 static __inline__ vector signed long long __ATTRS_o_ai 9642 vec_sll(vector signed long long __a, vector unsigned char __b) { 9643 return (vector signed long long)__builtin_altivec_vsl((vector int)__a, 9644 (vector int)__b); 9645 } 9646 9647 static __inline__ vector unsigned long long __ATTRS_o_ai 9648 vec_sll(vector unsigned long long __a, vector unsigned char __b) { 9649 return (vector unsigned long long)__builtin_altivec_vsl((vector int)__a, 9650 (vector int)__b); 9651 } 9652 #endif 9653 9654 /* vec_vsl */ 9655 9656 static __inline__ vector signed char __ATTRS_o_ai 9657 vec_vsl(vector signed char __a, vector unsigned char __b) { 9658 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9659 (vector int)__b); 9660 } 9661 9662 static __inline__ vector signed char __ATTRS_o_ai 9663 vec_vsl(vector signed char __a, vector unsigned short __b) { 9664 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9665 (vector int)__b); 9666 } 9667 9668 static __inline__ vector signed char __ATTRS_o_ai 9669 vec_vsl(vector signed char __a, vector unsigned int __b) { 9670 return (vector signed char)__builtin_altivec_vsl((vector int)__a, 9671 (vector int)__b); 9672 } 9673 9674 static __inline__ vector unsigned char __ATTRS_o_ai 9675 vec_vsl(vector unsigned char __a, vector unsigned char __b) { 9676 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9677 (vector int)__b); 9678 } 9679 9680 static __inline__ vector unsigned char __ATTRS_o_ai 9681 vec_vsl(vector unsigned char __a, vector unsigned short __b) { 9682 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9683 (vector int)__b); 9684 } 9685 9686 static __inline__ vector unsigned char __ATTRS_o_ai 9687 vec_vsl(vector unsigned char __a, vector unsigned int __b) { 9688 return (vector unsigned char)__builtin_altivec_vsl((vector int)__a, 9689 (vector int)__b); 9690 } 9691 9692 static __inline__ vector bool char __ATTRS_o_ai 9693 vec_vsl(vector bool char __a, vector unsigned char __b) { 9694 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9695 (vector int)__b); 9696 } 9697 9698 static __inline__ vector bool char __ATTRS_o_ai 9699 vec_vsl(vector bool char __a, vector unsigned short __b) { 9700 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9701 (vector int)__b); 9702 } 9703 9704 static __inline__ vector bool char __ATTRS_o_ai 9705 vec_vsl(vector bool char __a, vector unsigned int __b) { 9706 return (vector bool char)__builtin_altivec_vsl((vector int)__a, 9707 (vector int)__b); 9708 } 9709 9710 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9711 vector unsigned char __b) { 9712 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9713 } 9714 9715 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9716 vector unsigned short __b) { 9717 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9718 } 9719 9720 static __inline__ vector short __ATTRS_o_ai vec_vsl(vector short __a, 9721 vector unsigned int __b) { 9722 return (vector short)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9723 } 9724 9725 static __inline__ vector unsigned short __ATTRS_o_ai 9726 vec_vsl(vector unsigned short __a, vector unsigned char __b) { 9727 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9728 (vector int)__b); 9729 } 9730 9731 static __inline__ vector unsigned short __ATTRS_o_ai 9732 vec_vsl(vector unsigned short __a, vector unsigned short __b) { 9733 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9734 (vector int)__b); 9735 } 9736 9737 static __inline__ vector unsigned short __ATTRS_o_ai 9738 vec_vsl(vector unsigned short __a, vector unsigned int __b) { 9739 return (vector unsigned short)__builtin_altivec_vsl((vector int)__a, 9740 (vector int)__b); 9741 } 9742 9743 static __inline__ vector bool short __ATTRS_o_ai 9744 vec_vsl(vector bool short __a, vector unsigned char __b) { 9745 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9746 (vector int)__b); 9747 } 9748 9749 static __inline__ vector bool short __ATTRS_o_ai 9750 vec_vsl(vector bool short __a, vector unsigned short __b) { 9751 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9752 (vector int)__b); 9753 } 9754 9755 static __inline__ vector bool short __ATTRS_o_ai 9756 vec_vsl(vector bool short __a, vector unsigned int __b) { 9757 return (vector bool short)__builtin_altivec_vsl((vector int)__a, 9758 (vector int)__b); 9759 } 9760 9761 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9762 vector unsigned char __b) { 9763 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9764 } 9765 9766 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9767 vector unsigned short __b) { 9768 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9769 } 9770 9771 static __inline__ vector pixel __ATTRS_o_ai vec_vsl(vector pixel __a, 9772 vector unsigned int __b) { 9773 return (vector pixel)__builtin_altivec_vsl((vector int)__a, (vector int)__b); 9774 } 9775 9776 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9777 vector unsigned char __b) { 9778 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9779 } 9780 9781 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9782 vector unsigned short __b) { 9783 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9784 } 9785 9786 static __inline__ vector int __ATTRS_o_ai vec_vsl(vector int __a, 9787 vector unsigned int __b) { 9788 return (vector int)__builtin_altivec_vsl(__a, (vector int)__b); 9789 } 9790 9791 static __inline__ vector unsigned int __ATTRS_o_ai 9792 vec_vsl(vector unsigned int __a, vector unsigned char __b) { 9793 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9794 (vector int)__b); 9795 } 9796 9797 static __inline__ vector unsigned int __ATTRS_o_ai 9798 vec_vsl(vector unsigned int __a, vector unsigned short __b) { 9799 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9800 (vector int)__b); 9801 } 9802 9803 static __inline__ vector unsigned int __ATTRS_o_ai 9804 vec_vsl(vector unsigned int __a, vector unsigned int __b) { 9805 return (vector unsigned int)__builtin_altivec_vsl((vector int)__a, 9806 (vector int)__b); 9807 } 9808 9809 static __inline__ vector bool int __ATTRS_o_ai 9810 vec_vsl(vector bool int __a, vector unsigned char __b) { 9811 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9812 (vector int)__b); 9813 } 9814 9815 static __inline__ vector bool int __ATTRS_o_ai 9816 vec_vsl(vector bool int __a, vector unsigned short __b) { 9817 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9818 (vector int)__b); 9819 } 9820 9821 static __inline__ vector bool int __ATTRS_o_ai 9822 vec_vsl(vector bool int __a, vector unsigned int __b) { 9823 return (vector bool int)__builtin_altivec_vsl((vector int)__a, 9824 (vector int)__b); 9825 } 9826 9827 /* vec_slo */ 9828 9829 static __inline__ vector signed char __ATTRS_o_ai 9830 vec_slo(vector signed char __a, vector signed char __b) { 9831 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9832 (vector int)__b); 9833 } 9834 9835 static __inline__ vector signed char __ATTRS_o_ai 9836 vec_slo(vector signed char __a, vector unsigned char __b) { 9837 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9838 (vector int)__b); 9839 } 9840 9841 static __inline__ vector unsigned char __ATTRS_o_ai 9842 vec_slo(vector unsigned char __a, vector signed char __b) { 9843 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9844 (vector int)__b); 9845 } 9846 9847 static __inline__ vector unsigned char __ATTRS_o_ai 9848 vec_slo(vector unsigned char __a, vector unsigned char __b) { 9849 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9850 (vector int)__b); 9851 } 9852 9853 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9854 vector signed char __b) { 9855 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9856 } 9857 9858 static __inline__ vector short __ATTRS_o_ai vec_slo(vector short __a, 9859 vector unsigned char __b) { 9860 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9861 } 9862 9863 static __inline__ vector unsigned short __ATTRS_o_ai 9864 vec_slo(vector unsigned short __a, vector signed char __b) { 9865 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9866 (vector int)__b); 9867 } 9868 9869 static __inline__ vector unsigned short __ATTRS_o_ai 9870 vec_slo(vector unsigned short __a, vector unsigned char __b) { 9871 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9872 (vector int)__b); 9873 } 9874 9875 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9876 vector signed char __b) { 9877 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9878 } 9879 9880 static __inline__ vector pixel __ATTRS_o_ai vec_slo(vector pixel __a, 9881 vector unsigned char __b) { 9882 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9883 } 9884 9885 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9886 vector signed char __b) { 9887 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9888 } 9889 9890 static __inline__ vector int __ATTRS_o_ai vec_slo(vector int __a, 9891 vector unsigned char __b) { 9892 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 9893 } 9894 9895 static __inline__ vector unsigned int __ATTRS_o_ai 9896 vec_slo(vector unsigned int __a, vector signed char __b) { 9897 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9898 (vector int)__b); 9899 } 9900 9901 static __inline__ vector unsigned int __ATTRS_o_ai 9902 vec_slo(vector unsigned int __a, vector unsigned char __b) { 9903 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 9904 (vector int)__b); 9905 } 9906 9907 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9908 vector signed char __b) { 9909 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9910 } 9911 9912 static __inline__ vector float __ATTRS_o_ai vec_slo(vector float __a, 9913 vector unsigned char __b) { 9914 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9915 } 9916 9917 #ifdef __VSX__ 9918 static __inline__ vector signed long long __ATTRS_o_ai 9919 vec_slo(vector signed long long __a, vector signed char __b) { 9920 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9921 (vector int)__b); 9922 } 9923 9924 static __inline__ vector signed long long __ATTRS_o_ai 9925 vec_slo(vector signed long long __a, vector unsigned char __b) { 9926 return (vector signed long long)__builtin_altivec_vslo((vector int)__a, 9927 (vector int)__b); 9928 } 9929 9930 static __inline__ vector unsigned long long __ATTRS_o_ai 9931 vec_slo(vector unsigned long long __a, vector signed char __b) { 9932 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9933 (vector int)__b); 9934 } 9935 9936 static __inline__ vector unsigned long long __ATTRS_o_ai 9937 vec_slo(vector unsigned long long __a, vector unsigned char __b) { 9938 return (vector unsigned long long)__builtin_altivec_vslo((vector int)__a, 9939 (vector int)__b); 9940 } 9941 #endif 9942 9943 /* vec_vslo */ 9944 9945 static __inline__ vector signed char __ATTRS_o_ai 9946 vec_vslo(vector signed char __a, vector signed char __b) { 9947 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9948 (vector int)__b); 9949 } 9950 9951 static __inline__ vector signed char __ATTRS_o_ai 9952 vec_vslo(vector signed char __a, vector unsigned char __b) { 9953 return (vector signed char)__builtin_altivec_vslo((vector int)__a, 9954 (vector int)__b); 9955 } 9956 9957 static __inline__ vector unsigned char __ATTRS_o_ai 9958 vec_vslo(vector unsigned char __a, vector signed char __b) { 9959 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9960 (vector int)__b); 9961 } 9962 9963 static __inline__ vector unsigned char __ATTRS_o_ai 9964 vec_vslo(vector unsigned char __a, vector unsigned char __b) { 9965 return (vector unsigned char)__builtin_altivec_vslo((vector int)__a, 9966 (vector int)__b); 9967 } 9968 9969 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9970 vector signed char __b) { 9971 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9972 } 9973 9974 static __inline__ vector short __ATTRS_o_ai vec_vslo(vector short __a, 9975 vector unsigned char __b) { 9976 return (vector short)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9977 } 9978 9979 static __inline__ vector unsigned short __ATTRS_o_ai 9980 vec_vslo(vector unsigned short __a, vector signed char __b) { 9981 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9982 (vector int)__b); 9983 } 9984 9985 static __inline__ vector unsigned short __ATTRS_o_ai 9986 vec_vslo(vector unsigned short __a, vector unsigned char __b) { 9987 return (vector unsigned short)__builtin_altivec_vslo((vector int)__a, 9988 (vector int)__b); 9989 } 9990 9991 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9992 vector signed char __b) { 9993 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9994 } 9995 9996 static __inline__ vector pixel __ATTRS_o_ai vec_vslo(vector pixel __a, 9997 vector unsigned char __b) { 9998 return (vector pixel)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 9999 } 10000 10001 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 10002 vector signed char __b) { 10003 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 10004 } 10005 10006 static __inline__ vector int __ATTRS_o_ai vec_vslo(vector int __a, 10007 vector unsigned char __b) { 10008 return (vector int)__builtin_altivec_vslo(__a, (vector int)__b); 10009 } 10010 10011 static __inline__ vector unsigned int __ATTRS_o_ai 10012 vec_vslo(vector unsigned int __a, vector signed char __b) { 10013 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 10014 (vector int)__b); 10015 } 10016 10017 static __inline__ vector unsigned int __ATTRS_o_ai 10018 vec_vslo(vector unsigned int __a, vector unsigned char __b) { 10019 return (vector unsigned int)__builtin_altivec_vslo((vector int)__a, 10020 (vector int)__b); 10021 } 10022 10023 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10024 vector signed char __b) { 10025 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10026 } 10027 10028 static __inline__ vector float __ATTRS_o_ai vec_vslo(vector float __a, 10029 vector unsigned char __b) { 10030 return (vector float)__builtin_altivec_vslo((vector int)__a, (vector int)__b); 10031 } 10032 10033 /* vec_splat */ 10034 10035 static __inline__ vector signed char __ATTRS_o_ai 10036 vec_splat(vector signed char __a, unsigned const int __b) { 10037 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10038 } 10039 10040 static __inline__ vector unsigned char __ATTRS_o_ai 10041 vec_splat(vector unsigned char __a, unsigned const int __b) { 10042 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10043 } 10044 10045 static __inline__ vector bool char __ATTRS_o_ai 10046 vec_splat(vector bool char __a, unsigned const int __b) { 10047 return vec_perm(__a, __a, (vector unsigned char)(__b & 0x0F)); 10048 } 10049 10050 static __inline__ vector signed short __ATTRS_o_ai 10051 vec_splat(vector signed short __a, unsigned const int __b) { 10052 unsigned char b0 = (__b & 0x07) * 2; 10053 unsigned char b1 = b0 + 1; 10054 return vec_perm(__a, __a, 10055 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10056 b0, b1, b0, b1, b0, b1)); 10057 } 10058 10059 static __inline__ vector unsigned short __ATTRS_o_ai 10060 vec_splat(vector unsigned short __a, unsigned const int __b) { 10061 unsigned char b0 = (__b & 0x07) * 2; 10062 unsigned char b1 = b0 + 1; 10063 return vec_perm(__a, __a, 10064 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10065 b0, b1, b0, b1, b0, b1)); 10066 } 10067 10068 static __inline__ vector bool short __ATTRS_o_ai 10069 vec_splat(vector bool short __a, unsigned const int __b) { 10070 unsigned char b0 = (__b & 0x07) * 2; 10071 unsigned char b1 = b0 + 1; 10072 return vec_perm(__a, __a, 10073 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10074 b0, b1, b0, b1, b0, b1)); 10075 } 10076 10077 static __inline__ vector pixel __ATTRS_o_ai vec_splat(vector pixel __a, 10078 unsigned const int __b) { 10079 unsigned char b0 = (__b & 0x07) * 2; 10080 unsigned char b1 = b0 + 1; 10081 return vec_perm(__a, __a, 10082 (vector unsigned char)(b0, b1, b0, b1, b0, b1, b0, b1, b0, b1, 10083 b0, b1, b0, b1, b0, b1)); 10084 } 10085 10086 static __inline__ vector signed int __ATTRS_o_ai 10087 vec_splat(vector signed int __a, unsigned const int __b) { 10088 unsigned char b0 = (__b & 0x03) * 4; 10089 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10090 return vec_perm(__a, __a, 10091 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10092 b2, b3, b0, b1, b2, b3)); 10093 } 10094 10095 static __inline__ vector unsigned int __ATTRS_o_ai 10096 vec_splat(vector unsigned int __a, unsigned const int __b) { 10097 unsigned char b0 = (__b & 0x03) * 4; 10098 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10099 return vec_perm(__a, __a, 10100 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10101 b2, b3, b0, b1, b2, b3)); 10102 } 10103 10104 static __inline__ vector bool int __ATTRS_o_ai 10105 vec_splat(vector bool int __a, unsigned const int __b) { 10106 unsigned char b0 = (__b & 0x03) * 4; 10107 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10108 return vec_perm(__a, __a, 10109 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10110 b2, b3, b0, b1, b2, b3)); 10111 } 10112 10113 static __inline__ vector float __ATTRS_o_ai vec_splat(vector float __a, 10114 unsigned const int __b) { 10115 unsigned char b0 = (__b & 0x03) * 4; 10116 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3; 10117 return vec_perm(__a, __a, 10118 (vector unsigned char)(b0, b1, b2, b3, b0, b1, b2, b3, b0, b1, 10119 b2, b3, b0, b1, b2, b3)); 10120 } 10121 10122 #ifdef __VSX__ 10123 static __inline__ vector double __ATTRS_o_ai vec_splat(vector double __a, 10124 unsigned const int __b) { 10125 unsigned char b0 = (__b & 0x01) * 8; 10126 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10127 b6 = b0 + 6, b7 = b0 + 7; 10128 return vec_perm(__a, __a, 10129 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10130 b2, b3, b4, b5, b6, b7)); 10131 } 10132 static __inline__ vector bool long long __ATTRS_o_ai 10133 vec_splat(vector bool long long __a, unsigned const int __b) { 10134 unsigned char b0 = (__b & 0x01) * 8; 10135 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10136 b6 = b0 + 6, b7 = b0 + 7; 10137 return vec_perm(__a, __a, 10138 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10139 b2, b3, b4, b5, b6, b7)); 10140 } 10141 static __inline__ vector signed long long __ATTRS_o_ai 10142 vec_splat(vector signed long long __a, unsigned const int __b) { 10143 unsigned char b0 = (__b & 0x01) * 8; 10144 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10145 b6 = b0 + 6, b7 = b0 + 7; 10146 return vec_perm(__a, __a, 10147 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10148 b2, b3, b4, b5, b6, b7)); 10149 } 10150 static __inline__ vector unsigned long long __ATTRS_o_ai 10151 vec_splat(vector unsigned long long __a, unsigned const int __b) { 10152 unsigned char b0 = (__b & 0x01) * 8; 10153 unsigned char b1 = b0 + 1, b2 = b0 + 2, b3 = b0 + 3, b4 = b0 + 4, b5 = b0 + 5, 10154 b6 = b0 + 6, b7 = b0 + 7; 10155 return vec_perm(__a, __a, 10156 (vector unsigned char)(b0, b1, b2, b3, b4, b5, b6, b7, b0, b1, 10157 b2, b3, b4, b5, b6, b7)); 10158 } 10159 #endif 10160 10161 /* vec_vspltb */ 10162 10163 #define __builtin_altivec_vspltb vec_vspltb 10164 10165 static __inline__ vector signed char __ATTRS_o_ai 10166 vec_vspltb(vector signed char __a, unsigned char __b) { 10167 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10168 } 10169 10170 static __inline__ vector unsigned char __ATTRS_o_ai 10171 vec_vspltb(vector unsigned char __a, unsigned char __b) { 10172 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10173 } 10174 10175 static __inline__ vector bool char __ATTRS_o_ai vec_vspltb(vector bool char __a, 10176 unsigned char __b) { 10177 return vec_perm(__a, __a, (vector unsigned char)(__b)); 10178 } 10179 10180 /* vec_vsplth */ 10181 10182 #define __builtin_altivec_vsplth vec_vsplth 10183 10184 static __inline__ vector short __ATTRS_o_ai vec_vsplth(vector short __a, 10185 unsigned char __b) { 10186 __b *= 2; 10187 unsigned char b1 = __b + 1; 10188 return vec_perm(__a, __a, 10189 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10190 __b, b1, __b, b1, __b, b1, __b, b1)); 10191 } 10192 10193 static __inline__ vector unsigned short __ATTRS_o_ai 10194 vec_vsplth(vector unsigned short __a, unsigned char __b) { 10195 __b *= 2; 10196 unsigned char b1 = __b + 1; 10197 return vec_perm(__a, __a, 10198 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10199 __b, b1, __b, b1, __b, b1, __b, b1)); 10200 } 10201 10202 static __inline__ vector bool short __ATTRS_o_ai 10203 vec_vsplth(vector bool short __a, unsigned char __b) { 10204 __b *= 2; 10205 unsigned char b1 = __b + 1; 10206 return vec_perm(__a, __a, 10207 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10208 __b, b1, __b, b1, __b, b1, __b, b1)); 10209 } 10210 10211 static __inline__ vector pixel __ATTRS_o_ai vec_vsplth(vector pixel __a, 10212 unsigned char __b) { 10213 __b *= 2; 10214 unsigned char b1 = __b + 1; 10215 return vec_perm(__a, __a, 10216 (vector unsigned char)(__b, b1, __b, b1, __b, b1, __b, b1, 10217 __b, b1, __b, b1, __b, b1, __b, b1)); 10218 } 10219 10220 /* vec_vspltw */ 10221 10222 #define __builtin_altivec_vspltw vec_vspltw 10223 10224 static __inline__ vector int __ATTRS_o_ai vec_vspltw(vector int __a, 10225 unsigned char __b) { 10226 __b *= 4; 10227 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10228 return vec_perm(__a, __a, 10229 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10230 b1, b2, b3, __b, b1, b2, b3)); 10231 } 10232 10233 static __inline__ vector unsigned int __ATTRS_o_ai 10234 vec_vspltw(vector unsigned int __a, unsigned char __b) { 10235 __b *= 4; 10236 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10237 return vec_perm(__a, __a, 10238 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10239 b1, b2, b3, __b, b1, b2, b3)); 10240 } 10241 10242 static __inline__ vector bool int __ATTRS_o_ai vec_vspltw(vector bool int __a, 10243 unsigned char __b) { 10244 __b *= 4; 10245 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10246 return vec_perm(__a, __a, 10247 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10248 b1, b2, b3, __b, b1, b2, b3)); 10249 } 10250 10251 static __inline__ vector float __ATTRS_o_ai vec_vspltw(vector float __a, 10252 unsigned char __b) { 10253 __b *= 4; 10254 unsigned char b1 = __b + 1, b2 = __b + 2, b3 = __b + 3; 10255 return vec_perm(__a, __a, 10256 (vector unsigned char)(__b, b1, b2, b3, __b, b1, b2, b3, __b, 10257 b1, b2, b3, __b, b1, b2, b3)); 10258 } 10259 10260 /* vec_splat_s8 */ 10261 10262 #define __builtin_altivec_vspltisb vec_splat_s8 10263 10264 // FIXME: parameter should be treated as 5-bit signed literal 10265 static __inline__ vector signed char __ATTRS_o_ai 10266 vec_splat_s8(signed char __a) { 10267 return (vector signed char)(__a); 10268 } 10269 10270 /* vec_vspltisb */ 10271 10272 // FIXME: parameter should be treated as 5-bit signed literal 10273 static __inline__ vector signed char __ATTRS_o_ai 10274 vec_vspltisb(signed char __a) { 10275 return (vector signed char)(__a); 10276 } 10277 10278 /* vec_splat_s16 */ 10279 10280 #define __builtin_altivec_vspltish vec_splat_s16 10281 10282 // FIXME: parameter should be treated as 5-bit signed literal 10283 static __inline__ vector short __ATTRS_o_ai vec_splat_s16(signed char __a) { 10284 return (vector short)(__a); 10285 } 10286 10287 /* vec_vspltish */ 10288 10289 // FIXME: parameter should be treated as 5-bit signed literal 10290 static __inline__ vector short __ATTRS_o_ai vec_vspltish(signed char __a) { 10291 return (vector short)(__a); 10292 } 10293 10294 /* vec_splat_s32 */ 10295 10296 #define __builtin_altivec_vspltisw vec_splat_s32 10297 10298 // FIXME: parameter should be treated as 5-bit signed literal 10299 static __inline__ vector int __ATTRS_o_ai vec_splat_s32(signed char __a) { 10300 return (vector int)(__a); 10301 } 10302 10303 /* vec_vspltisw */ 10304 10305 // FIXME: parameter should be treated as 5-bit signed literal 10306 static __inline__ vector int __ATTRS_o_ai vec_vspltisw(signed char __a) { 10307 return (vector int)(__a); 10308 } 10309 10310 /* vec_splat_u8 */ 10311 10312 // FIXME: parameter should be treated as 5-bit signed literal 10313 static __inline__ vector unsigned char __ATTRS_o_ai 10314 vec_splat_u8(unsigned char __a) { 10315 return (vector unsigned char)(__a); 10316 } 10317 10318 /* vec_splat_u16 */ 10319 10320 // FIXME: parameter should be treated as 5-bit signed literal 10321 static __inline__ vector unsigned short __ATTRS_o_ai 10322 vec_splat_u16(signed char __a) { 10323 return (vector unsigned short)(__a); 10324 } 10325 10326 /* vec_splat_u32 */ 10327 10328 // FIXME: parameter should be treated as 5-bit signed literal 10329 static __inline__ vector unsigned int __ATTRS_o_ai 10330 vec_splat_u32(signed char __a) { 10331 return (vector unsigned int)(__a); 10332 } 10333 10334 /* vec_sr */ 10335 10336 // vec_sr does modulo arithmetic on __b first, so __b is allowed to be more 10337 // than the length of __a. 10338 static __inline__ vector unsigned char __ATTRS_o_ai 10339 vec_sr(vector unsigned char __a, vector unsigned char __b) { 10340 return __a >> 10341 (__b % (vector unsigned char)(sizeof(unsigned char) * __CHAR_BIT__)); 10342 } 10343 10344 static __inline__ vector signed char __ATTRS_o_ai 10345 vec_sr(vector signed char __a, vector unsigned char __b) { 10346 return (vector signed char)vec_sr((vector unsigned char)__a, __b); 10347 } 10348 10349 static __inline__ vector unsigned short __ATTRS_o_ai 10350 vec_sr(vector unsigned short __a, vector unsigned short __b) { 10351 return __a >> 10352 (__b % (vector unsigned short)(sizeof(unsigned short) * __CHAR_BIT__)); 10353 } 10354 10355 static __inline__ vector short __ATTRS_o_ai vec_sr(vector short __a, 10356 vector unsigned short __b) { 10357 return (vector short)vec_sr((vector unsigned short)__a, __b); 10358 } 10359 10360 static __inline__ vector unsigned int __ATTRS_o_ai 10361 vec_sr(vector unsigned int __a, vector unsigned int __b) { 10362 return __a >> 10363 (__b % (vector unsigned int)(sizeof(unsigned int) * __CHAR_BIT__)); 10364 } 10365 10366 static __inline__ vector int __ATTRS_o_ai vec_sr(vector int __a, 10367 vector unsigned int __b) { 10368 return (vector int)vec_sr((vector unsigned int)__a, __b); 10369 } 10370 10371 #ifdef __POWER8_VECTOR__ 10372 static __inline__ vector unsigned long long __ATTRS_o_ai 10373 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10374 return __a >> (__b % (vector unsigned long long)(sizeof(unsigned long long) * 10375 __CHAR_BIT__)); 10376 } 10377 10378 static __inline__ vector long long __ATTRS_o_ai 10379 vec_sr(vector long long __a, vector unsigned long long __b) { 10380 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10381 } 10382 #elif defined(__VSX__) 10383 static __inline__ vector unsigned long long __ATTRS_o_ai 10384 vec_sr(vector unsigned long long __a, vector unsigned long long __b) { 10385 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10386 10387 // Big endian element zero (the left doubleword) can be right shifted as-is. 10388 // However the shift amount must be in the right doubleword. 10389 // The other element needs to be swapped into the left doubleword and 10390 // shifted. Then the left doublewords of the two result vectors are merged. 10391 vector unsigned long long __swapshift = 10392 __builtin_shufflevector(__b, __b, 1, 0); 10393 vector unsigned long long __leftelt = 10394 (vector unsigned long long)__builtin_altivec_vsro( 10395 (vector signed int)__a, (vector signed int)__swapshift); 10396 #ifdef __LITTLE_ENDIAN__ 10397 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10398 (vector signed int)__leftelt, 10399 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 0)); 10400 #else 10401 __leftelt = (vector unsigned long long)__builtin_altivec_vsr( 10402 (vector signed int)__leftelt, 10403 (vector signed int)vec_vspltb((vector unsigned char)__swapshift, 15)); 10404 #endif 10405 __a = __builtin_shufflevector(__a, __a, 1, 0); 10406 vector unsigned long long __rightelt = 10407 (vector unsigned long long)__builtin_altivec_vsro((vector signed int)__a, 10408 (vector signed int)__b); 10409 #ifdef __LITTLE_ENDIAN__ 10410 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10411 (vector signed int)__rightelt, 10412 (vector signed int)vec_vspltb((vector unsigned char)__b, 0)); 10413 return __builtin_shufflevector(__rightelt, __leftelt, 1, 3); 10414 #else 10415 __rightelt = (vector unsigned long long)__builtin_altivec_vsr( 10416 (vector signed int)__rightelt, 10417 (vector signed int)vec_vspltb((vector unsigned char)__b, 15)); 10418 return __builtin_shufflevector(__leftelt, __rightelt, 0, 2); 10419 #endif 10420 } 10421 10422 static __inline__ vector long long __ATTRS_o_ai 10423 vec_sr(vector long long __a, vector unsigned long long __b) { 10424 return (vector long long)vec_sr((vector unsigned long long)__a, __b); 10425 } 10426 #endif /* __VSX__ */ 10427 10428 /* vec_vsrb */ 10429 10430 #define __builtin_altivec_vsrb vec_vsrb 10431 10432 static __inline__ vector signed char __ATTRS_o_ai 10433 vec_vsrb(vector signed char __a, vector unsigned char __b) { 10434 return vec_sr(__a, __b); 10435 } 10436 10437 static __inline__ vector unsigned char __ATTRS_o_ai 10438 vec_vsrb(vector unsigned char __a, vector unsigned char __b) { 10439 return vec_sr(__a, __b); 10440 } 10441 10442 /* vec_vsrh */ 10443 10444 #define __builtin_altivec_vsrh vec_vsrh 10445 10446 static __inline__ vector short __ATTRS_o_ai 10447 vec_vsrh(vector short __a, vector unsigned short __b) { 10448 return vec_sr(__a, __b); 10449 } 10450 10451 static __inline__ vector unsigned short __ATTRS_o_ai 10452 vec_vsrh(vector unsigned short __a, vector unsigned short __b) { 10453 return vec_sr(__a, __b); 10454 } 10455 10456 /* vec_vsrw */ 10457 10458 #define __builtin_altivec_vsrw vec_vsrw 10459 10460 static __inline__ vector int __ATTRS_o_ai vec_vsrw(vector int __a, 10461 vector unsigned int __b) { 10462 return vec_sr(__a, __b); 10463 } 10464 10465 static __inline__ vector unsigned int __ATTRS_o_ai 10466 vec_vsrw(vector unsigned int __a, vector unsigned int __b) { 10467 return vec_sr(__a, __b); 10468 } 10469 10470 /* vec_sra */ 10471 10472 static __inline__ vector signed char __ATTRS_o_ai 10473 vec_sra(vector signed char __a, vector unsigned char __b) { 10474 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10475 } 10476 10477 static __inline__ vector unsigned char __ATTRS_o_ai 10478 vec_sra(vector unsigned char __a, vector unsigned char __b) { 10479 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10480 } 10481 10482 static __inline__ vector short __ATTRS_o_ai vec_sra(vector short __a, 10483 vector unsigned short __b) { 10484 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10485 } 10486 10487 static __inline__ vector unsigned short __ATTRS_o_ai 10488 vec_sra(vector unsigned short __a, vector unsigned short __b) { 10489 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10490 } 10491 10492 static __inline__ vector int __ATTRS_o_ai vec_sra(vector int __a, 10493 vector unsigned int __b) { 10494 return __builtin_altivec_vsraw(__a, __b); 10495 } 10496 10497 static __inline__ vector unsigned int __ATTRS_o_ai 10498 vec_sra(vector unsigned int __a, vector unsigned int __b) { 10499 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10500 } 10501 10502 #ifdef __POWER8_VECTOR__ 10503 static __inline__ vector signed long long __ATTRS_o_ai 10504 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10505 return __a >> __b; 10506 } 10507 10508 static __inline__ vector unsigned long long __ATTRS_o_ai 10509 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10510 return (vector unsigned long long)((vector signed long long)__a >> __b); 10511 } 10512 #elif defined(__VSX__) 10513 static __inline__ vector signed long long __ATTRS_o_ai 10514 vec_sra(vector signed long long __a, vector unsigned long long __b) { 10515 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10516 return __a >> __b; 10517 } 10518 10519 static __inline__ vector unsigned long long __ATTRS_o_ai 10520 vec_sra(vector unsigned long long __a, vector unsigned long long __b) { 10521 __b %= (vector unsigned long long)(sizeof(unsigned long long) * __CHAR_BIT__); 10522 return (vector unsigned long long)((vector signed long long)__a >> __b); 10523 } 10524 #endif /* __VSX__ */ 10525 10526 /* vec_vsrab */ 10527 10528 static __inline__ vector signed char __ATTRS_o_ai 10529 vec_vsrab(vector signed char __a, vector unsigned char __b) { 10530 return (vector signed char)__builtin_altivec_vsrab((vector char)__a, __b); 10531 } 10532 10533 static __inline__ vector unsigned char __ATTRS_o_ai 10534 vec_vsrab(vector unsigned char __a, vector unsigned char __b) { 10535 return (vector unsigned char)__builtin_altivec_vsrab((vector char)__a, __b); 10536 } 10537 10538 /* vec_vsrah */ 10539 10540 static __inline__ vector short __ATTRS_o_ai 10541 vec_vsrah(vector short __a, vector unsigned short __b) { 10542 return __builtin_altivec_vsrah(__a, (vector unsigned short)__b); 10543 } 10544 10545 static __inline__ vector unsigned short __ATTRS_o_ai 10546 vec_vsrah(vector unsigned short __a, vector unsigned short __b) { 10547 return (vector unsigned short)__builtin_altivec_vsrah((vector short)__a, __b); 10548 } 10549 10550 /* vec_vsraw */ 10551 10552 static __inline__ vector int __ATTRS_o_ai vec_vsraw(vector int __a, 10553 vector unsigned int __b) { 10554 return __builtin_altivec_vsraw(__a, __b); 10555 } 10556 10557 static __inline__ vector unsigned int __ATTRS_o_ai 10558 vec_vsraw(vector unsigned int __a, vector unsigned int __b) { 10559 return (vector unsigned int)__builtin_altivec_vsraw((vector int)__a, __b); 10560 } 10561 10562 /* vec_srl */ 10563 10564 static __inline__ vector signed char __ATTRS_o_ai 10565 vec_srl(vector signed char __a, vector unsigned char __b) { 10566 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10567 (vector int)__b); 10568 } 10569 10570 static __inline__ vector signed char __ATTRS_o_ai 10571 vec_srl(vector signed char __a, vector unsigned short __b) { 10572 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10573 (vector int)__b); 10574 } 10575 10576 static __inline__ vector signed char __ATTRS_o_ai 10577 vec_srl(vector signed char __a, vector unsigned int __b) { 10578 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10579 (vector int)__b); 10580 } 10581 10582 static __inline__ vector unsigned char __ATTRS_o_ai 10583 vec_srl(vector unsigned char __a, vector unsigned char __b) { 10584 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10585 (vector int)__b); 10586 } 10587 10588 static __inline__ vector unsigned char __ATTRS_o_ai 10589 vec_srl(vector unsigned char __a, vector unsigned short __b) { 10590 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10591 (vector int)__b); 10592 } 10593 10594 static __inline__ vector unsigned char __ATTRS_o_ai 10595 vec_srl(vector unsigned char __a, vector unsigned int __b) { 10596 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10597 (vector int)__b); 10598 } 10599 10600 static __inline__ vector bool char __ATTRS_o_ai 10601 vec_srl(vector bool char __a, vector unsigned char __b) { 10602 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10603 (vector int)__b); 10604 } 10605 10606 static __inline__ vector bool char __ATTRS_o_ai 10607 vec_srl(vector bool char __a, vector unsigned short __b) { 10608 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10609 (vector int)__b); 10610 } 10611 10612 static __inline__ vector bool char __ATTRS_o_ai 10613 vec_srl(vector bool char __a, vector unsigned int __b) { 10614 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10615 (vector int)__b); 10616 } 10617 10618 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10619 vector unsigned char __b) { 10620 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10621 } 10622 10623 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10624 vector unsigned short __b) { 10625 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10626 } 10627 10628 static __inline__ vector short __ATTRS_o_ai vec_srl(vector short __a, 10629 vector unsigned int __b) { 10630 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10631 } 10632 10633 static __inline__ vector unsigned short __ATTRS_o_ai 10634 vec_srl(vector unsigned short __a, vector unsigned char __b) { 10635 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10636 (vector int)__b); 10637 } 10638 10639 static __inline__ vector unsigned short __ATTRS_o_ai 10640 vec_srl(vector unsigned short __a, vector unsigned short __b) { 10641 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10642 (vector int)__b); 10643 } 10644 10645 static __inline__ vector unsigned short __ATTRS_o_ai 10646 vec_srl(vector unsigned short __a, vector unsigned int __b) { 10647 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10648 (vector int)__b); 10649 } 10650 10651 static __inline__ vector bool short __ATTRS_o_ai 10652 vec_srl(vector bool short __a, vector unsigned char __b) { 10653 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10654 (vector int)__b); 10655 } 10656 10657 static __inline__ vector bool short __ATTRS_o_ai 10658 vec_srl(vector bool short __a, vector unsigned short __b) { 10659 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10660 (vector int)__b); 10661 } 10662 10663 static __inline__ vector bool short __ATTRS_o_ai 10664 vec_srl(vector bool short __a, vector unsigned int __b) { 10665 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10666 (vector int)__b); 10667 } 10668 10669 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10670 vector unsigned char __b) { 10671 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10672 } 10673 10674 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10675 vector unsigned short __b) { 10676 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10677 } 10678 10679 static __inline__ vector pixel __ATTRS_o_ai vec_srl(vector pixel __a, 10680 vector unsigned int __b) { 10681 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10682 } 10683 10684 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10685 vector unsigned char __b) { 10686 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10687 } 10688 10689 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10690 vector unsigned short __b) { 10691 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10692 } 10693 10694 static __inline__ vector int __ATTRS_o_ai vec_srl(vector int __a, 10695 vector unsigned int __b) { 10696 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10697 } 10698 10699 static __inline__ vector unsigned int __ATTRS_o_ai 10700 vec_srl(vector unsigned int __a, vector unsigned char __b) { 10701 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10702 (vector int)__b); 10703 } 10704 10705 static __inline__ vector unsigned int __ATTRS_o_ai 10706 vec_srl(vector unsigned int __a, vector unsigned short __b) { 10707 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10708 (vector int)__b); 10709 } 10710 10711 static __inline__ vector unsigned int __ATTRS_o_ai 10712 vec_srl(vector unsigned int __a, vector unsigned int __b) { 10713 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10714 (vector int)__b); 10715 } 10716 10717 static __inline__ vector bool int __ATTRS_o_ai 10718 vec_srl(vector bool int __a, vector unsigned char __b) { 10719 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10720 (vector int)__b); 10721 } 10722 10723 static __inline__ vector bool int __ATTRS_o_ai 10724 vec_srl(vector bool int __a, vector unsigned short __b) { 10725 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10726 (vector int)__b); 10727 } 10728 10729 static __inline__ vector bool int __ATTRS_o_ai 10730 vec_srl(vector bool int __a, vector unsigned int __b) { 10731 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10732 (vector int)__b); 10733 } 10734 10735 #ifdef __VSX__ 10736 static __inline__ vector signed long long __ATTRS_o_ai 10737 vec_srl(vector signed long long __a, vector unsigned char __b) { 10738 return (vector signed long long)__builtin_altivec_vsr((vector int)__a, 10739 (vector int)__b); 10740 } 10741 10742 static __inline__ vector unsigned long long __ATTRS_o_ai 10743 vec_srl(vector unsigned long long __a, vector unsigned char __b) { 10744 return (vector unsigned long long)__builtin_altivec_vsr((vector int)__a, 10745 (vector int)__b); 10746 } 10747 #endif 10748 10749 /* vec_vsr */ 10750 10751 static __inline__ vector signed char __ATTRS_o_ai 10752 vec_vsr(vector signed char __a, vector unsigned char __b) { 10753 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10754 (vector int)__b); 10755 } 10756 10757 static __inline__ vector signed char __ATTRS_o_ai 10758 vec_vsr(vector signed char __a, vector unsigned short __b) { 10759 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10760 (vector int)__b); 10761 } 10762 10763 static __inline__ vector signed char __ATTRS_o_ai 10764 vec_vsr(vector signed char __a, vector unsigned int __b) { 10765 return (vector signed char)__builtin_altivec_vsr((vector int)__a, 10766 (vector int)__b); 10767 } 10768 10769 static __inline__ vector unsigned char __ATTRS_o_ai 10770 vec_vsr(vector unsigned char __a, vector unsigned char __b) { 10771 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10772 (vector int)__b); 10773 } 10774 10775 static __inline__ vector unsigned char __ATTRS_o_ai 10776 vec_vsr(vector unsigned char __a, vector unsigned short __b) { 10777 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10778 (vector int)__b); 10779 } 10780 10781 static __inline__ vector unsigned char __ATTRS_o_ai 10782 vec_vsr(vector unsigned char __a, vector unsigned int __b) { 10783 return (vector unsigned char)__builtin_altivec_vsr((vector int)__a, 10784 (vector int)__b); 10785 } 10786 10787 static __inline__ vector bool char __ATTRS_o_ai 10788 vec_vsr(vector bool char __a, vector unsigned char __b) { 10789 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10790 (vector int)__b); 10791 } 10792 10793 static __inline__ vector bool char __ATTRS_o_ai 10794 vec_vsr(vector bool char __a, vector unsigned short __b) { 10795 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10796 (vector int)__b); 10797 } 10798 10799 static __inline__ vector bool char __ATTRS_o_ai 10800 vec_vsr(vector bool char __a, vector unsigned int __b) { 10801 return (vector bool char)__builtin_altivec_vsr((vector int)__a, 10802 (vector int)__b); 10803 } 10804 10805 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10806 vector unsigned char __b) { 10807 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10808 } 10809 10810 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10811 vector unsigned short __b) { 10812 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10813 } 10814 10815 static __inline__ vector short __ATTRS_o_ai vec_vsr(vector short __a, 10816 vector unsigned int __b) { 10817 return (vector short)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10818 } 10819 10820 static __inline__ vector unsigned short __ATTRS_o_ai 10821 vec_vsr(vector unsigned short __a, vector unsigned char __b) { 10822 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10823 (vector int)__b); 10824 } 10825 10826 static __inline__ vector unsigned short __ATTRS_o_ai 10827 vec_vsr(vector unsigned short __a, vector unsigned short __b) { 10828 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10829 (vector int)__b); 10830 } 10831 10832 static __inline__ vector unsigned short __ATTRS_o_ai 10833 vec_vsr(vector unsigned short __a, vector unsigned int __b) { 10834 return (vector unsigned short)__builtin_altivec_vsr((vector int)__a, 10835 (vector int)__b); 10836 } 10837 10838 static __inline__ vector bool short __ATTRS_o_ai 10839 vec_vsr(vector bool short __a, vector unsigned char __b) { 10840 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10841 (vector int)__b); 10842 } 10843 10844 static __inline__ vector bool short __ATTRS_o_ai 10845 vec_vsr(vector bool short __a, vector unsigned short __b) { 10846 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10847 (vector int)__b); 10848 } 10849 10850 static __inline__ vector bool short __ATTRS_o_ai 10851 vec_vsr(vector bool short __a, vector unsigned int __b) { 10852 return (vector bool short)__builtin_altivec_vsr((vector int)__a, 10853 (vector int)__b); 10854 } 10855 10856 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10857 vector unsigned char __b) { 10858 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10859 } 10860 10861 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10862 vector unsigned short __b) { 10863 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10864 } 10865 10866 static __inline__ vector pixel __ATTRS_o_ai vec_vsr(vector pixel __a, 10867 vector unsigned int __b) { 10868 return (vector pixel)__builtin_altivec_vsr((vector int)__a, (vector int)__b); 10869 } 10870 10871 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10872 vector unsigned char __b) { 10873 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10874 } 10875 10876 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10877 vector unsigned short __b) { 10878 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10879 } 10880 10881 static __inline__ vector int __ATTRS_o_ai vec_vsr(vector int __a, 10882 vector unsigned int __b) { 10883 return (vector int)__builtin_altivec_vsr(__a, (vector int)__b); 10884 } 10885 10886 static __inline__ vector unsigned int __ATTRS_o_ai 10887 vec_vsr(vector unsigned int __a, vector unsigned char __b) { 10888 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10889 (vector int)__b); 10890 } 10891 10892 static __inline__ vector unsigned int __ATTRS_o_ai 10893 vec_vsr(vector unsigned int __a, vector unsigned short __b) { 10894 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10895 (vector int)__b); 10896 } 10897 10898 static __inline__ vector unsigned int __ATTRS_o_ai 10899 vec_vsr(vector unsigned int __a, vector unsigned int __b) { 10900 return (vector unsigned int)__builtin_altivec_vsr((vector int)__a, 10901 (vector int)__b); 10902 } 10903 10904 static __inline__ vector bool int __ATTRS_o_ai 10905 vec_vsr(vector bool int __a, vector unsigned char __b) { 10906 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10907 (vector int)__b); 10908 } 10909 10910 static __inline__ vector bool int __ATTRS_o_ai 10911 vec_vsr(vector bool int __a, vector unsigned short __b) { 10912 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10913 (vector int)__b); 10914 } 10915 10916 static __inline__ vector bool int __ATTRS_o_ai 10917 vec_vsr(vector bool int __a, vector unsigned int __b) { 10918 return (vector bool int)__builtin_altivec_vsr((vector int)__a, 10919 (vector int)__b); 10920 } 10921 10922 /* vec_sro */ 10923 10924 static __inline__ vector signed char __ATTRS_o_ai 10925 vec_sro(vector signed char __a, vector signed char __b) { 10926 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10927 (vector int)__b); 10928 } 10929 10930 static __inline__ vector signed char __ATTRS_o_ai 10931 vec_sro(vector signed char __a, vector unsigned char __b) { 10932 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 10933 (vector int)__b); 10934 } 10935 10936 static __inline__ vector unsigned char __ATTRS_o_ai 10937 vec_sro(vector unsigned char __a, vector signed char __b) { 10938 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10939 (vector int)__b); 10940 } 10941 10942 static __inline__ vector unsigned char __ATTRS_o_ai 10943 vec_sro(vector unsigned char __a, vector unsigned char __b) { 10944 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 10945 (vector int)__b); 10946 } 10947 10948 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10949 vector signed char __b) { 10950 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10951 } 10952 10953 static __inline__ vector short __ATTRS_o_ai vec_sro(vector short __a, 10954 vector unsigned char __b) { 10955 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10956 } 10957 10958 static __inline__ vector unsigned short __ATTRS_o_ai 10959 vec_sro(vector unsigned short __a, vector signed char __b) { 10960 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10961 (vector int)__b); 10962 } 10963 10964 static __inline__ vector unsigned short __ATTRS_o_ai 10965 vec_sro(vector unsigned short __a, vector unsigned char __b) { 10966 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 10967 (vector int)__b); 10968 } 10969 10970 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10971 vector signed char __b) { 10972 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10973 } 10974 10975 static __inline__ vector pixel __ATTRS_o_ai vec_sro(vector pixel __a, 10976 vector unsigned char __b) { 10977 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 10978 } 10979 10980 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10981 vector signed char __b) { 10982 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10983 } 10984 10985 static __inline__ vector int __ATTRS_o_ai vec_sro(vector int __a, 10986 vector unsigned char __b) { 10987 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 10988 } 10989 10990 static __inline__ vector unsigned int __ATTRS_o_ai 10991 vec_sro(vector unsigned int __a, vector signed char __b) { 10992 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10993 (vector int)__b); 10994 } 10995 10996 static __inline__ vector unsigned int __ATTRS_o_ai 10997 vec_sro(vector unsigned int __a, vector unsigned char __b) { 10998 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 10999 (vector int)__b); 11000 } 11001 11002 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 11003 vector signed char __b) { 11004 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11005 } 11006 11007 static __inline__ vector float __ATTRS_o_ai vec_sro(vector float __a, 11008 vector unsigned char __b) { 11009 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11010 } 11011 11012 #ifdef __VSX__ 11013 static __inline__ vector signed long long __ATTRS_o_ai 11014 vec_sro(vector signed long long __a, vector signed char __b) { 11015 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 11016 (vector int)__b); 11017 } 11018 11019 static __inline__ vector signed long long __ATTRS_o_ai 11020 vec_sro(vector signed long long __a, vector unsigned char __b) { 11021 return (vector signed long long)__builtin_altivec_vsro((vector int)__a, 11022 (vector int)__b); 11023 } 11024 11025 static __inline__ vector unsigned long long __ATTRS_o_ai 11026 vec_sro(vector unsigned long long __a, vector signed char __b) { 11027 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11028 (vector int)__b); 11029 } 11030 11031 static __inline__ vector unsigned long long __ATTRS_o_ai 11032 vec_sro(vector unsigned long long __a, vector unsigned char __b) { 11033 return (vector unsigned long long)__builtin_altivec_vsro((vector int)__a, 11034 (vector int)__b); 11035 } 11036 #endif 11037 11038 /* vec_vsro */ 11039 11040 static __inline__ vector signed char __ATTRS_o_ai 11041 vec_vsro(vector signed char __a, vector signed char __b) { 11042 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11043 (vector int)__b); 11044 } 11045 11046 static __inline__ vector signed char __ATTRS_o_ai 11047 vec_vsro(vector signed char __a, vector unsigned char __b) { 11048 return (vector signed char)__builtin_altivec_vsro((vector int)__a, 11049 (vector int)__b); 11050 } 11051 11052 static __inline__ vector unsigned char __ATTRS_o_ai 11053 vec_vsro(vector unsigned char __a, vector signed char __b) { 11054 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11055 (vector int)__b); 11056 } 11057 11058 static __inline__ vector unsigned char __ATTRS_o_ai 11059 vec_vsro(vector unsigned char __a, vector unsigned char __b) { 11060 return (vector unsigned char)__builtin_altivec_vsro((vector int)__a, 11061 (vector int)__b); 11062 } 11063 11064 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11065 vector signed char __b) { 11066 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11067 } 11068 11069 static __inline__ vector short __ATTRS_o_ai vec_vsro(vector short __a, 11070 vector unsigned char __b) { 11071 return (vector short)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11072 } 11073 11074 static __inline__ vector unsigned short __ATTRS_o_ai 11075 vec_vsro(vector unsigned short __a, vector signed char __b) { 11076 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11077 (vector int)__b); 11078 } 11079 11080 static __inline__ vector unsigned short __ATTRS_o_ai 11081 vec_vsro(vector unsigned short __a, vector unsigned char __b) { 11082 return (vector unsigned short)__builtin_altivec_vsro((vector int)__a, 11083 (vector int)__b); 11084 } 11085 11086 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11087 vector signed char __b) { 11088 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11089 } 11090 11091 static __inline__ vector pixel __ATTRS_o_ai vec_vsro(vector pixel __a, 11092 vector unsigned char __b) { 11093 return (vector pixel)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11094 } 11095 11096 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11097 vector signed char __b) { 11098 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11099 } 11100 11101 static __inline__ vector int __ATTRS_o_ai vec_vsro(vector int __a, 11102 vector unsigned char __b) { 11103 return (vector int)__builtin_altivec_vsro(__a, (vector int)__b); 11104 } 11105 11106 static __inline__ vector unsigned int __ATTRS_o_ai 11107 vec_vsro(vector unsigned int __a, vector signed char __b) { 11108 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11109 (vector int)__b); 11110 } 11111 11112 static __inline__ vector unsigned int __ATTRS_o_ai 11113 vec_vsro(vector unsigned int __a, vector unsigned char __b) { 11114 return (vector unsigned int)__builtin_altivec_vsro((vector int)__a, 11115 (vector int)__b); 11116 } 11117 11118 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11119 vector signed char __b) { 11120 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11121 } 11122 11123 static __inline__ vector float __ATTRS_o_ai vec_vsro(vector float __a, 11124 vector unsigned char __b) { 11125 return (vector float)__builtin_altivec_vsro((vector int)__a, (vector int)__b); 11126 } 11127 11128 /* vec_st */ 11129 11130 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11131 vector signed char *__c) { 11132 __builtin_altivec_stvx((vector int)__a, __b, __c); 11133 } 11134 11135 static __inline__ void __ATTRS_o_ai vec_st(vector signed char __a, long __b, 11136 signed char *__c) { 11137 __builtin_altivec_stvx((vector int)__a, __b, __c); 11138 } 11139 11140 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11141 vector unsigned char *__c) { 11142 __builtin_altivec_stvx((vector int)__a, __b, __c); 11143 } 11144 11145 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned char __a, long __b, 11146 unsigned char *__c) { 11147 __builtin_altivec_stvx((vector int)__a, __b, __c); 11148 } 11149 11150 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11151 signed char *__c) { 11152 __builtin_altivec_stvx((vector int)__a, __b, __c); 11153 } 11154 11155 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11156 unsigned char *__c) { 11157 __builtin_altivec_stvx((vector int)__a, __b, __c); 11158 } 11159 11160 static __inline__ void __ATTRS_o_ai vec_st(vector bool char __a, long __b, 11161 vector bool char *__c) { 11162 __builtin_altivec_stvx((vector int)__a, __b, __c); 11163 } 11164 11165 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11166 vector short *__c) { 11167 __builtin_altivec_stvx((vector int)__a, __b, __c); 11168 } 11169 11170 static __inline__ void __ATTRS_o_ai vec_st(vector short __a, long __b, 11171 short *__c) { 11172 __builtin_altivec_stvx((vector int)__a, __b, __c); 11173 } 11174 11175 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11176 vector unsigned short *__c) { 11177 __builtin_altivec_stvx((vector int)__a, __b, __c); 11178 } 11179 11180 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned short __a, long __b, 11181 unsigned short *__c) { 11182 __builtin_altivec_stvx((vector int)__a, __b, __c); 11183 } 11184 11185 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11186 short *__c) { 11187 __builtin_altivec_stvx((vector int)__a, __b, __c); 11188 } 11189 11190 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11191 unsigned short *__c) { 11192 __builtin_altivec_stvx((vector int)__a, __b, __c); 11193 } 11194 11195 static __inline__ void __ATTRS_o_ai vec_st(vector bool short __a, long __b, 11196 vector bool short *__c) { 11197 __builtin_altivec_stvx((vector int)__a, __b, __c); 11198 } 11199 11200 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11201 short *__c) { 11202 __builtin_altivec_stvx((vector int)__a, __b, __c); 11203 } 11204 11205 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11206 unsigned short *__c) { 11207 __builtin_altivec_stvx((vector int)__a, __b, __c); 11208 } 11209 11210 static __inline__ void __ATTRS_o_ai vec_st(vector pixel __a, long __b, 11211 vector pixel *__c) { 11212 __builtin_altivec_stvx((vector int)__a, __b, __c); 11213 } 11214 11215 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, 11216 vector int *__c) { 11217 __builtin_altivec_stvx(__a, __b, __c); 11218 } 11219 11220 static __inline__ void __ATTRS_o_ai vec_st(vector int __a, long __b, int *__c) { 11221 __builtin_altivec_stvx(__a, __b, __c); 11222 } 11223 11224 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11225 vector unsigned int *__c) { 11226 __builtin_altivec_stvx((vector int)__a, __b, __c); 11227 } 11228 11229 static __inline__ void __ATTRS_o_ai vec_st(vector unsigned int __a, long __b, 11230 unsigned int *__c) { 11231 __builtin_altivec_stvx((vector int)__a, __b, __c); 11232 } 11233 11234 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11235 int *__c) { 11236 __builtin_altivec_stvx((vector int)__a, __b, __c); 11237 } 11238 11239 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11240 unsigned int *__c) { 11241 __builtin_altivec_stvx((vector int)__a, __b, __c); 11242 } 11243 11244 static __inline__ void __ATTRS_o_ai vec_st(vector bool int __a, long __b, 11245 vector bool int *__c) { 11246 __builtin_altivec_stvx((vector int)__a, __b, __c); 11247 } 11248 11249 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11250 vector float *__c) { 11251 __builtin_altivec_stvx((vector int)__a, __b, __c); 11252 } 11253 11254 static __inline__ void __ATTRS_o_ai vec_st(vector float __a, long __b, 11255 float *__c) { 11256 __builtin_altivec_stvx((vector int)__a, __b, __c); 11257 } 11258 11259 /* vec_stvx */ 11260 11261 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11262 vector signed char *__c) { 11263 __builtin_altivec_stvx((vector int)__a, __b, __c); 11264 } 11265 11266 static __inline__ void __ATTRS_o_ai vec_stvx(vector signed char __a, long __b, 11267 signed char *__c) { 11268 __builtin_altivec_stvx((vector int)__a, __b, __c); 11269 } 11270 11271 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11272 vector unsigned char *__c) { 11273 __builtin_altivec_stvx((vector int)__a, __b, __c); 11274 } 11275 11276 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned char __a, long __b, 11277 unsigned char *__c) { 11278 __builtin_altivec_stvx((vector int)__a, __b, __c); 11279 } 11280 11281 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11282 signed char *__c) { 11283 __builtin_altivec_stvx((vector int)__a, __b, __c); 11284 } 11285 11286 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11287 unsigned char *__c) { 11288 __builtin_altivec_stvx((vector int)__a, __b, __c); 11289 } 11290 11291 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool char __a, long __b, 11292 vector bool char *__c) { 11293 __builtin_altivec_stvx((vector int)__a, __b, __c); 11294 } 11295 11296 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11297 vector short *__c) { 11298 __builtin_altivec_stvx((vector int)__a, __b, __c); 11299 } 11300 11301 static __inline__ void __ATTRS_o_ai vec_stvx(vector short __a, long __b, 11302 short *__c) { 11303 __builtin_altivec_stvx((vector int)__a, __b, __c); 11304 } 11305 11306 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11307 vector unsigned short *__c) { 11308 __builtin_altivec_stvx((vector int)__a, __b, __c); 11309 } 11310 11311 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned short __a, long __b, 11312 unsigned short *__c) { 11313 __builtin_altivec_stvx((vector int)__a, __b, __c); 11314 } 11315 11316 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11317 short *__c) { 11318 __builtin_altivec_stvx((vector int)__a, __b, __c); 11319 } 11320 11321 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11322 unsigned short *__c) { 11323 __builtin_altivec_stvx((vector int)__a, __b, __c); 11324 } 11325 11326 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool short __a, long __b, 11327 vector bool short *__c) { 11328 __builtin_altivec_stvx((vector int)__a, __b, __c); 11329 } 11330 11331 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11332 short *__c) { 11333 __builtin_altivec_stvx((vector int)__a, __b, __c); 11334 } 11335 11336 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11337 unsigned short *__c) { 11338 __builtin_altivec_stvx((vector int)__a, __b, __c); 11339 } 11340 11341 static __inline__ void __ATTRS_o_ai vec_stvx(vector pixel __a, long __b, 11342 vector pixel *__c) { 11343 __builtin_altivec_stvx((vector int)__a, __b, __c); 11344 } 11345 11346 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11347 vector int *__c) { 11348 __builtin_altivec_stvx(__a, __b, __c); 11349 } 11350 11351 static __inline__ void __ATTRS_o_ai vec_stvx(vector int __a, long __b, 11352 int *__c) { 11353 __builtin_altivec_stvx(__a, __b, __c); 11354 } 11355 11356 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11357 vector unsigned int *__c) { 11358 __builtin_altivec_stvx((vector int)__a, __b, __c); 11359 } 11360 11361 static __inline__ void __ATTRS_o_ai vec_stvx(vector unsigned int __a, long __b, 11362 unsigned int *__c) { 11363 __builtin_altivec_stvx((vector int)__a, __b, __c); 11364 } 11365 11366 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11367 int *__c) { 11368 __builtin_altivec_stvx((vector int)__a, __b, __c); 11369 } 11370 11371 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11372 unsigned int *__c) { 11373 __builtin_altivec_stvx((vector int)__a, __b, __c); 11374 } 11375 11376 static __inline__ void __ATTRS_o_ai vec_stvx(vector bool int __a, long __b, 11377 vector bool int *__c) { 11378 __builtin_altivec_stvx((vector int)__a, __b, __c); 11379 } 11380 11381 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11382 vector float *__c) { 11383 __builtin_altivec_stvx((vector int)__a, __b, __c); 11384 } 11385 11386 static __inline__ void __ATTRS_o_ai vec_stvx(vector float __a, long __b, 11387 float *__c) { 11388 __builtin_altivec_stvx((vector int)__a, __b, __c); 11389 } 11390 11391 /* vec_ste */ 11392 11393 static __inline__ void __ATTRS_o_ai vec_ste(vector signed char __a, long __b, 11394 signed char *__c) { 11395 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11396 } 11397 11398 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned char __a, long __b, 11399 unsigned char *__c) { 11400 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11401 } 11402 11403 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11404 signed char *__c) { 11405 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11406 } 11407 11408 static __inline__ void __ATTRS_o_ai vec_ste(vector bool char __a, long __b, 11409 unsigned char *__c) { 11410 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11411 } 11412 11413 static __inline__ void __ATTRS_o_ai vec_ste(vector short __a, long __b, 11414 short *__c) { 11415 __builtin_altivec_stvehx(__a, __b, __c); 11416 } 11417 11418 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned short __a, long __b, 11419 unsigned short *__c) { 11420 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11421 } 11422 11423 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11424 short *__c) { 11425 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11426 } 11427 11428 static __inline__ void __ATTRS_o_ai vec_ste(vector bool short __a, long __b, 11429 unsigned short *__c) { 11430 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11431 } 11432 11433 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11434 short *__c) { 11435 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11436 } 11437 11438 static __inline__ void __ATTRS_o_ai vec_ste(vector pixel __a, long __b, 11439 unsigned short *__c) { 11440 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11441 } 11442 11443 static __inline__ void __ATTRS_o_ai vec_ste(vector int __a, long __b, int *__c) { 11444 __builtin_altivec_stvewx(__a, __b, __c); 11445 } 11446 11447 static __inline__ void __ATTRS_o_ai vec_ste(vector unsigned int __a, long __b, 11448 unsigned int *__c) { 11449 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11450 } 11451 11452 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11453 int *__c) { 11454 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11455 } 11456 11457 static __inline__ void __ATTRS_o_ai vec_ste(vector bool int __a, long __b, 11458 unsigned int *__c) { 11459 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11460 } 11461 11462 static __inline__ void __ATTRS_o_ai vec_ste(vector float __a, long __b, 11463 float *__c) { 11464 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11465 } 11466 11467 /* vec_stvebx */ 11468 11469 static __inline__ void __ATTRS_o_ai vec_stvebx(vector signed char __a, long __b, 11470 signed char *__c) { 11471 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11472 } 11473 11474 static __inline__ void __ATTRS_o_ai vec_stvebx(vector unsigned char __a, 11475 long __b, unsigned char *__c) { 11476 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11477 } 11478 11479 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11480 signed char *__c) { 11481 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11482 } 11483 11484 static __inline__ void __ATTRS_o_ai vec_stvebx(vector bool char __a, long __b, 11485 unsigned char *__c) { 11486 __builtin_altivec_stvebx((vector char)__a, __b, __c); 11487 } 11488 11489 /* vec_stvehx */ 11490 11491 static __inline__ void __ATTRS_o_ai vec_stvehx(vector short __a, long __b, 11492 short *__c) { 11493 __builtin_altivec_stvehx(__a, __b, __c); 11494 } 11495 11496 static __inline__ void __ATTRS_o_ai vec_stvehx(vector unsigned short __a, 11497 long __b, unsigned short *__c) { 11498 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11499 } 11500 11501 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11502 short *__c) { 11503 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11504 } 11505 11506 static __inline__ void __ATTRS_o_ai vec_stvehx(vector bool short __a, long __b, 11507 unsigned short *__c) { 11508 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11509 } 11510 11511 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11512 short *__c) { 11513 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11514 } 11515 11516 static __inline__ void __ATTRS_o_ai vec_stvehx(vector pixel __a, long __b, 11517 unsigned short *__c) { 11518 __builtin_altivec_stvehx((vector short)__a, __b, __c); 11519 } 11520 11521 /* vec_stvewx */ 11522 11523 static __inline__ void __ATTRS_o_ai vec_stvewx(vector int __a, long __b, 11524 int *__c) { 11525 __builtin_altivec_stvewx(__a, __b, __c); 11526 } 11527 11528 static __inline__ void __ATTRS_o_ai vec_stvewx(vector unsigned int __a, long __b, 11529 unsigned int *__c) { 11530 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11531 } 11532 11533 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11534 int *__c) { 11535 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11536 } 11537 11538 static __inline__ void __ATTRS_o_ai vec_stvewx(vector bool int __a, long __b, 11539 unsigned int *__c) { 11540 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11541 } 11542 11543 static __inline__ void __ATTRS_o_ai vec_stvewx(vector float __a, long __b, 11544 float *__c) { 11545 __builtin_altivec_stvewx((vector int)__a, __b, __c); 11546 } 11547 11548 /* vec_stl */ 11549 11550 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11551 vector signed char *__c) { 11552 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11553 } 11554 11555 static __inline__ void __ATTRS_o_ai vec_stl(vector signed char __a, int __b, 11556 signed char *__c) { 11557 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11558 } 11559 11560 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11561 vector unsigned char *__c) { 11562 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11563 } 11564 11565 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned char __a, int __b, 11566 unsigned char *__c) { 11567 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11568 } 11569 11570 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11571 signed char *__c) { 11572 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11573 } 11574 11575 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11576 unsigned char *__c) { 11577 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11578 } 11579 11580 static __inline__ void __ATTRS_o_ai vec_stl(vector bool char __a, int __b, 11581 vector bool char *__c) { 11582 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11583 } 11584 11585 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11586 vector short *__c) { 11587 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11588 } 11589 11590 static __inline__ void __ATTRS_o_ai vec_stl(vector short __a, int __b, 11591 short *__c) { 11592 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11593 } 11594 11595 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11596 vector unsigned short *__c) { 11597 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11598 } 11599 11600 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned short __a, int __b, 11601 unsigned short *__c) { 11602 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11603 } 11604 11605 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11606 short *__c) { 11607 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11608 } 11609 11610 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11611 unsigned short *__c) { 11612 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11613 } 11614 11615 static __inline__ void __ATTRS_o_ai vec_stl(vector bool short __a, int __b, 11616 vector bool short *__c) { 11617 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11618 } 11619 11620 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11621 short *__c) { 11622 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11623 } 11624 11625 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11626 unsigned short *__c) { 11627 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11628 } 11629 11630 static __inline__ void __ATTRS_o_ai vec_stl(vector pixel __a, int __b, 11631 vector pixel *__c) { 11632 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11633 } 11634 11635 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, 11636 vector int *__c) { 11637 __builtin_altivec_stvxl(__a, __b, __c); 11638 } 11639 11640 static __inline__ void __ATTRS_o_ai vec_stl(vector int __a, int __b, int *__c) { 11641 __builtin_altivec_stvxl(__a, __b, __c); 11642 } 11643 11644 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11645 vector unsigned int *__c) { 11646 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11647 } 11648 11649 static __inline__ void __ATTRS_o_ai vec_stl(vector unsigned int __a, int __b, 11650 unsigned int *__c) { 11651 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11652 } 11653 11654 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11655 int *__c) { 11656 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11657 } 11658 11659 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11660 unsigned int *__c) { 11661 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11662 } 11663 11664 static __inline__ void __ATTRS_o_ai vec_stl(vector bool int __a, int __b, 11665 vector bool int *__c) { 11666 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11667 } 11668 11669 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11670 vector float *__c) { 11671 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11672 } 11673 11674 static __inline__ void __ATTRS_o_ai vec_stl(vector float __a, int __b, 11675 float *__c) { 11676 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11677 } 11678 11679 /* vec_stvxl */ 11680 11681 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11682 vector signed char *__c) { 11683 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11684 } 11685 11686 static __inline__ void __ATTRS_o_ai vec_stvxl(vector signed char __a, int __b, 11687 signed char *__c) { 11688 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11689 } 11690 11691 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11692 vector unsigned char *__c) { 11693 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11694 } 11695 11696 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned char __a, int __b, 11697 unsigned char *__c) { 11698 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11699 } 11700 11701 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11702 signed char *__c) { 11703 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11704 } 11705 11706 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11707 unsigned char *__c) { 11708 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11709 } 11710 11711 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool char __a, int __b, 11712 vector bool char *__c) { 11713 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11714 } 11715 11716 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11717 vector short *__c) { 11718 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11719 } 11720 11721 static __inline__ void __ATTRS_o_ai vec_stvxl(vector short __a, int __b, 11722 short *__c) { 11723 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11724 } 11725 11726 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11727 int __b, 11728 vector unsigned short *__c) { 11729 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11730 } 11731 11732 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned short __a, 11733 int __b, unsigned short *__c) { 11734 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11735 } 11736 11737 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11738 short *__c) { 11739 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11740 } 11741 11742 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11743 unsigned short *__c) { 11744 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11745 } 11746 11747 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool short __a, int __b, 11748 vector bool short *__c) { 11749 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11750 } 11751 11752 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11753 short *__c) { 11754 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11755 } 11756 11757 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11758 unsigned short *__c) { 11759 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11760 } 11761 11762 static __inline__ void __ATTRS_o_ai vec_stvxl(vector pixel __a, int __b, 11763 vector pixel *__c) { 11764 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11765 } 11766 11767 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11768 vector int *__c) { 11769 __builtin_altivec_stvxl(__a, __b, __c); 11770 } 11771 11772 static __inline__ void __ATTRS_o_ai vec_stvxl(vector int __a, int __b, 11773 int *__c) { 11774 __builtin_altivec_stvxl(__a, __b, __c); 11775 } 11776 11777 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11778 vector unsigned int *__c) { 11779 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11780 } 11781 11782 static __inline__ void __ATTRS_o_ai vec_stvxl(vector unsigned int __a, int __b, 11783 unsigned int *__c) { 11784 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11785 } 11786 11787 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11788 int *__c) { 11789 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11790 } 11791 11792 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11793 unsigned int *__c) { 11794 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11795 } 11796 11797 static __inline__ void __ATTRS_o_ai vec_stvxl(vector bool int __a, int __b, 11798 vector bool int *__c) { 11799 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11800 } 11801 11802 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11803 vector float *__c) { 11804 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11805 } 11806 11807 static __inline__ void __ATTRS_o_ai vec_stvxl(vector float __a, int __b, 11808 float *__c) { 11809 __builtin_altivec_stvxl((vector int)__a, __b, __c); 11810 } 11811 11812 /* vec_sub */ 11813 11814 static __inline__ vector signed char __ATTRS_o_ai 11815 vec_sub(vector signed char __a, vector signed char __b) { 11816 return __a - __b; 11817 } 11818 11819 static __inline__ vector signed char __ATTRS_o_ai 11820 vec_sub(vector bool char __a, vector signed char __b) { 11821 return (vector signed char)__a - __b; 11822 } 11823 11824 static __inline__ vector signed char __ATTRS_o_ai 11825 vec_sub(vector signed char __a, vector bool char __b) { 11826 return __a - (vector signed char)__b; 11827 } 11828 11829 static __inline__ vector unsigned char __ATTRS_o_ai 11830 vec_sub(vector unsigned char __a, vector unsigned char __b) { 11831 return __a - __b; 11832 } 11833 11834 static __inline__ vector unsigned char __ATTRS_o_ai 11835 vec_sub(vector bool char __a, vector unsigned char __b) { 11836 return (vector unsigned char)__a - __b; 11837 } 11838 11839 static __inline__ vector unsigned char __ATTRS_o_ai 11840 vec_sub(vector unsigned char __a, vector bool char __b) { 11841 return __a - (vector unsigned char)__b; 11842 } 11843 11844 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11845 vector short __b) { 11846 return __a - __b; 11847 } 11848 11849 static __inline__ vector short __ATTRS_o_ai vec_sub(vector bool short __a, 11850 vector short __b) { 11851 return (vector short)__a - __b; 11852 } 11853 11854 static __inline__ vector short __ATTRS_o_ai vec_sub(vector short __a, 11855 vector bool short __b) { 11856 return __a - (vector short)__b; 11857 } 11858 11859 static __inline__ vector unsigned short __ATTRS_o_ai 11860 vec_sub(vector unsigned short __a, vector unsigned short __b) { 11861 return __a - __b; 11862 } 11863 11864 static __inline__ vector unsigned short __ATTRS_o_ai 11865 vec_sub(vector bool short __a, vector unsigned short __b) { 11866 return (vector unsigned short)__a - __b; 11867 } 11868 11869 static __inline__ vector unsigned short __ATTRS_o_ai 11870 vec_sub(vector unsigned short __a, vector bool short __b) { 11871 return __a - (vector unsigned short)__b; 11872 } 11873 11874 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11875 vector int __b) { 11876 return __a - __b; 11877 } 11878 11879 static __inline__ vector int __ATTRS_o_ai vec_sub(vector bool int __a, 11880 vector int __b) { 11881 return (vector int)__a - __b; 11882 } 11883 11884 static __inline__ vector int __ATTRS_o_ai vec_sub(vector int __a, 11885 vector bool int __b) { 11886 return __a - (vector int)__b; 11887 } 11888 11889 static __inline__ vector unsigned int __ATTRS_o_ai 11890 vec_sub(vector unsigned int __a, vector unsigned int __b) { 11891 return __a - __b; 11892 } 11893 11894 static __inline__ vector unsigned int __ATTRS_o_ai 11895 vec_sub(vector bool int __a, vector unsigned int __b) { 11896 return (vector unsigned int)__a - __b; 11897 } 11898 11899 static __inline__ vector unsigned int __ATTRS_o_ai 11900 vec_sub(vector unsigned int __a, vector bool int __b) { 11901 return __a - (vector unsigned int)__b; 11902 } 11903 11904 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 11905 defined(__SIZEOF_INT128__) 11906 static __inline__ vector signed __int128 __ATTRS_o_ai 11907 vec_sub(vector signed __int128 __a, vector signed __int128 __b) { 11908 return __a - __b; 11909 } 11910 11911 static __inline__ vector unsigned __int128 __ATTRS_o_ai 11912 vec_sub(vector unsigned __int128 __a, vector unsigned __int128 __b) { 11913 return __a - __b; 11914 } 11915 #endif // defined(__POWER8_VECTOR__) && defined(__powerpc64__) && 11916 // defined(__SIZEOF_INT128__) 11917 11918 #ifdef __VSX__ 11919 static __inline__ vector signed long long __ATTRS_o_ai 11920 vec_sub(vector signed long long __a, vector signed long long __b) { 11921 return __a - __b; 11922 } 11923 11924 static __inline__ vector unsigned long long __ATTRS_o_ai 11925 vec_sub(vector unsigned long long __a, vector unsigned long long __b) { 11926 return __a - __b; 11927 } 11928 11929 static __inline__ vector double __ATTRS_o_ai vec_sub(vector double __a, 11930 vector double __b) { 11931 return __a - __b; 11932 } 11933 #endif 11934 11935 static __inline__ vector float __ATTRS_o_ai vec_sub(vector float __a, 11936 vector float __b) { 11937 return __a - __b; 11938 } 11939 11940 /* vec_vsububm */ 11941 11942 #define __builtin_altivec_vsububm vec_vsububm 11943 11944 static __inline__ vector signed char __ATTRS_o_ai 11945 vec_vsububm(vector signed char __a, vector signed char __b) { 11946 return __a - __b; 11947 } 11948 11949 static __inline__ vector signed char __ATTRS_o_ai 11950 vec_vsububm(vector bool char __a, vector signed char __b) { 11951 return (vector signed char)__a - __b; 11952 } 11953 11954 static __inline__ vector signed char __ATTRS_o_ai 11955 vec_vsububm(vector signed char __a, vector bool char __b) { 11956 return __a - (vector signed char)__b; 11957 } 11958 11959 static __inline__ vector unsigned char __ATTRS_o_ai 11960 vec_vsububm(vector unsigned char __a, vector unsigned char __b) { 11961 return __a - __b; 11962 } 11963 11964 static __inline__ vector unsigned char __ATTRS_o_ai 11965 vec_vsububm(vector bool char __a, vector unsigned char __b) { 11966 return (vector unsigned char)__a - __b; 11967 } 11968 11969 static __inline__ vector unsigned char __ATTRS_o_ai 11970 vec_vsububm(vector unsigned char __a, vector bool char __b) { 11971 return __a - (vector unsigned char)__b; 11972 } 11973 11974 /* vec_vsubuhm */ 11975 11976 #define __builtin_altivec_vsubuhm vec_vsubuhm 11977 11978 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11979 vector short __b) { 11980 return __a - __b; 11981 } 11982 11983 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector bool short __a, 11984 vector short __b) { 11985 return (vector short)__a - __b; 11986 } 11987 11988 static __inline__ vector short __ATTRS_o_ai vec_vsubuhm(vector short __a, 11989 vector bool short __b) { 11990 return __a - (vector short)__b; 11991 } 11992 11993 static __inline__ vector unsigned short __ATTRS_o_ai 11994 vec_vsubuhm(vector unsigned short __a, vector unsigned short __b) { 11995 return __a - __b; 11996 } 11997 11998 static __inline__ vector unsigned short __ATTRS_o_ai 11999 vec_vsubuhm(vector bool short __a, vector unsigned short __b) { 12000 return (vector unsigned short)__a - __b; 12001 } 12002 12003 static __inline__ vector unsigned short __ATTRS_o_ai 12004 vec_vsubuhm(vector unsigned short __a, vector bool short __b) { 12005 return __a - (vector unsigned short)__b; 12006 } 12007 12008 /* vec_vsubuwm */ 12009 12010 #define __builtin_altivec_vsubuwm vec_vsubuwm 12011 12012 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 12013 vector int __b) { 12014 return __a - __b; 12015 } 12016 12017 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector bool int __a, 12018 vector int __b) { 12019 return (vector int)__a - __b; 12020 } 12021 12022 static __inline__ vector int __ATTRS_o_ai vec_vsubuwm(vector int __a, 12023 vector bool int __b) { 12024 return __a - (vector int)__b; 12025 } 12026 12027 static __inline__ vector unsigned int __ATTRS_o_ai 12028 vec_vsubuwm(vector unsigned int __a, vector unsigned int __b) { 12029 return __a - __b; 12030 } 12031 12032 static __inline__ vector unsigned int __ATTRS_o_ai 12033 vec_vsubuwm(vector bool int __a, vector unsigned int __b) { 12034 return (vector unsigned int)__a - __b; 12035 } 12036 12037 static __inline__ vector unsigned int __ATTRS_o_ai 12038 vec_vsubuwm(vector unsigned int __a, vector bool int __b) { 12039 return __a - (vector unsigned int)__b; 12040 } 12041 12042 /* vec_vsubfp */ 12043 12044 #define __builtin_altivec_vsubfp vec_vsubfp 12045 12046 static __inline__ vector float __attribute__((__always_inline__)) 12047 vec_vsubfp(vector float __a, vector float __b) { 12048 return __a - __b; 12049 } 12050 12051 /* vec_subc */ 12052 12053 static __inline__ vector signed int __ATTRS_o_ai 12054 vec_subc(vector signed int __a, vector signed int __b) { 12055 return (vector signed int)__builtin_altivec_vsubcuw((vector unsigned int)__a, 12056 (vector unsigned int) __b); 12057 } 12058 12059 static __inline__ vector unsigned int __ATTRS_o_ai 12060 vec_subc(vector unsigned int __a, vector unsigned int __b) { 12061 return __builtin_altivec_vsubcuw(__a, __b); 12062 } 12063 12064 #ifdef __POWER8_VECTOR__ 12065 #ifdef __SIZEOF_INT128__ 12066 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12067 vec_subc(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12068 return __builtin_altivec_vsubcuq(__a, __b); 12069 } 12070 12071 static __inline__ vector signed __int128 __ATTRS_o_ai 12072 vec_subc(vector signed __int128 __a, vector signed __int128 __b) { 12073 return __builtin_altivec_vsubcuq(__a, __b); 12074 } 12075 #endif 12076 12077 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12078 vec_subc_u128(vector unsigned char __a, vector unsigned char __b) { 12079 return (vector unsigned char)__builtin_altivec_vsubcuq(__a, __b); 12080 } 12081 #endif // __POWER8_VECTOR__ 12082 12083 /* vec_vsubcuw */ 12084 12085 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12086 vec_vsubcuw(vector unsigned int __a, vector unsigned int __b) { 12087 return __builtin_altivec_vsubcuw(__a, __b); 12088 } 12089 12090 /* vec_subs */ 12091 12092 static __inline__ vector signed char __ATTRS_o_ai 12093 vec_subs(vector signed char __a, vector signed char __b) { 12094 return __builtin_altivec_vsubsbs(__a, __b); 12095 } 12096 12097 static __inline__ vector signed char __ATTRS_o_ai 12098 vec_subs(vector bool char __a, vector signed char __b) { 12099 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12100 } 12101 12102 static __inline__ vector signed char __ATTRS_o_ai 12103 vec_subs(vector signed char __a, vector bool char __b) { 12104 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12105 } 12106 12107 static __inline__ vector unsigned char __ATTRS_o_ai 12108 vec_subs(vector unsigned char __a, vector unsigned char __b) { 12109 return __builtin_altivec_vsububs(__a, __b); 12110 } 12111 12112 static __inline__ vector unsigned char __ATTRS_o_ai 12113 vec_subs(vector bool char __a, vector unsigned char __b) { 12114 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12115 } 12116 12117 static __inline__ vector unsigned char __ATTRS_o_ai 12118 vec_subs(vector unsigned char __a, vector bool char __b) { 12119 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12120 } 12121 12122 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12123 vector short __b) { 12124 return __builtin_altivec_vsubshs(__a, __b); 12125 } 12126 12127 static __inline__ vector short __ATTRS_o_ai vec_subs(vector bool short __a, 12128 vector short __b) { 12129 return __builtin_altivec_vsubshs((vector short)__a, __b); 12130 } 12131 12132 static __inline__ vector short __ATTRS_o_ai vec_subs(vector short __a, 12133 vector bool short __b) { 12134 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12135 } 12136 12137 static __inline__ vector unsigned short __ATTRS_o_ai 12138 vec_subs(vector unsigned short __a, vector unsigned short __b) { 12139 return __builtin_altivec_vsubuhs(__a, __b); 12140 } 12141 12142 static __inline__ vector unsigned short __ATTRS_o_ai 12143 vec_subs(vector bool short __a, vector unsigned short __b) { 12144 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12145 } 12146 12147 static __inline__ vector unsigned short __ATTRS_o_ai 12148 vec_subs(vector unsigned short __a, vector bool short __b) { 12149 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12150 } 12151 12152 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12153 vector int __b) { 12154 return __builtin_altivec_vsubsws(__a, __b); 12155 } 12156 12157 static __inline__ vector int __ATTRS_o_ai vec_subs(vector bool int __a, 12158 vector int __b) { 12159 return __builtin_altivec_vsubsws((vector int)__a, __b); 12160 } 12161 12162 static __inline__ vector int __ATTRS_o_ai vec_subs(vector int __a, 12163 vector bool int __b) { 12164 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12165 } 12166 12167 static __inline__ vector unsigned int __ATTRS_o_ai 12168 vec_subs(vector unsigned int __a, vector unsigned int __b) { 12169 return __builtin_altivec_vsubuws(__a, __b); 12170 } 12171 12172 static __inline__ vector unsigned int __ATTRS_o_ai 12173 vec_subs(vector bool int __a, vector unsigned int __b) { 12174 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12175 } 12176 12177 static __inline__ vector unsigned int __ATTRS_o_ai 12178 vec_subs(vector unsigned int __a, vector bool int __b) { 12179 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12180 } 12181 12182 /* vec_vsubsbs */ 12183 12184 static __inline__ vector signed char __ATTRS_o_ai 12185 vec_vsubsbs(vector signed char __a, vector signed char __b) { 12186 return __builtin_altivec_vsubsbs(__a, __b); 12187 } 12188 12189 static __inline__ vector signed char __ATTRS_o_ai 12190 vec_vsubsbs(vector bool char __a, vector signed char __b) { 12191 return __builtin_altivec_vsubsbs((vector signed char)__a, __b); 12192 } 12193 12194 static __inline__ vector signed char __ATTRS_o_ai 12195 vec_vsubsbs(vector signed char __a, vector bool char __b) { 12196 return __builtin_altivec_vsubsbs(__a, (vector signed char)__b); 12197 } 12198 12199 /* vec_vsububs */ 12200 12201 static __inline__ vector unsigned char __ATTRS_o_ai 12202 vec_vsububs(vector unsigned char __a, vector unsigned char __b) { 12203 return __builtin_altivec_vsububs(__a, __b); 12204 } 12205 12206 static __inline__ vector unsigned char __ATTRS_o_ai 12207 vec_vsububs(vector bool char __a, vector unsigned char __b) { 12208 return __builtin_altivec_vsububs((vector unsigned char)__a, __b); 12209 } 12210 12211 static __inline__ vector unsigned char __ATTRS_o_ai 12212 vec_vsububs(vector unsigned char __a, vector bool char __b) { 12213 return __builtin_altivec_vsububs(__a, (vector unsigned char)__b); 12214 } 12215 12216 /* vec_vsubshs */ 12217 12218 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12219 vector short __b) { 12220 return __builtin_altivec_vsubshs(__a, __b); 12221 } 12222 12223 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector bool short __a, 12224 vector short __b) { 12225 return __builtin_altivec_vsubshs((vector short)__a, __b); 12226 } 12227 12228 static __inline__ vector short __ATTRS_o_ai vec_vsubshs(vector short __a, 12229 vector bool short __b) { 12230 return __builtin_altivec_vsubshs(__a, (vector short)__b); 12231 } 12232 12233 /* vec_vsubuhs */ 12234 12235 static __inline__ vector unsigned short __ATTRS_o_ai 12236 vec_vsubuhs(vector unsigned short __a, vector unsigned short __b) { 12237 return __builtin_altivec_vsubuhs(__a, __b); 12238 } 12239 12240 static __inline__ vector unsigned short __ATTRS_o_ai 12241 vec_vsubuhs(vector bool short __a, vector unsigned short __b) { 12242 return __builtin_altivec_vsubuhs((vector unsigned short)__a, __b); 12243 } 12244 12245 static __inline__ vector unsigned short __ATTRS_o_ai 12246 vec_vsubuhs(vector unsigned short __a, vector bool short __b) { 12247 return __builtin_altivec_vsubuhs(__a, (vector unsigned short)__b); 12248 } 12249 12250 /* vec_vsubsws */ 12251 12252 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12253 vector int __b) { 12254 return __builtin_altivec_vsubsws(__a, __b); 12255 } 12256 12257 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector bool int __a, 12258 vector int __b) { 12259 return __builtin_altivec_vsubsws((vector int)__a, __b); 12260 } 12261 12262 static __inline__ vector int __ATTRS_o_ai vec_vsubsws(vector int __a, 12263 vector bool int __b) { 12264 return __builtin_altivec_vsubsws(__a, (vector int)__b); 12265 } 12266 12267 /* vec_vsubuws */ 12268 12269 static __inline__ vector unsigned int __ATTRS_o_ai 12270 vec_vsubuws(vector unsigned int __a, vector unsigned int __b) { 12271 return __builtin_altivec_vsubuws(__a, __b); 12272 } 12273 12274 static __inline__ vector unsigned int __ATTRS_o_ai 12275 vec_vsubuws(vector bool int __a, vector unsigned int __b) { 12276 return __builtin_altivec_vsubuws((vector unsigned int)__a, __b); 12277 } 12278 12279 static __inline__ vector unsigned int __ATTRS_o_ai 12280 vec_vsubuws(vector unsigned int __a, vector bool int __b) { 12281 return __builtin_altivec_vsubuws(__a, (vector unsigned int)__b); 12282 } 12283 12284 #ifdef __POWER8_VECTOR__ 12285 /* vec_vsubuqm */ 12286 12287 #ifdef __SIZEOF_INT128__ 12288 static __inline__ vector signed __int128 __ATTRS_o_ai 12289 vec_vsubuqm(vector signed __int128 __a, vector signed __int128 __b) { 12290 return __a - __b; 12291 } 12292 12293 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12294 vec_vsubuqm(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12295 return __a - __b; 12296 } 12297 #endif 12298 12299 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12300 vec_sub_u128(vector unsigned char __a, vector unsigned char __b) { 12301 return __builtin_altivec_vsubuqm(__a, __b); 12302 } 12303 12304 /* vec_vsubeuqm */ 12305 12306 #ifdef __SIZEOF_INT128__ 12307 static __inline__ vector signed __int128 __ATTRS_o_ai 12308 vec_vsubeuqm(vector signed __int128 __a, vector signed __int128 __b, 12309 vector signed __int128 __c) { 12310 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12311 } 12312 12313 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12314 vec_vsubeuqm(vector unsigned __int128 __a, vector unsigned __int128 __b, 12315 vector unsigned __int128 __c) { 12316 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12317 } 12318 12319 static __inline__ vector signed __int128 __ATTRS_o_ai 12320 vec_sube(vector signed __int128 __a, vector signed __int128 __b, 12321 vector signed __int128 __c) { 12322 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12323 } 12324 12325 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12326 vec_sube(vector unsigned __int128 __a, vector unsigned __int128 __b, 12327 vector unsigned __int128 __c) { 12328 return __builtin_altivec_vsubeuqm(__a, __b, __c); 12329 } 12330 #endif 12331 12332 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12333 vec_sube_u128(vector unsigned char __a, vector unsigned char __b, 12334 vector unsigned char __c) { 12335 return (vector unsigned char)__builtin_altivec_vsubeuqm(__a, __b, __c); 12336 } 12337 12338 /* vec_vsubcuq */ 12339 12340 #ifdef __SIZEOF_INT128__ 12341 static __inline__ vector signed __int128 __ATTRS_o_ai 12342 vec_vsubcuq(vector signed __int128 __a, vector signed __int128 __b) { 12343 return __builtin_altivec_vsubcuq(__a, __b); 12344 } 12345 12346 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12347 vec_vsubcuq(vector unsigned __int128 __a, vector unsigned __int128 __b) { 12348 return __builtin_altivec_vsubcuq(__a, __b); 12349 } 12350 12351 /* vec_vsubecuq */ 12352 12353 static __inline__ vector signed __int128 __ATTRS_o_ai 12354 vec_vsubecuq(vector signed __int128 __a, vector signed __int128 __b, 12355 vector signed __int128 __c) { 12356 return __builtin_altivec_vsubecuq(__a, __b, __c); 12357 } 12358 12359 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12360 vec_vsubecuq(vector unsigned __int128 __a, vector unsigned __int128 __b, 12361 vector unsigned __int128 __c) { 12362 return __builtin_altivec_vsubecuq(__a, __b, __c); 12363 } 12364 #endif 12365 12366 #ifdef __powerpc64__ 12367 static __inline__ vector signed int __ATTRS_o_ai 12368 vec_subec(vector signed int __a, vector signed int __b, 12369 vector signed int __c) { 12370 return vec_addec(__a, ~__b, __c); 12371 } 12372 12373 static __inline__ vector unsigned int __ATTRS_o_ai 12374 vec_subec(vector unsigned int __a, vector unsigned int __b, 12375 vector unsigned int __c) { 12376 return vec_addec(__a, ~__b, __c); 12377 } 12378 #endif 12379 12380 #ifdef __SIZEOF_INT128__ 12381 static __inline__ vector signed __int128 __ATTRS_o_ai 12382 vec_subec(vector signed __int128 __a, vector signed __int128 __b, 12383 vector signed __int128 __c) { 12384 return __builtin_altivec_vsubecuq(__a, __b, __c); 12385 } 12386 12387 static __inline__ vector unsigned __int128 __ATTRS_o_ai 12388 vec_subec(vector unsigned __int128 __a, vector unsigned __int128 __b, 12389 vector unsigned __int128 __c) { 12390 return __builtin_altivec_vsubecuq(__a, __b, __c); 12391 } 12392 #endif 12393 12394 static __inline__ vector unsigned char __attribute__((__always_inline__)) 12395 vec_subec_u128(vector unsigned char __a, vector unsigned char __b, 12396 vector unsigned char __c) { 12397 return (vector unsigned char)__builtin_altivec_vsubecuq(__a, __b, __c); 12398 } 12399 #endif // __POWER8_VECTOR__ 12400 12401 static __inline__ vector signed int __ATTRS_o_ai 12402 vec_sube(vector signed int __a, vector signed int __b, 12403 vector signed int __c) { 12404 vector signed int __mask = {1, 1, 1, 1}; 12405 vector signed int __carry = __c & __mask; 12406 return vec_adde(__a, ~__b, __carry); 12407 } 12408 12409 static __inline__ vector unsigned int __ATTRS_o_ai 12410 vec_sube(vector unsigned int __a, vector unsigned int __b, 12411 vector unsigned int __c) { 12412 vector unsigned int __mask = {1, 1, 1, 1}; 12413 vector unsigned int __carry = __c & __mask; 12414 return vec_adde(__a, ~__b, __carry); 12415 } 12416 /* vec_sum4s */ 12417 12418 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed char __a, 12419 vector int __b) { 12420 return __builtin_altivec_vsum4sbs(__a, __b); 12421 } 12422 12423 static __inline__ vector unsigned int __ATTRS_o_ai 12424 vec_sum4s(vector unsigned char __a, vector unsigned int __b) { 12425 return __builtin_altivec_vsum4ubs(__a, __b); 12426 } 12427 12428 static __inline__ vector int __ATTRS_o_ai vec_sum4s(vector signed short __a, 12429 vector int __b) { 12430 return __builtin_altivec_vsum4shs(__a, __b); 12431 } 12432 12433 /* vec_vsum4sbs */ 12434 12435 static __inline__ vector int __attribute__((__always_inline__)) 12436 vec_vsum4sbs(vector signed char __a, vector int __b) { 12437 return __builtin_altivec_vsum4sbs(__a, __b); 12438 } 12439 12440 /* vec_vsum4ubs */ 12441 12442 static __inline__ vector unsigned int __attribute__((__always_inline__)) 12443 vec_vsum4ubs(vector unsigned char __a, vector unsigned int __b) { 12444 return __builtin_altivec_vsum4ubs(__a, __b); 12445 } 12446 12447 /* vec_vsum4shs */ 12448 12449 static __inline__ vector int __attribute__((__always_inline__)) 12450 vec_vsum4shs(vector signed short __a, vector int __b) { 12451 return __builtin_altivec_vsum4shs(__a, __b); 12452 } 12453 12454 /* vec_sum2s */ 12455 12456 /* The vsum2sws instruction has a big-endian bias, so that the second 12457 input vector and the result always reference big-endian elements 12458 1 and 3 (little-endian element 0 and 2). For ease of porting the 12459 programmer wants elements 1 and 3 in both cases, so for little 12460 endian we must perform some permutes. */ 12461 12462 static __inline__ vector signed int __attribute__((__always_inline__)) 12463 vec_sum2s(vector int __a, vector int __b) { 12464 #ifdef __LITTLE_ENDIAN__ 12465 vector int __c = (vector signed int)vec_perm( 12466 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12467 8, 9, 10, 11)); 12468 __c = __builtin_altivec_vsum2sws(__a, __c); 12469 return (vector signed int)vec_perm( 12470 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12471 8, 9, 10, 11)); 12472 #else 12473 return __builtin_altivec_vsum2sws(__a, __b); 12474 #endif 12475 } 12476 12477 /* vec_vsum2sws */ 12478 12479 static __inline__ vector signed int __attribute__((__always_inline__)) 12480 vec_vsum2sws(vector int __a, vector int __b) { 12481 #ifdef __LITTLE_ENDIAN__ 12482 vector int __c = (vector signed int)vec_perm( 12483 __b, __b, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12484 8, 9, 10, 11)); 12485 __c = __builtin_altivec_vsum2sws(__a, __c); 12486 return (vector signed int)vec_perm( 12487 __c, __c, (vector unsigned char)(4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 12488 8, 9, 10, 11)); 12489 #else 12490 return __builtin_altivec_vsum2sws(__a, __b); 12491 #endif 12492 } 12493 12494 /* vec_sums */ 12495 12496 /* The vsumsws instruction has a big-endian bias, so that the second 12497 input vector and the result always reference big-endian element 3 12498 (little-endian element 0). For ease of porting the programmer 12499 wants element 3 in both cases, so for little endian we must perform 12500 some permutes. */ 12501 12502 static __inline__ vector signed int __attribute__((__always_inline__)) 12503 vec_sums(vector signed int __a, vector signed int __b) { 12504 #ifdef __LITTLE_ENDIAN__ 12505 __b = (vector signed int)vec_splat(__b, 3); 12506 __b = __builtin_altivec_vsumsws(__a, __b); 12507 return (vector signed int)(0, 0, 0, __b[0]); 12508 #else 12509 return __builtin_altivec_vsumsws(__a, __b); 12510 #endif 12511 } 12512 12513 /* vec_vsumsws */ 12514 12515 static __inline__ vector signed int __attribute__((__always_inline__)) 12516 vec_vsumsws(vector signed int __a, vector signed int __b) { 12517 #ifdef __LITTLE_ENDIAN__ 12518 __b = (vector signed int)vec_splat(__b, 3); 12519 __b = __builtin_altivec_vsumsws(__a, __b); 12520 return (vector signed int)(0, 0, 0, __b[0]); 12521 #else 12522 return __builtin_altivec_vsumsws(__a, __b); 12523 #endif 12524 } 12525 12526 /* vec_trunc */ 12527 12528 static __inline__ vector float __ATTRS_o_ai vec_trunc(vector float __a) { 12529 #ifdef __VSX__ 12530 return __builtin_vsx_xvrspiz(__a); 12531 #else 12532 return __builtin_altivec_vrfiz(__a); 12533 #endif 12534 } 12535 12536 #ifdef __VSX__ 12537 static __inline__ vector double __ATTRS_o_ai vec_trunc(vector double __a) { 12538 return __builtin_vsx_xvrdpiz(__a); 12539 } 12540 #endif 12541 12542 /* vec_roundz */ 12543 static __inline__ vector float __ATTRS_o_ai vec_roundz(vector float __a) { 12544 return vec_trunc(__a); 12545 } 12546 12547 #ifdef __VSX__ 12548 static __inline__ vector double __ATTRS_o_ai vec_roundz(vector double __a) { 12549 return vec_trunc(__a); 12550 } 12551 #endif 12552 12553 /* vec_vrfiz */ 12554 12555 static __inline__ vector float __attribute__((__always_inline__)) 12556 vec_vrfiz(vector float __a) { 12557 return __builtin_altivec_vrfiz(__a); 12558 } 12559 12560 /* vec_unpackh */ 12561 12562 /* The vector unpack instructions all have a big-endian bias, so for 12563 little endian we must reverse the meanings of "high" and "low." */ 12564 #ifdef __LITTLE_ENDIAN__ 12565 #define vec_vupkhpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12566 #define vec_vupklpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12567 #else 12568 #define vec_vupkhpx(__a) __builtin_altivec_vupkhpx((vector short)(__a)) 12569 #define vec_vupklpx(__a) __builtin_altivec_vupklpx((vector short)(__a)) 12570 #endif 12571 12572 static __inline__ vector short __ATTRS_o_ai 12573 vec_unpackh(vector signed char __a) { 12574 #ifdef __LITTLE_ENDIAN__ 12575 return __builtin_altivec_vupklsb((vector char)__a); 12576 #else 12577 return __builtin_altivec_vupkhsb((vector char)__a); 12578 #endif 12579 } 12580 12581 static __inline__ vector bool short __ATTRS_o_ai 12582 vec_unpackh(vector bool char __a) { 12583 #ifdef __LITTLE_ENDIAN__ 12584 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12585 #else 12586 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12587 #endif 12588 } 12589 12590 static __inline__ vector int __ATTRS_o_ai vec_unpackh(vector short __a) { 12591 #ifdef __LITTLE_ENDIAN__ 12592 return __builtin_altivec_vupklsh(__a); 12593 #else 12594 return __builtin_altivec_vupkhsh(__a); 12595 #endif 12596 } 12597 12598 static __inline__ vector bool int __ATTRS_o_ai 12599 vec_unpackh(vector bool short __a) { 12600 #ifdef __LITTLE_ENDIAN__ 12601 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12602 #else 12603 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12604 #endif 12605 } 12606 12607 static __inline__ vector unsigned int __ATTRS_o_ai 12608 vec_unpackh(vector pixel __a) { 12609 #ifdef __LITTLE_ENDIAN__ 12610 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12611 #else 12612 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12613 #endif 12614 } 12615 12616 #ifdef __POWER8_VECTOR__ 12617 static __inline__ vector long long __ATTRS_o_ai vec_unpackh(vector int __a) { 12618 #ifdef __LITTLE_ENDIAN__ 12619 return __builtin_altivec_vupklsw(__a); 12620 #else 12621 return __builtin_altivec_vupkhsw(__a); 12622 #endif 12623 } 12624 12625 static __inline__ vector bool long long __ATTRS_o_ai 12626 vec_unpackh(vector bool int __a) { 12627 #ifdef __LITTLE_ENDIAN__ 12628 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12629 #else 12630 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12631 #endif 12632 } 12633 12634 static __inline__ vector double __ATTRS_o_ai 12635 vec_unpackh(vector float __a) { 12636 return (vector double)(__a[0], __a[1]); 12637 } 12638 #endif 12639 12640 /* vec_vupkhsb */ 12641 12642 static __inline__ vector short __ATTRS_o_ai 12643 vec_vupkhsb(vector signed char __a) { 12644 #ifdef __LITTLE_ENDIAN__ 12645 return __builtin_altivec_vupklsb((vector char)__a); 12646 #else 12647 return __builtin_altivec_vupkhsb((vector char)__a); 12648 #endif 12649 } 12650 12651 static __inline__ vector bool short __ATTRS_o_ai 12652 vec_vupkhsb(vector bool char __a) { 12653 #ifdef __LITTLE_ENDIAN__ 12654 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12655 #else 12656 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12657 #endif 12658 } 12659 12660 /* vec_vupkhsh */ 12661 12662 static __inline__ vector int __ATTRS_o_ai vec_vupkhsh(vector short __a) { 12663 #ifdef __LITTLE_ENDIAN__ 12664 return __builtin_altivec_vupklsh(__a); 12665 #else 12666 return __builtin_altivec_vupkhsh(__a); 12667 #endif 12668 } 12669 12670 static __inline__ vector bool int __ATTRS_o_ai 12671 vec_vupkhsh(vector bool short __a) { 12672 #ifdef __LITTLE_ENDIAN__ 12673 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12674 #else 12675 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12676 #endif 12677 } 12678 12679 static __inline__ vector unsigned int __ATTRS_o_ai 12680 vec_vupkhsh(vector pixel __a) { 12681 #ifdef __LITTLE_ENDIAN__ 12682 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12683 #else 12684 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12685 #endif 12686 } 12687 12688 /* vec_vupkhsw */ 12689 12690 #ifdef __POWER8_VECTOR__ 12691 static __inline__ vector long long __ATTRS_o_ai vec_vupkhsw(vector int __a) { 12692 #ifdef __LITTLE_ENDIAN__ 12693 return __builtin_altivec_vupklsw(__a); 12694 #else 12695 return __builtin_altivec_vupkhsw(__a); 12696 #endif 12697 } 12698 12699 static __inline__ vector bool long long __ATTRS_o_ai 12700 vec_vupkhsw(vector bool int __a) { 12701 #ifdef __LITTLE_ENDIAN__ 12702 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12703 #else 12704 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12705 #endif 12706 } 12707 #endif 12708 12709 /* vec_unpackl */ 12710 12711 static __inline__ vector short __ATTRS_o_ai 12712 vec_unpackl(vector signed char __a) { 12713 #ifdef __LITTLE_ENDIAN__ 12714 return __builtin_altivec_vupkhsb((vector char)__a); 12715 #else 12716 return __builtin_altivec_vupklsb((vector char)__a); 12717 #endif 12718 } 12719 12720 static __inline__ vector bool short __ATTRS_o_ai 12721 vec_unpackl(vector bool char __a) { 12722 #ifdef __LITTLE_ENDIAN__ 12723 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12724 #else 12725 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12726 #endif 12727 } 12728 12729 static __inline__ vector int __ATTRS_o_ai vec_unpackl(vector short __a) { 12730 #ifdef __LITTLE_ENDIAN__ 12731 return __builtin_altivec_vupkhsh(__a); 12732 #else 12733 return __builtin_altivec_vupklsh(__a); 12734 #endif 12735 } 12736 12737 static __inline__ vector bool int __ATTRS_o_ai 12738 vec_unpackl(vector bool short __a) { 12739 #ifdef __LITTLE_ENDIAN__ 12740 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12741 #else 12742 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12743 #endif 12744 } 12745 12746 static __inline__ vector unsigned int __ATTRS_o_ai 12747 vec_unpackl(vector pixel __a) { 12748 #ifdef __LITTLE_ENDIAN__ 12749 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12750 #else 12751 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12752 #endif 12753 } 12754 12755 #ifdef __POWER8_VECTOR__ 12756 static __inline__ vector long long __ATTRS_o_ai vec_unpackl(vector int __a) { 12757 #ifdef __LITTLE_ENDIAN__ 12758 return __builtin_altivec_vupkhsw(__a); 12759 #else 12760 return __builtin_altivec_vupklsw(__a); 12761 #endif 12762 } 12763 12764 static __inline__ vector bool long long __ATTRS_o_ai 12765 vec_unpackl(vector bool int __a) { 12766 #ifdef __LITTLE_ENDIAN__ 12767 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12768 #else 12769 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12770 #endif 12771 } 12772 12773 static __inline__ vector double __ATTRS_o_ai 12774 vec_unpackl(vector float __a) { 12775 return (vector double)(__a[2], __a[3]); 12776 } 12777 #endif 12778 12779 /* vec_vupklsb */ 12780 12781 static __inline__ vector short __ATTRS_o_ai 12782 vec_vupklsb(vector signed char __a) { 12783 #ifdef __LITTLE_ENDIAN__ 12784 return __builtin_altivec_vupkhsb((vector char)__a); 12785 #else 12786 return __builtin_altivec_vupklsb((vector char)__a); 12787 #endif 12788 } 12789 12790 static __inline__ vector bool short __ATTRS_o_ai 12791 vec_vupklsb(vector bool char __a) { 12792 #ifdef __LITTLE_ENDIAN__ 12793 return (vector bool short)__builtin_altivec_vupkhsb((vector char)__a); 12794 #else 12795 return (vector bool short)__builtin_altivec_vupklsb((vector char)__a); 12796 #endif 12797 } 12798 12799 /* vec_vupklsh */ 12800 12801 static __inline__ vector int __ATTRS_o_ai vec_vupklsh(vector short __a) { 12802 #ifdef __LITTLE_ENDIAN__ 12803 return __builtin_altivec_vupkhsh(__a); 12804 #else 12805 return __builtin_altivec_vupklsh(__a); 12806 #endif 12807 } 12808 12809 static __inline__ vector bool int __ATTRS_o_ai 12810 vec_vupklsh(vector bool short __a) { 12811 #ifdef __LITTLE_ENDIAN__ 12812 return (vector bool int)__builtin_altivec_vupkhsh((vector short)__a); 12813 #else 12814 return (vector bool int)__builtin_altivec_vupklsh((vector short)__a); 12815 #endif 12816 } 12817 12818 static __inline__ vector unsigned int __ATTRS_o_ai 12819 vec_vupklsh(vector pixel __a) { 12820 #ifdef __LITTLE_ENDIAN__ 12821 return (vector unsigned int)__builtin_altivec_vupkhpx((vector short)__a); 12822 #else 12823 return (vector unsigned int)__builtin_altivec_vupklpx((vector short)__a); 12824 #endif 12825 } 12826 12827 /* vec_vupklsw */ 12828 12829 #ifdef __POWER8_VECTOR__ 12830 static __inline__ vector long long __ATTRS_o_ai vec_vupklsw(vector int __a) { 12831 #ifdef __LITTLE_ENDIAN__ 12832 return __builtin_altivec_vupkhsw(__a); 12833 #else 12834 return __builtin_altivec_vupklsw(__a); 12835 #endif 12836 } 12837 12838 static __inline__ vector bool long long __ATTRS_o_ai 12839 vec_vupklsw(vector bool int __a) { 12840 #ifdef __LITTLE_ENDIAN__ 12841 return (vector bool long long)__builtin_altivec_vupkhsw((vector int)__a); 12842 #else 12843 return (vector bool long long)__builtin_altivec_vupklsw((vector int)__a); 12844 #endif 12845 } 12846 #endif 12847 12848 /* vec_vsx_ld */ 12849 12850 #ifdef __VSX__ 12851 12852 static __inline__ vector bool int __ATTRS_o_ai 12853 vec_vsx_ld(int __a, const vector bool int *__b) { 12854 return (vector bool int)__builtin_vsx_lxvw4x(__a, __b); 12855 } 12856 12857 static __inline__ vector signed int __ATTRS_o_ai 12858 vec_vsx_ld(int __a, const vector signed int *__b) { 12859 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12860 } 12861 12862 static __inline__ vector signed int __ATTRS_o_ai 12863 vec_vsx_ld(int __a, const signed int *__b) { 12864 return (vector signed int)__builtin_vsx_lxvw4x(__a, __b); 12865 } 12866 12867 static __inline__ vector unsigned int __ATTRS_o_ai 12868 vec_vsx_ld(int __a, const vector unsigned int *__b) { 12869 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12870 } 12871 12872 static __inline__ vector unsigned int __ATTRS_o_ai 12873 vec_vsx_ld(int __a, const unsigned int *__b) { 12874 return (vector unsigned int)__builtin_vsx_lxvw4x(__a, __b); 12875 } 12876 12877 static __inline__ vector float __ATTRS_o_ai 12878 vec_vsx_ld(int __a, const vector float *__b) { 12879 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12880 } 12881 12882 static __inline__ vector float __ATTRS_o_ai vec_vsx_ld(int __a, 12883 const float *__b) { 12884 return (vector float)__builtin_vsx_lxvw4x(__a, __b); 12885 } 12886 12887 static __inline__ vector signed long long __ATTRS_o_ai 12888 vec_vsx_ld(int __a, const vector signed long long *__b) { 12889 return (vector signed long long)__builtin_vsx_lxvd2x(__a, __b); 12890 } 12891 12892 static __inline__ vector unsigned long long __ATTRS_o_ai 12893 vec_vsx_ld(int __a, const vector unsigned long long *__b) { 12894 return (vector unsigned long long)__builtin_vsx_lxvd2x(__a, __b); 12895 } 12896 12897 static __inline__ vector double __ATTRS_o_ai 12898 vec_vsx_ld(int __a, const vector double *__b) { 12899 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12900 } 12901 12902 static __inline__ vector double __ATTRS_o_ai 12903 vec_vsx_ld(int __a, const double *__b) { 12904 return (vector double)__builtin_vsx_lxvd2x(__a, __b); 12905 } 12906 12907 static __inline__ vector bool short __ATTRS_o_ai 12908 vec_vsx_ld(int __a, const vector bool short *__b) { 12909 return (vector bool short)__builtin_vsx_lxvw4x(__a, __b); 12910 } 12911 12912 static __inline__ vector signed short __ATTRS_o_ai 12913 vec_vsx_ld(int __a, const vector signed short *__b) { 12914 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12915 } 12916 12917 static __inline__ vector signed short __ATTRS_o_ai 12918 vec_vsx_ld(int __a, const signed short *__b) { 12919 return (vector signed short)__builtin_vsx_lxvw4x(__a, __b); 12920 } 12921 12922 static __inline__ vector unsigned short __ATTRS_o_ai 12923 vec_vsx_ld(int __a, const vector unsigned short *__b) { 12924 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12925 } 12926 12927 static __inline__ vector unsigned short __ATTRS_o_ai 12928 vec_vsx_ld(int __a, const unsigned short *__b) { 12929 return (vector unsigned short)__builtin_vsx_lxvw4x(__a, __b); 12930 } 12931 12932 static __inline__ vector bool char __ATTRS_o_ai 12933 vec_vsx_ld(int __a, const vector bool char *__b) { 12934 return (vector bool char)__builtin_vsx_lxvw4x(__a, __b); 12935 } 12936 12937 static __inline__ vector signed char __ATTRS_o_ai 12938 vec_vsx_ld(int __a, const vector signed char *__b) { 12939 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12940 } 12941 12942 static __inline__ vector signed char __ATTRS_o_ai 12943 vec_vsx_ld(int __a, const signed char *__b) { 12944 return (vector signed char)__builtin_vsx_lxvw4x(__a, __b); 12945 } 12946 12947 static __inline__ vector unsigned char __ATTRS_o_ai 12948 vec_vsx_ld(int __a, const vector unsigned char *__b) { 12949 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12950 } 12951 12952 static __inline__ vector unsigned char __ATTRS_o_ai 12953 vec_vsx_ld(int __a, const unsigned char *__b) { 12954 return (vector unsigned char)__builtin_vsx_lxvw4x(__a, __b); 12955 } 12956 12957 #endif 12958 12959 /* vec_vsx_st */ 12960 12961 #ifdef __VSX__ 12962 12963 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12964 vector bool int *__c) { 12965 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12966 } 12967 12968 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12969 signed int *__c) { 12970 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12971 } 12972 12973 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool int __a, int __b, 12974 unsigned int *__c) { 12975 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12976 } 12977 12978 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12979 vector signed int *__c) { 12980 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12981 } 12982 12983 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed int __a, int __b, 12984 signed int *__c) { 12985 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12986 } 12987 12988 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12989 vector unsigned int *__c) { 12990 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12991 } 12992 12993 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned int __a, int __b, 12994 unsigned int *__c) { 12995 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 12996 } 12997 12998 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 12999 vector float *__c) { 13000 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13001 } 13002 13003 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector float __a, int __b, 13004 float *__c) { 13005 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13006 } 13007 13008 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed long long __a, 13009 int __b, 13010 vector signed long long *__c) { 13011 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13012 } 13013 13014 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned long long __a, 13015 int __b, 13016 vector unsigned long long *__c) { 13017 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13018 } 13019 13020 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 13021 vector double *__c) { 13022 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13023 } 13024 13025 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector double __a, int __b, 13026 double *__c) { 13027 __builtin_vsx_stxvd2x((vector double)__a, __b, __c); 13028 } 13029 13030 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13031 vector bool short *__c) { 13032 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13033 } 13034 13035 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13036 signed short *__c) { 13037 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13038 } 13039 13040 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool short __a, int __b, 13041 unsigned short *__c) { 13042 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13043 } 13044 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13045 vector signed short *__c) { 13046 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13047 } 13048 13049 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed short __a, int __b, 13050 signed short *__c) { 13051 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13052 } 13053 13054 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13055 int __b, 13056 vector unsigned short *__c) { 13057 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13058 } 13059 13060 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned short __a, 13061 int __b, unsigned short *__c) { 13062 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13063 } 13064 13065 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13066 vector bool char *__c) { 13067 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13068 } 13069 13070 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13071 signed char *__c) { 13072 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13073 } 13074 13075 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector bool char __a, int __b, 13076 unsigned char *__c) { 13077 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13078 } 13079 13080 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13081 vector signed char *__c) { 13082 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13083 } 13084 13085 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector signed char __a, int __b, 13086 signed char *__c) { 13087 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13088 } 13089 13090 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13091 int __b, 13092 vector unsigned char *__c) { 13093 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13094 } 13095 13096 static __inline__ void __ATTRS_o_ai vec_vsx_st(vector unsigned char __a, 13097 int __b, unsigned char *__c) { 13098 __builtin_vsx_stxvw4x((vector int)__a, __b, __c); 13099 } 13100 13101 #endif 13102 13103 #ifdef __VSX__ 13104 #define vec_xxpermdi __builtin_vsx_xxpermdi 13105 #define vec_xxsldwi __builtin_vsx_xxsldwi 13106 #define vec_permi(__a, __b, __c) \ 13107 _Generic((__a), vector signed long long \ 13108 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13109 (((__c)&0x1) + 2)), \ 13110 vector unsigned long long \ 13111 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13112 (((__c)&0x1) + 2)), \ 13113 vector double \ 13114 : __builtin_shufflevector((__a), (__b), (((__c) >> 1) & 0x1), \ 13115 (((__c)&0x1) + 2))) 13116 #endif 13117 13118 /* vec_xor */ 13119 13120 #define __builtin_altivec_vxor vec_xor 13121 13122 static __inline__ vector signed char __ATTRS_o_ai 13123 vec_xor(vector signed char __a, vector signed char __b) { 13124 return __a ^ __b; 13125 } 13126 13127 static __inline__ vector signed char __ATTRS_o_ai 13128 vec_xor(vector bool char __a, vector signed char __b) { 13129 return (vector signed char)__a ^ __b; 13130 } 13131 13132 static __inline__ vector signed char __ATTRS_o_ai 13133 vec_xor(vector signed char __a, vector bool char __b) { 13134 return __a ^ (vector signed char)__b; 13135 } 13136 13137 static __inline__ vector unsigned char __ATTRS_o_ai 13138 vec_xor(vector unsigned char __a, vector unsigned char __b) { 13139 return __a ^ __b; 13140 } 13141 13142 static __inline__ vector unsigned char __ATTRS_o_ai 13143 vec_xor(vector bool char __a, vector unsigned char __b) { 13144 return (vector unsigned char)__a ^ __b; 13145 } 13146 13147 static __inline__ vector unsigned char __ATTRS_o_ai 13148 vec_xor(vector unsigned char __a, vector bool char __b) { 13149 return __a ^ (vector unsigned char)__b; 13150 } 13151 13152 static __inline__ vector bool char __ATTRS_o_ai vec_xor(vector bool char __a, 13153 vector bool char __b) { 13154 return __a ^ __b; 13155 } 13156 13157 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13158 vector short __b) { 13159 return __a ^ __b; 13160 } 13161 13162 static __inline__ vector short __ATTRS_o_ai vec_xor(vector bool short __a, 13163 vector short __b) { 13164 return (vector short)__a ^ __b; 13165 } 13166 13167 static __inline__ vector short __ATTRS_o_ai vec_xor(vector short __a, 13168 vector bool short __b) { 13169 return __a ^ (vector short)__b; 13170 } 13171 13172 static __inline__ vector unsigned short __ATTRS_o_ai 13173 vec_xor(vector unsigned short __a, vector unsigned short __b) { 13174 return __a ^ __b; 13175 } 13176 13177 static __inline__ vector unsigned short __ATTRS_o_ai 13178 vec_xor(vector bool short __a, vector unsigned short __b) { 13179 return (vector unsigned short)__a ^ __b; 13180 } 13181 13182 static __inline__ vector unsigned short __ATTRS_o_ai 13183 vec_xor(vector unsigned short __a, vector bool short __b) { 13184 return __a ^ (vector unsigned short)__b; 13185 } 13186 13187 static __inline__ vector bool short __ATTRS_o_ai 13188 vec_xor(vector bool short __a, vector bool short __b) { 13189 return __a ^ __b; 13190 } 13191 13192 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13193 vector int __b) { 13194 return __a ^ __b; 13195 } 13196 13197 static __inline__ vector int __ATTRS_o_ai vec_xor(vector bool int __a, 13198 vector int __b) { 13199 return (vector int)__a ^ __b; 13200 } 13201 13202 static __inline__ vector int __ATTRS_o_ai vec_xor(vector int __a, 13203 vector bool int __b) { 13204 return __a ^ (vector int)__b; 13205 } 13206 13207 static __inline__ vector unsigned int __ATTRS_o_ai 13208 vec_xor(vector unsigned int __a, vector unsigned int __b) { 13209 return __a ^ __b; 13210 } 13211 13212 static __inline__ vector unsigned int __ATTRS_o_ai 13213 vec_xor(vector bool int __a, vector unsigned int __b) { 13214 return (vector unsigned int)__a ^ __b; 13215 } 13216 13217 static __inline__ vector unsigned int __ATTRS_o_ai 13218 vec_xor(vector unsigned int __a, vector bool int __b) { 13219 return __a ^ (vector unsigned int)__b; 13220 } 13221 13222 static __inline__ vector bool int __ATTRS_o_ai vec_xor(vector bool int __a, 13223 vector bool int __b) { 13224 return __a ^ __b; 13225 } 13226 13227 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13228 vector float __b) { 13229 vector unsigned int __res = 13230 (vector unsigned int)__a ^ (vector unsigned int)__b; 13231 return (vector float)__res; 13232 } 13233 13234 static __inline__ vector float __ATTRS_o_ai vec_xor(vector bool int __a, 13235 vector float __b) { 13236 vector unsigned int __res = 13237 (vector unsigned int)__a ^ (vector unsigned int)__b; 13238 return (vector float)__res; 13239 } 13240 13241 static __inline__ vector float __ATTRS_o_ai vec_xor(vector float __a, 13242 vector bool int __b) { 13243 vector unsigned int __res = 13244 (vector unsigned int)__a ^ (vector unsigned int)__b; 13245 return (vector float)__res; 13246 } 13247 13248 #ifdef __VSX__ 13249 static __inline__ vector signed long long __ATTRS_o_ai 13250 vec_xor(vector signed long long __a, vector signed long long __b) { 13251 return __a ^ __b; 13252 } 13253 13254 static __inline__ vector signed long long __ATTRS_o_ai 13255 vec_xor(vector bool long long __a, vector signed long long __b) { 13256 return (vector signed long long)__a ^ __b; 13257 } 13258 13259 static __inline__ vector signed long long __ATTRS_o_ai 13260 vec_xor(vector signed long long __a, vector bool long long __b) { 13261 return __a ^ (vector signed long long)__b; 13262 } 13263 13264 static __inline__ vector unsigned long long __ATTRS_o_ai 13265 vec_xor(vector unsigned long long __a, vector unsigned long long __b) { 13266 return __a ^ __b; 13267 } 13268 13269 static __inline__ vector unsigned long long __ATTRS_o_ai 13270 vec_xor(vector bool long long __a, vector unsigned long long __b) { 13271 return (vector unsigned long long)__a ^ __b; 13272 } 13273 13274 static __inline__ vector unsigned long long __ATTRS_o_ai 13275 vec_xor(vector unsigned long long __a, vector bool long long __b) { 13276 return __a ^ (vector unsigned long long)__b; 13277 } 13278 13279 static __inline__ vector bool long long __ATTRS_o_ai 13280 vec_xor(vector bool long long __a, vector bool long long __b) { 13281 return __a ^ __b; 13282 } 13283 13284 static __inline__ vector double __ATTRS_o_ai vec_xor(vector double __a, 13285 vector double __b) { 13286 return (vector double)((vector unsigned long long)__a ^ 13287 (vector unsigned long long)__b); 13288 } 13289 13290 static __inline__ vector double __ATTRS_o_ai 13291 vec_xor(vector double __a, vector bool long long __b) { 13292 return (vector double)((vector unsigned long long)__a ^ 13293 (vector unsigned long long)__b); 13294 } 13295 13296 static __inline__ vector double __ATTRS_o_ai vec_xor(vector bool long long __a, 13297 vector double __b) { 13298 return (vector double)((vector unsigned long long)__a ^ 13299 (vector unsigned long long)__b); 13300 } 13301 #endif 13302 13303 /* vec_vxor */ 13304 13305 static __inline__ vector signed char __ATTRS_o_ai 13306 vec_vxor(vector signed char __a, vector signed char __b) { 13307 return __a ^ __b; 13308 } 13309 13310 static __inline__ vector signed char __ATTRS_o_ai 13311 vec_vxor(vector bool char __a, vector signed char __b) { 13312 return (vector signed char)__a ^ __b; 13313 } 13314 13315 static __inline__ vector signed char __ATTRS_o_ai 13316 vec_vxor(vector signed char __a, vector bool char __b) { 13317 return __a ^ (vector signed char)__b; 13318 } 13319 13320 static __inline__ vector unsigned char __ATTRS_o_ai 13321 vec_vxor(vector unsigned char __a, vector unsigned char __b) { 13322 return __a ^ __b; 13323 } 13324 13325 static __inline__ vector unsigned char __ATTRS_o_ai 13326 vec_vxor(vector bool char __a, vector unsigned char __b) { 13327 return (vector unsigned char)__a ^ __b; 13328 } 13329 13330 static __inline__ vector unsigned char __ATTRS_o_ai 13331 vec_vxor(vector unsigned char __a, vector bool char __b) { 13332 return __a ^ (vector unsigned char)__b; 13333 } 13334 13335 static __inline__ vector bool char __ATTRS_o_ai vec_vxor(vector bool char __a, 13336 vector bool char __b) { 13337 return __a ^ __b; 13338 } 13339 13340 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13341 vector short __b) { 13342 return __a ^ __b; 13343 } 13344 13345 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector bool short __a, 13346 vector short __b) { 13347 return (vector short)__a ^ __b; 13348 } 13349 13350 static __inline__ vector short __ATTRS_o_ai vec_vxor(vector short __a, 13351 vector bool short __b) { 13352 return __a ^ (vector short)__b; 13353 } 13354 13355 static __inline__ vector unsigned short __ATTRS_o_ai 13356 vec_vxor(vector unsigned short __a, vector unsigned short __b) { 13357 return __a ^ __b; 13358 } 13359 13360 static __inline__ vector unsigned short __ATTRS_o_ai 13361 vec_vxor(vector bool short __a, vector unsigned short __b) { 13362 return (vector unsigned short)__a ^ __b; 13363 } 13364 13365 static __inline__ vector unsigned short __ATTRS_o_ai 13366 vec_vxor(vector unsigned short __a, vector bool short __b) { 13367 return __a ^ (vector unsigned short)__b; 13368 } 13369 13370 static __inline__ vector bool short __ATTRS_o_ai 13371 vec_vxor(vector bool short __a, vector bool short __b) { 13372 return __a ^ __b; 13373 } 13374 13375 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13376 vector int __b) { 13377 return __a ^ __b; 13378 } 13379 13380 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector bool int __a, 13381 vector int __b) { 13382 return (vector int)__a ^ __b; 13383 } 13384 13385 static __inline__ vector int __ATTRS_o_ai vec_vxor(vector int __a, 13386 vector bool int __b) { 13387 return __a ^ (vector int)__b; 13388 } 13389 13390 static __inline__ vector unsigned int __ATTRS_o_ai 13391 vec_vxor(vector unsigned int __a, vector unsigned int __b) { 13392 return __a ^ __b; 13393 } 13394 13395 static __inline__ vector unsigned int __ATTRS_o_ai 13396 vec_vxor(vector bool int __a, vector unsigned int __b) { 13397 return (vector unsigned int)__a ^ __b; 13398 } 13399 13400 static __inline__ vector unsigned int __ATTRS_o_ai 13401 vec_vxor(vector unsigned int __a, vector bool int __b) { 13402 return __a ^ (vector unsigned int)__b; 13403 } 13404 13405 static __inline__ vector bool int __ATTRS_o_ai vec_vxor(vector bool int __a, 13406 vector bool int __b) { 13407 return __a ^ __b; 13408 } 13409 13410 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13411 vector float __b) { 13412 vector unsigned int __res = 13413 (vector unsigned int)__a ^ (vector unsigned int)__b; 13414 return (vector float)__res; 13415 } 13416 13417 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector bool int __a, 13418 vector float __b) { 13419 vector unsigned int __res = 13420 (vector unsigned int)__a ^ (vector unsigned int)__b; 13421 return (vector float)__res; 13422 } 13423 13424 static __inline__ vector float __ATTRS_o_ai vec_vxor(vector float __a, 13425 vector bool int __b) { 13426 vector unsigned int __res = 13427 (vector unsigned int)__a ^ (vector unsigned int)__b; 13428 return (vector float)__res; 13429 } 13430 13431 #ifdef __VSX__ 13432 static __inline__ vector signed long long __ATTRS_o_ai 13433 vec_vxor(vector signed long long __a, vector signed long long __b) { 13434 return __a ^ __b; 13435 } 13436 13437 static __inline__ vector signed long long __ATTRS_o_ai 13438 vec_vxor(vector bool long long __a, vector signed long long __b) { 13439 return (vector signed long long)__a ^ __b; 13440 } 13441 13442 static __inline__ vector signed long long __ATTRS_o_ai 13443 vec_vxor(vector signed long long __a, vector bool long long __b) { 13444 return __a ^ (vector signed long long)__b; 13445 } 13446 13447 static __inline__ vector unsigned long long __ATTRS_o_ai 13448 vec_vxor(vector unsigned long long __a, vector unsigned long long __b) { 13449 return __a ^ __b; 13450 } 13451 13452 static __inline__ vector unsigned long long __ATTRS_o_ai 13453 vec_vxor(vector bool long long __a, vector unsigned long long __b) { 13454 return (vector unsigned long long)__a ^ __b; 13455 } 13456 13457 static __inline__ vector unsigned long long __ATTRS_o_ai 13458 vec_vxor(vector unsigned long long __a, vector bool long long __b) { 13459 return __a ^ (vector unsigned long long)__b; 13460 } 13461 13462 static __inline__ vector bool long long __ATTRS_o_ai 13463 vec_vxor(vector bool long long __a, vector bool long long __b) { 13464 return __a ^ __b; 13465 } 13466 #endif 13467 13468 /* ------------------------ extensions for CBEA ----------------------------- */ 13469 13470 /* vec_extract */ 13471 13472 static __inline__ signed char __ATTRS_o_ai vec_extract(vector signed char __a, 13473 signed int __b) { 13474 return __a[__b & 0xf]; 13475 } 13476 13477 static __inline__ unsigned char __ATTRS_o_ai 13478 vec_extract(vector unsigned char __a, signed int __b) { 13479 return __a[__b & 0xf]; 13480 } 13481 13482 static __inline__ unsigned char __ATTRS_o_ai vec_extract(vector bool char __a, 13483 signed int __b) { 13484 return __a[__b & 0xf]; 13485 } 13486 13487 static __inline__ signed short __ATTRS_o_ai vec_extract(vector signed short __a, 13488 signed int __b) { 13489 return __a[__b & 0x7]; 13490 } 13491 13492 static __inline__ unsigned short __ATTRS_o_ai 13493 vec_extract(vector unsigned short __a, signed int __b) { 13494 return __a[__b & 0x7]; 13495 } 13496 13497 static __inline__ unsigned short __ATTRS_o_ai vec_extract(vector bool short __a, 13498 signed int __b) { 13499 return __a[__b & 0x7]; 13500 } 13501 13502 static __inline__ signed int __ATTRS_o_ai vec_extract(vector signed int __a, 13503 signed int __b) { 13504 return __a[__b & 0x3]; 13505 } 13506 13507 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector unsigned int __a, 13508 signed int __b) { 13509 return __a[__b & 0x3]; 13510 } 13511 13512 static __inline__ unsigned int __ATTRS_o_ai vec_extract(vector bool int __a, 13513 signed int __b) { 13514 return __a[__b & 0x3]; 13515 } 13516 13517 #ifdef __VSX__ 13518 static __inline__ signed long long __ATTRS_o_ai 13519 vec_extract(vector signed long long __a, signed int __b) { 13520 return __a[__b & 0x1]; 13521 } 13522 13523 static __inline__ unsigned long long __ATTRS_o_ai 13524 vec_extract(vector unsigned long long __a, signed int __b) { 13525 return __a[__b & 0x1]; 13526 } 13527 13528 static __inline__ unsigned long long __ATTRS_o_ai 13529 vec_extract(vector bool long long __a, signed int __b) { 13530 return __a[__b & 0x1]; 13531 } 13532 13533 static __inline__ double __ATTRS_o_ai vec_extract(vector double __a, 13534 signed int __b) { 13535 return __a[__b & 0x1]; 13536 } 13537 #endif 13538 13539 static __inline__ float __ATTRS_o_ai vec_extract(vector float __a, 13540 signed int __b) { 13541 return __a[__b & 0x3]; 13542 } 13543 13544 #ifdef __POWER9_VECTOR__ 13545 13546 #define vec_insert4b __builtin_vsx_insertword 13547 #define vec_extract4b __builtin_vsx_extractuword 13548 13549 /* vec_extract_exp */ 13550 13551 static __inline__ vector unsigned int __ATTRS_o_ai 13552 vec_extract_exp(vector float __a) { 13553 return __builtin_vsx_xvxexpsp(__a); 13554 } 13555 13556 static __inline__ vector unsigned long long __ATTRS_o_ai 13557 vec_extract_exp(vector double __a) { 13558 return __builtin_vsx_xvxexpdp(__a); 13559 } 13560 13561 /* vec_extract_sig */ 13562 13563 static __inline__ vector unsigned int __ATTRS_o_ai 13564 vec_extract_sig(vector float __a) { 13565 return __builtin_vsx_xvxsigsp(__a); 13566 } 13567 13568 static __inline__ vector unsigned long long __ATTRS_o_ai 13569 vec_extract_sig (vector double __a) { 13570 return __builtin_vsx_xvxsigdp(__a); 13571 } 13572 13573 static __inline__ vector float __ATTRS_o_ai 13574 vec_extract_fp32_from_shorth(vector unsigned short __a) { 13575 vector unsigned short __b = 13576 #ifdef __LITTLE_ENDIAN__ 13577 __builtin_shufflevector(__a, __a, 0, -1, 1, -1, 2, -1, 3, -1); 13578 #else 13579 __builtin_shufflevector(__a, __a, -1, 0, -1, 1, -1, 2, -1, 3); 13580 #endif 13581 return __builtin_vsx_xvcvhpsp(__b); 13582 } 13583 13584 static __inline__ vector float __ATTRS_o_ai 13585 vec_extract_fp32_from_shortl(vector unsigned short __a) { 13586 vector unsigned short __b = 13587 #ifdef __LITTLE_ENDIAN__ 13588 __builtin_shufflevector(__a, __a, 4, -1, 5, -1, 6, -1, 7, -1); 13589 #else 13590 __builtin_shufflevector(__a, __a, -1, 4, -1, 5, -1, 6, -1, 7); 13591 #endif 13592 return __builtin_vsx_xvcvhpsp(__b); 13593 } 13594 #endif /* __POWER9_VECTOR__ */ 13595 13596 /* vec_insert */ 13597 13598 static __inline__ vector signed char __ATTRS_o_ai 13599 vec_insert(signed char __a, vector signed char __b, int __c) { 13600 __b[__c & 0xF] = __a; 13601 return __b; 13602 } 13603 13604 static __inline__ vector unsigned char __ATTRS_o_ai 13605 vec_insert(unsigned char __a, vector unsigned char __b, int __c) { 13606 __b[__c & 0xF] = __a; 13607 return __b; 13608 } 13609 13610 static __inline__ vector bool char __ATTRS_o_ai vec_insert(unsigned char __a, 13611 vector bool char __b, 13612 int __c) { 13613 __b[__c & 0xF] = __a; 13614 return __b; 13615 } 13616 13617 static __inline__ vector signed short __ATTRS_o_ai 13618 vec_insert(signed short __a, vector signed short __b, int __c) { 13619 __b[__c & 0x7] = __a; 13620 return __b; 13621 } 13622 13623 static __inline__ vector unsigned short __ATTRS_o_ai 13624 vec_insert(unsigned short __a, vector unsigned short __b, int __c) { 13625 __b[__c & 0x7] = __a; 13626 return __b; 13627 } 13628 13629 static __inline__ vector bool short __ATTRS_o_ai 13630 vec_insert(unsigned short __a, vector bool short __b, int __c) { 13631 __b[__c & 0x7] = __a; 13632 return __b; 13633 } 13634 13635 static __inline__ vector signed int __ATTRS_o_ai 13636 vec_insert(signed int __a, vector signed int __b, int __c) { 13637 __b[__c & 0x3] = __a; 13638 return __b; 13639 } 13640 13641 static __inline__ vector unsigned int __ATTRS_o_ai 13642 vec_insert(unsigned int __a, vector unsigned int __b, int __c) { 13643 __b[__c & 0x3] = __a; 13644 return __b; 13645 } 13646 13647 static __inline__ vector bool int __ATTRS_o_ai vec_insert(unsigned int __a, 13648 vector bool int __b, 13649 int __c) { 13650 __b[__c & 0x3] = __a; 13651 return __b; 13652 } 13653 13654 #ifdef __VSX__ 13655 static __inline__ vector signed long long __ATTRS_o_ai 13656 vec_insert(signed long long __a, vector signed long long __b, int __c) { 13657 __b[__c & 0x1] = __a; 13658 return __b; 13659 } 13660 13661 static __inline__ vector unsigned long long __ATTRS_o_ai 13662 vec_insert(unsigned long long __a, vector unsigned long long __b, int __c) { 13663 __b[__c & 0x1] = __a; 13664 return __b; 13665 } 13666 13667 static __inline__ vector bool long long __ATTRS_o_ai 13668 vec_insert(unsigned long long __a, vector bool long long __b, int __c) { 13669 __b[__c & 0x1] = __a; 13670 return __b; 13671 } 13672 static __inline__ vector double __ATTRS_o_ai vec_insert(double __a, 13673 vector double __b, 13674 int __c) { 13675 __b[__c & 0x1] = __a; 13676 return __b; 13677 } 13678 #endif 13679 13680 static __inline__ vector float __ATTRS_o_ai vec_insert(float __a, 13681 vector float __b, 13682 int __c) { 13683 __b[__c & 0x3] = __a; 13684 return __b; 13685 } 13686 13687 /* vec_lvlx */ 13688 13689 static __inline__ vector signed char __ATTRS_o_ai 13690 vec_lvlx(int __a, const signed char *__b) { 13691 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13692 vec_lvsl(__a, __b)); 13693 } 13694 13695 static __inline__ vector signed char __ATTRS_o_ai 13696 vec_lvlx(int __a, const vector signed char *__b) { 13697 return vec_perm(vec_ld(__a, __b), (vector signed char)(0), 13698 vec_lvsl(__a, (unsigned char *)__b)); 13699 } 13700 13701 static __inline__ vector unsigned char __ATTRS_o_ai 13702 vec_lvlx(int __a, const unsigned char *__b) { 13703 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13704 vec_lvsl(__a, __b)); 13705 } 13706 13707 static __inline__ vector unsigned char __ATTRS_o_ai 13708 vec_lvlx(int __a, const vector unsigned char *__b) { 13709 return vec_perm(vec_ld(__a, __b), (vector unsigned char)(0), 13710 vec_lvsl(__a, (unsigned char *)__b)); 13711 } 13712 13713 static __inline__ vector bool char __ATTRS_o_ai 13714 vec_lvlx(int __a, const vector bool char *__b) { 13715 return vec_perm(vec_ld(__a, __b), (vector bool char)(0), 13716 vec_lvsl(__a, (unsigned char *)__b)); 13717 } 13718 13719 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13720 const short *__b) { 13721 return vec_perm(vec_ld(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13722 } 13723 13724 static __inline__ vector short __ATTRS_o_ai vec_lvlx(int __a, 13725 const vector short *__b) { 13726 return vec_perm(vec_ld(__a, __b), (vector short)(0), 13727 vec_lvsl(__a, (unsigned char *)__b)); 13728 } 13729 13730 static __inline__ vector unsigned short __ATTRS_o_ai 13731 vec_lvlx(int __a, const unsigned short *__b) { 13732 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13733 vec_lvsl(__a, __b)); 13734 } 13735 13736 static __inline__ vector unsigned short __ATTRS_o_ai 13737 vec_lvlx(int __a, const vector unsigned short *__b) { 13738 return vec_perm(vec_ld(__a, __b), (vector unsigned short)(0), 13739 vec_lvsl(__a, (unsigned char *)__b)); 13740 } 13741 13742 static __inline__ vector bool short __ATTRS_o_ai 13743 vec_lvlx(int __a, const vector bool short *__b) { 13744 return vec_perm(vec_ld(__a, __b), (vector bool short)(0), 13745 vec_lvsl(__a, (unsigned char *)__b)); 13746 } 13747 13748 static __inline__ vector pixel __ATTRS_o_ai vec_lvlx(int __a, 13749 const vector pixel *__b) { 13750 return vec_perm(vec_ld(__a, __b), (vector pixel)(0), 13751 vec_lvsl(__a, (unsigned char *)__b)); 13752 } 13753 13754 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, const int *__b) { 13755 return vec_perm(vec_ld(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13756 } 13757 13758 static __inline__ vector int __ATTRS_o_ai vec_lvlx(int __a, 13759 const vector int *__b) { 13760 return vec_perm(vec_ld(__a, __b), (vector int)(0), 13761 vec_lvsl(__a, (unsigned char *)__b)); 13762 } 13763 13764 static __inline__ vector unsigned int __ATTRS_o_ai 13765 vec_lvlx(int __a, const unsigned int *__b) { 13766 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13767 vec_lvsl(__a, __b)); 13768 } 13769 13770 static __inline__ vector unsigned int __ATTRS_o_ai 13771 vec_lvlx(int __a, const vector unsigned int *__b) { 13772 return vec_perm(vec_ld(__a, __b), (vector unsigned int)(0), 13773 vec_lvsl(__a, (unsigned char *)__b)); 13774 } 13775 13776 static __inline__ vector bool int __ATTRS_o_ai 13777 vec_lvlx(int __a, const vector bool int *__b) { 13778 return vec_perm(vec_ld(__a, __b), (vector bool int)(0), 13779 vec_lvsl(__a, (unsigned char *)__b)); 13780 } 13781 13782 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13783 const float *__b) { 13784 return vec_perm(vec_ld(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13785 } 13786 13787 static __inline__ vector float __ATTRS_o_ai vec_lvlx(int __a, 13788 const vector float *__b) { 13789 return vec_perm(vec_ld(__a, __b), (vector float)(0), 13790 vec_lvsl(__a, (unsigned char *)__b)); 13791 } 13792 13793 /* vec_lvlxl */ 13794 13795 static __inline__ vector signed char __ATTRS_o_ai 13796 vec_lvlxl(int __a, const signed char *__b) { 13797 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13798 vec_lvsl(__a, __b)); 13799 } 13800 13801 static __inline__ vector signed char __ATTRS_o_ai 13802 vec_lvlxl(int __a, const vector signed char *__b) { 13803 return vec_perm(vec_ldl(__a, __b), (vector signed char)(0), 13804 vec_lvsl(__a, (unsigned char *)__b)); 13805 } 13806 13807 static __inline__ vector unsigned char __ATTRS_o_ai 13808 vec_lvlxl(int __a, const unsigned char *__b) { 13809 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13810 vec_lvsl(__a, __b)); 13811 } 13812 13813 static __inline__ vector unsigned char __ATTRS_o_ai 13814 vec_lvlxl(int __a, const vector unsigned char *__b) { 13815 return vec_perm(vec_ldl(__a, __b), (vector unsigned char)(0), 13816 vec_lvsl(__a, (unsigned char *)__b)); 13817 } 13818 13819 static __inline__ vector bool char __ATTRS_o_ai 13820 vec_lvlxl(int __a, const vector bool char *__b) { 13821 return vec_perm(vec_ldl(__a, __b), (vector bool char)(0), 13822 vec_lvsl(__a, (unsigned char *)__b)); 13823 } 13824 13825 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13826 const short *__b) { 13827 return vec_perm(vec_ldl(__a, __b), (vector short)(0), vec_lvsl(__a, __b)); 13828 } 13829 13830 static __inline__ vector short __ATTRS_o_ai vec_lvlxl(int __a, 13831 const vector short *__b) { 13832 return vec_perm(vec_ldl(__a, __b), (vector short)(0), 13833 vec_lvsl(__a, (unsigned char *)__b)); 13834 } 13835 13836 static __inline__ vector unsigned short __ATTRS_o_ai 13837 vec_lvlxl(int __a, const unsigned short *__b) { 13838 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13839 vec_lvsl(__a, __b)); 13840 } 13841 13842 static __inline__ vector unsigned short __ATTRS_o_ai 13843 vec_lvlxl(int __a, const vector unsigned short *__b) { 13844 return vec_perm(vec_ldl(__a, __b), (vector unsigned short)(0), 13845 vec_lvsl(__a, (unsigned char *)__b)); 13846 } 13847 13848 static __inline__ vector bool short __ATTRS_o_ai 13849 vec_lvlxl(int __a, const vector bool short *__b) { 13850 return vec_perm(vec_ldl(__a, __b), (vector bool short)(0), 13851 vec_lvsl(__a, (unsigned char *)__b)); 13852 } 13853 13854 static __inline__ vector pixel __ATTRS_o_ai vec_lvlxl(int __a, 13855 const vector pixel *__b) { 13856 return vec_perm(vec_ldl(__a, __b), (vector pixel)(0), 13857 vec_lvsl(__a, (unsigned char *)__b)); 13858 } 13859 13860 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, const int *__b) { 13861 return vec_perm(vec_ldl(__a, __b), (vector int)(0), vec_lvsl(__a, __b)); 13862 } 13863 13864 static __inline__ vector int __ATTRS_o_ai vec_lvlxl(int __a, 13865 const vector int *__b) { 13866 return vec_perm(vec_ldl(__a, __b), (vector int)(0), 13867 vec_lvsl(__a, (unsigned char *)__b)); 13868 } 13869 13870 static __inline__ vector unsigned int __ATTRS_o_ai 13871 vec_lvlxl(int __a, const unsigned int *__b) { 13872 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13873 vec_lvsl(__a, __b)); 13874 } 13875 13876 static __inline__ vector unsigned int __ATTRS_o_ai 13877 vec_lvlxl(int __a, const vector unsigned int *__b) { 13878 return vec_perm(vec_ldl(__a, __b), (vector unsigned int)(0), 13879 vec_lvsl(__a, (unsigned char *)__b)); 13880 } 13881 13882 static __inline__ vector bool int __ATTRS_o_ai 13883 vec_lvlxl(int __a, const vector bool int *__b) { 13884 return vec_perm(vec_ldl(__a, __b), (vector bool int)(0), 13885 vec_lvsl(__a, (unsigned char *)__b)); 13886 } 13887 13888 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13889 const float *__b) { 13890 return vec_perm(vec_ldl(__a, __b), (vector float)(0), vec_lvsl(__a, __b)); 13891 } 13892 13893 static __inline__ vector float __ATTRS_o_ai vec_lvlxl(int __a, 13894 vector float *__b) { 13895 return vec_perm(vec_ldl(__a, __b), (vector float)(0), 13896 vec_lvsl(__a, (unsigned char *)__b)); 13897 } 13898 13899 /* vec_lvrx */ 13900 13901 static __inline__ vector signed char __ATTRS_o_ai 13902 vec_lvrx(int __a, const signed char *__b) { 13903 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13904 vec_lvsl(__a, __b)); 13905 } 13906 13907 static __inline__ vector signed char __ATTRS_o_ai 13908 vec_lvrx(int __a, const vector signed char *__b) { 13909 return vec_perm((vector signed char)(0), vec_ld(__a, __b), 13910 vec_lvsl(__a, (unsigned char *)__b)); 13911 } 13912 13913 static __inline__ vector unsigned char __ATTRS_o_ai 13914 vec_lvrx(int __a, const unsigned char *__b) { 13915 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13916 vec_lvsl(__a, __b)); 13917 } 13918 13919 static __inline__ vector unsigned char __ATTRS_o_ai 13920 vec_lvrx(int __a, const vector unsigned char *__b) { 13921 return vec_perm((vector unsigned char)(0), vec_ld(__a, __b), 13922 vec_lvsl(__a, (unsigned char *)__b)); 13923 } 13924 13925 static __inline__ vector bool char __ATTRS_o_ai 13926 vec_lvrx(int __a, const vector bool char *__b) { 13927 return vec_perm((vector bool char)(0), vec_ld(__a, __b), 13928 vec_lvsl(__a, (unsigned char *)__b)); 13929 } 13930 13931 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13932 const short *__b) { 13933 return vec_perm((vector short)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13934 } 13935 13936 static __inline__ vector short __ATTRS_o_ai vec_lvrx(int __a, 13937 const vector short *__b) { 13938 return vec_perm((vector short)(0), vec_ld(__a, __b), 13939 vec_lvsl(__a, (unsigned char *)__b)); 13940 } 13941 13942 static __inline__ vector unsigned short __ATTRS_o_ai 13943 vec_lvrx(int __a, const unsigned short *__b) { 13944 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13945 vec_lvsl(__a, __b)); 13946 } 13947 13948 static __inline__ vector unsigned short __ATTRS_o_ai 13949 vec_lvrx(int __a, const vector unsigned short *__b) { 13950 return vec_perm((vector unsigned short)(0), vec_ld(__a, __b), 13951 vec_lvsl(__a, (unsigned char *)__b)); 13952 } 13953 13954 static __inline__ vector bool short __ATTRS_o_ai 13955 vec_lvrx(int __a, const vector bool short *__b) { 13956 return vec_perm((vector bool short)(0), vec_ld(__a, __b), 13957 vec_lvsl(__a, (unsigned char *)__b)); 13958 } 13959 13960 static __inline__ vector pixel __ATTRS_o_ai vec_lvrx(int __a, 13961 const vector pixel *__b) { 13962 return vec_perm((vector pixel)(0), vec_ld(__a, __b), 13963 vec_lvsl(__a, (unsigned char *)__b)); 13964 } 13965 13966 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, const int *__b) { 13967 return vec_perm((vector int)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13968 } 13969 13970 static __inline__ vector int __ATTRS_o_ai vec_lvrx(int __a, 13971 const vector int *__b) { 13972 return vec_perm((vector int)(0), vec_ld(__a, __b), 13973 vec_lvsl(__a, (unsigned char *)__b)); 13974 } 13975 13976 static __inline__ vector unsigned int __ATTRS_o_ai 13977 vec_lvrx(int __a, const unsigned int *__b) { 13978 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13979 vec_lvsl(__a, __b)); 13980 } 13981 13982 static __inline__ vector unsigned int __ATTRS_o_ai 13983 vec_lvrx(int __a, const vector unsigned int *__b) { 13984 return vec_perm((vector unsigned int)(0), vec_ld(__a, __b), 13985 vec_lvsl(__a, (unsigned char *)__b)); 13986 } 13987 13988 static __inline__ vector bool int __ATTRS_o_ai 13989 vec_lvrx(int __a, const vector bool int *__b) { 13990 return vec_perm((vector bool int)(0), vec_ld(__a, __b), 13991 vec_lvsl(__a, (unsigned char *)__b)); 13992 } 13993 13994 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 13995 const float *__b) { 13996 return vec_perm((vector float)(0), vec_ld(__a, __b), vec_lvsl(__a, __b)); 13997 } 13998 13999 static __inline__ vector float __ATTRS_o_ai vec_lvrx(int __a, 14000 const vector float *__b) { 14001 return vec_perm((vector float)(0), vec_ld(__a, __b), 14002 vec_lvsl(__a, (unsigned char *)__b)); 14003 } 14004 14005 /* vec_lvrxl */ 14006 14007 static __inline__ vector signed char __ATTRS_o_ai 14008 vec_lvrxl(int __a, const signed char *__b) { 14009 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 14010 vec_lvsl(__a, __b)); 14011 } 14012 14013 static __inline__ vector signed char __ATTRS_o_ai 14014 vec_lvrxl(int __a, const vector signed char *__b) { 14015 return vec_perm((vector signed char)(0), vec_ldl(__a, __b), 14016 vec_lvsl(__a, (unsigned char *)__b)); 14017 } 14018 14019 static __inline__ vector unsigned char __ATTRS_o_ai 14020 vec_lvrxl(int __a, const unsigned char *__b) { 14021 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 14022 vec_lvsl(__a, __b)); 14023 } 14024 14025 static __inline__ vector unsigned char __ATTRS_o_ai 14026 vec_lvrxl(int __a, const vector unsigned char *__b) { 14027 return vec_perm((vector unsigned char)(0), vec_ldl(__a, __b), 14028 vec_lvsl(__a, (unsigned char *)__b)); 14029 } 14030 14031 static __inline__ vector bool char __ATTRS_o_ai 14032 vec_lvrxl(int __a, const vector bool char *__b) { 14033 return vec_perm((vector bool char)(0), vec_ldl(__a, __b), 14034 vec_lvsl(__a, (unsigned char *)__b)); 14035 } 14036 14037 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14038 const short *__b) { 14039 return vec_perm((vector short)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14040 } 14041 14042 static __inline__ vector short __ATTRS_o_ai vec_lvrxl(int __a, 14043 const vector short *__b) { 14044 return vec_perm((vector short)(0), vec_ldl(__a, __b), 14045 vec_lvsl(__a, (unsigned char *)__b)); 14046 } 14047 14048 static __inline__ vector unsigned short __ATTRS_o_ai 14049 vec_lvrxl(int __a, const unsigned short *__b) { 14050 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14051 vec_lvsl(__a, __b)); 14052 } 14053 14054 static __inline__ vector unsigned short __ATTRS_o_ai 14055 vec_lvrxl(int __a, const vector unsigned short *__b) { 14056 return vec_perm((vector unsigned short)(0), vec_ldl(__a, __b), 14057 vec_lvsl(__a, (unsigned char *)__b)); 14058 } 14059 14060 static __inline__ vector bool short __ATTRS_o_ai 14061 vec_lvrxl(int __a, const vector bool short *__b) { 14062 return vec_perm((vector bool short)(0), vec_ldl(__a, __b), 14063 vec_lvsl(__a, (unsigned char *)__b)); 14064 } 14065 14066 static __inline__ vector pixel __ATTRS_o_ai vec_lvrxl(int __a, 14067 const vector pixel *__b) { 14068 return vec_perm((vector pixel)(0), vec_ldl(__a, __b), 14069 vec_lvsl(__a, (unsigned char *)__b)); 14070 } 14071 14072 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, const int *__b) { 14073 return vec_perm((vector int)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14074 } 14075 14076 static __inline__ vector int __ATTRS_o_ai vec_lvrxl(int __a, 14077 const vector int *__b) { 14078 return vec_perm((vector int)(0), vec_ldl(__a, __b), 14079 vec_lvsl(__a, (unsigned char *)__b)); 14080 } 14081 14082 static __inline__ vector unsigned int __ATTRS_o_ai 14083 vec_lvrxl(int __a, const unsigned int *__b) { 14084 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14085 vec_lvsl(__a, __b)); 14086 } 14087 14088 static __inline__ vector unsigned int __ATTRS_o_ai 14089 vec_lvrxl(int __a, const vector unsigned int *__b) { 14090 return vec_perm((vector unsigned int)(0), vec_ldl(__a, __b), 14091 vec_lvsl(__a, (unsigned char *)__b)); 14092 } 14093 14094 static __inline__ vector bool int __ATTRS_o_ai 14095 vec_lvrxl(int __a, const vector bool int *__b) { 14096 return vec_perm((vector bool int)(0), vec_ldl(__a, __b), 14097 vec_lvsl(__a, (unsigned char *)__b)); 14098 } 14099 14100 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14101 const float *__b) { 14102 return vec_perm((vector float)(0), vec_ldl(__a, __b), vec_lvsl(__a, __b)); 14103 } 14104 14105 static __inline__ vector float __ATTRS_o_ai vec_lvrxl(int __a, 14106 const vector float *__b) { 14107 return vec_perm((vector float)(0), vec_ldl(__a, __b), 14108 vec_lvsl(__a, (unsigned char *)__b)); 14109 } 14110 14111 /* vec_stvlx */ 14112 14113 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14114 signed char *__c) { 14115 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14116 __c); 14117 } 14118 14119 static __inline__ void __ATTRS_o_ai vec_stvlx(vector signed char __a, int __b, 14120 vector signed char *__c) { 14121 return vec_st( 14122 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14123 __b, __c); 14124 } 14125 14126 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14127 unsigned char *__c) { 14128 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14129 __c); 14130 } 14131 14132 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned char __a, int __b, 14133 vector unsigned char *__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 bool char __a, int __b, 14140 vector bool char *__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 short __a, int __b, 14147 short *__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 short __a, int __b, 14153 vector short *__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 short __a, 14160 int __b, unsigned short *__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 short __a, 14166 int __b, 14167 vector unsigned short *__c) { 14168 return vec_st( 14169 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14170 __b, __c); 14171 } 14172 14173 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool short __a, int __b, 14174 vector bool short *__c) { 14175 return vec_st( 14176 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14177 __b, __c); 14178 } 14179 14180 static __inline__ void __ATTRS_o_ai vec_stvlx(vector pixel __a, int __b, 14181 vector pixel *__c) { 14182 return vec_st( 14183 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14184 __b, __c); 14185 } 14186 14187 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14188 int *__c) { 14189 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14190 __c); 14191 } 14192 14193 static __inline__ void __ATTRS_o_ai vec_stvlx(vector int __a, int __b, 14194 vector int *__c) { 14195 return vec_st( 14196 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14197 __b, __c); 14198 } 14199 14200 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14201 unsigned int *__c) { 14202 return vec_st(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14203 __c); 14204 } 14205 14206 static __inline__ void __ATTRS_o_ai vec_stvlx(vector unsigned int __a, int __b, 14207 vector unsigned int *__c) { 14208 return vec_st( 14209 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14210 __b, __c); 14211 } 14212 14213 static __inline__ void __ATTRS_o_ai vec_stvlx(vector bool int __a, int __b, 14214 vector bool int *__c) { 14215 return vec_st( 14216 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14217 __b, __c); 14218 } 14219 14220 static __inline__ void __ATTRS_o_ai vec_stvlx(vector float __a, int __b, 14221 vector float *__c) { 14222 return vec_st( 14223 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14224 __b, __c); 14225 } 14226 14227 /* vec_stvlxl */ 14228 14229 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14230 signed char *__c) { 14231 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14232 __c); 14233 } 14234 14235 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector signed char __a, int __b, 14236 vector signed char *__c) { 14237 return vec_stl( 14238 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14239 __b, __c); 14240 } 14241 14242 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14243 int __b, unsigned char *__c) { 14244 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14245 __c); 14246 } 14247 14248 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned char __a, 14249 int __b, 14250 vector unsigned char *__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 bool char __a, int __b, 14257 vector bool char *__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 short __a, int __b, 14264 short *__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 short __a, int __b, 14270 vector short *__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 short __a, 14277 int __b, unsigned short *__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 short __a, 14283 int __b, 14284 vector unsigned short *__c) { 14285 return vec_stl( 14286 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14287 __b, __c); 14288 } 14289 14290 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool short __a, int __b, 14291 vector bool short *__c) { 14292 return vec_stl( 14293 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14294 __b, __c); 14295 } 14296 14297 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector pixel __a, int __b, 14298 vector pixel *__c) { 14299 return vec_stl( 14300 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14301 __b, __c); 14302 } 14303 14304 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14305 int *__c) { 14306 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14307 __c); 14308 } 14309 14310 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector int __a, int __b, 14311 vector int *__c) { 14312 return vec_stl( 14313 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14314 __b, __c); 14315 } 14316 14317 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14318 unsigned int *__c) { 14319 return vec_stl(vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, __c)), __b, 14320 __c); 14321 } 14322 14323 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector unsigned int __a, int __b, 14324 vector unsigned int *__c) { 14325 return vec_stl( 14326 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14327 __b, __c); 14328 } 14329 14330 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector bool int __a, int __b, 14331 vector bool int *__c) { 14332 return vec_stl( 14333 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14334 __b, __c); 14335 } 14336 14337 static __inline__ void __ATTRS_o_ai vec_stvlxl(vector float __a, int __b, 14338 vector float *__c) { 14339 return vec_stl( 14340 vec_perm(vec_lvrx(__b, __c), __a, vec_lvsr(__b, (unsigned char *)__c)), 14341 __b, __c); 14342 } 14343 14344 /* vec_stvrx */ 14345 14346 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14347 signed char *__c) { 14348 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14349 __c); 14350 } 14351 14352 static __inline__ void __ATTRS_o_ai vec_stvrx(vector signed char __a, int __b, 14353 vector signed char *__c) { 14354 return vec_st( 14355 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14356 __b, __c); 14357 } 14358 14359 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14360 unsigned char *__c) { 14361 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14362 __c); 14363 } 14364 14365 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned char __a, int __b, 14366 vector unsigned char *__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 bool char __a, int __b, 14373 vector bool char *__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 short __a, int __b, 14380 short *__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 short __a, int __b, 14386 vector short *__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 short __a, 14393 int __b, unsigned short *__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 short __a, 14399 int __b, 14400 vector unsigned short *__c) { 14401 return vec_st( 14402 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14403 __b, __c); 14404 } 14405 14406 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool short __a, int __b, 14407 vector bool short *__c) { 14408 return vec_st( 14409 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14410 __b, __c); 14411 } 14412 14413 static __inline__ void __ATTRS_o_ai vec_stvrx(vector pixel __a, int __b, 14414 vector pixel *__c) { 14415 return vec_st( 14416 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14417 __b, __c); 14418 } 14419 14420 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14421 int *__c) { 14422 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14423 __c); 14424 } 14425 14426 static __inline__ void __ATTRS_o_ai vec_stvrx(vector int __a, int __b, 14427 vector int *__c) { 14428 return vec_st( 14429 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14430 __b, __c); 14431 } 14432 14433 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14434 unsigned int *__c) { 14435 return vec_st(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14436 __c); 14437 } 14438 14439 static __inline__ void __ATTRS_o_ai vec_stvrx(vector unsigned int __a, int __b, 14440 vector unsigned int *__c) { 14441 return vec_st( 14442 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14443 __b, __c); 14444 } 14445 14446 static __inline__ void __ATTRS_o_ai vec_stvrx(vector bool int __a, int __b, 14447 vector bool int *__c) { 14448 return vec_st( 14449 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14450 __b, __c); 14451 } 14452 14453 static __inline__ void __ATTRS_o_ai vec_stvrx(vector float __a, int __b, 14454 vector float *__c) { 14455 return vec_st( 14456 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14457 __b, __c); 14458 } 14459 14460 /* vec_stvrxl */ 14461 14462 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14463 signed char *__c) { 14464 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14465 __c); 14466 } 14467 14468 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector signed char __a, int __b, 14469 vector signed char *__c) { 14470 return vec_stl( 14471 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14472 __b, __c); 14473 } 14474 14475 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14476 int __b, unsigned char *__c) { 14477 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14478 __c); 14479 } 14480 14481 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned char __a, 14482 int __b, 14483 vector unsigned char *__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 bool char __a, int __b, 14490 vector bool char *__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 short __a, int __b, 14497 short *__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 short __a, int __b, 14503 vector short *__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 short __a, 14510 int __b, unsigned short *__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 short __a, 14516 int __b, 14517 vector unsigned short *__c) { 14518 return vec_stl( 14519 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14520 __b, __c); 14521 } 14522 14523 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool short __a, int __b, 14524 vector bool short *__c) { 14525 return vec_stl( 14526 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14527 __b, __c); 14528 } 14529 14530 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector pixel __a, int __b, 14531 vector pixel *__c) { 14532 return vec_stl( 14533 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14534 __b, __c); 14535 } 14536 14537 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14538 int *__c) { 14539 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14540 __c); 14541 } 14542 14543 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector int __a, int __b, 14544 vector int *__c) { 14545 return vec_stl( 14546 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14547 __b, __c); 14548 } 14549 14550 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14551 unsigned int *__c) { 14552 return vec_stl(vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, __c)), __b, 14553 __c); 14554 } 14555 14556 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector unsigned int __a, int __b, 14557 vector unsigned int *__c) { 14558 return vec_stl( 14559 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14560 __b, __c); 14561 } 14562 14563 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector bool int __a, int __b, 14564 vector bool int *__c) { 14565 return vec_stl( 14566 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14567 __b, __c); 14568 } 14569 14570 static __inline__ void __ATTRS_o_ai vec_stvrxl(vector float __a, int __b, 14571 vector float *__c) { 14572 return vec_stl( 14573 vec_perm(__a, vec_lvlx(__b, __c), vec_lvsr(__b, (unsigned char *)__c)), 14574 __b, __c); 14575 } 14576 14577 /* vec_promote */ 14578 14579 static __inline__ vector signed char __ATTRS_o_ai vec_promote(signed char __a, 14580 int __b) { 14581 vector signed char __res = (vector signed char)(0); 14582 __res[__b & 0x7] = __a; 14583 return __res; 14584 } 14585 14586 static __inline__ vector unsigned char __ATTRS_o_ai 14587 vec_promote(unsigned char __a, int __b) { 14588 vector unsigned char __res = (vector unsigned char)(0); 14589 __res[__b & 0x7] = __a; 14590 return __res; 14591 } 14592 14593 static __inline__ vector short __ATTRS_o_ai vec_promote(short __a, int __b) { 14594 vector short __res = (vector short)(0); 14595 __res[__b & 0x7] = __a; 14596 return __res; 14597 } 14598 14599 static __inline__ vector unsigned short __ATTRS_o_ai 14600 vec_promote(unsigned short __a, int __b) { 14601 vector unsigned short __res = (vector unsigned short)(0); 14602 __res[__b & 0x7] = __a; 14603 return __res; 14604 } 14605 14606 static __inline__ vector int __ATTRS_o_ai vec_promote(int __a, int __b) { 14607 vector int __res = (vector int)(0); 14608 __res[__b & 0x3] = __a; 14609 return __res; 14610 } 14611 14612 static __inline__ vector unsigned int __ATTRS_o_ai vec_promote(unsigned int __a, 14613 int __b) { 14614 vector unsigned int __res = (vector unsigned int)(0); 14615 __res[__b & 0x3] = __a; 14616 return __res; 14617 } 14618 14619 static __inline__ vector float __ATTRS_o_ai vec_promote(float __a, int __b) { 14620 vector float __res = (vector float)(0); 14621 __res[__b & 0x3] = __a; 14622 return __res; 14623 } 14624 14625 #ifdef __VSX__ 14626 static __inline__ vector double __ATTRS_o_ai vec_promote(double __a, int __b) { 14627 vector double __res = (vector double)(0); 14628 __res[__b & 0x1] = __a; 14629 return __res; 14630 } 14631 14632 static __inline__ vector signed long long __ATTRS_o_ai 14633 vec_promote(signed long long __a, int __b) { 14634 vector signed long long __res = (vector signed long long)(0); 14635 __res[__b & 0x1] = __a; 14636 return __res; 14637 } 14638 14639 static __inline__ vector unsigned long long __ATTRS_o_ai 14640 vec_promote(unsigned long long __a, int __b) { 14641 vector unsigned long long __res = (vector unsigned long long)(0); 14642 __res[__b & 0x1] = __a; 14643 return __res; 14644 } 14645 #endif 14646 14647 /* vec_splats */ 14648 14649 static __inline__ vector signed char __ATTRS_o_ai vec_splats(signed char __a) { 14650 return (vector signed char)(__a); 14651 } 14652 14653 static __inline__ vector unsigned char __ATTRS_o_ai 14654 vec_splats(unsigned char __a) { 14655 return (vector unsigned char)(__a); 14656 } 14657 14658 static __inline__ vector short __ATTRS_o_ai vec_splats(short __a) { 14659 return (vector short)(__a); 14660 } 14661 14662 static __inline__ vector unsigned short __ATTRS_o_ai 14663 vec_splats(unsigned short __a) { 14664 return (vector unsigned short)(__a); 14665 } 14666 14667 static __inline__ vector int __ATTRS_o_ai vec_splats(int __a) { 14668 return (vector int)(__a); 14669 } 14670 14671 static __inline__ vector unsigned int __ATTRS_o_ai 14672 vec_splats(unsigned int __a) { 14673 return (vector unsigned int)(__a); 14674 } 14675 14676 #ifdef __VSX__ 14677 static __inline__ vector signed long long __ATTRS_o_ai 14678 vec_splats(signed long long __a) { 14679 return (vector signed long long)(__a); 14680 } 14681 14682 static __inline__ vector unsigned long long __ATTRS_o_ai 14683 vec_splats(unsigned long long __a) { 14684 return (vector unsigned long long)(__a); 14685 } 14686 14687 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 14688 defined(__SIZEOF_INT128__) 14689 static __inline__ vector signed __int128 __ATTRS_o_ai 14690 vec_splats(signed __int128 __a) { 14691 return (vector signed __int128)(__a); 14692 } 14693 14694 static __inline__ vector unsigned __int128 __ATTRS_o_ai 14695 vec_splats(unsigned __int128 __a) { 14696 return (vector unsigned __int128)(__a); 14697 } 14698 14699 #endif 14700 14701 static __inline__ vector double __ATTRS_o_ai vec_splats(double __a) { 14702 return (vector double)(__a); 14703 } 14704 #endif 14705 14706 static __inline__ vector float __ATTRS_o_ai vec_splats(float __a) { 14707 return (vector float)(__a); 14708 } 14709 14710 /* ----------------------------- predicates --------------------------------- */ 14711 14712 /* vec_all_eq */ 14713 14714 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14715 vector signed char __b) { 14716 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14717 (vector char)__b); 14718 } 14719 14720 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed char __a, 14721 vector bool char __b) { 14722 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14723 (vector char)__b); 14724 } 14725 14726 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14727 vector unsigned char __b) { 14728 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14729 (vector char)__b); 14730 } 14731 14732 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned char __a, 14733 vector bool char __b) { 14734 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14735 (vector char)__b); 14736 } 14737 14738 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14739 vector signed char __b) { 14740 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14741 (vector char)__b); 14742 } 14743 14744 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14745 vector unsigned char __b) { 14746 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14747 (vector char)__b); 14748 } 14749 14750 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool char __a, 14751 vector bool char __b) { 14752 return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)__a, 14753 (vector char)__b); 14754 } 14755 14756 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14757 vector short __b) { 14758 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, __b); 14759 } 14760 14761 static __inline__ int __ATTRS_o_ai vec_all_eq(vector short __a, 14762 vector bool short __b) { 14763 return __builtin_altivec_vcmpequh_p(__CR6_LT, __a, (vector short)__b); 14764 } 14765 14766 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14767 vector unsigned short __b) { 14768 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14769 (vector short)__b); 14770 } 14771 14772 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned short __a, 14773 vector bool short __b) { 14774 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14775 (vector short)__b); 14776 } 14777 14778 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14779 vector short __b) { 14780 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14781 (vector short)__b); 14782 } 14783 14784 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14785 vector unsigned short __b) { 14786 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14787 (vector short)__b); 14788 } 14789 14790 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool short __a, 14791 vector bool short __b) { 14792 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14793 (vector short)__b); 14794 } 14795 14796 static __inline__ int __ATTRS_o_ai vec_all_eq(vector pixel __a, 14797 vector pixel __b) { 14798 return __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)__a, 14799 (vector short)__b); 14800 } 14801 14802 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, vector int __b) { 14803 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, __b); 14804 } 14805 14806 static __inline__ int __ATTRS_o_ai vec_all_eq(vector int __a, 14807 vector bool int __b) { 14808 return __builtin_altivec_vcmpequw_p(__CR6_LT, __a, (vector int)__b); 14809 } 14810 14811 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14812 vector unsigned int __b) { 14813 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14814 (vector int)__b); 14815 } 14816 14817 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned int __a, 14818 vector bool int __b) { 14819 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14820 (vector int)__b); 14821 } 14822 14823 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14824 vector int __b) { 14825 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14826 (vector int)__b); 14827 } 14828 14829 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14830 vector unsigned int __b) { 14831 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14832 (vector int)__b); 14833 } 14834 14835 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool int __a, 14836 vector bool int __b) { 14837 return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)__a, 14838 (vector int)__b); 14839 } 14840 14841 #ifdef __VSX__ 14842 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed long long __a, 14843 vector signed long long __b) { 14844 #ifdef __POWER8_VECTOR__ 14845 return __builtin_altivec_vcmpequd_p(__CR6_LT, __a, __b); 14846 #else 14847 // No vcmpequd on Power7 so we xor the two vectors and compare against zero as 14848 // 32-bit elements. 14849 return vec_all_eq((vector signed int)vec_xor(__a, __b), (vector signed int)0); 14850 #endif 14851 } 14852 14853 static __inline__ int __ATTRS_o_ai vec_all_eq(vector long long __a, 14854 vector bool long long __b) { 14855 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14856 } 14857 14858 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14859 vector unsigned long long __b) { 14860 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14861 } 14862 14863 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned long long __a, 14864 vector bool long long __b) { 14865 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14866 } 14867 14868 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14869 vector long long __b) { 14870 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14871 } 14872 14873 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14874 vector unsigned long long __b) { 14875 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14876 } 14877 14878 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool long long __a, 14879 vector bool long long __b) { 14880 return vec_all_eq((vector signed long long)__a, (vector signed long long)__b); 14881 } 14882 #endif 14883 14884 static __inline__ int __ATTRS_o_ai vec_all_eq(vector float __a, 14885 vector float __b) { 14886 #ifdef __VSX__ 14887 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __b); 14888 #else 14889 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __b); 14890 #endif 14891 } 14892 14893 #ifdef __VSX__ 14894 static __inline__ int __ATTRS_o_ai vec_all_eq(vector double __a, 14895 vector double __b) { 14896 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __b); 14897 } 14898 #endif 14899 14900 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 14901 static __inline__ int __ATTRS_o_ai vec_all_eq(vector signed __int128 __a, 14902 vector signed __int128 __b) { 14903 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14904 } 14905 14906 static __inline__ int __ATTRS_o_ai vec_all_eq(vector unsigned __int128 __a, 14907 vector unsigned __int128 __b) { 14908 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14909 } 14910 14911 static __inline__ int __ATTRS_o_ai vec_all_eq(vector bool __int128 __a, 14912 vector bool __int128 __b) { 14913 return __builtin_altivec_vcmpequq_p(__CR6_LT, __a, __b); 14914 } 14915 #endif 14916 14917 /* vec_all_ge */ 14918 14919 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14920 vector signed char __b) { 14921 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, __a); 14922 } 14923 14924 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed char __a, 14925 vector bool char __b) { 14926 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__b, __a); 14927 } 14928 14929 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14930 vector unsigned char __b) { 14931 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, __a); 14932 } 14933 14934 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned char __a, 14935 vector bool char __b) { 14936 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, __a); 14937 } 14938 14939 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14940 vector signed char __b) { 14941 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __b, (vector signed char)__a); 14942 } 14943 14944 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14945 vector unsigned char __b) { 14946 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __b, (vector unsigned char)__a); 14947 } 14948 14949 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool char __a, 14950 vector bool char __b) { 14951 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__b, 14952 (vector unsigned char)__a); 14953 } 14954 14955 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14956 vector short __b) { 14957 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, __a); 14958 } 14959 14960 static __inline__ int __ATTRS_o_ai vec_all_ge(vector short __a, 14961 vector bool short __b) { 14962 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)__b, __a); 14963 } 14964 14965 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14966 vector unsigned short __b) { 14967 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, __a); 14968 } 14969 14970 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned short __a, 14971 vector bool short __b) { 14972 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14973 __a); 14974 } 14975 14976 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14977 vector short __b) { 14978 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __b, (vector signed short)__a); 14979 } 14980 14981 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14982 vector unsigned short __b) { 14983 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __b, 14984 (vector unsigned short)__a); 14985 } 14986 14987 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool short __a, 14988 vector bool short __b) { 14989 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__b, 14990 (vector unsigned short)__a); 14991 } 14992 14993 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, vector int __b) { 14994 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, __a); 14995 } 14996 14997 static __inline__ int __ATTRS_o_ai vec_all_ge(vector int __a, 14998 vector bool int __b) { 14999 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)__b, __a); 15000 } 15001 15002 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 15003 vector unsigned int __b) { 15004 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, __a); 15005 } 15006 15007 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned int __a, 15008 vector bool int __b) { 15009 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, __a); 15010 } 15011 15012 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15013 vector int __b) { 15014 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __b, (vector signed int)__a); 15015 } 15016 15017 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15018 vector unsigned int __b) { 15019 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __b, (vector unsigned int)__a); 15020 } 15021 15022 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool int __a, 15023 vector bool int __b) { 15024 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__b, 15025 (vector unsigned int)__a); 15026 } 15027 15028 #ifdef __VSX__ 15029 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 15030 vector signed long long __b) { 15031 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, __a); 15032 } 15033 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed long long __a, 15034 vector bool long long __b) { 15035 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__b, 15036 __a); 15037 } 15038 15039 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15040 vector unsigned long long __b) { 15041 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, __a); 15042 } 15043 15044 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned long long __a, 15045 vector bool long long __b) { 15046 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15047 __a); 15048 } 15049 15050 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15051 vector signed long long __b) { 15052 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __b, 15053 (vector signed long long)__a); 15054 } 15055 15056 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15057 vector unsigned long long __b) { 15058 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __b, 15059 (vector unsigned long long)__a); 15060 } 15061 15062 static __inline__ int __ATTRS_o_ai vec_all_ge(vector bool long long __a, 15063 vector bool long long __b) { 15064 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__b, 15065 (vector unsigned long long)__a); 15066 } 15067 #endif 15068 15069 static __inline__ int __ATTRS_o_ai vec_all_ge(vector float __a, 15070 vector float __b) { 15071 #ifdef __VSX__ 15072 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __a, __b); 15073 #else 15074 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __a, __b); 15075 #endif 15076 } 15077 15078 #ifdef __VSX__ 15079 static __inline__ int __ATTRS_o_ai vec_all_ge(vector double __a, 15080 vector double __b) { 15081 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __a, __b); 15082 } 15083 #endif 15084 15085 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15086 static __inline__ int __ATTRS_o_ai vec_all_ge(vector signed __int128 __a, 15087 vector signed __int128 __b) { 15088 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __b, __a); 15089 } 15090 15091 static __inline__ int __ATTRS_o_ai vec_all_ge(vector unsigned __int128 __a, 15092 vector unsigned __int128 __b) { 15093 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __b, __a); 15094 } 15095 #endif 15096 15097 /* vec_all_gt */ 15098 15099 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15100 vector signed char __b) { 15101 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, __b); 15102 } 15103 15104 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed char __a, 15105 vector bool char __b) { 15106 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __a, (vector signed char)__b); 15107 } 15108 15109 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15110 vector unsigned char __b) { 15111 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, __b); 15112 } 15113 15114 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned char __a, 15115 vector bool char __b) { 15116 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __a, (vector unsigned char)__b); 15117 } 15118 15119 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15120 vector signed char __b) { 15121 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__a, __b); 15122 } 15123 15124 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15125 vector unsigned char __b) { 15126 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, __b); 15127 } 15128 15129 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool char __a, 15130 vector bool char __b) { 15131 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__a, 15132 (vector unsigned char)__b); 15133 } 15134 15135 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15136 vector short __b) { 15137 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, __b); 15138 } 15139 15140 static __inline__ int __ATTRS_o_ai vec_all_gt(vector short __a, 15141 vector bool short __b) { 15142 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __a, (vector short)__b); 15143 } 15144 15145 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15146 vector unsigned short __b) { 15147 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, __b); 15148 } 15149 15150 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned short __a, 15151 vector bool short __b) { 15152 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __a, 15153 (vector unsigned short)__b); 15154 } 15155 15156 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15157 vector short __b) { 15158 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector signed short)__a, __b); 15159 } 15160 15161 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15162 vector unsigned short __b) { 15163 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15164 __b); 15165 } 15166 15167 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool short __a, 15168 vector bool short __b) { 15169 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__a, 15170 (vector unsigned short)__b); 15171 } 15172 15173 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, vector int __b) { 15174 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, __b); 15175 } 15176 15177 static __inline__ int __ATTRS_o_ai vec_all_gt(vector int __a, 15178 vector bool int __b) { 15179 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __a, (vector int)__b); 15180 } 15181 15182 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15183 vector unsigned int __b) { 15184 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, __b); 15185 } 15186 15187 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned int __a, 15188 vector bool int __b) { 15189 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __a, (vector unsigned int)__b); 15190 } 15191 15192 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15193 vector int __b) { 15194 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector signed int)__a, __b); 15195 } 15196 15197 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15198 vector unsigned int __b) { 15199 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, __b); 15200 } 15201 15202 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool int __a, 15203 vector bool int __b) { 15204 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__a, 15205 (vector unsigned int)__b); 15206 } 15207 15208 #ifdef __VSX__ 15209 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15210 vector signed long long __b) { 15211 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, __b); 15212 } 15213 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed long long __a, 15214 vector bool long long __b) { 15215 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __a, 15216 (vector signed long long)__b); 15217 } 15218 15219 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15220 vector unsigned long long __b) { 15221 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, __b); 15222 } 15223 15224 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned long long __a, 15225 vector bool long long __b) { 15226 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __a, 15227 (vector unsigned long long)__b); 15228 } 15229 15230 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15231 vector signed long long __b) { 15232 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__a, 15233 __b); 15234 } 15235 15236 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15237 vector unsigned long long __b) { 15238 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15239 __b); 15240 } 15241 15242 static __inline__ int __ATTRS_o_ai vec_all_gt(vector bool long long __a, 15243 vector bool long long __b) { 15244 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__a, 15245 (vector unsigned long long)__b); 15246 } 15247 #endif 15248 15249 static __inline__ int __ATTRS_o_ai vec_all_gt(vector float __a, 15250 vector float __b) { 15251 #ifdef __VSX__ 15252 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __a, __b); 15253 #else 15254 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __a, __b); 15255 #endif 15256 } 15257 15258 #ifdef __VSX__ 15259 static __inline__ int __ATTRS_o_ai vec_all_gt(vector double __a, 15260 vector double __b) { 15261 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __a, __b); 15262 } 15263 #endif 15264 15265 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15266 static __inline__ int __ATTRS_o_ai vec_all_gt(vector signed __int128 __a, 15267 vector signed __int128 __b) { 15268 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __a, __b); 15269 } 15270 15271 static __inline__ int __ATTRS_o_ai vec_all_gt(vector unsigned __int128 __a, 15272 vector unsigned __int128 __b) { 15273 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __a, __b); 15274 } 15275 #endif 15276 15277 /* vec_all_in */ 15278 15279 static __inline__ int __attribute__((__always_inline__)) 15280 vec_all_in(vector float __a, vector float __b) { 15281 return __builtin_altivec_vcmpbfp_p(__CR6_EQ, __a, __b); 15282 } 15283 15284 /* vec_all_le */ 15285 15286 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15287 vector signed char __b) { 15288 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, __b); 15289 } 15290 15291 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed char __a, 15292 vector bool char __b) { 15293 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, __a, (vector signed char)__b); 15294 } 15295 15296 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15297 vector unsigned char __b) { 15298 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, __b); 15299 } 15300 15301 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned char __a, 15302 vector bool char __b) { 15303 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, __a, (vector unsigned char)__b); 15304 } 15305 15306 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15307 vector signed char __b) { 15308 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)__a, __b); 15309 } 15310 15311 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15312 vector unsigned char __b) { 15313 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, __b); 15314 } 15315 15316 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool char __a, 15317 vector bool char __b) { 15318 return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)__a, 15319 (vector unsigned char)__b); 15320 } 15321 15322 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15323 vector short __b) { 15324 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, __b); 15325 } 15326 15327 static __inline__ int __ATTRS_o_ai vec_all_le(vector short __a, 15328 vector bool short __b) { 15329 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, __a, (vector short)__b); 15330 } 15331 15332 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15333 vector unsigned short __b) { 15334 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, __b); 15335 } 15336 15337 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned short __a, 15338 vector bool short __b) { 15339 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, __a, 15340 (vector unsigned short)__b); 15341 } 15342 15343 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15344 vector short __b) { 15345 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector signed short)__a, __b); 15346 } 15347 15348 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15349 vector unsigned short __b) { 15350 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15351 __b); 15352 } 15353 15354 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool short __a, 15355 vector bool short __b) { 15356 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)__a, 15357 (vector unsigned short)__b); 15358 } 15359 15360 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, vector int __b) { 15361 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, __b); 15362 } 15363 15364 static __inline__ int __ATTRS_o_ai vec_all_le(vector int __a, 15365 vector bool int __b) { 15366 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, __a, (vector int)__b); 15367 } 15368 15369 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15370 vector unsigned int __b) { 15371 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, __b); 15372 } 15373 15374 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned int __a, 15375 vector bool int __b) { 15376 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, __a, (vector unsigned int)__b); 15377 } 15378 15379 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15380 vector int __b) { 15381 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector signed int)__a, __b); 15382 } 15383 15384 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15385 vector unsigned int __b) { 15386 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, __b); 15387 } 15388 15389 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool int __a, 15390 vector bool int __b) { 15391 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)__a, 15392 (vector unsigned int)__b); 15393 } 15394 15395 #ifdef __VSX__ 15396 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15397 vector signed long long __b) { 15398 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, __b); 15399 } 15400 15401 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15402 vector unsigned long long __b) { 15403 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, __b); 15404 } 15405 15406 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed long long __a, 15407 vector bool long long __b) { 15408 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, __a, 15409 (vector signed long long)__b); 15410 } 15411 15412 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned long long __a, 15413 vector bool long long __b) { 15414 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, __a, 15415 (vector unsigned long long)__b); 15416 } 15417 15418 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15419 vector signed long long __b) { 15420 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ, (vector signed long long)__a, 15421 __b); 15422 } 15423 15424 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15425 vector unsigned long long __b) { 15426 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15427 __b); 15428 } 15429 15430 static __inline__ int __ATTRS_o_ai vec_all_le(vector bool long long __a, 15431 vector bool long long __b) { 15432 return __builtin_altivec_vcmpgtud_p(__CR6_EQ, (vector unsigned long long)__a, 15433 (vector unsigned long long)__b); 15434 } 15435 #endif 15436 15437 static __inline__ int __ATTRS_o_ai vec_all_le(vector float __a, 15438 vector float __b) { 15439 #ifdef __VSX__ 15440 return __builtin_vsx_xvcmpgesp_p(__CR6_LT, __b, __a); 15441 #else 15442 return __builtin_altivec_vcmpgefp_p(__CR6_LT, __b, __a); 15443 #endif 15444 } 15445 15446 #ifdef __VSX__ 15447 static __inline__ int __ATTRS_o_ai vec_all_le(vector double __a, 15448 vector double __b) { 15449 return __builtin_vsx_xvcmpgedp_p(__CR6_LT, __b, __a); 15450 } 15451 #endif 15452 15453 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15454 static __inline__ int __ATTRS_o_ai vec_all_le(vector signed __int128 __a, 15455 vector signed __int128 __b) { 15456 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ, __a, __b); 15457 } 15458 15459 static __inline__ int __ATTRS_o_ai vec_all_le(vector unsigned __int128 __a, 15460 vector unsigned __int128 __b) { 15461 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ, __a, __b); 15462 } 15463 #endif 15464 15465 /* vec_all_lt */ 15466 15467 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15468 vector signed char __b) { 15469 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, __a); 15470 } 15471 15472 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed char __a, 15473 vector bool char __b) { 15474 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)__b, __a); 15475 } 15476 15477 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15478 vector unsigned char __b) { 15479 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, __a); 15480 } 15481 15482 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned char __a, 15483 vector bool char __b) { 15484 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, __a); 15485 } 15486 15487 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15488 vector signed char __b) { 15489 return __builtin_altivec_vcmpgtsb_p(__CR6_LT, __b, (vector signed char)__a); 15490 } 15491 15492 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15493 vector unsigned char __b) { 15494 return __builtin_altivec_vcmpgtub_p(__CR6_LT, __b, (vector unsigned char)__a); 15495 } 15496 15497 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool char __a, 15498 vector bool char __b) { 15499 return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)__b, 15500 (vector unsigned char)__a); 15501 } 15502 15503 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15504 vector short __b) { 15505 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, __a); 15506 } 15507 15508 static __inline__ int __ATTRS_o_ai vec_all_lt(vector short __a, 15509 vector bool short __b) { 15510 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)__b, __a); 15511 } 15512 15513 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15514 vector unsigned short __b) { 15515 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, __a); 15516 } 15517 15518 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned short __a, 15519 vector bool short __b) { 15520 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15521 __a); 15522 } 15523 15524 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15525 vector short __b) { 15526 return __builtin_altivec_vcmpgtsh_p(__CR6_LT, __b, (vector signed short)__a); 15527 } 15528 15529 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15530 vector unsigned short __b) { 15531 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, __b, 15532 (vector unsigned short)__a); 15533 } 15534 15535 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool short __a, 15536 vector bool short __b) { 15537 return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)__b, 15538 (vector unsigned short)__a); 15539 } 15540 15541 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, vector int __b) { 15542 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, __a); 15543 } 15544 15545 static __inline__ int __ATTRS_o_ai vec_all_lt(vector int __a, 15546 vector bool int __b) { 15547 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)__b, __a); 15548 } 15549 15550 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15551 vector unsigned int __b) { 15552 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, __a); 15553 } 15554 15555 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned int __a, 15556 vector bool int __b) { 15557 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, __a); 15558 } 15559 15560 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15561 vector int __b) { 15562 return __builtin_altivec_vcmpgtsw_p(__CR6_LT, __b, (vector signed int)__a); 15563 } 15564 15565 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15566 vector unsigned int __b) { 15567 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, __b, (vector unsigned int)__a); 15568 } 15569 15570 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool int __a, 15571 vector bool int __b) { 15572 return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)__b, 15573 (vector unsigned int)__a); 15574 } 15575 15576 #ifdef __VSX__ 15577 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15578 vector signed long long __b) { 15579 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, __a); 15580 } 15581 15582 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15583 vector unsigned long long __b) { 15584 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, __a); 15585 } 15586 15587 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed long long __a, 15588 vector bool long long __b) { 15589 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, (vector signed long long)__b, 15590 __a); 15591 } 15592 15593 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned long long __a, 15594 vector bool long long __b) { 15595 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15596 __a); 15597 } 15598 15599 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15600 vector signed long long __b) { 15601 return __builtin_altivec_vcmpgtsd_p(__CR6_LT, __b, 15602 (vector signed long long)__a); 15603 } 15604 15605 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15606 vector unsigned long long __b) { 15607 return __builtin_altivec_vcmpgtud_p(__CR6_LT, __b, 15608 (vector unsigned long long)__a); 15609 } 15610 15611 static __inline__ int __ATTRS_o_ai vec_all_lt(vector bool long long __a, 15612 vector bool long long __b) { 15613 return __builtin_altivec_vcmpgtud_p(__CR6_LT, (vector unsigned long long)__b, 15614 (vector unsigned long long)__a); 15615 } 15616 #endif 15617 15618 static __inline__ int __ATTRS_o_ai vec_all_lt(vector float __a, 15619 vector float __b) { 15620 #ifdef __VSX__ 15621 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT, __b, __a); 15622 #else 15623 return __builtin_altivec_vcmpgtfp_p(__CR6_LT, __b, __a); 15624 #endif 15625 } 15626 15627 #ifdef __VSX__ 15628 static __inline__ int __ATTRS_o_ai vec_all_lt(vector double __a, 15629 vector double __b) { 15630 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT, __b, __a); 15631 } 15632 #endif 15633 15634 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15635 static __inline__ int __ATTRS_o_ai vec_all_lt(vector signed __int128 __a, 15636 vector signed __int128 __b) { 15637 return __builtin_altivec_vcmpgtsq_p(__CR6_LT, __b, __a); 15638 } 15639 15640 static __inline__ int __ATTRS_o_ai vec_all_lt(vector unsigned __int128 __a, 15641 vector unsigned __int128 __b) { 15642 return __builtin_altivec_vcmpgtuq_p(__CR6_LT, __b, __a); 15643 } 15644 #endif 15645 15646 /* vec_all_nan */ 15647 15648 static __inline__ int __ATTRS_o_ai vec_all_nan(vector float __a) { 15649 #ifdef __VSX__ 15650 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __a); 15651 #else 15652 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __a); 15653 #endif 15654 } 15655 15656 #ifdef __VSX__ 15657 static __inline__ int __ATTRS_o_ai vec_all_nan(vector double __a) { 15658 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __a); 15659 } 15660 #endif 15661 15662 /* vec_all_ne */ 15663 15664 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15665 vector signed char __b) { 15666 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15667 (vector char)__b); 15668 } 15669 15670 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed char __a, 15671 vector bool char __b) { 15672 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15673 (vector char)__b); 15674 } 15675 15676 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15677 vector unsigned char __b) { 15678 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15679 (vector char)__b); 15680 } 15681 15682 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned char __a, 15683 vector bool char __b) { 15684 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15685 (vector char)__b); 15686 } 15687 15688 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15689 vector signed char __b) { 15690 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15691 (vector char)__b); 15692 } 15693 15694 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15695 vector unsigned char __b) { 15696 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15697 (vector char)__b); 15698 } 15699 15700 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool char __a, 15701 vector bool char __b) { 15702 return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)__a, 15703 (vector char)__b); 15704 } 15705 15706 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15707 vector short __b) { 15708 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, __b); 15709 } 15710 15711 static __inline__ int __ATTRS_o_ai vec_all_ne(vector short __a, 15712 vector bool short __b) { 15713 return __builtin_altivec_vcmpequh_p(__CR6_EQ, __a, (vector short)__b); 15714 } 15715 15716 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15717 vector unsigned short __b) { 15718 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15719 (vector short)__b); 15720 } 15721 15722 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned short __a, 15723 vector bool short __b) { 15724 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15725 (vector short)__b); 15726 } 15727 15728 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15729 vector short __b) { 15730 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15731 (vector short)__b); 15732 } 15733 15734 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15735 vector unsigned short __b) { 15736 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15737 (vector short)__b); 15738 } 15739 15740 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool short __a, 15741 vector bool short __b) { 15742 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15743 (vector short)__b); 15744 } 15745 15746 static __inline__ int __ATTRS_o_ai vec_all_ne(vector pixel __a, 15747 vector pixel __b) { 15748 return __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)__a, 15749 (vector short)__b); 15750 } 15751 15752 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, vector int __b) { 15753 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, __b); 15754 } 15755 15756 static __inline__ int __ATTRS_o_ai vec_all_ne(vector int __a, 15757 vector bool int __b) { 15758 return __builtin_altivec_vcmpequw_p(__CR6_EQ, __a, (vector int)__b); 15759 } 15760 15761 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15762 vector unsigned int __b) { 15763 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15764 (vector int)__b); 15765 } 15766 15767 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned int __a, 15768 vector bool int __b) { 15769 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15770 (vector int)__b); 15771 } 15772 15773 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15774 vector int __b) { 15775 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15776 (vector int)__b); 15777 } 15778 15779 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15780 vector unsigned int __b) { 15781 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15782 (vector int)__b); 15783 } 15784 15785 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool int __a, 15786 vector bool int __b) { 15787 return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)__a, 15788 (vector int)__b); 15789 } 15790 15791 #ifdef __VSX__ 15792 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15793 vector signed long long __b) { 15794 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, __b); 15795 } 15796 15797 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15798 vector unsigned long long __b) { 15799 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector long long)__a, 15800 (vector long long)__b); 15801 } 15802 15803 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed long long __a, 15804 vector bool long long __b) { 15805 return __builtin_altivec_vcmpequd_p(__CR6_EQ, __a, 15806 (vector signed long long)__b); 15807 } 15808 15809 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned long long __a, 15810 vector bool long long __b) { 15811 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15812 (vector signed long long)__b); 15813 } 15814 15815 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15816 vector signed long long __b) { 15817 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15818 (vector signed long long)__b); 15819 } 15820 15821 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15822 vector unsigned long long __b) { 15823 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15824 (vector signed long long)__b); 15825 } 15826 15827 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool long long __a, 15828 vector bool long long __b) { 15829 return __builtin_altivec_vcmpequd_p(__CR6_EQ, (vector signed long long)__a, 15830 (vector signed long long)__b); 15831 } 15832 #endif 15833 15834 static __inline__ int __ATTRS_o_ai vec_all_ne(vector float __a, 15835 vector float __b) { 15836 #ifdef __VSX__ 15837 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ, __a, __b); 15838 #else 15839 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, __a, __b); 15840 #endif 15841 } 15842 15843 #ifdef __VSX__ 15844 static __inline__ int __ATTRS_o_ai vec_all_ne(vector double __a, 15845 vector double __b) { 15846 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ, __a, __b); 15847 } 15848 #endif 15849 15850 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 15851 static __inline__ int __ATTRS_o_ai vec_all_ne(vector signed __int128 __a, 15852 vector signed __int128 __b) { 15853 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15854 } 15855 15856 static __inline__ int __ATTRS_o_ai vec_all_ne(vector unsigned __int128 __a, 15857 vector unsigned __int128 __b) { 15858 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15859 } 15860 15861 static __inline__ int __ATTRS_o_ai vec_all_ne(vector bool __int128 __a, 15862 vector bool __int128 __b) { 15863 return __builtin_altivec_vcmpequq_p(__CR6_EQ, __a, __b); 15864 } 15865 #endif 15866 15867 /* vec_all_nge */ 15868 15869 static __inline__ int __ATTRS_o_ai vec_all_nge(vector float __a, 15870 vector float __b) { 15871 #ifdef __VSX__ 15872 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __a, __b); 15873 #else 15874 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __a, __b); 15875 #endif 15876 } 15877 15878 #ifdef __VSX__ 15879 static __inline__ int __ATTRS_o_ai vec_all_nge(vector double __a, 15880 vector double __b) { 15881 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __a, __b); 15882 } 15883 #endif 15884 15885 /* vec_all_ngt */ 15886 15887 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector float __a, 15888 vector float __b) { 15889 #ifdef __VSX__ 15890 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __a, __b); 15891 #else 15892 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __a, __b); 15893 #endif 15894 } 15895 15896 #ifdef __VSX__ 15897 static __inline__ int __ATTRS_o_ai vec_all_ngt(vector double __a, 15898 vector double __b) { 15899 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __a, __b); 15900 } 15901 #endif 15902 15903 /* vec_all_nle */ 15904 15905 static __inline__ int __ATTRS_o_ai 15906 vec_all_nle(vector float __a, vector float __b) { 15907 #ifdef __VSX__ 15908 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ, __b, __a); 15909 #else 15910 return __builtin_altivec_vcmpgefp_p(__CR6_EQ, __b, __a); 15911 #endif 15912 } 15913 15914 #ifdef __VSX__ 15915 static __inline__ int __ATTRS_o_ai vec_all_nle(vector double __a, 15916 vector double __b) { 15917 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ, __b, __a); 15918 } 15919 #endif 15920 15921 /* vec_all_nlt */ 15922 15923 static __inline__ int __ATTRS_o_ai 15924 vec_all_nlt(vector float __a, vector float __b) { 15925 #ifdef __VSX__ 15926 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ, __b, __a); 15927 #else 15928 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, __b, __a); 15929 #endif 15930 } 15931 15932 #ifdef __VSX__ 15933 static __inline__ int __ATTRS_o_ai vec_all_nlt(vector double __a, 15934 vector double __b) { 15935 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ, __b, __a); 15936 } 15937 #endif 15938 15939 /* vec_all_numeric */ 15940 15941 static __inline__ int __ATTRS_o_ai 15942 vec_all_numeric(vector float __a) { 15943 #ifdef __VSX__ 15944 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT, __a, __a); 15945 #else 15946 return __builtin_altivec_vcmpeqfp_p(__CR6_LT, __a, __a); 15947 #endif 15948 } 15949 15950 #ifdef __VSX__ 15951 static __inline__ int __ATTRS_o_ai vec_all_numeric(vector double __a) { 15952 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT, __a, __a); 15953 } 15954 #endif 15955 15956 /* vec_any_eq */ 15957 15958 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15959 vector signed char __b) { 15960 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15961 (vector char)__b); 15962 } 15963 15964 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed char __a, 15965 vector bool char __b) { 15966 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15967 (vector char)__b); 15968 } 15969 15970 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15971 vector unsigned char __b) { 15972 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15973 (vector char)__b); 15974 } 15975 15976 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned char __a, 15977 vector bool char __b) { 15978 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15979 (vector char)__b); 15980 } 15981 15982 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15983 vector signed char __b) { 15984 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15985 (vector char)__b); 15986 } 15987 15988 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15989 vector unsigned char __b) { 15990 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15991 (vector char)__b); 15992 } 15993 15994 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool char __a, 15995 vector bool char __b) { 15996 return __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)__a, 15997 (vector char)__b); 15998 } 15999 16000 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 16001 vector short __b) { 16002 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, __b); 16003 } 16004 16005 static __inline__ int __ATTRS_o_ai vec_any_eq(vector short __a, 16006 vector bool short __b) { 16007 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, __a, (vector short)__b); 16008 } 16009 16010 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 16011 vector unsigned short __b) { 16012 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16013 (vector short)__b); 16014 } 16015 16016 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned short __a, 16017 vector bool short __b) { 16018 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16019 (vector short)__b); 16020 } 16021 16022 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16023 vector short __b) { 16024 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16025 (vector short)__b); 16026 } 16027 16028 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16029 vector unsigned short __b) { 16030 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16031 (vector short)__b); 16032 } 16033 16034 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool short __a, 16035 vector bool short __b) { 16036 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16037 (vector short)__b); 16038 } 16039 16040 static __inline__ int __ATTRS_o_ai vec_any_eq(vector pixel __a, 16041 vector pixel __b) { 16042 return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, (vector short)__a, 16043 (vector short)__b); 16044 } 16045 16046 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, vector int __b) { 16047 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, __b); 16048 } 16049 16050 static __inline__ int __ATTRS_o_ai vec_any_eq(vector int __a, 16051 vector bool int __b) { 16052 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, __a, (vector int)__b); 16053 } 16054 16055 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16056 vector unsigned int __b) { 16057 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16058 (vector int)__b); 16059 } 16060 16061 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned int __a, 16062 vector bool int __b) { 16063 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16064 (vector int)__b); 16065 } 16066 16067 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16068 vector int __b) { 16069 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16070 (vector int)__b); 16071 } 16072 16073 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16074 vector unsigned int __b) { 16075 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16076 (vector int)__b); 16077 } 16078 16079 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool int __a, 16080 vector bool int __b) { 16081 return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)__a, 16082 (vector int)__b); 16083 } 16084 16085 #ifdef __VSX__ 16086 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16087 vector signed long long __b) { 16088 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, __b); 16089 } 16090 16091 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16092 vector unsigned long long __b) { 16093 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, (vector long long)__a, 16094 (vector long long)__b); 16095 } 16096 16097 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed long long __a, 16098 vector bool long long __b) { 16099 return __builtin_altivec_vcmpequd_p(__CR6_EQ_REV, __a, 16100 (vector signed long long)__b); 16101 } 16102 16103 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned long long __a, 16104 vector bool long long __b) { 16105 return __builtin_altivec_vcmpequd_p( 16106 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16107 } 16108 16109 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16110 vector signed long long __b) { 16111 return __builtin_altivec_vcmpequd_p( 16112 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16113 } 16114 16115 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16116 vector unsigned long long __b) { 16117 return __builtin_altivec_vcmpequd_p( 16118 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16119 } 16120 16121 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool long long __a, 16122 vector bool long long __b) { 16123 return __builtin_altivec_vcmpequd_p( 16124 __CR6_EQ_REV, (vector signed long long)__a, (vector signed long long)__b); 16125 } 16126 #endif 16127 16128 static __inline__ int __ATTRS_o_ai vec_any_eq(vector float __a, 16129 vector float __b) { 16130 #ifdef __VSX__ 16131 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __b); 16132 #else 16133 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __b); 16134 #endif 16135 } 16136 16137 #ifdef __VSX__ 16138 static __inline__ int __ATTRS_o_ai vec_any_eq(vector double __a, 16139 vector double __b) { 16140 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __b); 16141 } 16142 #endif 16143 16144 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16145 static __inline__ int __ATTRS_o_ai vec_any_eq(vector signed __int128 __a, 16146 vector signed __int128 __b) { 16147 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16148 } 16149 16150 static __inline__ int __ATTRS_o_ai vec_any_eq(vector unsigned __int128 __a, 16151 vector unsigned __int128 __b) { 16152 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16153 } 16154 16155 static __inline__ int __ATTRS_o_ai vec_any_eq(vector bool __int128 __a, 16156 vector bool __int128 __b) { 16157 return __builtin_altivec_vcmpequq_p(__CR6_EQ_REV, __a, __b); 16158 } 16159 #endif 16160 16161 /* vec_any_ge */ 16162 16163 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16164 vector signed char __b) { 16165 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, __a); 16166 } 16167 16168 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed char __a, 16169 vector bool char __b) { 16170 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__b, 16171 __a); 16172 } 16173 16174 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16175 vector unsigned char __b) { 16176 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, __a); 16177 } 16178 16179 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned char __a, 16180 vector bool char __b) { 16181 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16182 __a); 16183 } 16184 16185 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16186 vector signed char __b) { 16187 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __b, 16188 (vector signed char)__a); 16189 } 16190 16191 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16192 vector unsigned char __b) { 16193 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __b, 16194 (vector unsigned char)__a); 16195 } 16196 16197 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool char __a, 16198 vector bool char __b) { 16199 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__b, 16200 (vector unsigned char)__a); 16201 } 16202 16203 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16204 vector short __b) { 16205 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, __a); 16206 } 16207 16208 static __inline__ int __ATTRS_o_ai vec_any_ge(vector short __a, 16209 vector bool short __b) { 16210 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)__b, __a); 16211 } 16212 16213 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16214 vector unsigned short __b) { 16215 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, __a); 16216 } 16217 16218 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned short __a, 16219 vector bool short __b) { 16220 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16221 __a); 16222 } 16223 16224 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16225 vector short __b) { 16226 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __b, 16227 (vector signed short)__a); 16228 } 16229 16230 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16231 vector unsigned short __b) { 16232 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __b, 16233 (vector unsigned short)__a); 16234 } 16235 16236 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool short __a, 16237 vector bool short __b) { 16238 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__b, 16239 (vector unsigned short)__a); 16240 } 16241 16242 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, vector int __b) { 16243 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, __a); 16244 } 16245 16246 static __inline__ int __ATTRS_o_ai vec_any_ge(vector int __a, 16247 vector bool int __b) { 16248 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)__b, __a); 16249 } 16250 16251 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16252 vector unsigned int __b) { 16253 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, __a); 16254 } 16255 16256 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned int __a, 16257 vector bool int __b) { 16258 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16259 __a); 16260 } 16261 16262 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16263 vector int __b) { 16264 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __b, 16265 (vector signed int)__a); 16266 } 16267 16268 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16269 vector unsigned int __b) { 16270 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __b, 16271 (vector unsigned int)__a); 16272 } 16273 16274 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool int __a, 16275 vector bool int __b) { 16276 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__b, 16277 (vector unsigned int)__a); 16278 } 16279 16280 #ifdef __VSX__ 16281 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16282 vector signed long long __b) { 16283 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, __a); 16284 } 16285 16286 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16287 vector unsigned long long __b) { 16288 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, __a); 16289 } 16290 16291 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed long long __a, 16292 vector bool long long __b) { 16293 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16294 (vector signed long long)__b, __a); 16295 } 16296 16297 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned long long __a, 16298 vector bool long long __b) { 16299 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16300 (vector unsigned long long)__b, __a); 16301 } 16302 16303 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16304 vector signed long long __b) { 16305 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __b, 16306 (vector signed long long)__a); 16307 } 16308 16309 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16310 vector unsigned long long __b) { 16311 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __b, 16312 (vector unsigned long long)__a); 16313 } 16314 16315 static __inline__ int __ATTRS_o_ai vec_any_ge(vector bool long long __a, 16316 vector bool long long __b) { 16317 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16318 (vector unsigned long long)__b, 16319 (vector unsigned long long)__a); 16320 } 16321 #endif 16322 16323 static __inline__ int __ATTRS_o_ai vec_any_ge(vector float __a, 16324 vector float __b) { 16325 #ifdef __VSX__ 16326 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __a, __b); 16327 #else 16328 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __a, __b); 16329 #endif 16330 } 16331 16332 #ifdef __VSX__ 16333 static __inline__ int __ATTRS_o_ai vec_any_ge(vector double __a, 16334 vector double __b) { 16335 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __a, __b); 16336 } 16337 #endif 16338 16339 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16340 static __inline__ int __ATTRS_o_ai vec_any_ge(vector signed __int128 __a, 16341 vector signed __int128 __b) { 16342 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __b, __a); 16343 } 16344 16345 static __inline__ int __ATTRS_o_ai vec_any_ge(vector unsigned __int128 __a, 16346 vector unsigned __int128 __b) { 16347 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __b, __a); 16348 } 16349 #endif 16350 16351 /* vec_any_gt */ 16352 16353 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16354 vector signed char __b) { 16355 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, __b); 16356 } 16357 16358 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed char __a, 16359 vector bool char __b) { 16360 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __a, 16361 (vector signed char)__b); 16362 } 16363 16364 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16365 vector unsigned char __b) { 16366 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, __b); 16367 } 16368 16369 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned char __a, 16370 vector bool char __b) { 16371 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __a, 16372 (vector unsigned char)__b); 16373 } 16374 16375 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16376 vector signed char __b) { 16377 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__a, 16378 __b); 16379 } 16380 16381 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16382 vector unsigned char __b) { 16383 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16384 __b); 16385 } 16386 16387 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool char __a, 16388 vector bool char __b) { 16389 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__a, 16390 (vector unsigned char)__b); 16391 } 16392 16393 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16394 vector short __b) { 16395 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, __b); 16396 } 16397 16398 static __inline__ int __ATTRS_o_ai vec_any_gt(vector short __a, 16399 vector bool short __b) { 16400 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __a, (vector short)__b); 16401 } 16402 16403 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16404 vector unsigned short __b) { 16405 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, __b); 16406 } 16407 16408 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned short __a, 16409 vector bool short __b) { 16410 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __a, 16411 (vector unsigned short)__b); 16412 } 16413 16414 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16415 vector short __b) { 16416 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector signed short)__a, 16417 __b); 16418 } 16419 16420 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16421 vector unsigned short __b) { 16422 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16423 __b); 16424 } 16425 16426 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool short __a, 16427 vector bool short __b) { 16428 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__a, 16429 (vector unsigned short)__b); 16430 } 16431 16432 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, vector int __b) { 16433 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, __b); 16434 } 16435 16436 static __inline__ int __ATTRS_o_ai vec_any_gt(vector int __a, 16437 vector bool int __b) { 16438 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __a, (vector int)__b); 16439 } 16440 16441 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16442 vector unsigned int __b) { 16443 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, __b); 16444 } 16445 16446 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned int __a, 16447 vector bool int __b) { 16448 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __a, 16449 (vector unsigned int)__b); 16450 } 16451 16452 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16453 vector int __b) { 16454 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector signed int)__a, 16455 __b); 16456 } 16457 16458 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16459 vector unsigned int __b) { 16460 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16461 __b); 16462 } 16463 16464 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool int __a, 16465 vector bool int __b) { 16466 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__a, 16467 (vector unsigned int)__b); 16468 } 16469 16470 #ifdef __VSX__ 16471 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16472 vector signed long long __b) { 16473 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, __b); 16474 } 16475 16476 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16477 vector unsigned long long __b) { 16478 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, __b); 16479 } 16480 16481 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed long long __a, 16482 vector bool long long __b) { 16483 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __a, 16484 (vector signed long long)__b); 16485 } 16486 16487 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned long long __a, 16488 vector bool long long __b) { 16489 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __a, 16490 (vector unsigned long long)__b); 16491 } 16492 16493 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16494 vector signed long long __b) { 16495 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16496 (vector signed long long)__a, __b); 16497 } 16498 16499 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16500 vector unsigned long long __b) { 16501 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16502 (vector unsigned long long)__a, __b); 16503 } 16504 16505 static __inline__ int __ATTRS_o_ai vec_any_gt(vector bool long long __a, 16506 vector bool long long __b) { 16507 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16508 (vector unsigned long long)__a, 16509 (vector unsigned long long)__b); 16510 } 16511 #endif 16512 16513 static __inline__ int __ATTRS_o_ai vec_any_gt(vector float __a, 16514 vector float __b) { 16515 #ifdef __VSX__ 16516 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __a, __b); 16517 #else 16518 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __a, __b); 16519 #endif 16520 } 16521 16522 #ifdef __VSX__ 16523 static __inline__ int __ATTRS_o_ai vec_any_gt(vector double __a, 16524 vector double __b) { 16525 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __a, __b); 16526 } 16527 #endif 16528 16529 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16530 static __inline__ int __ATTRS_o_ai vec_any_gt(vector signed __int128 __a, 16531 vector signed __int128 __b) { 16532 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __a, __b); 16533 } 16534 16535 static __inline__ int __ATTRS_o_ai vec_any_gt(vector unsigned __int128 __a, 16536 vector unsigned __int128 __b) { 16537 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __a, __b); 16538 } 16539 #endif 16540 16541 /* vec_any_le */ 16542 16543 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16544 vector signed char __b) { 16545 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, __b); 16546 } 16547 16548 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed char __a, 16549 vector bool char __b) { 16550 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, __a, 16551 (vector signed char)__b); 16552 } 16553 16554 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16555 vector unsigned char __b) { 16556 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, __b); 16557 } 16558 16559 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned char __a, 16560 vector bool char __b) { 16561 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, __a, 16562 (vector unsigned char)__b); 16563 } 16564 16565 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16566 vector signed char __b) { 16567 return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)__a, 16568 __b); 16569 } 16570 16571 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16572 vector unsigned char __b) { 16573 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16574 __b); 16575 } 16576 16577 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool char __a, 16578 vector bool char __b) { 16579 return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)__a, 16580 (vector unsigned char)__b); 16581 } 16582 16583 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16584 vector short __b) { 16585 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, __b); 16586 } 16587 16588 static __inline__ int __ATTRS_o_ai vec_any_le(vector short __a, 16589 vector bool short __b) { 16590 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, __a, (vector short)__b); 16591 } 16592 16593 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16594 vector unsigned short __b) { 16595 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, __b); 16596 } 16597 16598 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned short __a, 16599 vector bool short __b) { 16600 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, __a, 16601 (vector unsigned short)__b); 16602 } 16603 16604 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16605 vector short __b) { 16606 return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector signed short)__a, 16607 __b); 16608 } 16609 16610 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16611 vector unsigned short __b) { 16612 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16613 __b); 16614 } 16615 16616 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool short __a, 16617 vector bool short __b) { 16618 return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)__a, 16619 (vector unsigned short)__b); 16620 } 16621 16622 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, vector int __b) { 16623 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, __b); 16624 } 16625 16626 static __inline__ int __ATTRS_o_ai vec_any_le(vector int __a, 16627 vector bool int __b) { 16628 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, __a, (vector int)__b); 16629 } 16630 16631 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16632 vector unsigned int __b) { 16633 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, __b); 16634 } 16635 16636 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned int __a, 16637 vector bool int __b) { 16638 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, __a, 16639 (vector unsigned int)__b); 16640 } 16641 16642 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16643 vector int __b) { 16644 return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector signed int)__a, 16645 __b); 16646 } 16647 16648 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16649 vector unsigned int __b) { 16650 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16651 __b); 16652 } 16653 16654 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool int __a, 16655 vector bool int __b) { 16656 return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)__a, 16657 (vector unsigned int)__b); 16658 } 16659 16660 #ifdef __VSX__ 16661 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16662 vector signed long long __b) { 16663 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, __b); 16664 } 16665 16666 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16667 vector unsigned long long __b) { 16668 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, __b); 16669 } 16670 16671 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed long long __a, 16672 vector bool long long __b) { 16673 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, __a, 16674 (vector signed long long)__b); 16675 } 16676 16677 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned long long __a, 16678 vector bool long long __b) { 16679 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, __a, 16680 (vector unsigned long long)__b); 16681 } 16682 16683 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16684 vector signed long long __b) { 16685 return __builtin_altivec_vcmpgtsd_p(__CR6_LT_REV, 16686 (vector signed long long)__a, __b); 16687 } 16688 16689 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16690 vector unsigned long long __b) { 16691 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16692 (vector unsigned long long)__a, __b); 16693 } 16694 16695 static __inline__ int __ATTRS_o_ai vec_any_le(vector bool long long __a, 16696 vector bool long long __b) { 16697 return __builtin_altivec_vcmpgtud_p(__CR6_LT_REV, 16698 (vector unsigned long long)__a, 16699 (vector unsigned long long)__b); 16700 } 16701 #endif 16702 16703 static __inline__ int __ATTRS_o_ai vec_any_le(vector float __a, 16704 vector float __b) { 16705 #ifdef __VSX__ 16706 return __builtin_vsx_xvcmpgesp_p(__CR6_EQ_REV, __b, __a); 16707 #else 16708 return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, __b, __a); 16709 #endif 16710 } 16711 16712 #ifdef __VSX__ 16713 static __inline__ int __ATTRS_o_ai vec_any_le(vector double __a, 16714 vector double __b) { 16715 return __builtin_vsx_xvcmpgedp_p(__CR6_EQ_REV, __b, __a); 16716 } 16717 #endif 16718 16719 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16720 static __inline__ int __ATTRS_o_ai vec_any_le(vector signed __int128 __a, 16721 vector signed __int128 __b) { 16722 return __builtin_altivec_vcmpgtsq_p(__CR6_LT_REV, __a, __b); 16723 } 16724 16725 static __inline__ int __ATTRS_o_ai vec_any_le(vector unsigned __int128 __a, 16726 vector unsigned __int128 __b) { 16727 return __builtin_altivec_vcmpgtuq_p(__CR6_LT_REV, __a, __b); 16728 } 16729 #endif 16730 16731 /* vec_any_lt */ 16732 16733 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16734 vector signed char __b) { 16735 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, __a); 16736 } 16737 16738 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed char __a, 16739 vector bool char __b) { 16740 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)__b, 16741 __a); 16742 } 16743 16744 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16745 vector unsigned char __b) { 16746 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, __a); 16747 } 16748 16749 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned char __a, 16750 vector bool char __b) { 16751 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16752 __a); 16753 } 16754 16755 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16756 vector signed char __b) { 16757 return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, __b, 16758 (vector signed char)__a); 16759 } 16760 16761 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16762 vector unsigned char __b) { 16763 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, __b, 16764 (vector unsigned char)__a); 16765 } 16766 16767 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool char __a, 16768 vector bool char __b) { 16769 return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)__b, 16770 (vector unsigned char)__a); 16771 } 16772 16773 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16774 vector short __b) { 16775 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, __a); 16776 } 16777 16778 static __inline__ int __ATTRS_o_ai vec_any_lt(vector short __a, 16779 vector bool short __b) { 16780 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)__b, __a); 16781 } 16782 16783 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16784 vector unsigned short __b) { 16785 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, __a); 16786 } 16787 16788 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned short __a, 16789 vector bool short __b) { 16790 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16791 __a); 16792 } 16793 16794 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16795 vector short __b) { 16796 return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, __b, 16797 (vector signed short)__a); 16798 } 16799 16800 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16801 vector unsigned short __b) { 16802 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, __b, 16803 (vector unsigned short)__a); 16804 } 16805 16806 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool short __a, 16807 vector bool short __b) { 16808 return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)__b, 16809 (vector unsigned short)__a); 16810 } 16811 16812 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, vector int __b) { 16813 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, __a); 16814 } 16815 16816 static __inline__ int __ATTRS_o_ai vec_any_lt(vector int __a, 16817 vector bool int __b) { 16818 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)__b, __a); 16819 } 16820 16821 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16822 vector unsigned int __b) { 16823 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, __a); 16824 } 16825 16826 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned int __a, 16827 vector bool int __b) { 16828 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16829 __a); 16830 } 16831 16832 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16833 vector int __b) { 16834 return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, __b, 16835 (vector signed int)__a); 16836 } 16837 16838 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16839 vector unsigned int __b) { 16840 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, __b, 16841 (vector unsigned int)__a); 16842 } 16843 16844 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool int __a, 16845 vector bool int __b) { 16846 return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)__b, 16847 (vector unsigned int)__a); 16848 } 16849 16850 #ifdef __VSX__ 16851 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16852 vector signed long long __b) { 16853 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, __a); 16854 } 16855 16856 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16857 vector unsigned long long __b) { 16858 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, __a); 16859 } 16860 16861 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed long long __a, 16862 vector bool long long __b) { 16863 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, 16864 (vector signed long long)__b, __a); 16865 } 16866 16867 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned long long __a, 16868 vector bool long long __b) { 16869 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16870 (vector unsigned long long)__b, __a); 16871 } 16872 16873 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16874 vector signed long long __b) { 16875 return __builtin_altivec_vcmpgtsd_p(__CR6_EQ_REV, __b, 16876 (vector signed long long)__a); 16877 } 16878 16879 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16880 vector unsigned long long __b) { 16881 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, __b, 16882 (vector unsigned long long)__a); 16883 } 16884 16885 static __inline__ int __ATTRS_o_ai vec_any_lt(vector bool long long __a, 16886 vector bool long long __b) { 16887 return __builtin_altivec_vcmpgtud_p(__CR6_EQ_REV, 16888 (vector unsigned long long)__b, 16889 (vector unsigned long long)__a); 16890 } 16891 #endif 16892 16893 static __inline__ int __ATTRS_o_ai vec_any_lt(vector float __a, 16894 vector float __b) { 16895 #ifdef __VSX__ 16896 return __builtin_vsx_xvcmpgtsp_p(__CR6_EQ_REV, __b, __a); 16897 #else 16898 return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, __b, __a); 16899 #endif 16900 } 16901 16902 #ifdef __VSX__ 16903 static __inline__ int __ATTRS_o_ai vec_any_lt(vector double __a, 16904 vector double __b) { 16905 return __builtin_vsx_xvcmpgtdp_p(__CR6_EQ_REV, __b, __a); 16906 } 16907 #endif 16908 16909 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 16910 static __inline__ int __ATTRS_o_ai vec_any_lt(vector signed __int128 __a, 16911 vector signed __int128 __b) { 16912 return __builtin_altivec_vcmpgtsq_p(__CR6_EQ_REV, __b, __a); 16913 } 16914 16915 static __inline__ int __ATTRS_o_ai vec_any_lt(vector unsigned __int128 __a, 16916 vector unsigned __int128 __b) { 16917 return __builtin_altivec_vcmpgtuq_p(__CR6_EQ_REV, __b, __a); 16918 } 16919 #endif 16920 16921 /* vec_any_nan */ 16922 16923 static __inline__ int __ATTRS_o_ai vec_any_nan(vector float __a) { 16924 #ifdef __VSX__ 16925 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __a); 16926 #else 16927 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __a); 16928 #endif 16929 } 16930 #ifdef __VSX__ 16931 static __inline__ int __ATTRS_o_ai vec_any_nan(vector double __a) { 16932 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __a); 16933 } 16934 #endif 16935 16936 /* vec_any_ne */ 16937 16938 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16939 vector signed char __b) { 16940 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16941 (vector char)__b); 16942 } 16943 16944 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed char __a, 16945 vector bool char __b) { 16946 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16947 (vector char)__b); 16948 } 16949 16950 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16951 vector unsigned char __b) { 16952 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16953 (vector char)__b); 16954 } 16955 16956 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned char __a, 16957 vector bool char __b) { 16958 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16959 (vector char)__b); 16960 } 16961 16962 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16963 vector signed char __b) { 16964 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16965 (vector char)__b); 16966 } 16967 16968 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16969 vector unsigned char __b) { 16970 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16971 (vector char)__b); 16972 } 16973 16974 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool char __a, 16975 vector bool char __b) { 16976 return __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)__a, 16977 (vector char)__b); 16978 } 16979 16980 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16981 vector short __b) { 16982 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, __b); 16983 } 16984 16985 static __inline__ int __ATTRS_o_ai vec_any_ne(vector short __a, 16986 vector bool short __b) { 16987 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, __a, (vector short)__b); 16988 } 16989 16990 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16991 vector unsigned short __b) { 16992 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16993 (vector short)__b); 16994 } 16995 16996 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned short __a, 16997 vector bool short __b) { 16998 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 16999 (vector short)__b); 17000 } 17001 17002 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17003 vector short __b) { 17004 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17005 (vector short)__b); 17006 } 17007 17008 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17009 vector unsigned short __b) { 17010 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17011 (vector short)__b); 17012 } 17013 17014 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool short __a, 17015 vector bool short __b) { 17016 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17017 (vector short)__b); 17018 } 17019 17020 static __inline__ int __ATTRS_o_ai vec_any_ne(vector pixel __a, 17021 vector pixel __b) { 17022 return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, (vector short)__a, 17023 (vector short)__b); 17024 } 17025 17026 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, vector int __b) { 17027 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, __b); 17028 } 17029 17030 static __inline__ int __ATTRS_o_ai vec_any_ne(vector int __a, 17031 vector bool int __b) { 17032 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, __a, (vector int)__b); 17033 } 17034 17035 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17036 vector unsigned int __b) { 17037 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17038 (vector int)__b); 17039 } 17040 17041 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned int __a, 17042 vector bool int __b) { 17043 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17044 (vector int)__b); 17045 } 17046 17047 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17048 vector int __b) { 17049 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17050 (vector int)__b); 17051 } 17052 17053 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17054 vector unsigned int __b) { 17055 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17056 (vector int)__b); 17057 } 17058 17059 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool int __a, 17060 vector bool int __b) { 17061 return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)__a, 17062 (vector int)__b); 17063 } 17064 17065 #ifdef __VSX__ 17066 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17067 vector signed long long __b) { 17068 #ifdef __POWER8_VECTOR__ 17069 return __builtin_altivec_vcmpequd_p(__CR6_LT_REV, __a, __b); 17070 #else 17071 // Take advantage of the optimized sequence for vec_all_eq when vcmpequd is 17072 // not available. 17073 return !vec_all_eq(__a, __b); 17074 #endif 17075 } 17076 17077 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17078 vector unsigned long long __b) { 17079 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17080 } 17081 17082 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed long long __a, 17083 vector bool long long __b) { 17084 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17085 } 17086 17087 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned long long __a, 17088 vector bool long long __b) { 17089 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17090 } 17091 17092 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17093 vector signed long long __b) { 17094 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17095 } 17096 17097 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17098 vector unsigned long long __b) { 17099 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17100 } 17101 17102 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool long long __a, 17103 vector bool long long __b) { 17104 return vec_any_ne((vector signed long long)__a, (vector signed long long)__b); 17105 } 17106 #endif 17107 17108 static __inline__ int __ATTRS_o_ai vec_any_ne(vector float __a, 17109 vector float __b) { 17110 #ifdef __VSX__ 17111 return __builtin_vsx_xvcmpeqsp_p(__CR6_LT_REV, __a, __b); 17112 #else 17113 return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, __a, __b); 17114 #endif 17115 } 17116 17117 #ifdef __VSX__ 17118 static __inline__ int __ATTRS_o_ai vec_any_ne(vector double __a, 17119 vector double __b) { 17120 return __builtin_vsx_xvcmpeqdp_p(__CR6_LT_REV, __a, __b); 17121 } 17122 #endif 17123 17124 #if defined(__POWER10_VECTOR__) && defined(__SIZEOF_INT128__) 17125 static __inline__ int __ATTRS_o_ai vec_any_ne(vector signed __int128 __a, 17126 vector signed __int128 __b) { 17127 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17128 } 17129 17130 static __inline__ int __ATTRS_o_ai vec_any_ne(vector unsigned __int128 __a, 17131 vector unsigned __int128 __b) { 17132 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17133 } 17134 17135 static __inline__ int __ATTRS_o_ai vec_any_ne(vector bool __int128 __a, 17136 vector bool __int128 __b) { 17137 return __builtin_altivec_vcmpequq_p(__CR6_LT_REV, __a, __b); 17138 } 17139 #endif 17140 17141 /* vec_any_nge */ 17142 17143 static __inline__ int __ATTRS_o_ai vec_any_nge(vector float __a, 17144 vector float __b) { 17145 #ifdef __VSX__ 17146 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __a, __b); 17147 #else 17148 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __a, __b); 17149 #endif 17150 } 17151 17152 #ifdef __VSX__ 17153 static __inline__ int __ATTRS_o_ai vec_any_nge(vector double __a, 17154 vector double __b) { 17155 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __a, __b); 17156 } 17157 #endif 17158 17159 /* vec_any_ngt */ 17160 17161 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector float __a, 17162 vector float __b) { 17163 #ifdef __VSX__ 17164 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __a, __b); 17165 #else 17166 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __a, __b); 17167 #endif 17168 } 17169 17170 #ifdef __VSX__ 17171 static __inline__ int __ATTRS_o_ai vec_any_ngt(vector double __a, 17172 vector double __b) { 17173 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __a, __b); 17174 } 17175 #endif 17176 17177 /* vec_any_nle */ 17178 17179 static __inline__ int __ATTRS_o_ai vec_any_nle(vector float __a, 17180 vector float __b) { 17181 #ifdef __VSX__ 17182 return __builtin_vsx_xvcmpgesp_p(__CR6_LT_REV, __b, __a); 17183 #else 17184 return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, __b, __a); 17185 #endif 17186 } 17187 17188 #ifdef __VSX__ 17189 static __inline__ int __ATTRS_o_ai vec_any_nle(vector double __a, 17190 vector double __b) { 17191 return __builtin_vsx_xvcmpgedp_p(__CR6_LT_REV, __b, __a); 17192 } 17193 #endif 17194 17195 /* vec_any_nlt */ 17196 17197 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector float __a, 17198 vector float __b) { 17199 #ifdef __VSX__ 17200 return __builtin_vsx_xvcmpgtsp_p(__CR6_LT_REV, __b, __a); 17201 #else 17202 return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, __b, __a); 17203 #endif 17204 } 17205 17206 #ifdef __VSX__ 17207 static __inline__ int __ATTRS_o_ai vec_any_nlt(vector double __a, 17208 vector double __b) { 17209 return __builtin_vsx_xvcmpgtdp_p(__CR6_LT_REV, __b, __a); 17210 } 17211 #endif 17212 17213 /* vec_any_numeric */ 17214 17215 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector float __a) { 17216 #ifdef __VSX__ 17217 return __builtin_vsx_xvcmpeqsp_p(__CR6_EQ_REV, __a, __a); 17218 #else 17219 return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, __a, __a); 17220 #endif 17221 } 17222 17223 #ifdef __VSX__ 17224 static __inline__ int __ATTRS_o_ai vec_any_numeric(vector double __a) { 17225 return __builtin_vsx_xvcmpeqdp_p(__CR6_EQ_REV, __a, __a); 17226 } 17227 #endif 17228 17229 /* vec_any_out */ 17230 17231 static __inline__ int __attribute__((__always_inline__)) 17232 vec_any_out(vector float __a, vector float __b) { 17233 return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, __a, __b); 17234 } 17235 17236 /* Power 8 Crypto functions 17237 Note: We diverge from the current GCC implementation with regard 17238 to cryptography and related functions as follows: 17239 - Only the SHA and AES instructions and builtins are disabled by -mno-crypto 17240 - The remaining ones are only available on Power8 and up so 17241 require -mpower8-vector 17242 The justification for this is that export requirements require that 17243 Category:Vector.Crypto is optional (i.e. compliant hardware may not provide 17244 support). As a result, we need to be able to turn off support for those. 17245 The remaining ones (currently controlled by -mcrypto for GCC) still 17246 need to be provided on compliant hardware even if Vector.Crypto is not 17247 provided. 17248 */ 17249 #ifdef __CRYPTO__ 17250 #define vec_sbox_be __builtin_altivec_crypto_vsbox 17251 #define vec_cipher_be __builtin_altivec_crypto_vcipher 17252 #define vec_cipherlast_be __builtin_altivec_crypto_vcipherlast 17253 #define vec_ncipher_be __builtin_altivec_crypto_vncipher 17254 #define vec_ncipherlast_be __builtin_altivec_crypto_vncipherlast 17255 17256 #ifdef __VSX__ 17257 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17258 __builtin_crypto_vsbox(vector unsigned long long __a) { 17259 return __builtin_altivec_crypto_vsbox(__a); 17260 } 17261 17262 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17263 __builtin_crypto_vcipher(vector unsigned long long __a, 17264 vector unsigned long long __b) { 17265 return __builtin_altivec_crypto_vcipher(__a, __b); 17266 } 17267 17268 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17269 __builtin_crypto_vcipherlast(vector unsigned long long __a, 17270 vector unsigned long long __b) { 17271 return __builtin_altivec_crypto_vcipherlast(__a, __b); 17272 } 17273 17274 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17275 __builtin_crypto_vncipher(vector unsigned long long __a, 17276 vector unsigned long long __b) { 17277 return __builtin_altivec_crypto_vncipher(__a, __b); 17278 } 17279 17280 static __inline__ vector unsigned long long __attribute__((__always_inline__)) 17281 __builtin_crypto_vncipherlast(vector unsigned long long __a, 17282 vector unsigned long long __b) { 17283 return __builtin_altivec_crypto_vncipherlast(__a, __b); 17284 } 17285 #endif /* __VSX__ */ 17286 17287 #define __builtin_crypto_vshasigmad __builtin_altivec_crypto_vshasigmad 17288 #define __builtin_crypto_vshasigmaw __builtin_altivec_crypto_vshasigmaw 17289 17290 #define vec_shasigma_be(X, Y, Z) \ 17291 _Generic((X), vector unsigned int \ 17292 : __builtin_crypto_vshasigmaw, vector unsigned long long \ 17293 : __builtin_crypto_vshasigmad)((X), (Y), (Z)) 17294 #endif 17295 17296 #ifdef __POWER8_VECTOR__ 17297 static __inline__ vector bool char __ATTRS_o_ai 17298 vec_permxor(vector bool char __a, vector bool char __b, 17299 vector bool char __c) { 17300 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17301 } 17302 17303 static __inline__ vector signed char __ATTRS_o_ai 17304 vec_permxor(vector signed char __a, vector signed char __b, 17305 vector signed char __c) { 17306 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17307 } 17308 17309 static __inline__ vector unsigned char __ATTRS_o_ai 17310 vec_permxor(vector unsigned char __a, vector unsigned char __b, 17311 vector unsigned char __c) { 17312 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17313 } 17314 17315 static __inline__ vector unsigned char __ATTRS_o_ai 17316 __builtin_crypto_vpermxor(vector unsigned char __a, vector unsigned char __b, 17317 vector unsigned char __c) { 17318 return __builtin_altivec_crypto_vpermxor(__a, __b, __c); 17319 } 17320 17321 static __inline__ vector unsigned short __ATTRS_o_ai 17322 __builtin_crypto_vpermxor(vector unsigned short __a, vector unsigned short __b, 17323 vector unsigned short __c) { 17324 return (vector unsigned short)__builtin_altivec_crypto_vpermxor( 17325 (vector unsigned char)__a, (vector unsigned char)__b, 17326 (vector unsigned char)__c); 17327 } 17328 17329 static __inline__ vector unsigned int __ATTRS_o_ai __builtin_crypto_vpermxor( 17330 vector unsigned int __a, vector unsigned int __b, vector unsigned int __c) { 17331 return (vector unsigned int)__builtin_altivec_crypto_vpermxor( 17332 (vector unsigned char)__a, (vector unsigned char)__b, 17333 (vector unsigned char)__c); 17334 } 17335 17336 static __inline__ vector unsigned long long __ATTRS_o_ai 17337 __builtin_crypto_vpermxor(vector unsigned long long __a, 17338 vector unsigned long long __b, 17339 vector unsigned long long __c) { 17340 return (vector unsigned long long)__builtin_altivec_crypto_vpermxor( 17341 (vector unsigned char)__a, (vector unsigned char)__b, 17342 (vector unsigned char)__c); 17343 } 17344 17345 static __inline__ vector unsigned char __ATTRS_o_ai 17346 __builtin_crypto_vpmsumb(vector unsigned char __a, vector unsigned char __b) { 17347 return __builtin_altivec_crypto_vpmsumb(__a, __b); 17348 } 17349 17350 static __inline__ vector unsigned short __ATTRS_o_ai 17351 __builtin_crypto_vpmsumb(vector unsigned short __a, vector unsigned short __b) { 17352 return __builtin_altivec_crypto_vpmsumh(__a, __b); 17353 } 17354 17355 static __inline__ vector unsigned int __ATTRS_o_ai 17356 __builtin_crypto_vpmsumb(vector unsigned int __a, vector unsigned int __b) { 17357 return __builtin_altivec_crypto_vpmsumw(__a, __b); 17358 } 17359 17360 static __inline__ vector unsigned long long __ATTRS_o_ai 17361 __builtin_crypto_vpmsumb(vector unsigned long long __a, 17362 vector unsigned long long __b) { 17363 return __builtin_altivec_crypto_vpmsumd(__a, __b); 17364 } 17365 17366 static __inline__ vector signed char __ATTRS_o_ai 17367 vec_vgbbd(vector signed char __a) { 17368 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17369 } 17370 17371 #define vec_pmsum_be __builtin_crypto_vpmsumb 17372 #define vec_gb __builtin_altivec_vgbbd 17373 17374 static __inline__ vector unsigned char __ATTRS_o_ai 17375 vec_vgbbd(vector unsigned char __a) { 17376 return __builtin_altivec_vgbbd(__a); 17377 } 17378 17379 static __inline__ vector signed long long __ATTRS_o_ai 17380 vec_gbb(vector signed long long __a) { 17381 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17382 } 17383 17384 static __inline__ vector unsigned long long __ATTRS_o_ai 17385 vec_gbb(vector unsigned long long __a) { 17386 return __builtin_altivec_vgbbd((vector unsigned char)__a); 17387 } 17388 17389 static __inline__ vector long long __ATTRS_o_ai 17390 vec_vbpermq(vector signed char __a, vector signed char __b) { 17391 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17392 (vector unsigned char)__b); 17393 } 17394 17395 static __inline__ vector long long __ATTRS_o_ai 17396 vec_vbpermq(vector unsigned char __a, vector unsigned char __b) { 17397 return __builtin_altivec_vbpermq(__a, __b); 17398 } 17399 17400 #if defined(__powerpc64__) && defined(__SIZEOF_INT128__) 17401 static __inline__ vector unsigned long long __ATTRS_o_ai 17402 vec_bperm(vector unsigned __int128 __a, vector unsigned char __b) { 17403 return __builtin_altivec_vbpermq((vector unsigned char)__a, 17404 (vector unsigned char)__b); 17405 } 17406 #endif 17407 static __inline__ vector unsigned char __ATTRS_o_ai 17408 vec_bperm(vector unsigned char __a, vector unsigned char __b) { 17409 return __builtin_altivec_vbpermq(__a, __b); 17410 } 17411 #endif // __POWER8_VECTOR__ 17412 #ifdef __POWER9_VECTOR__ 17413 static __inline__ vector unsigned long long __ATTRS_o_ai 17414 vec_bperm(vector unsigned long long __a, vector unsigned char __b) { 17415 return __builtin_altivec_vbpermd(__a, __b); 17416 } 17417 #endif 17418 17419 17420 /* vec_reve */ 17421 17422 static inline __ATTRS_o_ai vector bool char vec_reve(vector bool char __a) { 17423 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17424 5, 4, 3, 2, 1, 0); 17425 } 17426 17427 static inline __ATTRS_o_ai vector signed char vec_reve(vector signed char __a) { 17428 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17429 5, 4, 3, 2, 1, 0); 17430 } 17431 17432 static inline __ATTRS_o_ai vector unsigned char 17433 vec_reve(vector unsigned char __a) { 17434 return __builtin_shufflevector(__a, __a, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 17435 5, 4, 3, 2, 1, 0); 17436 } 17437 17438 static inline __ATTRS_o_ai vector bool int vec_reve(vector bool int __a) { 17439 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17440 } 17441 17442 static inline __ATTRS_o_ai vector signed int vec_reve(vector signed int __a) { 17443 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17444 } 17445 17446 static inline __ATTRS_o_ai vector unsigned int 17447 vec_reve(vector unsigned int __a) { 17448 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17449 } 17450 17451 static inline __ATTRS_o_ai vector bool short vec_reve(vector bool short __a) { 17452 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17453 } 17454 17455 static inline __ATTRS_o_ai vector signed short 17456 vec_reve(vector signed short __a) { 17457 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17458 } 17459 17460 static inline __ATTRS_o_ai vector unsigned short 17461 vec_reve(vector unsigned short __a) { 17462 return __builtin_shufflevector(__a, __a, 7, 6, 5, 4, 3, 2, 1, 0); 17463 } 17464 17465 static inline __ATTRS_o_ai vector float vec_reve(vector float __a) { 17466 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0); 17467 } 17468 17469 #ifdef __VSX__ 17470 static inline __ATTRS_o_ai vector bool long long 17471 vec_reve(vector bool long long __a) { 17472 return __builtin_shufflevector(__a, __a, 1, 0); 17473 } 17474 17475 static inline __ATTRS_o_ai vector signed long long 17476 vec_reve(vector signed long long __a) { 17477 return __builtin_shufflevector(__a, __a, 1, 0); 17478 } 17479 17480 static inline __ATTRS_o_ai vector unsigned long long 17481 vec_reve(vector unsigned long long __a) { 17482 return __builtin_shufflevector(__a, __a, 1, 0); 17483 } 17484 17485 static inline __ATTRS_o_ai vector double vec_reve(vector double __a) { 17486 return __builtin_shufflevector(__a, __a, 1, 0); 17487 } 17488 #endif 17489 17490 /* vec_revb */ 17491 static __inline__ vector bool char __ATTRS_o_ai 17492 vec_revb(vector bool char __a) { 17493 return __a; 17494 } 17495 17496 static __inline__ vector signed char __ATTRS_o_ai 17497 vec_revb(vector signed char __a) { 17498 return __a; 17499 } 17500 17501 static __inline__ vector unsigned char __ATTRS_o_ai 17502 vec_revb(vector unsigned char __a) { 17503 return __a; 17504 } 17505 17506 static __inline__ vector bool short __ATTRS_o_ai 17507 vec_revb(vector bool short __a) { 17508 vector unsigned char __indices = 17509 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17510 return vec_perm(__a, __a, __indices); 17511 } 17512 17513 static __inline__ vector signed short __ATTRS_o_ai 17514 vec_revb(vector signed short __a) { 17515 vector unsigned char __indices = 17516 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17517 return vec_perm(__a, __a, __indices); 17518 } 17519 17520 static __inline__ vector unsigned short __ATTRS_o_ai 17521 vec_revb(vector unsigned short __a) { 17522 vector unsigned char __indices = 17523 { 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14 }; 17524 return vec_perm(__a, __a, __indices); 17525 } 17526 17527 static __inline__ vector bool int __ATTRS_o_ai 17528 vec_revb(vector bool int __a) { 17529 vector unsigned char __indices = 17530 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17531 return vec_perm(__a, __a, __indices); 17532 } 17533 17534 static __inline__ vector signed int __ATTRS_o_ai 17535 vec_revb(vector signed int __a) { 17536 vector unsigned char __indices = 17537 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17538 return vec_perm(__a, __a, __indices); 17539 } 17540 17541 static __inline__ vector unsigned int __ATTRS_o_ai 17542 vec_revb(vector unsigned int __a) { 17543 vector unsigned char __indices = 17544 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17545 return vec_perm(__a, __a, __indices); 17546 } 17547 17548 static __inline__ vector float __ATTRS_o_ai 17549 vec_revb(vector float __a) { 17550 vector unsigned char __indices = 17551 { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 }; 17552 return vec_perm(__a, __a, __indices); 17553 } 17554 17555 #ifdef __VSX__ 17556 static __inline__ vector bool long long __ATTRS_o_ai 17557 vec_revb(vector bool long long __a) { 17558 vector unsigned char __indices = 17559 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17560 return vec_perm(__a, __a, __indices); 17561 } 17562 17563 static __inline__ vector signed long long __ATTRS_o_ai 17564 vec_revb(vector signed long long __a) { 17565 vector unsigned char __indices = 17566 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17567 return vec_perm(__a, __a, __indices); 17568 } 17569 17570 static __inline__ vector unsigned long long __ATTRS_o_ai 17571 vec_revb(vector unsigned long long __a) { 17572 vector unsigned char __indices = 17573 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17574 return vec_perm(__a, __a, __indices); 17575 } 17576 17577 static __inline__ vector double __ATTRS_o_ai 17578 vec_revb(vector double __a) { 17579 vector unsigned char __indices = 17580 { 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 }; 17581 return vec_perm(__a, __a, __indices); 17582 } 17583 #endif /* End __VSX__ */ 17584 17585 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17586 defined(__SIZEOF_INT128__) 17587 static __inline__ vector signed __int128 __ATTRS_o_ai 17588 vec_revb(vector signed __int128 __a) { 17589 vector unsigned char __indices = 17590 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17591 return (vector signed __int128)vec_perm((vector signed int)__a, 17592 (vector signed int)__a, 17593 __indices); 17594 } 17595 17596 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17597 vec_revb(vector unsigned __int128 __a) { 17598 vector unsigned char __indices = 17599 { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; 17600 return (vector unsigned __int128)vec_perm((vector signed int)__a, 17601 (vector signed int)__a, 17602 __indices); 17603 } 17604 #endif /* END __POWER8_VECTOR__ && __powerpc64__ */ 17605 17606 /* vec_xl */ 17607 17608 #define vec_xld2 vec_xl 17609 #define vec_xlw4 vec_xl 17610 typedef vector signed char unaligned_vec_schar __attribute__((aligned(1))); 17611 typedef vector unsigned char unaligned_vec_uchar __attribute__((aligned(1))); 17612 typedef vector signed short unaligned_vec_sshort __attribute__((aligned(1))); 17613 typedef vector unsigned short unaligned_vec_ushort __attribute__((aligned(1))); 17614 typedef vector signed int unaligned_vec_sint __attribute__((aligned(1))); 17615 typedef vector unsigned int unaligned_vec_uint __attribute__((aligned(1))); 17616 typedef vector float unaligned_vec_float __attribute__((aligned(1))); 17617 17618 static inline __ATTRS_o_ai vector signed char vec_xl(ptrdiff_t __offset, 17619 const signed char *__ptr) { 17620 return *(unaligned_vec_schar *)(__ptr + __offset); 17621 } 17622 17623 static inline __ATTRS_o_ai vector unsigned char 17624 vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) { 17625 return *(unaligned_vec_uchar*)(__ptr + __offset); 17626 } 17627 17628 static inline __ATTRS_o_ai vector signed short 17629 vec_xl(ptrdiff_t __offset, const signed short *__ptr) { 17630 signed char *__addr = (signed char *)__ptr + __offset; 17631 return *(unaligned_vec_sshort *)__addr; 17632 } 17633 17634 static inline __ATTRS_o_ai vector unsigned short 17635 vec_xl(ptrdiff_t __offset, const unsigned short *__ptr) { 17636 signed char *__addr = (signed char *)__ptr + __offset; 17637 return *(unaligned_vec_ushort *)__addr; 17638 } 17639 17640 static inline __ATTRS_o_ai vector signed int vec_xl(ptrdiff_t __offset, 17641 const signed int *__ptr) { 17642 signed char *__addr = (signed char *)__ptr + __offset; 17643 return *(unaligned_vec_sint *)__addr; 17644 } 17645 17646 static inline __ATTRS_o_ai vector unsigned int 17647 vec_xl(ptrdiff_t __offset, const unsigned int *__ptr) { 17648 signed char *__addr = (signed char *)__ptr + __offset; 17649 return *(unaligned_vec_uint *)__addr; 17650 } 17651 17652 static inline __ATTRS_o_ai vector float vec_xl(ptrdiff_t __offset, 17653 const float *__ptr) { 17654 signed char *__addr = (signed char *)__ptr + __offset; 17655 return *(unaligned_vec_float *)__addr; 17656 } 17657 17658 #ifdef __VSX__ 17659 typedef vector signed long long unaligned_vec_sll __attribute__((aligned(1))); 17660 typedef vector unsigned long long unaligned_vec_ull __attribute__((aligned(1))); 17661 typedef vector double unaligned_vec_double __attribute__((aligned(1))); 17662 17663 static inline __ATTRS_o_ai vector signed long long 17664 vec_xl(ptrdiff_t __offset, const signed long long *__ptr) { 17665 signed char *__addr = (signed char *)__ptr + __offset; 17666 return *(unaligned_vec_sll *)__addr; 17667 } 17668 17669 static inline __ATTRS_o_ai vector unsigned long long 17670 vec_xl(ptrdiff_t __offset, const unsigned long long *__ptr) { 17671 signed char *__addr = (signed char *)__ptr + __offset; 17672 return *(unaligned_vec_ull *)__addr; 17673 } 17674 17675 static inline __ATTRS_o_ai vector double vec_xl(ptrdiff_t __offset, 17676 const double *__ptr) { 17677 signed char *__addr = (signed char *)__ptr + __offset; 17678 return *(unaligned_vec_double *)__addr; 17679 } 17680 #endif 17681 17682 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17683 defined(__SIZEOF_INT128__) 17684 typedef vector signed __int128 unaligned_vec_si128 __attribute__((aligned(1))); 17685 typedef vector unsigned __int128 unaligned_vec_ui128 17686 __attribute__((aligned(1))); 17687 static inline __ATTRS_o_ai vector signed __int128 17688 vec_xl(ptrdiff_t __offset, const signed __int128 *__ptr) { 17689 signed char *__addr = (signed char *)__ptr + __offset; 17690 return *(unaligned_vec_si128 *)__addr; 17691 } 17692 17693 static inline __ATTRS_o_ai vector unsigned __int128 17694 vec_xl(ptrdiff_t __offset, const unsigned __int128 *__ptr) { 17695 signed char *__addr = (signed char *)__ptr + __offset; 17696 return *(unaligned_vec_ui128 *)__addr; 17697 } 17698 #endif 17699 17700 /* vec_xl_be */ 17701 17702 #ifdef __LITTLE_ENDIAN__ 17703 static __inline__ vector signed char __ATTRS_o_ai 17704 vec_xl_be(ptrdiff_t __offset, const signed char *__ptr) { 17705 vector signed char __vec = (vector signed char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17706 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17707 13, 12, 11, 10, 9, 8); 17708 } 17709 17710 static __inline__ vector unsigned char __ATTRS_o_ai 17711 vec_xl_be(ptrdiff_t __offset, const unsigned char *__ptr) { 17712 vector unsigned char __vec = (vector unsigned char)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17713 return __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 17714 13, 12, 11, 10, 9, 8); 17715 } 17716 17717 static __inline__ vector signed short __ATTRS_o_ai 17718 vec_xl_be(ptrdiff_t __offset, const signed short *__ptr) { 17719 vector signed short __vec = (vector signed short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17720 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17721 } 17722 17723 static __inline__ vector unsigned short __ATTRS_o_ai 17724 vec_xl_be(ptrdiff_t __offset, const unsigned short *__ptr) { 17725 vector unsigned short __vec = (vector unsigned short)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17726 return __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 17727 } 17728 17729 static __inline__ vector signed int __ATTRS_o_ai 17730 vec_xl_be(signed long long __offset, const signed int *__ptr) { 17731 return (vector signed int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17732 } 17733 17734 static __inline__ vector unsigned int __ATTRS_o_ai 17735 vec_xl_be(signed long long __offset, const unsigned int *__ptr) { 17736 return (vector unsigned int)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17737 } 17738 17739 static __inline__ vector float __ATTRS_o_ai 17740 vec_xl_be(signed long long __offset, const float *__ptr) { 17741 return (vector float)__builtin_vsx_lxvw4x_be(__offset, __ptr); 17742 } 17743 17744 #ifdef __VSX__ 17745 static __inline__ vector signed long long __ATTRS_o_ai 17746 vec_xl_be(signed long long __offset, const signed long long *__ptr) { 17747 return (vector signed long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17748 } 17749 17750 static __inline__ vector unsigned long long __ATTRS_o_ai 17751 vec_xl_be(signed long long __offset, const unsigned long long *__ptr) { 17752 return (vector unsigned long long)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17753 } 17754 17755 static __inline__ vector double __ATTRS_o_ai 17756 vec_xl_be(signed long long __offset, const double *__ptr) { 17757 return (vector double)__builtin_vsx_lxvd2x_be(__offset, __ptr); 17758 } 17759 #endif 17760 17761 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17762 defined(__SIZEOF_INT128__) 17763 static __inline__ vector signed __int128 __ATTRS_o_ai 17764 vec_xl_be(signed long long __offset, const signed __int128 *__ptr) { 17765 return vec_xl(__offset, __ptr); 17766 } 17767 17768 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17769 vec_xl_be(signed long long __offset, const unsigned __int128 *__ptr) { 17770 return vec_xl(__offset, __ptr); 17771 } 17772 #endif 17773 #else 17774 #define vec_xl_be vec_xl 17775 #endif 17776 17777 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17778 defined(__SIZEOF_INT128__) 17779 17780 /* vect_xl_sext */ 17781 17782 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17783 vec_xl_sext(ptrdiff_t __offset, const signed char *__pointer) { 17784 return (vector unsigned __int128)*(__pointer + __offset); 17785 } 17786 17787 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17788 vec_xl_sext(ptrdiff_t __offset, const signed short *__pointer) { 17789 return (vector unsigned __int128)*(__pointer + __offset); 17790 } 17791 17792 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17793 vec_xl_sext(ptrdiff_t __offset, const signed int *__pointer) { 17794 return (vector unsigned __int128)*(__pointer + __offset); 17795 } 17796 17797 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17798 vec_xl_sext(ptrdiff_t __offset, const signed long long *__pointer) { 17799 return (vector unsigned __int128)*(__pointer + __offset); 17800 } 17801 17802 /* vec_xl_zext */ 17803 17804 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17805 vec_xl_zext(ptrdiff_t __offset, const unsigned char *__pointer) { 17806 return (vector unsigned __int128)*(__pointer + __offset); 17807 } 17808 17809 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17810 vec_xl_zext(ptrdiff_t __offset, const unsigned short *__pointer) { 17811 return (vector unsigned __int128)*(__pointer + __offset); 17812 } 17813 17814 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17815 vec_xl_zext(ptrdiff_t __offset, const unsigned int *__pointer) { 17816 return (vector unsigned __int128)*(__pointer + __offset); 17817 } 17818 17819 static __inline__ vector unsigned __int128 __ATTRS_o_ai 17820 vec_xl_zext(ptrdiff_t __offset, const unsigned long long *__pointer) { 17821 return (vector unsigned __int128)*(__pointer + __offset); 17822 } 17823 17824 #endif 17825 17826 /* vec_xlds */ 17827 #ifdef __VSX__ 17828 static __inline__ vector signed long long __ATTRS_o_ai 17829 vec_xlds(ptrdiff_t __offset, const signed long long *__ptr) { 17830 signed long long *__addr = (signed long long*)((signed char *)__ptr + __offset); 17831 return (vector signed long long) *__addr; 17832 } 17833 17834 static __inline__ vector unsigned long long __ATTRS_o_ai 17835 vec_xlds(ptrdiff_t __offset, const unsigned long long *__ptr) { 17836 unsigned long long *__addr = (unsigned long long *)((signed char *)__ptr + __offset); 17837 return (unaligned_vec_ull) *__addr; 17838 } 17839 17840 static __inline__ vector double __ATTRS_o_ai vec_xlds(ptrdiff_t __offset, 17841 const double *__ptr) { 17842 double *__addr = (double*)((signed char *)__ptr + __offset); 17843 return (unaligned_vec_double) *__addr; 17844 } 17845 17846 /* vec_load_splats */ 17847 static __inline__ vector signed int __ATTRS_o_ai 17848 vec_load_splats(signed long long __offset, const signed int *__ptr) { 17849 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17850 return (vector signed int)*__addr; 17851 } 17852 17853 static __inline__ vector signed int __ATTRS_o_ai 17854 vec_load_splats(unsigned long long __offset, const signed int *__ptr) { 17855 signed int *__addr = (signed int*)((signed char *)__ptr + __offset); 17856 return (vector signed int)*__addr; 17857 } 17858 17859 static __inline__ vector unsigned int __ATTRS_o_ai 17860 vec_load_splats(signed long long __offset, const unsigned int *__ptr) { 17861 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17862 return (vector unsigned int)*__addr; 17863 } 17864 17865 static __inline__ vector unsigned int __ATTRS_o_ai 17866 vec_load_splats(unsigned long long __offset, const unsigned int *__ptr) { 17867 unsigned int *__addr = (unsigned int*)((signed char *)__ptr + __offset); 17868 return (vector unsigned int)*__addr; 17869 } 17870 17871 static __inline__ vector float __ATTRS_o_ai 17872 vec_load_splats(signed long long __offset, const float *__ptr) { 17873 float *__addr = (float*)((signed char *)__ptr + __offset); 17874 return (vector float)*__addr; 17875 } 17876 17877 static __inline__ vector float __ATTRS_o_ai 17878 vec_load_splats(unsigned long long __offset, const float *__ptr) { 17879 float *__addr = (float*)((signed char *)__ptr + __offset); 17880 return (vector float)*__addr; 17881 } 17882 #endif 17883 17884 /* vec_xst */ 17885 17886 #define vec_xstd2 vec_xst 17887 #define vec_xstw4 vec_xst 17888 static inline __ATTRS_o_ai void 17889 vec_xst(vector signed char __vec, ptrdiff_t __offset, signed char *__ptr) { 17890 *(unaligned_vec_schar *)(__ptr + __offset) = __vec; 17891 } 17892 17893 static inline __ATTRS_o_ai void 17894 vec_xst(vector unsigned char __vec, ptrdiff_t __offset, unsigned char *__ptr) { 17895 *(unaligned_vec_uchar *)(__ptr + __offset) = __vec; 17896 } 17897 17898 static inline __ATTRS_o_ai void 17899 vec_xst(vector signed short __vec, ptrdiff_t __offset, signed short *__ptr) { 17900 signed char *__addr = (signed char *)__ptr + __offset; 17901 *(unaligned_vec_sshort *)__addr = __vec; 17902 } 17903 17904 static inline __ATTRS_o_ai void vec_xst(vector unsigned short __vec, 17905 ptrdiff_t __offset, 17906 unsigned short *__ptr) { 17907 signed char *__addr = (signed char *)__ptr + __offset; 17908 *(unaligned_vec_ushort *)__addr = __vec; 17909 } 17910 17911 static inline __ATTRS_o_ai void vec_xst(vector signed int __vec, 17912 ptrdiff_t __offset, signed int *__ptr) { 17913 signed char *__addr = (signed char *)__ptr + __offset; 17914 *(unaligned_vec_sint *)__addr = __vec; 17915 } 17916 17917 static inline __ATTRS_o_ai void 17918 vec_xst(vector unsigned int __vec, ptrdiff_t __offset, unsigned int *__ptr) { 17919 signed char *__addr = (signed char *)__ptr + __offset; 17920 *(unaligned_vec_uint *)__addr = __vec; 17921 } 17922 17923 static inline __ATTRS_o_ai void vec_xst(vector float __vec, ptrdiff_t __offset, 17924 float *__ptr) { 17925 signed char *__addr = (signed char *)__ptr + __offset; 17926 *(unaligned_vec_float *)__addr = __vec; 17927 } 17928 17929 #ifdef __VSX__ 17930 static inline __ATTRS_o_ai void vec_xst(vector signed long long __vec, 17931 ptrdiff_t __offset, 17932 signed long long *__ptr) { 17933 signed char *__addr = (signed char *)__ptr + __offset; 17934 *(unaligned_vec_sll *)__addr = __vec; 17935 } 17936 17937 static inline __ATTRS_o_ai void vec_xst(vector unsigned long long __vec, 17938 ptrdiff_t __offset, 17939 unsigned long long *__ptr) { 17940 signed char *__addr = (signed char *)__ptr + __offset; 17941 *(unaligned_vec_ull *)__addr = __vec; 17942 } 17943 17944 static inline __ATTRS_o_ai void vec_xst(vector double __vec, ptrdiff_t __offset, 17945 double *__ptr) { 17946 signed char *__addr = (signed char *)__ptr + __offset; 17947 *(unaligned_vec_double *)__addr = __vec; 17948 } 17949 #endif 17950 17951 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 17952 defined(__SIZEOF_INT128__) 17953 static inline __ATTRS_o_ai void vec_xst(vector signed __int128 __vec, 17954 ptrdiff_t __offset, 17955 signed __int128 *__ptr) { 17956 signed char *__addr = (signed char *)__ptr + __offset; 17957 *(unaligned_vec_si128 *)__addr = __vec; 17958 } 17959 17960 static inline __ATTRS_o_ai void vec_xst(vector unsigned __int128 __vec, 17961 ptrdiff_t __offset, 17962 unsigned __int128 *__ptr) { 17963 signed char *__addr = (signed char *)__ptr + __offset; 17964 *(unaligned_vec_ui128 *)__addr = __vec; 17965 } 17966 #endif 17967 17968 /* vec_xst_trunc */ 17969 17970 #if defined(__POWER10_VECTOR__) && defined(__VSX__) && \ 17971 defined(__SIZEOF_INT128__) 17972 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17973 ptrdiff_t __offset, 17974 signed char *__ptr) { 17975 *(__ptr + __offset) = (signed char)__vec[0]; 17976 } 17977 17978 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17979 ptrdiff_t __offset, 17980 unsigned char *__ptr) { 17981 *(__ptr + __offset) = (unsigned char)__vec[0]; 17982 } 17983 17984 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17985 ptrdiff_t __offset, 17986 signed short *__ptr) { 17987 *(__ptr + __offset) = (signed short)__vec[0]; 17988 } 17989 17990 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 17991 ptrdiff_t __offset, 17992 unsigned short *__ptr) { 17993 *(__ptr + __offset) = (unsigned short)__vec[0]; 17994 } 17995 17996 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 17997 ptrdiff_t __offset, 17998 signed int *__ptr) { 17999 *(__ptr + __offset) = (signed int)__vec[0]; 18000 } 18001 18002 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18003 ptrdiff_t __offset, 18004 unsigned int *__ptr) { 18005 *(__ptr + __offset) = (unsigned int)__vec[0]; 18006 } 18007 18008 static inline __ATTRS_o_ai void vec_xst_trunc(vector signed __int128 __vec, 18009 ptrdiff_t __offset, 18010 signed long long *__ptr) { 18011 *(__ptr + __offset) = (signed long long)__vec[0]; 18012 } 18013 18014 static inline __ATTRS_o_ai void vec_xst_trunc(vector unsigned __int128 __vec, 18015 ptrdiff_t __offset, 18016 unsigned long long *__ptr) { 18017 *(__ptr + __offset) = (unsigned long long)__vec[0]; 18018 } 18019 #endif 18020 18021 /* vec_xst_be */ 18022 18023 #ifdef __LITTLE_ENDIAN__ 18024 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed char __vec, 18025 signed long long __offset, 18026 signed char *__ptr) { 18027 vector signed char __tmp = 18028 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 18029 13, 12, 11, 10, 9, 8); 18030 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18031 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18032 } 18033 18034 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned char __vec, 18035 signed long long __offset, 18036 unsigned char *__ptr) { 18037 vector unsigned char __tmp = 18038 __builtin_shufflevector(__vec, __vec, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 18039 13, 12, 11, 10, 9, 8); 18040 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18041 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18042 } 18043 18044 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed short __vec, 18045 signed long long __offset, 18046 signed short *__ptr) { 18047 vector signed short __tmp = 18048 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18049 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18050 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18051 } 18052 18053 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned short __vec, 18054 signed long long __offset, 18055 unsigned short *__ptr) { 18056 vector unsigned short __tmp = 18057 __builtin_shufflevector(__vec, __vec, 3, 2, 1, 0, 7, 6, 5, 4); 18058 typedef __attribute__((vector_size(sizeof(__tmp)))) double __vector_double; 18059 __builtin_vsx_stxvd2x_be((__vector_double)__tmp, __offset, __ptr); 18060 } 18061 18062 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed int __vec, 18063 signed long long __offset, 18064 signed int *__ptr) { 18065 __builtin_vsx_stxvw4x_be(__vec, __offset, __ptr); 18066 } 18067 18068 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned int __vec, 18069 signed long long __offset, 18070 unsigned int *__ptr) { 18071 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18072 } 18073 18074 static __inline__ void __ATTRS_o_ai vec_xst_be(vector float __vec, 18075 signed long long __offset, 18076 float *__ptr) { 18077 __builtin_vsx_stxvw4x_be((vector int)__vec, __offset, __ptr); 18078 } 18079 18080 #ifdef __VSX__ 18081 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed long long __vec, 18082 signed long long __offset, 18083 signed long long *__ptr) { 18084 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18085 } 18086 18087 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned long long __vec, 18088 signed long long __offset, 18089 unsigned long long *__ptr) { 18090 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18091 } 18092 18093 static __inline__ void __ATTRS_o_ai vec_xst_be(vector double __vec, 18094 signed long long __offset, 18095 double *__ptr) { 18096 __builtin_vsx_stxvd2x_be((vector double)__vec, __offset, __ptr); 18097 } 18098 #endif 18099 18100 #if defined(__POWER8_VECTOR__) && defined(__powerpc64__) && \ 18101 defined(__SIZEOF_INT128__) 18102 static __inline__ void __ATTRS_o_ai vec_xst_be(vector signed __int128 __vec, 18103 signed long long __offset, 18104 signed __int128 *__ptr) { 18105 vec_xst(__vec, __offset, __ptr); 18106 } 18107 18108 static __inline__ void __ATTRS_o_ai vec_xst_be(vector unsigned __int128 __vec, 18109 signed long long __offset, 18110 unsigned __int128 *__ptr) { 18111 vec_xst(__vec, __offset, __ptr); 18112 } 18113 #endif 18114 #else 18115 #define vec_xst_be vec_xst 18116 #endif 18117 18118 #ifdef __POWER9_VECTOR__ 18119 #define vec_test_data_class(__a, __b) \ 18120 _Generic( \ 18121 (__a), vector float \ 18122 : (vector bool int)__builtin_vsx_xvtstdcsp((vector float)(__a), (__b)), \ 18123 vector double \ 18124 : (vector bool long long)__builtin_vsx_xvtstdcdp((vector double)(__a), \ 18125 (__b))) 18126 18127 #endif /* #ifdef __POWER9_VECTOR__ */ 18128 18129 static vector float __ATTRS_o_ai vec_neg(vector float __a) { 18130 return -__a; 18131 } 18132 18133 #ifdef __VSX__ 18134 static vector double __ATTRS_o_ai vec_neg(vector double __a) { 18135 return -__a; 18136 } 18137 18138 #endif 18139 18140 #ifdef __VSX__ 18141 static vector long long __ATTRS_o_ai vec_neg(vector long long __a) { 18142 return -__a; 18143 } 18144 #endif 18145 18146 static vector signed int __ATTRS_o_ai vec_neg(vector signed int __a) { 18147 return -__a; 18148 } 18149 18150 static vector signed short __ATTRS_o_ai vec_neg(vector signed short __a) { 18151 return -__a; 18152 } 18153 18154 static vector signed char __ATTRS_o_ai vec_neg(vector signed char __a) { 18155 return -__a; 18156 } 18157 18158 static vector float __ATTRS_o_ai vec_nabs(vector float __a) { 18159 return - vec_abs(__a); 18160 } 18161 18162 #ifdef __VSX__ 18163 static vector double __ATTRS_o_ai vec_nabs(vector double __a) { 18164 return - vec_abs(__a); 18165 } 18166 18167 #endif 18168 18169 #ifdef __POWER8_VECTOR__ 18170 static vector long long __ATTRS_o_ai vec_nabs(vector long long __a) { 18171 return __builtin_altivec_vminsd(__a, -__a); 18172 } 18173 #endif 18174 18175 static vector signed int __ATTRS_o_ai vec_nabs(vector signed int __a) { 18176 return __builtin_altivec_vminsw(__a, -__a); 18177 } 18178 18179 static vector signed short __ATTRS_o_ai vec_nabs(vector signed short __a) { 18180 return __builtin_altivec_vminsh(__a, -__a); 18181 } 18182 18183 static vector signed char __ATTRS_o_ai vec_nabs(vector signed char __a) { 18184 return __builtin_altivec_vminsb(__a, -__a); 18185 } 18186 18187 static vector float __ATTRS_o_ai vec_recipdiv(vector float __a, 18188 vector float __b) { 18189 return __builtin_ppc_recipdivf(__a, __b); 18190 } 18191 18192 #ifdef __VSX__ 18193 static vector double __ATTRS_o_ai vec_recipdiv(vector double __a, 18194 vector double __b) { 18195 return __builtin_ppc_recipdivd(__a, __b); 18196 } 18197 #endif 18198 18199 #ifdef __POWER10_VECTOR__ 18200 18201 /* vec_extractm */ 18202 18203 static __inline__ unsigned int __ATTRS_o_ai 18204 vec_extractm(vector unsigned char __a) { 18205 return __builtin_altivec_vextractbm(__a); 18206 } 18207 18208 static __inline__ unsigned int __ATTRS_o_ai 18209 vec_extractm(vector unsigned short __a) { 18210 return __builtin_altivec_vextracthm(__a); 18211 } 18212 18213 static __inline__ unsigned int __ATTRS_o_ai 18214 vec_extractm(vector unsigned int __a) { 18215 return __builtin_altivec_vextractwm(__a); 18216 } 18217 18218 static __inline__ unsigned int __ATTRS_o_ai 18219 vec_extractm(vector unsigned long long __a) { 18220 return __builtin_altivec_vextractdm(__a); 18221 } 18222 18223 #ifdef __SIZEOF_INT128__ 18224 static __inline__ unsigned int __ATTRS_o_ai 18225 vec_extractm(vector unsigned __int128 __a) { 18226 return __builtin_altivec_vextractqm(__a); 18227 } 18228 #endif 18229 18230 /* vec_expandm */ 18231 18232 static __inline__ vector unsigned char __ATTRS_o_ai 18233 vec_expandm(vector unsigned char __a) { 18234 return __builtin_altivec_vexpandbm(__a); 18235 } 18236 18237 static __inline__ vector unsigned short __ATTRS_o_ai 18238 vec_expandm(vector unsigned short __a) { 18239 return __builtin_altivec_vexpandhm(__a); 18240 } 18241 18242 static __inline__ vector unsigned int __ATTRS_o_ai 18243 vec_expandm(vector unsigned int __a) { 18244 return __builtin_altivec_vexpandwm(__a); 18245 } 18246 18247 static __inline__ vector unsigned long long __ATTRS_o_ai 18248 vec_expandm(vector unsigned long long __a) { 18249 return __builtin_altivec_vexpanddm(__a); 18250 } 18251 18252 #ifdef __SIZEOF_INT128__ 18253 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18254 vec_expandm(vector unsigned __int128 __a) { 18255 return __builtin_altivec_vexpandqm(__a); 18256 } 18257 #endif 18258 18259 /* vec_cntm */ 18260 18261 #define vec_cntm(__a, __mp) \ 18262 _Generic((__a), vector unsigned char \ 18263 : __builtin_altivec_vcntmbb((__a), (unsigned char)(__mp)), \ 18264 vector unsigned short \ 18265 : __builtin_altivec_vcntmbh((__a), (unsigned char)(__mp)), \ 18266 vector unsigned int \ 18267 : __builtin_altivec_vcntmbw((__a), (unsigned char)(__mp)), \ 18268 vector unsigned long long \ 18269 : __builtin_altivec_vcntmbd((__a), (unsigned char)(__mp))) 18270 18271 /* vec_gen[b|h|w|d|q]m */ 18272 18273 static __inline__ vector unsigned char __ATTRS_o_ai 18274 vec_genbm(unsigned long long __bm) { 18275 return __builtin_altivec_mtvsrbm(__bm); 18276 } 18277 18278 static __inline__ vector unsigned short __ATTRS_o_ai 18279 vec_genhm(unsigned long long __bm) { 18280 return __builtin_altivec_mtvsrhm(__bm); 18281 } 18282 18283 static __inline__ vector unsigned int __ATTRS_o_ai 18284 vec_genwm(unsigned long long __bm) { 18285 return __builtin_altivec_mtvsrwm(__bm); 18286 } 18287 18288 static __inline__ vector unsigned long long __ATTRS_o_ai 18289 vec_gendm(unsigned long long __bm) { 18290 return __builtin_altivec_mtvsrdm(__bm); 18291 } 18292 18293 #ifdef __SIZEOF_INT128__ 18294 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18295 vec_genqm(unsigned long long __bm) { 18296 return __builtin_altivec_mtvsrqm(__bm); 18297 } 18298 #endif 18299 18300 /* vec_pdep */ 18301 18302 static __inline__ vector unsigned long long __ATTRS_o_ai 18303 vec_pdep(vector unsigned long long __a, vector unsigned long long __b) { 18304 return __builtin_altivec_vpdepd(__a, __b); 18305 } 18306 18307 /* vec_pext */ 18308 18309 static __inline__ vector unsigned long long __ATTRS_o_ai 18310 vec_pext(vector unsigned long long __a, vector unsigned long long __b) { 18311 return __builtin_altivec_vpextd(__a, __b); 18312 } 18313 18314 /* vec_cfuge */ 18315 18316 static __inline__ vector unsigned long long __ATTRS_o_ai 18317 vec_cfuge(vector unsigned long long __a, vector unsigned long long __b) { 18318 return __builtin_altivec_vcfuged(__a, __b); 18319 } 18320 18321 /* vec_gnb */ 18322 18323 #define vec_gnb(__a, __b) __builtin_altivec_vgnb(__a, __b) 18324 18325 /* vec_ternarylogic */ 18326 #ifdef __VSX__ 18327 #ifdef __SIZEOF_INT128__ 18328 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18329 _Generic((__a), vector unsigned char \ 18330 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18331 (vector unsigned long long)(__b), \ 18332 (vector unsigned long long)(__c), (__imm)), \ 18333 vector unsigned short \ 18334 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18335 (vector unsigned long long)(__b), \ 18336 (vector unsigned long long)(__c), (__imm)), \ 18337 vector unsigned int \ 18338 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18339 (vector unsigned long long)(__b), \ 18340 (vector unsigned long long)(__c), (__imm)), \ 18341 vector unsigned long long \ 18342 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18343 (vector unsigned long long)(__b), \ 18344 (vector unsigned long long)(__c), (__imm)), \ 18345 vector unsigned __int128 \ 18346 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18347 (vector unsigned long long)(__b), \ 18348 (vector unsigned long long)(__c), (__imm))) 18349 #else 18350 #define vec_ternarylogic(__a, __b, __c, __imm) \ 18351 _Generic((__a), vector unsigned char \ 18352 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18353 (vector unsigned long long)(__b), \ 18354 (vector unsigned long long)(__c), (__imm)), \ 18355 vector unsigned short \ 18356 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18357 (vector unsigned long long)(__b), \ 18358 (vector unsigned long long)(__c), (__imm)), \ 18359 vector unsigned int \ 18360 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18361 (vector unsigned long long)(__b), \ 18362 (vector unsigned long long)(__c), (__imm)), \ 18363 vector unsigned long long \ 18364 : __builtin_vsx_xxeval((vector unsigned long long)(__a), \ 18365 (vector unsigned long long)(__b), \ 18366 (vector unsigned long long)(__c), (__imm))) 18367 #endif /* __SIZEOF_INT128__ */ 18368 #endif /* __VSX__ */ 18369 18370 /* vec_genpcvm */ 18371 18372 #ifdef __VSX__ 18373 #define vec_genpcvm(__a, __imm) \ 18374 _Generic((__a), vector unsigned char \ 18375 : __builtin_vsx_xxgenpcvbm((__a), (int)(__imm)), \ 18376 vector unsigned short \ 18377 : __builtin_vsx_xxgenpcvhm((__a), (int)(__imm)), \ 18378 vector unsigned int \ 18379 : __builtin_vsx_xxgenpcvwm((__a), (int)(__imm)), \ 18380 vector unsigned long long \ 18381 : __builtin_vsx_xxgenpcvdm((__a), (int)(__imm))) 18382 #endif /* __VSX__ */ 18383 18384 /* vec_clr_first */ 18385 18386 static __inline__ vector signed char __ATTRS_o_ai 18387 vec_clr_first(vector signed char __a, unsigned int __n) { 18388 #ifdef __LITTLE_ENDIAN__ 18389 return __builtin_altivec_vclrrb(__a, __n); 18390 #else 18391 return __builtin_altivec_vclrlb( __a, __n); 18392 #endif 18393 } 18394 18395 static __inline__ vector unsigned char __ATTRS_o_ai 18396 vec_clr_first(vector unsigned char __a, unsigned int __n) { 18397 #ifdef __LITTLE_ENDIAN__ 18398 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18399 #else 18400 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18401 #endif 18402 } 18403 18404 /* vec_clr_last */ 18405 18406 static __inline__ vector signed char __ATTRS_o_ai 18407 vec_clr_last(vector signed char __a, unsigned int __n) { 18408 #ifdef __LITTLE_ENDIAN__ 18409 return __builtin_altivec_vclrlb(__a, __n); 18410 #else 18411 return __builtin_altivec_vclrrb( __a, __n); 18412 #endif 18413 } 18414 18415 static __inline__ vector unsigned char __ATTRS_o_ai 18416 vec_clr_last(vector unsigned char __a, unsigned int __n) { 18417 #ifdef __LITTLE_ENDIAN__ 18418 return __builtin_altivec_vclrlb((vector signed char)__a, __n); 18419 #else 18420 return __builtin_altivec_vclrrb((vector signed char)__a, __n); 18421 #endif 18422 } 18423 18424 /* vec_cntlzm */ 18425 18426 static __inline__ vector unsigned long long __ATTRS_o_ai 18427 vec_cntlzm(vector unsigned long long __a, vector unsigned long long __b) { 18428 return __builtin_altivec_vclzdm(__a, __b); 18429 } 18430 18431 /* vec_cnttzm */ 18432 18433 static __inline__ vector unsigned long long __ATTRS_o_ai 18434 vec_cnttzm(vector unsigned long long __a, vector unsigned long long __b) { 18435 return __builtin_altivec_vctzdm(__a, __b); 18436 } 18437 18438 /* vec_mod */ 18439 18440 static __inline__ vector signed int __ATTRS_o_ai 18441 vec_mod(vector signed int __a, vector signed int __b) { 18442 return __a % __b; 18443 } 18444 18445 static __inline__ vector unsigned int __ATTRS_o_ai 18446 vec_mod(vector unsigned int __a, vector unsigned int __b) { 18447 return __a % __b; 18448 } 18449 18450 static __inline__ vector signed long long __ATTRS_o_ai 18451 vec_mod(vector signed long long __a, vector signed long long __b) { 18452 return __a % __b; 18453 } 18454 18455 static __inline__ vector unsigned long long __ATTRS_o_ai 18456 vec_mod(vector unsigned long long __a, vector unsigned long long __b) { 18457 return __a % __b; 18458 } 18459 18460 #ifdef __SIZEOF_INT128__ 18461 static __inline__ vector signed __int128 __ATTRS_o_ai 18462 vec_mod(vector signed __int128 __a, vector signed __int128 __b) { 18463 return __a % __b; 18464 } 18465 18466 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18467 vec_mod(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18468 return __a % __b; 18469 } 18470 #endif 18471 18472 /* vec_sldbi */ 18473 18474 #define vec_sldb(__a, __b, __c) __builtin_altivec_vsldbi(__a, __b, (__c & 0x7)) 18475 18476 /* vec_srdbi */ 18477 18478 #define vec_srdb(__a, __b, __c) __builtin_altivec_vsrdbi(__a, __b, (__c & 0x7)) 18479 18480 /* vec_insertl */ 18481 18482 static __inline__ vector unsigned char __ATTRS_o_ai 18483 vec_insertl(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18484 #ifdef __LITTLE_ENDIAN__ 18485 return __builtin_altivec_vinsbrx(__b, __c, __a); 18486 #else 18487 return __builtin_altivec_vinsblx(__b, __c, __a); 18488 #endif 18489 } 18490 18491 static __inline__ vector unsigned short __ATTRS_o_ai 18492 vec_insertl(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18493 #ifdef __LITTLE_ENDIAN__ 18494 return __builtin_altivec_vinshrx(__b, __c, __a); 18495 #else 18496 return __builtin_altivec_vinshlx(__b, __c, __a); 18497 #endif 18498 } 18499 18500 static __inline__ vector unsigned int __ATTRS_o_ai 18501 vec_insertl(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18502 #ifdef __LITTLE_ENDIAN__ 18503 return __builtin_altivec_vinswrx(__b, __c, __a); 18504 #else 18505 return __builtin_altivec_vinswlx(__b, __c, __a); 18506 #endif 18507 } 18508 18509 static __inline__ vector unsigned long long __ATTRS_o_ai 18510 vec_insertl(unsigned long long __a, vector unsigned long long __b, 18511 unsigned int __c) { 18512 #ifdef __LITTLE_ENDIAN__ 18513 return __builtin_altivec_vinsdrx(__b, __c, __a); 18514 #else 18515 return __builtin_altivec_vinsdlx(__b, __c, __a); 18516 #endif 18517 } 18518 18519 static __inline__ vector unsigned char __ATTRS_o_ai 18520 vec_insertl(vector unsigned char __a, vector unsigned char __b, 18521 unsigned int __c) { 18522 #ifdef __LITTLE_ENDIAN__ 18523 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18524 #else 18525 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18526 #endif 18527 } 18528 18529 static __inline__ vector unsigned short __ATTRS_o_ai 18530 vec_insertl(vector unsigned short __a, vector unsigned short __b, 18531 unsigned int __c) { 18532 #ifdef __LITTLE_ENDIAN__ 18533 return __builtin_altivec_vinshvrx(__b, __c, __a); 18534 #else 18535 return __builtin_altivec_vinshvlx(__b, __c, __a); 18536 #endif 18537 } 18538 18539 static __inline__ vector unsigned int __ATTRS_o_ai 18540 vec_insertl(vector unsigned int __a, vector unsigned int __b, 18541 unsigned int __c) { 18542 #ifdef __LITTLE_ENDIAN__ 18543 return __builtin_altivec_vinswvrx(__b, __c, __a); 18544 #else 18545 return __builtin_altivec_vinswvlx(__b, __c, __a); 18546 #endif 18547 } 18548 18549 /* vec_inserth */ 18550 18551 static __inline__ vector unsigned char __ATTRS_o_ai 18552 vec_inserth(unsigned char __a, vector unsigned char __b, unsigned int __c) { 18553 #ifdef __LITTLE_ENDIAN__ 18554 return __builtin_altivec_vinsblx(__b, __c, __a); 18555 #else 18556 return __builtin_altivec_vinsbrx(__b, __c, __a); 18557 #endif 18558 } 18559 18560 static __inline__ vector unsigned short __ATTRS_o_ai 18561 vec_inserth(unsigned short __a, vector unsigned short __b, unsigned int __c) { 18562 #ifdef __LITTLE_ENDIAN__ 18563 return __builtin_altivec_vinshlx(__b, __c, __a); 18564 #else 18565 return __builtin_altivec_vinshrx(__b, __c, __a); 18566 #endif 18567 } 18568 18569 static __inline__ vector unsigned int __ATTRS_o_ai 18570 vec_inserth(unsigned int __a, vector unsigned int __b, unsigned int __c) { 18571 #ifdef __LITTLE_ENDIAN__ 18572 return __builtin_altivec_vinswlx(__b, __c, __a); 18573 #else 18574 return __builtin_altivec_vinswrx(__b, __c, __a); 18575 #endif 18576 } 18577 18578 static __inline__ vector unsigned long long __ATTRS_o_ai 18579 vec_inserth(unsigned long long __a, vector unsigned long long __b, 18580 unsigned int __c) { 18581 #ifdef __LITTLE_ENDIAN__ 18582 return __builtin_altivec_vinsdlx(__b, __c, __a); 18583 #else 18584 return __builtin_altivec_vinsdrx(__b, __c, __a); 18585 #endif 18586 } 18587 18588 static __inline__ vector unsigned char __ATTRS_o_ai 18589 vec_inserth(vector unsigned char __a, vector unsigned char __b, 18590 unsigned int __c) { 18591 #ifdef __LITTLE_ENDIAN__ 18592 return __builtin_altivec_vinsbvlx(__b, __c, __a); 18593 #else 18594 return __builtin_altivec_vinsbvrx(__b, __c, __a); 18595 #endif 18596 } 18597 18598 static __inline__ vector unsigned short __ATTRS_o_ai 18599 vec_inserth(vector unsigned short __a, vector unsigned short __b, 18600 unsigned int __c) { 18601 #ifdef __LITTLE_ENDIAN__ 18602 return __builtin_altivec_vinshvlx(__b, __c, __a); 18603 #else 18604 return __builtin_altivec_vinshvrx(__b, __c, __a); 18605 #endif 18606 } 18607 18608 static __inline__ vector unsigned int __ATTRS_o_ai 18609 vec_inserth(vector unsigned int __a, vector unsigned int __b, 18610 unsigned int __c) { 18611 #ifdef __LITTLE_ENDIAN__ 18612 return __builtin_altivec_vinswvlx(__b, __c, __a); 18613 #else 18614 return __builtin_altivec_vinswvrx(__b, __c, __a); 18615 #endif 18616 } 18617 18618 /* vec_extractl */ 18619 18620 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18621 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18622 #ifdef __LITTLE_ENDIAN__ 18623 return __builtin_altivec_vextdubvrx(__a, __b, __c); 18624 #else 18625 vector unsigned long long __ret = __builtin_altivec_vextdubvlx(__a, __b, __c); 18626 return vec_sld(__ret, __ret, 8); 18627 #endif 18628 } 18629 18630 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18631 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18632 #ifdef __LITTLE_ENDIAN__ 18633 return __builtin_altivec_vextduhvrx(__a, __b, __c); 18634 #else 18635 vector unsigned long long __ret = __builtin_altivec_vextduhvlx(__a, __b, __c); 18636 return vec_sld(__ret, __ret, 8); 18637 #endif 18638 } 18639 18640 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extractl( 18641 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18642 #ifdef __LITTLE_ENDIAN__ 18643 return __builtin_altivec_vextduwvrx(__a, __b, __c); 18644 #else 18645 vector unsigned long long __ret = __builtin_altivec_vextduwvlx(__a, __b, __c); 18646 return vec_sld(__ret, __ret, 8); 18647 #endif 18648 } 18649 18650 static __inline__ vector unsigned long long __ATTRS_o_ai 18651 vec_extractl(vector unsigned long long __a, vector unsigned long long __b, 18652 unsigned int __c) { 18653 #ifdef __LITTLE_ENDIAN__ 18654 return __builtin_altivec_vextddvrx(__a, __b, __c); 18655 #else 18656 vector unsigned long long __ret = __builtin_altivec_vextddvlx(__a, __b, __c); 18657 return vec_sld(__ret, __ret, 8); 18658 #endif 18659 } 18660 18661 /* vec_extracth */ 18662 18663 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18664 vector unsigned char __a, vector unsigned char __b, unsigned int __c) { 18665 #ifdef __LITTLE_ENDIAN__ 18666 return __builtin_altivec_vextdubvlx(__a, __b, __c); 18667 #else 18668 vector unsigned long long __ret = __builtin_altivec_vextdubvrx(__a, __b, __c); 18669 return vec_sld(__ret, __ret, 8); 18670 #endif 18671 } 18672 18673 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18674 vector unsigned short __a, vector unsigned short __b, unsigned int __c) { 18675 #ifdef __LITTLE_ENDIAN__ 18676 return __builtin_altivec_vextduhvlx(__a, __b, __c); 18677 #else 18678 vector unsigned long long __ret = __builtin_altivec_vextduhvrx(__a, __b, __c); 18679 return vec_sld(__ret, __ret, 8); 18680 #endif 18681 } 18682 18683 static __inline__ vector unsigned long long __ATTRS_o_ai vec_extracth( 18684 vector unsigned int __a, vector unsigned int __b, unsigned int __c) { 18685 #ifdef __LITTLE_ENDIAN__ 18686 return __builtin_altivec_vextduwvlx(__a, __b, __c); 18687 #else 18688 vector unsigned long long __ret = __builtin_altivec_vextduwvrx(__a, __b, __c); 18689 return vec_sld(__ret, __ret, 8); 18690 #endif 18691 } 18692 18693 static __inline__ vector unsigned long long __ATTRS_o_ai 18694 vec_extracth(vector unsigned long long __a, vector unsigned long long __b, 18695 unsigned int __c) { 18696 #ifdef __LITTLE_ENDIAN__ 18697 return __builtin_altivec_vextddvlx(__a, __b, __c); 18698 #else 18699 vector unsigned long long __ret = __builtin_altivec_vextddvrx(__a, __b, __c); 18700 return vec_sld(__ret, __ret, 8); 18701 #endif 18702 } 18703 18704 #ifdef __VSX__ 18705 18706 /* vec_permx */ 18707 18708 #define vec_permx(__a, __b, __c, __d) \ 18709 __builtin_vsx_xxpermx((__a), (__b), (__c), (__d)) 18710 18711 /* vec_blendv */ 18712 18713 static __inline__ vector signed char __ATTRS_o_ai 18714 vec_blendv(vector signed char __a, vector signed char __b, 18715 vector unsigned char __c) { 18716 return __builtin_vsx_xxblendvb(__a, __b, __c); 18717 } 18718 18719 static __inline__ vector unsigned char __ATTRS_o_ai 18720 vec_blendv(vector unsigned char __a, vector unsigned char __b, 18721 vector unsigned char __c) { 18722 return __builtin_vsx_xxblendvb(__a, __b, __c); 18723 } 18724 18725 static __inline__ vector signed short __ATTRS_o_ai 18726 vec_blendv(vector signed short __a, vector signed short __b, 18727 vector unsigned short __c) { 18728 return __builtin_vsx_xxblendvh(__a, __b, __c); 18729 } 18730 18731 static __inline__ vector unsigned short __ATTRS_o_ai 18732 vec_blendv(vector unsigned short __a, vector unsigned short __b, 18733 vector unsigned short __c) { 18734 return __builtin_vsx_xxblendvh(__a, __b, __c); 18735 } 18736 18737 static __inline__ vector signed int __ATTRS_o_ai 18738 vec_blendv(vector signed int __a, vector signed int __b, 18739 vector unsigned int __c) { 18740 return __builtin_vsx_xxblendvw(__a, __b, __c); 18741 } 18742 18743 static __inline__ vector unsigned int __ATTRS_o_ai 18744 vec_blendv(vector unsigned int __a, vector unsigned int __b, 18745 vector unsigned int __c) { 18746 return __builtin_vsx_xxblendvw(__a, __b, __c); 18747 } 18748 18749 static __inline__ vector signed long long __ATTRS_o_ai 18750 vec_blendv(vector signed long long __a, vector signed long long __b, 18751 vector unsigned long long __c) { 18752 return __builtin_vsx_xxblendvd(__a, __b, __c); 18753 } 18754 18755 static __inline__ vector unsigned long long __ATTRS_o_ai 18756 vec_blendv(vector unsigned long long __a, vector unsigned long long __b, 18757 vector unsigned long long __c) { 18758 return __builtin_vsx_xxblendvd(__a, __b, __c); 18759 } 18760 18761 static __inline__ vector float __ATTRS_o_ai 18762 vec_blendv(vector float __a, vector float __b, vector unsigned int __c) { 18763 return __builtin_vsx_xxblendvw(__a, __b, __c); 18764 } 18765 18766 static __inline__ vector double __ATTRS_o_ai 18767 vec_blendv(vector double __a, vector double __b, 18768 vector unsigned long long __c) { 18769 return __builtin_vsx_xxblendvd(__a, __b, __c); 18770 } 18771 18772 /* vec_replace_elt */ 18773 18774 #define vec_replace_elt __builtin_altivec_vec_replace_elt 18775 18776 /* vec_replace_unaligned */ 18777 18778 #define vec_replace_unaligned __builtin_altivec_vec_replace_unaligned 18779 18780 /* vec_splati */ 18781 18782 #define vec_splati(__a) \ 18783 _Generic((__a), signed int \ 18784 : ((vector signed int)__a), unsigned int \ 18785 : ((vector unsigned int)__a), float \ 18786 : ((vector float)__a)) 18787 18788 /* vec_spatid */ 18789 18790 static __inline__ vector double __ATTRS_o_ai vec_splatid(const float __a) { 18791 return ((vector double)((double)__a)); 18792 } 18793 18794 /* vec_splati_ins */ 18795 18796 static __inline__ vector signed int __ATTRS_o_ai vec_splati_ins( 18797 vector signed int __a, const unsigned int __b, const signed int __c) { 18798 const unsigned int __d = __b & 0x01; 18799 #ifdef __LITTLE_ENDIAN__ 18800 __a[1 - __d] = __c; 18801 __a[3 - __d] = __c; 18802 #else 18803 __a[__d] = __c; 18804 __a[2 + __d] = __c; 18805 #endif 18806 return __a; 18807 } 18808 18809 static __inline__ vector unsigned int __ATTRS_o_ai vec_splati_ins( 18810 vector unsigned int __a, const unsigned int __b, const unsigned int __c) { 18811 const unsigned int __d = __b & 0x01; 18812 #ifdef __LITTLE_ENDIAN__ 18813 __a[1 - __d] = __c; 18814 __a[3 - __d] = __c; 18815 #else 18816 __a[__d] = __c; 18817 __a[2 + __d] = __c; 18818 #endif 18819 return __a; 18820 } 18821 18822 static __inline__ vector float __ATTRS_o_ai 18823 vec_splati_ins(vector float __a, const unsigned int __b, const float __c) { 18824 const unsigned int __d = __b & 0x01; 18825 #ifdef __LITTLE_ENDIAN__ 18826 __a[1 - __d] = __c; 18827 __a[3 - __d] = __c; 18828 #else 18829 __a[__d] = __c; 18830 __a[2 + __d] = __c; 18831 #endif 18832 return __a; 18833 } 18834 18835 /* vec_test_lsbb_all_ones */ 18836 18837 static __inline__ int __ATTRS_o_ai 18838 vec_test_lsbb_all_ones(vector unsigned char __a) { 18839 return __builtin_vsx_xvtlsbb(__a, 1); 18840 } 18841 18842 /* vec_test_lsbb_all_zeros */ 18843 18844 static __inline__ int __ATTRS_o_ai 18845 vec_test_lsbb_all_zeros(vector unsigned char __a) { 18846 return __builtin_vsx_xvtlsbb(__a, 0); 18847 } 18848 #endif /* __VSX__ */ 18849 18850 /* vec_stril */ 18851 18852 static __inline__ vector unsigned char __ATTRS_o_ai 18853 vec_stril(vector unsigned char __a) { 18854 #ifdef __LITTLE_ENDIAN__ 18855 return __builtin_altivec_vstribr((vector signed char)__a); 18856 #else 18857 return __builtin_altivec_vstribl((vector signed char)__a); 18858 #endif 18859 } 18860 18861 static __inline__ vector signed char __ATTRS_o_ai 18862 vec_stril(vector signed char __a) { 18863 #ifdef __LITTLE_ENDIAN__ 18864 return __builtin_altivec_vstribr(__a); 18865 #else 18866 return __builtin_altivec_vstribl(__a); 18867 #endif 18868 } 18869 18870 static __inline__ vector unsigned short __ATTRS_o_ai 18871 vec_stril(vector unsigned short __a) { 18872 #ifdef __LITTLE_ENDIAN__ 18873 return __builtin_altivec_vstrihr((vector signed short)__a); 18874 #else 18875 return __builtin_altivec_vstrihl((vector signed short)__a); 18876 #endif 18877 } 18878 18879 static __inline__ vector signed short __ATTRS_o_ai 18880 vec_stril(vector signed short __a) { 18881 #ifdef __LITTLE_ENDIAN__ 18882 return __builtin_altivec_vstrihr(__a); 18883 #else 18884 return __builtin_altivec_vstrihl(__a); 18885 #endif 18886 } 18887 18888 /* vec_stril_p */ 18889 18890 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned char __a) { 18891 #ifdef __LITTLE_ENDIAN__ 18892 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18893 #else 18894 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18895 #endif 18896 } 18897 18898 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed char __a) { 18899 #ifdef __LITTLE_ENDIAN__ 18900 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18901 #else 18902 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18903 #endif 18904 } 18905 18906 static __inline__ int __ATTRS_o_ai vec_stril_p(vector unsigned short __a) { 18907 #ifdef __LITTLE_ENDIAN__ 18908 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18909 #else 18910 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18911 #endif 18912 } 18913 18914 static __inline__ int __ATTRS_o_ai vec_stril_p(vector signed short __a) { 18915 #ifdef __LITTLE_ENDIAN__ 18916 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18917 #else 18918 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18919 #endif 18920 } 18921 18922 /* vec_strir */ 18923 18924 static __inline__ vector unsigned char __ATTRS_o_ai 18925 vec_strir(vector unsigned char __a) { 18926 #ifdef __LITTLE_ENDIAN__ 18927 return __builtin_altivec_vstribl((vector signed char)__a); 18928 #else 18929 return __builtin_altivec_vstribr((vector signed char)__a); 18930 #endif 18931 } 18932 18933 static __inline__ vector signed char __ATTRS_o_ai 18934 vec_strir(vector signed char __a) { 18935 #ifdef __LITTLE_ENDIAN__ 18936 return __builtin_altivec_vstribl(__a); 18937 #else 18938 return __builtin_altivec_vstribr(__a); 18939 #endif 18940 } 18941 18942 static __inline__ vector unsigned short __ATTRS_o_ai 18943 vec_strir(vector unsigned short __a) { 18944 #ifdef __LITTLE_ENDIAN__ 18945 return __builtin_altivec_vstrihl((vector signed short)__a); 18946 #else 18947 return __builtin_altivec_vstrihr((vector signed short)__a); 18948 #endif 18949 } 18950 18951 static __inline__ vector signed short __ATTRS_o_ai 18952 vec_strir(vector signed short __a) { 18953 #ifdef __LITTLE_ENDIAN__ 18954 return __builtin_altivec_vstrihl(__a); 18955 #else 18956 return __builtin_altivec_vstrihr(__a); 18957 #endif 18958 } 18959 18960 /* vec_strir_p */ 18961 18962 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned char __a) { 18963 #ifdef __LITTLE_ENDIAN__ 18964 return __builtin_altivec_vstribl_p(__CR6_EQ, (vector signed char)__a); 18965 #else 18966 return __builtin_altivec_vstribr_p(__CR6_EQ, (vector signed char)__a); 18967 #endif 18968 } 18969 18970 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed char __a) { 18971 #ifdef __LITTLE_ENDIAN__ 18972 return __builtin_altivec_vstribl_p(__CR6_EQ, __a); 18973 #else 18974 return __builtin_altivec_vstribr_p(__CR6_EQ, __a); 18975 #endif 18976 } 18977 18978 static __inline__ int __ATTRS_o_ai vec_strir_p(vector unsigned short __a) { 18979 #ifdef __LITTLE_ENDIAN__ 18980 return __builtin_altivec_vstrihl_p(__CR6_EQ, (vector signed short)__a); 18981 #else 18982 return __builtin_altivec_vstrihr_p(__CR6_EQ, (vector signed short)__a); 18983 #endif 18984 } 18985 18986 static __inline__ int __ATTRS_o_ai vec_strir_p(vector signed short __a) { 18987 #ifdef __LITTLE_ENDIAN__ 18988 return __builtin_altivec_vstrihl_p(__CR6_EQ, __a); 18989 #else 18990 return __builtin_altivec_vstrihr_p(__CR6_EQ, __a); 18991 #endif 18992 } 18993 18994 /* vs[l | r | ra] */ 18995 18996 #ifdef __SIZEOF_INT128__ 18997 static __inline__ vector unsigned __int128 __ATTRS_o_ai 18998 vec_sl(vector unsigned __int128 __a, vector unsigned __int128 __b) { 18999 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19000 __CHAR_BIT__)); 19001 } 19002 19003 static __inline__ vector signed __int128 __ATTRS_o_ai 19004 vec_sl(vector signed __int128 __a, vector unsigned __int128 __b) { 19005 return __a << (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19006 __CHAR_BIT__)); 19007 } 19008 19009 static __inline__ vector unsigned __int128 __ATTRS_o_ai 19010 vec_sr(vector unsigned __int128 __a, vector unsigned __int128 __b) { 19011 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19012 __CHAR_BIT__)); 19013 } 19014 19015 static __inline__ vector signed __int128 __ATTRS_o_ai 19016 vec_sr(vector signed __int128 __a, vector unsigned __int128 __b) { 19017 return ( 19018 vector signed __int128)(((vector unsigned __int128)__a) >> 19019 (__b % 19020 (vector unsigned __int128)(sizeof( 19021 unsigned __int128) * 19022 __CHAR_BIT__))); 19023 } 19024 19025 static __inline__ vector unsigned __int128 __ATTRS_o_ai 19026 vec_sra(vector unsigned __int128 __a, vector unsigned __int128 __b) { 19027 return ( 19028 vector unsigned __int128)(((vector signed __int128)__a) >> 19029 (__b % 19030 (vector unsigned __int128)(sizeof( 19031 unsigned __int128) * 19032 __CHAR_BIT__))); 19033 } 19034 19035 static __inline__ vector signed __int128 __ATTRS_o_ai 19036 vec_sra(vector signed __int128 __a, vector unsigned __int128 __b) { 19037 return __a >> (__b % (vector unsigned __int128)(sizeof(unsigned __int128) * 19038 __CHAR_BIT__)); 19039 } 19040 19041 #endif /* __SIZEOF_INT128__ */ 19042 #endif /* __POWER10_VECTOR__ */ 19043 19044 #ifdef __POWER8_VECTOR__ 19045 #define __bcdadd(__a, __b, __ps) __builtin_ppc_bcdadd((__a), (__b), (__ps)) 19046 #define __bcdsub(__a, __b, __ps) __builtin_ppc_bcdsub((__a), (__b), (__ps)) 19047 19048 static __inline__ long __bcdadd_ofl(vector unsigned char __a, 19049 vector unsigned char __b) { 19050 return __builtin_ppc_bcdadd_p(__CR6_SO, __a, __b); 19051 } 19052 19053 static __inline__ long __bcdsub_ofl(vector unsigned char __a, 19054 vector unsigned char __b) { 19055 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __b); 19056 } 19057 19058 static __inline__ long __bcd_invalid(vector unsigned char __a) { 19059 return __builtin_ppc_bcdsub_p(__CR6_SO, __a, __a); 19060 } 19061 19062 static __inline__ long __bcdcmpeq(vector unsigned char __a, 19063 vector unsigned char __b) { 19064 return __builtin_ppc_bcdsub_p(__CR6_EQ, __a, __b); 19065 } 19066 19067 static __inline__ long __bcdcmplt(vector unsigned char __a, 19068 vector unsigned char __b) { 19069 return __builtin_ppc_bcdsub_p(__CR6_LT, __a, __b); 19070 } 19071 19072 static __inline__ long __bcdcmpgt(vector unsigned char __a, 19073 vector unsigned char __b) { 19074 return __builtin_ppc_bcdsub_p(__CR6_GT, __a, __b); 19075 } 19076 19077 static __inline__ long __bcdcmple(vector unsigned char __a, 19078 vector unsigned char __b) { 19079 return __builtin_ppc_bcdsub_p(__CR6_GT_REV, __a, __b); 19080 } 19081 19082 static __inline__ long __bcdcmpge(vector unsigned char __a, 19083 vector unsigned char __b) { 19084 return __builtin_ppc_bcdsub_p(__CR6_LT_REV, __a, __b); 19085 } 19086 19087 #endif // __POWER8_VECTOR__ 19088 19089 #undef __ATTRS_o_ai 19090 19091 #endif /* __ALTIVEC_H */ 19092